forked from qt-creator/qt-creator
CMake build: Fix remaining issues with Devel package
On Linux (and Windows) we should not create toplevel files (README.md etc) or directories (doc/, scripts/ etc). On macOS, move the whole Devel package contents into the app bundle, because that is installed toplevel in the Qt installers, and we shouldn't even create include/, lib/ or any other directory at the toplevel at all. Since the prefix path must now point to the Resources folder inside the app bundle, adapt build_plugin.py to also accept --qtc-path pointing to the app bundle (Qt Creator.app) itself, and also to the app bundles parent directory. Adapt the Qt Creator plugin project template similarly. Task-number: QTCREATORBUG-25414 Fixes: QTCREATORBUG-25415 Change-Id: Ic756237fb920b54b1ec95d076649ad947b39a7e8 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
+2
-2
@@ -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
|
||||
)
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
+1
-1
@@ -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
|
||||
)
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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})
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
+5
-5
@@ -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
|
||||
)
|
||||
|
||||
@@ -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
|
||||
)
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user