summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2024-03-13 19:03:19 +0100
committerAlexandru Croitor <alexandru.croitor@qt.io>2024-03-19 18:22:16 +0100
commit224b7c6b6a2a425487df19643709d105e8f3cdd5 (patch)
treef8b3605b569f51038c8e9b51e5c98d13e6bea67b /cmake
parentc5d0e93199beea314e4e4607c8ef5f7c29162666 (diff)
CMake: Allow configuring a minimal subset of examples to deploy
When building examples as part of Qt in the CI, it's best to skip running deployment for all examples to save resources (space and time). Add a QT_DEPLOY_MINIMAL_EXAMPLES option similar to our QT_BUILD_MINIMAL_STATIC_TESTS option, which will set QT_INTERNAL_SKIP_DEPLOYMENT at the root examples directory scope, to skip deployment for all examples. Each example can then opt into the minimal subset by unsetting the QT_INTERNAL_SKIP_DEPLOYMENT variable before its qt_internal_add_example call. Add Coin instructions to enable this option when building our examples in the CI. Pick-to: 6.7 Task-number: QTBUG-90820 Task-number: QTBUG-96232 Task-number: QTBUG-102057 Change-Id: I2efcda455b400c27fe1efd1bcf81b133137fa2d1 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtBuildOptionsHelpers.cmake3
-rw-r--r--cmake/QtBuildRepoExamplesHelpers.cmake9
2 files changed, 12 insertions, 0 deletions
diff --git a/cmake/QtBuildOptionsHelpers.cmake b/cmake/QtBuildOptionsHelpers.cmake
index 81166a7f26..6f795e2ec2 100644
--- a/cmake/QtBuildOptionsHelpers.cmake
+++ b/cmake/QtBuildOptionsHelpers.cmake
@@ -323,6 +323,9 @@ macro(qt_internal_setup_build_examples)
"Should examples be built as part of the default 'all' target." FORCE)
endif()
+ option(QT_DEPLOY_MINIMAL_EXAMPLES
+ "Deploy minimal subset of examples to save time and space" OFF)
+
# FIXME: Support prefix builds as well QTBUG-96232
# We don't want to enable EP examples with -debug-and-release because starting with CMake 3.24
# ExternalProject_Add ends up creating build rules twice, once for each configuration, in the
diff --git a/cmake/QtBuildRepoExamplesHelpers.cmake b/cmake/QtBuildRepoExamplesHelpers.cmake
index 63db15491b..6802d81323 100644
--- a/cmake/QtBuildRepoExamplesHelpers.cmake
+++ b/cmake/QtBuildRepoExamplesHelpers.cmake
@@ -11,6 +11,14 @@ macro(qt_examples_build_begin)
# Examples are not unity-ready.
set(CMAKE_UNITY_BUILD OFF)
+ # Skip running deployment steps when the developer asked to deploy a minimal subset of examples.
+ # Each example can then decide whether it wants to be deployed as part of the minimal subset
+ # by unsetting the QT_INTERNAL_SKIP_DEPLOYMENT variable before its qt_internal_add_example call.
+ # This will be used by our CI.
+ if(NOT DEFINED QT_INTERNAL_SKIP_DEPLOYMENT AND QT_DEPLOY_MINIMAL_EXAMPLES)
+ set(QT_INTERNAL_SKIP_DEPLOYMENT TRUE)
+ endif()
+
# Use by qt_internal_add_example.
set(QT_EXAMPLE_BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
@@ -414,6 +422,7 @@ function(qt_internal_add_example_external_project subdir)
QT_BUILD_CMAKE_PREFIX_PATH:STRING
QT_ADDITIONAL_PACKAGES_PREFIX_PATH:STRING
QT_ADDITIONAL_QML_PLUGIN_GLOB_PREFIXES:STRING
+ QT_INTERNAL_SKIP_DEPLOYMENT:BOOL
CMAKE_FIND_ROOT_PATH:STRING
CMAKE_MODULE_PATH:STRING
BUILD_SHARED_LIBS:BOOL