diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2024-03-06 17:43:04 +0100 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2024-03-14 11:44:16 +0100 |
commit | 62905163bf887c2c2c9ba7edcd64c96d237a6e95 (patch) | |
tree | a2282ce0c3dccce3690bc8ffebdd356679a660f8 /cmake/QtWrapperScriptHelpers.cmake | |
parent | d298a05ed1f86d4789c81877990dfd8965457d74 (diff) |
CMake: Allow building all examples as standalone just like tests
Introduce a new libexec/qt-internal-configure-examples script that
allows to configure and build "standalone examples" just like
"standalone tests".
This is a prerequisite for using deployment api in examples for prefix
builds, otherwise deployment api gets confused not finding various
information that it expects from an installed qt.
Because the various conditions in the build system for standalone
examples are similar to standalone tests, introduce a new
QT_BUILD_STANDALONE_PARTS variable and use that in the conditions.
The variable should not be set by the user, and is instead set by the
build system whenever QT_BUILD_STANDALONE_TESTS/EXAMPLES is set.
Unfortunately due to no common file being available before the first
project() call, in qtbase builds, per-repo builds and top-level builds,
we need to duplicate the code for setting QT_BUILD_STANDALONE_PARTS for
all three cases.
Task-number: QTBUG-90820
Task-number: QTBUG-96232
Change-Id: Ia40d03a0e8f5142abe5c7cd4ff3000df4a5f7a8a
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'cmake/QtWrapperScriptHelpers.cmake')
-rw-r--r-- | cmake/QtWrapperScriptHelpers.cmake | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/cmake/QtWrapperScriptHelpers.cmake b/cmake/QtWrapperScriptHelpers.cmake index e583a413dd..62d9290ffe 100644 --- a/cmake/QtWrapperScriptHelpers.cmake +++ b/cmake/QtWrapperScriptHelpers.cmake @@ -224,11 +224,12 @@ function(qt_internal_create_wrapper_scripts) qt_install(FILES "${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/${__qt_cmake_install_script_name}" DESTINATION "${INSTALL_LIBEXECDIR}") - qt_internal_create_qt_configure_tests_wrapper_script() + qt_internal_create_qt_configure_part_wrapper_script("STANDALONE_TESTS") + qt_internal_create_qt_configure_part_wrapper_script("STANDALONE_EXAMPLES") qt_internal_create_qt_configure_redo_script() endfunction() -function(qt_internal_create_qt_configure_tests_wrapper_script) +function(qt_internal_create_qt_configure_part_wrapper_script component) if(QT_GENERATE_WRAPPER_SCRIPTS_FOR_ALL_HOSTS) set(generate_unix TRUE) set(generate_non_unix TRUE) @@ -238,17 +239,27 @@ function(qt_internal_create_qt_configure_tests_wrapper_script) set(generate_non_unix TRUE) endif() - # Create a private wrapper script to configure and build all standalone tests. + # Create a private wrapper script to configure and build all standalone tests / examples. # # The script uses qt-cmake instead of qt-cmake-private on purpose. That's to ensure we build # only one configuration of tests (e.g RelWithDebInfo only) when Qt is configured with more # than one configuration (RelWithDebInfo;Debug). # Meant to be used by our CI instructions. # - # The script takes a path to the repo for which the standalone tests will be configured. - set(script_name "qt-internal-configure-tests") + # The script takes a path to the repo for which the standalone tests / examples will be + # configured. + + if(component STREQUAL "STANDALONE_TESTS") + set(script_name "qt-internal-configure-tests") + set(script_passed_args "-DQT_BUILD_STANDALONE_TESTS=ON -DQT_BUILD_EXAMPLES=OFF") + elseif(component STREQUAL "STANDALONE_EXAMPLES") + set(script_name "qt-internal-configure-examples") + set(script_passed_args "-DQT_BUILD_STANDALONE_EXAMPLES=ON -DQT_BUILD_TESTS=OFF") + else() + message(FATAL_ERROR "Invalid component type: ${component}") + endif() - set(script_passed_args "-DQT_BUILD_STANDALONE_TESTS=ON -DQT_USE_ORIGINAL_COMPILER=ON") + string(APPEND script_passed_args " -DQT_USE_ORIGINAL_COMPILER=ON") file(RELATIVE_PATH relative_path_from_libexec_dir_to_bin_dir ${__qt_libexec_dir_absolute} |