forked from qt-creator/qt-creator
CMake build: Put wininterrupt and cdbextension into separate components
And make it possible to turn off building the cdbextension library. So they can be installed and packaged separately Change-Id: Ic7da1411aa3973604b897e1cbf57ad9c5b0fe460 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
@@ -322,6 +322,17 @@ function(qtc_plugin_enabled varName name)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(qtc_library_enabled varName name)
|
||||
if (NOT (name IN_LIST __QTC_LIBRARIES))
|
||||
message(FATAL_ERROR "extend_qtc_library: Unknown library target \"${name}\"")
|
||||
endif()
|
||||
if (TARGET ${name})
|
||||
set(${varName} ON PARENT_SCOPE)
|
||||
else()
|
||||
set(${varName} OFF PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(enable_pch target)
|
||||
if (BUILD_WITH_PCH)
|
||||
# Skip PCH for targets that do not use the expected visibility settings:
|
||||
@@ -417,7 +428,7 @@ endfunction()
|
||||
|
||||
function(add_qtc_library name)
|
||||
cmake_parse_arguments(_arg "STATIC;OBJECT;SKIP_TRANSLATION;BUILD_BY_DEFAULT;ALLOW_ASCII_CASTS"
|
||||
"DESTINATION"
|
||||
"DESTINATION;COMPONENT"
|
||||
"DEFINES;DEPENDS;EXTRA_TRANSLATIONS;INCLUDES;PUBLIC_DEFINES;PUBLIC_DEPENDS;PUBLIC_INCLUDES;SOURCES;EXPLICIT_MOC;SKIP_AUTOMOC;PROPERTIES" ${ARGN}
|
||||
)
|
||||
|
||||
@@ -432,6 +443,20 @@ function(add_qtc_library name)
|
||||
|
||||
update_cached_list(__QTC_LIBRARIES "${name}")
|
||||
|
||||
# special libraries can be turned off
|
||||
if (_arg_BUILD_BY_DEFAULT)
|
||||
string(TOUPPER "BUILD_LIBRARY_${name}" _build_library_var)
|
||||
set(_build_library_default "ON")
|
||||
if (DEFINED ENV{QTC_${_build_library_var}})
|
||||
set(_build_library_default "$ENV{QTC_${_build_library_var}}")
|
||||
endif()
|
||||
set(${_build_library_var} "${_build_library_default}" CACHE BOOL "Build library ${name}.")
|
||||
|
||||
if (NOT ${_build_library_var})
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
compare_sources_with_existing_disk_files(${name} "${_arg_SOURCES}")
|
||||
|
||||
set(library_type SHARED)
|
||||
@@ -529,12 +554,21 @@ function(add_qtc_library name)
|
||||
set(NAMELINK_OPTION NAMELINK_SKIP)
|
||||
endif()
|
||||
|
||||
unset(COMPONENT_OPTION)
|
||||
if (_arg_COMPONENT)
|
||||
set(COMPONENT_OPTION "COMPONENT" "${_arg_COMPONENT}")
|
||||
endif()
|
||||
|
||||
install(TARGETS ${name}
|
||||
EXPORT ${IDE_CASED_ID}
|
||||
RUNTIME DESTINATION "${_DESTINATION}" OPTIONAL
|
||||
RUNTIME
|
||||
DESTINATION "${_DESTINATION}"
|
||||
${COMPONENT_OPTION}
|
||||
OPTIONAL
|
||||
LIBRARY
|
||||
DESTINATION "${IDE_LIBRARY_PATH}"
|
||||
${NAMELINK_OPTION}
|
||||
${COMPONENT_OPTION}
|
||||
OPTIONAL
|
||||
OBJECTS
|
||||
DESTINATION "${IDE_LIBRARY_PATH}"
|
||||
@@ -871,9 +905,18 @@ function(extend_qtc_plugin target_name)
|
||||
extend_qtc_target(${target_name} ${ARGN})
|
||||
endfunction()
|
||||
|
||||
function(extend_qtc_library target_name)
|
||||
qtc_library_enabled(_library_enabled ${target_name})
|
||||
if (NOT _library_enabled)
|
||||
return()
|
||||
endif()
|
||||
|
||||
extend_qtc_target(${target_name} ${ARGN})
|
||||
endfunction()
|
||||
|
||||
function(add_qtc_executable name)
|
||||
cmake_parse_arguments(_arg "SKIP_INSTALL;SKIP_TRANSLATION;ALLOW_ASCII_CASTS"
|
||||
"DESTINATION"
|
||||
"DESTINATION;COMPONENT"
|
||||
"DEFINES;DEPENDS;EXTRA_TRANSLATIONS;INCLUDES;SOURCES;PROPERTIES" ${ARGN})
|
||||
|
||||
if ($_arg_UNPARSED_ARGUMENTS)
|
||||
@@ -950,7 +993,16 @@ function(add_qtc_executable name)
|
||||
enable_pch(${name})
|
||||
|
||||
if (NOT _arg_SKIP_INSTALL)
|
||||
install(TARGETS ${name} DESTINATION "${_DESTINATION}" OPTIONAL)
|
||||
unset(COMPONENT_OPTION)
|
||||
if (_arg_COMPONENT)
|
||||
set(COMPONENT_OPTION "COMPONENT" "${_arg_COMPONENT}")
|
||||
endif()
|
||||
|
||||
install(TARGETS ${name}
|
||||
DESTINATION "${_DESTINATION}"
|
||||
${COMPONENT_OPTION}
|
||||
OPTIONAL
|
||||
)
|
||||
update_cached_list(__QTC_INSTALLED_EXECUTABLES
|
||||
"${_DESTINATION}/${name}${CMAKE_EXECUTABLE_SUFFIX}")
|
||||
|
||||
|
@@ -33,6 +33,7 @@ if (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
endif()
|
||||
|
||||
add_qtc_library(qtcreatorcdbext
|
||||
COMPONENT qtcreatorcdbext
|
||||
BUILD_BY_DEFAULT
|
||||
DEPENDS ${DbgEngLib}
|
||||
DESTINATION lib/qtcreatorcdbext${ArchSuffix}/
|
||||
@@ -53,48 +54,53 @@ add_qtc_library(qtcreatorcdbext
|
||||
symbolgroupvalue.cpp symbolgroupvalue.h
|
||||
)
|
||||
|
||||
find_package(PythonLibs 3.5)
|
||||
if (NOT ${PYTHONLIBS_FOUND})
|
||||
message(WARNING "PythonLibs (at least version 3.5) not found. qtcreatorcdbext will be built without Python support.")
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(PythonRegex "^(.*)/(.*)/(python[0-9]+)${CMAKE_IMPORT_LIBRARY_SUFFIX}$")
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
set(PythonRegex "^(.*)/(.*)/(python[0-9]+_d)${CMAKE_IMPORT_LIBRARY_SUFFIX}$")
|
||||
endif()
|
||||
|
||||
foreach(lib IN LISTS PYTHON_LIBRARIES)
|
||||
if (lib MATCHES ${PythonRegex})
|
||||
set(PythonDll "${CMAKE_MATCH_1}/${CMAKE_MATCH_3}${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
break()
|
||||
qtc_library_enabled(_library_enabled qtcreatorcdbext)
|
||||
if (_library_enabled)
|
||||
find_package(PythonLibs 3.5)
|
||||
if (NOT ${PYTHONLIBS_FOUND})
|
||||
message(WARNING "PythonLibs (at least version 3.5) not found. qtcreatorcdbext will be built without Python support.")
|
||||
return()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if (NOT PythonDll)
|
||||
set(PythonRegex "^(.*)/(.*)/(python[0-9]+)${CMAKE_IMPORT_LIBRARY_SUFFIX}$")
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
message(WARNING "The Debug build of Qt Creator requires Debug Python libraries. Please check your Python installation")
|
||||
set(PythonRegex "^(.*)/(.*)/(python[0-9]+_d)${CMAKE_IMPORT_LIBRARY_SUFFIX}$")
|
||||
endif()
|
||||
message(WARNING "PythonDll not found. qtcreatorcdbext will be built without Python support.")
|
||||
return()
|
||||
|
||||
foreach(lib IN LISTS PYTHON_LIBRARIES)
|
||||
if (lib MATCHES ${PythonRegex})
|
||||
set(PythonDll "${CMAKE_MATCH_1}/${CMAKE_MATCH_3}${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if (NOT PythonDll)
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
message(WARNING "The Debug build of Qt Creator requires Debug Python libraries. Please check your Python installation")
|
||||
endif()
|
||||
message(WARNING "PythonDll not found. qtcreatorcdbext will be built without Python support.")
|
||||
return()
|
||||
endif()
|
||||
|
||||
extend_qtc_target(qtcreatorcdbext
|
||||
DEPENDS "${PYTHON_LIBRARIES}"
|
||||
INCLUDES "${PYTHON_INCLUDE_DIR}"
|
||||
DEFINES WITH_PYTHON=1
|
||||
SOURCES
|
||||
pycdbextmodule.cpp pycdbextmodule.h
|
||||
pyfield.cpp pyfield.h
|
||||
pystdoutredirect.cpp pystdoutredirect.h
|
||||
pytype.cpp pytype.h
|
||||
pyvalue.cpp pyvalue.h
|
||||
)
|
||||
|
||||
install(FILES "${PythonDll}"
|
||||
DESTINATION lib/qtcreatorcdbext${ArchSuffix}/
|
||||
COMPONENT qtcreatorcdbext)
|
||||
|
||||
add_custom_target(copy_python_dll ALL VERBATIM)
|
||||
add_custom_command(TARGET copy_python_dll POST_BUILD
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy "${PythonDll}" "${PROJECT_BINARY_DIR}/lib/qtcreatorcdbext${ArchSuffix}/"
|
||||
VERBATIM
|
||||
)
|
||||
endif()
|
||||
|
||||
extend_qtc_target(qtcreatorcdbext
|
||||
DEPENDS "${PYTHON_LIBRARIES}"
|
||||
INCLUDES "${PYTHON_INCLUDE_DIR}"
|
||||
DEFINES WITH_PYTHON=1
|
||||
SOURCES
|
||||
pycdbextmodule.cpp pycdbextmodule.h
|
||||
pyfield.cpp pyfield.h
|
||||
pystdoutredirect.cpp pystdoutredirect.h
|
||||
pytype.cpp pytype.h
|
||||
pyvalue.cpp pyvalue.h
|
||||
)
|
||||
|
||||
install(FILES "${PythonDll}" DESTINATION lib/qtcreatorcdbext${ArchSuffix}/)
|
||||
|
||||
add_custom_target(copy_python_dll ALL VERBATIM)
|
||||
add_custom_command(TARGET copy_python_dll POST_BUILD
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy "${PythonDll}" "${PROJECT_BINARY_DIR}/lib/qtcreatorcdbext${ArchSuffix}/"
|
||||
VERBATIM
|
||||
)
|
||||
|
@@ -8,5 +8,6 @@ if (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
endif()
|
||||
|
||||
add_qtc_executable(win${Arch}interrupt
|
||||
COMPONENT wininterrupt
|
||||
SOURCES wininterrupt.c
|
||||
)
|
||||
|
Reference in New Issue
Block a user