diff options
-rw-r--r-- | CMakeLists.txt | 4 | ||||
-rw-r--r-- | cmake/QtCreatorAPI.cmake | 26 | ||||
-rw-r--r-- | cmake/QtCreatorAPIInternal.cmake | 13 | ||||
-rw-r--r-- | cmake/QtCreatorDocumentation.cmake | 5 | ||||
-rw-r--r-- | doc/CMakeLists.txt | 2 | ||||
-rwxr-xr-x | scripts/build_plugin.py | 8 | ||||
-rw-r--r-- | share/qtcreator/templates/wizards/qtcreatorplugin/CMakeLists.txt | 8 | ||||
-rw-r--r-- | share/qtcreator/templates/wizards/qtcreatorplugin/README.md | 7 | ||||
-rw-r--r-- | src/CMakeLists.txt | 10 | ||||
-rw-r--r-- | src/app/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/libs/CMakeLists.txt | 2 |
11 files changed, 64 insertions, 23 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 2d1b2a39d3..cc1b3be88b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -162,7 +162,7 @@ install( qtcreator.pri qtcreatordata.pri qtcreator_ide_branding.pri - DESTINATION include + DESTINATION ${IDE_HEADER_INSTALL_PATH} COMPONENT Devel EXCLUDE_FROM_ALL ) install( @@ -171,7 +171,7 @@ install( src/qtcreatorplugin.pri src/qtcreatortool.pri src/rpath.pri - DESTINATION include/src + DESTINATION ${IDE_HEADER_INSTALL_PATH}/src COMPONENT Devel EXCLUDE_FROM_ALL ) diff --git a/cmake/QtCreatorAPI.cmake b/cmake/QtCreatorAPI.cmake index aefae6f729..921106a3f6 100644 --- a/cmake/QtCreatorAPI.cmake +++ b/cmake/QtCreatorAPI.cmake @@ -18,6 +18,9 @@ set(IDE_DATA_PATH "${_IDE_DATA_PATH}") # The IDE data path (rel set(IDE_DOC_PATH "${_IDE_DOC_PATH}") # The IDE documentation path (relative to CMAKE_INSTALL_PREFIX). set(IDE_BIN_PATH "${_IDE_BIN_PATH}") # The IDE bin path (relative to CMAKE_INSTALL_PREFIX). +set(IDE_HEADER_INSTALL_PATH "${_IDE_HEADER_INSTALL_PATH}") +set(IDE_CMAKE_INSTALL_PATH "${_IDE_CMAKE_INSTALL_PATH}") + file(RELATIVE_PATH RELATIVE_PLUGIN_PATH "/${IDE_BIN_PATH}" "/${IDE_PLUGIN_PATH}") file(RELATIVE_PATH RELATIVE_LIBEXEC_PATH "/${IDE_BIN_PATH}" "/${IDE_LIBEXEC_PATH}") file(RELATIVE_PATH RELATIVE_DATA_PATH "/${IDE_BIN_PATH}" "/${IDE_DATA_PATH}") @@ -93,6 +96,14 @@ function(qtc_output_binary_dir varName) endif() endfunction() +function(qtc_source_dir varName) + if (QTC_MERGE_BINARY_DIR) + set(${varName} ${QtCreator_SOURCE_DIR} PARENT_SCOPE) + else() + set(${varName} ${PROJECT_SOURCE_DIR} PARENT_SCOPE) + endif() +endfunction() + function(add_qtc_library name) cmake_parse_arguments(_arg "STATIC;OBJECT;SKIP_TRANSLATION;ALLOW_ASCII_CASTS;UNVERSIONED;FEATURE_INFO" "DESTINATION;COMPONENT;SOURCES_PREFIX;BUILD_DEFAULT" @@ -208,7 +219,7 @@ function(add_qtc_library name) "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>" PUBLIC "$<BUILD_INTERFACE:${public_build_interface_dir}>" - "$<INSTALL_INTERFACE:include/${include_dir_relative_path}>" + "$<INSTALL_INTERFACE:${IDE_HEADER_INSTALL_PATH}/${include_dir_relative_path}>" ) endif() @@ -463,7 +474,7 @@ function(add_qtc_plugin target_name) "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>" PUBLIC "$<BUILD_INTERFACE:${public_build_interface_dir}>" - "$<INSTALL_INTERFACE:include/${include_dir_relative_path}>" + "$<INSTALL_INTERFACE:${IDE_HEADER_INSTALL_PATH}/${include_dir_relative_path}>" ) set(plugin_dir "${IDE_PLUGIN_PATH}") @@ -531,18 +542,18 @@ function(add_qtc_plugin target_name) # export of external plugins install(EXPORT ${export} FILE ${export}Targets.cmake - DESTINATION lib/cmake/${export} + DESTINATION ${IDE_CMAKE_INSTALL_PATH}/${export} COMPONENT Devel EXCLUDE_FROM_ALL NAMESPACE QtCreator:: ) include(CMakePackageConfigHelpers) configure_package_config_file(${_THIS_MODULE_BASE_DIR}/Config.cmake.in "${CMAKE_BINARY_DIR}/cmake/${export}Config.cmake" - INSTALL_DESTINATION lib/cmake/${export} + INSTALL_DESTINATION ${IDE_CMAKE_INSTALL_PATH}/${export} ) install( FILES ${CMAKE_BINARY_DIR}/cmake/${export}Config.cmake - DESTINATION lib/cmake/${export} + DESTINATION ${IDE_CMAKE_INSTALL_PATH}/${export} COMPONENT Devel EXCLUDE_FROM_ALL ) export(EXPORT ${export} @@ -971,12 +982,13 @@ function(qtc_add_public_header header) set(header "${CMAKE_CURRENT_SOURCE_DIR}/${header}") endif() + qtc_source_dir(qtcreator_source_dir) get_filename_component(source_dir ${header} DIRECTORY) - file(RELATIVE_PATH include_dir_relative_path ${PROJECT_SOURCE_DIR} ${source_dir}) + file(RELATIVE_PATH include_dir_relative_path ${qtcreator_source_dir} ${source_dir}) install( FILES ${header} - DESTINATION "include/${include_dir_relative_path}" + DESTINATION "${IDE_HEADER_INSTALL_PATH}/${include_dir_relative_path}" COMPONENT Devel EXCLUDE_FROM_ALL ) endfunction() diff --git a/cmake/QtCreatorAPIInternal.cmake b/cmake/QtCreatorAPIInternal.cmake index 15cdb05f9a..8335ae3457 100644 --- a/cmake/QtCreatorAPIInternal.cmake +++ b/cmake/QtCreatorAPIInternal.cmake @@ -37,7 +37,7 @@ if (APPLE) set(_IDE_APP_PATH ".") set(_IDE_APP_TARGET "${IDE_DISPLAY_NAME}") - set(_IDE_OUTPUT_PATH "${_IDE_APP_PATH}/${_IDE_APP_TARGET}.app/Contents") + set(_IDE_OUTPUT_PATH "${_IDE_APP_TARGET}.app/Contents") set(_IDE_LIBRARY_BASE_PATH "Frameworks") set(_IDE_LIBRARY_PATH "${_IDE_OUTPUT_PATH}/${_IDE_LIBRARY_BASE_PATH}") @@ -46,6 +46,9 @@ if (APPLE) set(_IDE_DATA_PATH "${_IDE_OUTPUT_PATH}/Resources") set(_IDE_DOC_PATH "${_IDE_OUTPUT_PATH}/Resources/doc") set(_IDE_BIN_PATH "${_IDE_OUTPUT_PATH}/MacOS") + + set(_IDE_HEADER_INSTALL_PATH "${_IDE_DATA_PATH}/Headers/qtcreator") + set(_IDE_CMAKE_INSTALL_PATH "${_IDE_DATA_PATH}/lib/cmake") elseif(WIN32) set(_IDE_APP_PATH "bin") set(_IDE_APP_TARGET "${IDE_ID}") @@ -57,6 +60,9 @@ elseif(WIN32) set(_IDE_DATA_PATH "share/qtcreator") set(_IDE_DOC_PATH "share/doc/qtcreator") set(_IDE_BIN_PATH "bin") + + set(_IDE_HEADER_INSTALL_PATH "include/qtcreator") + set(_IDE_CMAKE_INSTALL_PATH "lib/cmake") else () include(GNUInstallDirs) set(_IDE_APP_PATH "${CMAKE_INSTALL_BINDIR}") @@ -69,6 +75,9 @@ else () set(_IDE_DATA_PATH "${CMAKE_INSTALL_DATAROOTDIR}/qtcreator") set(_IDE_DOC_PATH "${CMAKE_INSTALL_DATAROOTDIR}/doc/qtcreator") set(_IDE_BIN_PATH "${CMAKE_INSTALL_BINDIR}") + + set(_IDE_HEADER_INSTALL_PATH "include/qtcreator") + set(_IDE_CMAKE_INSTALL_PATH "lib/cmake") endif () file(RELATIVE_PATH _PLUGIN_TO_LIB "/${_IDE_PLUGIN_PATH}" "/${_IDE_LIBRARY_PATH}") @@ -192,7 +201,7 @@ function(set_public_includes target includes) file(RELATIVE_PATH include_dir_relative_path ${PROJECT_SOURCE_DIR} ${inc_dir}) target_include_directories(${target} PUBLIC $<BUILD_INTERFACE:${inc_dir}> - $<INSTALL_INTERFACE:include/${include_dir_relative_path}> + $<INSTALL_INTERFACE:${_IDE_HEADER_INSTALL_PATH}/${include_dir_relative_path}> ) endforeach() endfunction() diff --git a/cmake/QtCreatorDocumentation.cmake b/cmake/QtCreatorDocumentation.cmake index b2cf79224e..49bf3d2d02 100644 --- a/cmake/QtCreatorDocumentation.cmake +++ b/cmake/QtCreatorDocumentation.cmake @@ -219,7 +219,10 @@ function(qtc_docs_dir varName) set(${varName} "${QtCreator_SOURCE_DIR}/doc" PARENT_SCOPE) elseif(QtCreatorDocumentation_LIST_DIR MATCHES /lib/cmake/QtCreator$) # Dev package - set(${varName} "${QtCreatorDocumentation_LIST_DIR}/../../../doc" PARENT_SCOPE) + file(RELATIVE_PATH relative_header_path "/${IDE_CMAKE_INSTALL_PATH}/QtCreator" "/${IDE_HEADER_INSTALL_PATH}") + set(${varName} + "${QtCreatorDocumentation_LIST_DIR}/${relative_header_path}/doc" + PARENT_SCOPE) else() message(FATAL_ERROR "Could not find qtc_docs_dir") endif() diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 8425aa5024..077d181493 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -53,7 +53,7 @@ if(WITH_ONLINE_DOCS) endif() install(DIRECTORY config - DESTINATION doc + DESTINATION ${IDE_HEADER_INSTALL_PATH}/doc COMPONENT Devel EXCLUDE_FROM_ALL ) diff --git a/scripts/build_plugin.py b/scripts/build_plugin.py index 8ec5eb4464..c70d605128 100755 --- a/scripts/build_plugin.py +++ b/scripts/build_plugin.py @@ -69,6 +69,14 @@ def build(args, paths): if not os.path.exists(paths.result): os.makedirs(paths.result) prefix_paths = [os.path.abspath(fp) for fp in args.prefix_paths] + [paths.qt_creator, paths.qt] + if common.is_mac_platform(): + # --qtc-path may be + # "/path/Qt Creator.app/Contents/Resources", + # "/path/Qt Creator.app", or + # "/path", + # so add some variants to the prefix path + prefix_paths += [os.path.join(paths.qt_creator, 'Contents', 'Resources'), + os.path.join(paths.qt_creator, 'Qt Creator.app', 'Contents', 'Resources')] prefix_paths = [common.to_posix_path(fp) for fp in prefix_paths] separate_debug_info_option = 'ON' if args.with_debug_info else 'OFF' cmake_args = ['cmake', diff --git a/share/qtcreator/templates/wizards/qtcreatorplugin/CMakeLists.txt b/share/qtcreator/templates/wizards/qtcreatorplugin/CMakeLists.txt index d9a268a634..b27b902e02 100644 --- a/share/qtcreator/templates/wizards/qtcreatorplugin/CMakeLists.txt +++ b/share/qtcreator/templates/wizards/qtcreatorplugin/CMakeLists.txt @@ -1,7 +1,15 @@ cmake_minimum_required(VERSION 3.10) # Remove when sharing with others. +@if %{JS: Util.isDirectory('%{QtCreatorBuild}/Qt Creator.app/Contents/Resources')} +list(APPEND CMAKE_PREFIX_PATH "%{QtCreatorBuild}/Qt Creator.app/Contents/Resources") +@else + @if %{JS: Util.isDirectory('%{QtCreatorBuild}/Contents/Resources')} +list(APPEND CMAKE_PREFIX_PATH "%{QtCreatorBuild}/Contents/Resources") + @else list(APPEND CMAKE_PREFIX_PATH "%{QtCreatorBuild}") + @endif +@endif project(%{PluginName}) diff --git a/share/qtcreator/templates/wizards/qtcreatorplugin/README.md b/share/qtcreator/templates/wizards/qtcreatorplugin/README.md index bdd9b8a67d..035b6c5c88 100644 --- a/share/qtcreator/templates/wizards/qtcreatorplugin/README.md +++ b/share/qtcreator/templates/wizards/qtcreatorplugin/README.md @@ -7,9 +7,10 @@ Create a build directory and run cmake -DCMAKE_PREFIX_PATH=<path_to_qtcreator> -DCMAKE_BUILD_TYPE=RelWithDebInfo <path_to_plugin_source> cmake --build . -where `<path_to_qtcreator>` is the relative or absolute path to a Qt Creator build directory, or to -a combined binary and development package, and `<path_to_plugin_source>` is the relative or absolute -path to this plugin directory. +where `<path_to_qtcreator>` is the relative or absolute path to a Qt Creator build directory, or to a +combined binary and development package (Windows / Linux), or to the `Qt Creator.app/Contents/Resources/` +directory of a combined binary and development package (macOS), and `<path_to_plugin_source>` is the +relative or absolute path to this plugin directory. ## How to Run diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f822331965..799d8ef68c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,7 +1,7 @@ add_library(app_version INTERFACE) target_include_directories(app_version INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}> - INTERFACE $<INSTALL_INTERFACE:include/src>) + INTERFACE $<INSTALL_INTERFACE:${IDE_HEADER_INSTALL_PATH}/src>) install(TARGETS app_version EXPORT QtCreator) add_subdirectory(libs) @@ -16,20 +16,20 @@ install( ${PROJECT_SOURCE_DIR}/HACKING ${PROJECT_SOURCE_DIR}/LICENSE.GPL3-EXCEPT ${PROJECT_SOURCE_DIR}/README.md - DESTINATION ./ + DESTINATION ${IDE_DATA_PATH} COMPONENT Devel EXCLUDE_FROM_ALL ) install( DIRECTORY ${PROJECT_SOURCE_DIR}/scripts - DESTINATION ./ + DESTINATION ${IDE_DATA_PATH} COMPONENT Devel EXCLUDE_FROM_ALL USE_SOURCE_PERMISSIONS ) install(EXPORT QtCreator - DESTINATION "lib/cmake/QtCreator" + DESTINATION ${IDE_CMAKE_INSTALL_PATH}/QtCreator COMPONENT Devel EXCLUDE_FROM_ALL NAMESPACE QtCreator:: FILE QtCreatorTargets.cmake @@ -106,6 +106,6 @@ install( ${PROJECT_SOURCE_DIR}/cmake/QtcSeparateDebugInfo.cmake ${PROJECT_SOURCE_DIR}/cmake/QtcSeparateDebugInfo.Info.plist.in ${CMAKE_BINARY_DIR}/cmake/QtCreatorConfig.cmake - DESTINATION lib/cmake/QtCreator + DESTINATION ${IDE_CMAKE_INSTALL_PATH}/QtCreator COMPONENT Devel EXCLUDE_FROM_ALL ) diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt index 83695baf6c..b08211cf57 100644 --- a/src/app/CMakeLists.txt +++ b/src/app/CMakeLists.txt @@ -2,7 +2,7 @@ configure_file(app_version.h.cmakein app_version.h ESCAPE_QUOTES) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/app_version.h - DESTINATION include/src/app + DESTINATION ${IDE_HEADER_INSTALL_PATH}/src/app COMPONENT Devel EXCLUDE_FROM_ALL ) diff --git a/src/libs/CMakeLists.txt b/src/libs/CMakeLists.txt index bdcd9aabc9..7907d8272a 100644 --- a/src/libs/CMakeLists.txt +++ b/src/libs/CMakeLists.txt @@ -28,7 +28,7 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/qlitehtml/src/CMakeLists.txt) set(QLITEHTML_EXPORT QtCreator) set(QLITEHTML_DEVEL_COMPONENT Devel) set(QLITEHTML_DEVEL_EXCLUDE_FROM_ALL ON) - set(QLITEHTML_HEADER_PATH "include/src/lib/qlitehtml") + set(QLITEHTML_HEADER_PATH "${IDE_HEADER_INSTALL_PATH}/src/lib/qlitehtml") add_subdirectory(qlitehtml/src) endif() if(TARGET qlitehtml) |