diff --git a/cmake/QtBuildOptionsHelpers.cmake b/cmake/QtBuildOptionsHelpers.cmake index 81166a7f263..6f795e2ec2b 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 5261dd90a1f..b6e47430c5a 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}") @@ -407,6 +415,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 diff --git a/coin/instructions/prepare_building_env.yaml b/coin/instructions/prepare_building_env.yaml index d1517dce09d..a3ac5c3f0b8 100644 --- a/coin/instructions/prepare_building_env.yaml +++ b/coin/instructions/prepare_building_env.yaml @@ -536,6 +536,8 @@ instructions: # Specify a custom examples installation directory, so that the built example binaries are not # packaged into the artifact archive together with the Qt libraries. + # Also specify that during examples deployment, only a subset of examples should be deployed, to + # save time and space. - type: Group instructions: - type: AppendToEnvironmentVariable @@ -544,6 +546,12 @@ instructions: - type: AppendToEnvironmentVariable variableName: COMMON_TARGET_CMAKE_ARGS variableValue: " -DQT_INTERNAL_EXAMPLES_INSTALL_PREFIX={{unixPathSeparators .BuildDir}}/installed_examples" + - type: AppendToEnvironmentVariable + variableName: COMMON_CMAKE_ARGS + variableValue: " -DQT_DEPLOY_MINIMAL_EXAMPLES=ON" + - type: AppendToEnvironmentVariable + variableName: COMMON_TARGET_CMAKE_ARGS + variableValue: " -DQT_DEPLOY_MINIMAL_EXAMPLES=ON" - type: Group instructions: - type: AppendToEnvironmentVariable