diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-04-08 17:23:57 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-12-03 13:35:59 +0000 |
commit | 55a15a1c1b93d36d705fc69e44b5c806b807dd55 (patch) | |
tree | 5b98c29c723bda2f298a394ee46e63f3c23ec74f /cmake/QtBaseGlobalTargets.cmake | |
parent | c800a6240353eb54bd7a2ad06c455ac9374c2476 (diff) |
Add initial support for cross-building to iOS
Tested locally with the following configurations:
- iOS device builds (arm64)
- iOS simulator builds (x86_64)
- iOS simulator_and_device builds (fat arm64 and x86_64 archives)
All iOS builds currently require a custom vcpkg fork which contains
fixes for building the required 3rd party libraries.
qtsvg, qtdeclarative, qtgraphicaleffects and qtquickcontrols2
have also been tested to build successfully.
simulator_and_device builds are also supported, but require an umerged
patch in upstream CMake as well as further patches to vcpkg.
Task-number: QTBUG-75576
Change-Id: Icd29913fbbd52a60e07ea5253fd9c7af7f8ce44c
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Diffstat (limited to 'cmake/QtBaseGlobalTargets.cmake')
-rw-r--r-- | cmake/QtBaseGlobalTargets.cmake | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/cmake/QtBaseGlobalTargets.cmake b/cmake/QtBaseGlobalTargets.cmake index 66ec2c73e4..ad15207005 100644 --- a/cmake/QtBaseGlobalTargets.cmake +++ b/cmake/QtBaseGlobalTargets.cmake @@ -91,11 +91,27 @@ list(APPEND init_platform "set(CMAKE_CXX_COMPILER \"${CMAKE_CXX_COMPILER}\" CACH list(APPEND init_platform "set(CMAKE_C_COMPILER \"${CMAKE_C_COMPILER}\" CACHE STRING \"\")") if(APPLE) - if(CMAKE_OSX_SYSROOT) + # For simulator_and_device build, we should not explicitly set the sysroot. + list(LENGTH CMAKE_OSX_ARCHITECTURES _qt_osx_architectures_count) + if(CMAKE_OSX_SYSROOT AND NOT _qt_osx_architectures_count GREATER 1 AND APPLE_UIKIT) list(APPEND init_platform "set(CMAKE_OSX_SYSROOT \"${CMAKE_OSX_SYSROOT}\" CACHE PATH \"\")") endif() + unset(_qt_osx_architectures_count) + if(CMAKE_OSX_DEPLOYMENT_TARGET) - list(APPEND init_platform "set(CMAKE_OSX_DEPLOYMENT_TARGET \"${CMAKE_OSX_DEPLOYMENT_TARGET}\" CACHE STRING \"\")") + list(APPEND init_platform + "set(CMAKE_OSX_DEPLOYMENT_TARGET \"${CMAKE_OSX_DEPLOYMENT_TARGET}\" CACHE STRING \"\")") + endif() + + if(APPLE_UIKIT) + list(APPEND init_platform + "set(CMAKE_SYSTEM_NAME \"${CMAKE_SYSTEM_NAME}\" CACHE STRING \"\")") + set(_qt_osx_architectures_escaped "${CMAKE_OSX_ARCHITECTURES}") + string(REPLACE ";" "LITERAL_SEMICOLON" + _qt_osx_architectures_escaped "${_qt_osx_architectures_escaped}") + list(APPEND init_platform + "set(CMAKE_OSX_ARCHITECTURES \"${_qt_osx_architectures_escaped}\" CACHE STRING \"\")") + unset(_qt_osx_architectures_escaped) endif() elseif(ANDROID) list(APPEND init_platform "set(ANDROID_NATIVE_API_LEVEL \"${ANDROID_NATIVE_API_LEVEL}\" CACHE STRING \"\")") @@ -108,6 +124,7 @@ endif() string(REPLACE ";" "\n" init_vcpkg "${init_vcpkg}") string(REPLACE ";" "\n" init_platform "${init_platform}") +string(REPLACE "LITERAL_SEMICOLON" ";" init_platform "${init_platform}") configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/qt.toolchain.cmake.in" "${__GlobalConfig_build_dir}/qt.toolchain.cmake" @ONLY) qt_install(FILES "${__GlobalConfig_build_dir}/qt.toolchain.cmake" DESTINATION "${__GlobalConfig_install_dir}" COMPONENT Devel) @@ -135,6 +152,16 @@ qt_feature_module_begin(NO_MODULE PRIVATE_FILE src/corelib/global/qconfig_p.h ) include("${CMAKE_CURRENT_SOURCE_DIR}/configure.cmake") + +# Do what mkspecs/features/uikit/default_pre.prf does, aka enable sse2 for +# simulator_and_device_builds. +if(APPLE_UIKIT AND NOT QT_UIKIT_SDK) + set(__QtFeature_custom_enabled_cache_variables + TEST_subarch_sse2 + FEATURE_sse2 + QT_FEATURE_sse2) +endif() + qt_feature_module_end(GlobalConfig OUT_VAR_PREFIX "__GlobalConfig_") qt_generate_global_config_pri_file() |