diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2021-08-19 16:19:21 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2021-08-26 16:40:15 +0200 |
commit | 80705298ca11587782beed49c4ae55f533cfc0c2 (patch) | |
tree | 73fa32a0d8dccb35ab7121b0fb264fde96eb419f /src | |
parent | 1f3949a5a8182aee4047fcf73413f67c613cbb86 (diff) |
CMake: Build a subset of tests when targeting iOS in the CI
Add infrastructure to build cmake auto tests in the CI when targeting
iOS.
Currently the are only CI instructions for qtbase.
More work is needed to make it work for other repos.
With this change, we will build a single Widgets application targeting
the iOS simulator. We can't target the device SDK in the CI because
signing fails due to a missing signing certificate and provisioning
profile.
The Coin instructions will now set a QT_BUILD_ENVIRONMENT=ci env var
whose value will be checked in _qt_internal_test_expect_pass, to
ensure we build for the simulator SDK when using a universal Qt.
Without this, xcodebuild will try to build with the device SDK and
fail to build the project.
Pick-to: 6.2
Task-number: QTBUG-95839
Change-Id: Ib39c9527b107b2004746ccbdc9d9d1d658f88c76
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/Qt6CTestMacros.cmake | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/corelib/Qt6CTestMacros.cmake b/src/corelib/Qt6CTestMacros.cmake index 8460600a62..19601c5dec 100644 --- a/src/corelib/Qt6CTestMacros.cmake +++ b/src/corelib/Qt6CTestMacros.cmake @@ -132,6 +132,8 @@ endfunction() # # GENERATOR: Use a custom generator. When not specified, uses existing CMAKE_GENERATOR value. # +# NO_IOS_DEFAULT_ARGS: Skips setting default iOS-specific options like the generator to be used. +# # MAKE_PROGRAM: Specify a different make program. Can be useful with a custom make or ninja wrapper. # # BUILD_TYPE: Specify a different CMake build type. Defaults to CMAKE_BUILD_TYPE if it is not empty. @@ -163,6 +165,7 @@ macro(_qt_internal_test_expect_pass _dir) SIMULATE_IN_SOURCE NO_CLEAN_STEP NO_BUILD_PROJECT_ARG + NO_IOS_DEFAULT_ARGS ) set(_test_single_args BINARY @@ -182,6 +185,13 @@ macro(_qt_internal_test_expect_pass _dir) "${_test_multi_args}" ${ARGN} ) + + if(NOT _ARGS_NO_IOS_DEFAULT_ARGS AND IOS) + set(_ARGS_NO_BUILD_PROJECT_ARG TRUE) + set(_ARGS_GENERATOR Xcode) + set(_ARGS_MAKE_PROGRAM xcodebuild) + endif() + if(_ARGS_TESTNAME) set(testname "${_ARGS_TESTNAME}") else() @@ -250,6 +260,28 @@ macro(_qt_internal_test_expect_pass _dir) list(APPEND additional_configure_args $ENV{QT_CMAKE_TESTS_ADDITIONAL_CONFIGURE_OPTIONS}) endif() + # When building an iOS CMake test in the CI using a universal Qt build, target the simulator + # sdk, because the CI currently doesn't have a proper setup for signing device binaries + # (missing a working signing certificate and provisioning profile). Allow opt-out. + if(IOS) + set(osx_arch_count 0) + if(QT_OSX_ARCHITECTURES) + list(LENGTH QT_OSX_ARCHITECTURES osx_arch_count) + endif() + + set(build_environment "") + if(DEFINED ENV{QT_BUILD_ENVIRONMENT}) + set(build_environment "$ENV{QT_BUILD_ENVIRONMENT}") + endif() + if(build_environment STREQUAL "ci" + AND osx_arch_count GREATER_EQUAL 2 + AND NOT QT_UIKIT_SDK + AND NOT QT_NO_IOS_BUILD_ADJUSTMENT_IN_CI) + list(APPEND additional_configure_args + -DCMAKE_OSX_ARCHITECTURES=x86_64 -DCMAKE_OSX_SYSROOT=iphonesimulator) + endif() + endif() + set(__expect_pass_prefixes "${CMAKE_PREFIX_PATH}") string(REPLACE ";" "\;" __expect_pass_prefixes "${__expect_pass_prefixes}") |