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/QtBaseConfigureTests.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/QtBaseConfigureTests.cmake')
-rw-r--r-- | cmake/QtBaseConfigureTests.cmake | 43 |
1 files changed, 30 insertions, 13 deletions
diff --git a/cmake/QtBaseConfigureTests.cmake b/cmake/QtBaseConfigureTests.cmake index 6b46ed26b2..777adb7b5f 100644 --- a/cmake/QtBaseConfigureTests.cmake +++ b/cmake/QtBaseConfigureTests.cmake @@ -1,27 +1,41 @@ include(CheckCXXSourceCompiles) + function(qt_run_config_test_architecture) set(QT_BASE_CONFIGURE_TESTS_VARS_TO_EXPORT "" CACHE INTERNAL "Test variables that should be exported" FORCE) - # Test architecture - set(_arch_file "${CMAKE_CURRENT_BINARY_DIR}/architecture_test") - set(saved_executable_suffix "${CMAKE_EXECUTABLE_SUFFIX}") - # With emscripten the application entry point is a .js file (to be run with node for example), but the - # real "data" is in the .wasm file, so that's where we need to look for the ABI, etc. information. - if (EMSCRIPTEN) - set(CMAKE_EXECUTABLE_SUFFIX ".wasm") - endif() + # Compile test to find the target architecture and sub-architectures. + set(flags "") + qt_get_platform_try_compile_vars(platform_try_compile_vars) + list(APPEND flags ${platform_try_compile_vars}) - try_compile(_arch_result "${CMAKE_CURRENT_BINARY_DIR}" - "${CMAKE_CURRENT_SOURCE_DIR}/config.tests/arch/arch.cpp" - COPY_FILE "${_arch_file}") - - set(CMAKE_EXECUTABLE_SUFFIX "${saved_executable_suffix}") + try_compile( + _arch_result + "${CMAKE_CURRENT_BINARY_DIR}/config.tests/arch" + "${CMAKE_CURRENT_SOURCE_DIR}/config.tests/arch" + arch + CMAKE_FLAGS ${flags} + ) if (NOT _arch_result) message(FATAL_ERROR "Failed to compile architecture detection file.") endif() + set(_arch_file_suffix "${CMAKE_EXECUTABLE_SUFFIX}") + # With emscripten the application entry point is a .js file (to be run with node for example), + # but the real "data" is in the .wasm file, so that's where we need to look for the ABI, etc. + # information. + if (EMSCRIPTEN) + set(_arch_file_suffix ".wasm") + endif() + set(_arch_file + "${CMAKE_CURRENT_BINARY_DIR}/config.tests/arch/architecture_test${_arch_file_suffix}") + if (NOT EXISTS "${_arch_file}") + message(FATAL_ERROR + "Failed to find compiled architecture detection executable at ${_arch_file}.") + endif() + message(STATUS "Extracting architecture info from ${_arch_file}.") + file(STRINGS "${_arch_file}" _arch_lines LENGTH_MINIMUM 16 LENGTH_MAXIMUM 1024 ENCODING UTF-8) foreach (_line ${_arch_lines}) @@ -60,6 +74,9 @@ function(qt_run_config_test_architecture) set(TEST_buildAbi "${_build_abi}" CACHE INTERNAL "Target machine buildAbi") list(APPEND QT_BASE_CONFIGURE_TESTS_VARS_TO_EXPORT TEST_buildAbi) set(QT_BASE_CONFIGURE_TESTS_VARS_TO_EXPORT ${QT_BASE_CONFIGURE_TESTS_VARS_TO_EXPORT} CACHE INTERNAL "Test variables that should be exported") + + list(JOIN _sub_architecture " " subarch_summary) + message(STATUS "Building for: ${QT_QMAKE_TARGET_MKSPEC} (${TEST_architecture_arch}, CPU features: ${subarch_summary})") endfunction() |