diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2020-06-30 16:11:29 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2020-07-01 10:03:54 +0200 |
commit | a0468331761b497992e9d554c210583781308272 (patch) | |
tree | e7e060bbc22b01a70dacd0281163a8d2413b417c /cmake/QtInternalTargets.cmake | |
parent | 36b0d9b51cd1c25d5e3decdd80d4b01420b11c17 (diff) |
CMake: Enable bitcode when targeting UIKIT aka iOS
Building an iOS app with qmake failed because Qt itself was not built
with bitcode enabled.
Enable building with bitcode.
Make sure qrc resource files and bundled 3rd party libraries also
build with the regular Qt module flags and thus with bitcode enabled.
As a consequence gc_sections has to be disabled for UIKIT platforms.
Task-number: QTBUG-82581
Task-number: QTBUG-84781
Task-number: QTBUG-85240
Change-Id: I15fe668725a139c02f2a32a5db849b46d4ce325c
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'cmake/QtInternalTargets.cmake')
-rw-r--r-- | cmake/QtInternalTargets.cmake | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/cmake/QtInternalTargets.cmake b/cmake/QtInternalTargets.cmake index 9fca5d41de..6eb4bd96f9 100644 --- a/cmake/QtInternalTargets.cmake +++ b/cmake/QtInternalTargets.cmake @@ -108,6 +108,21 @@ endif() target_compile_definitions(PlatformCommonInternal INTERFACE $<$<NOT:$<CONFIG:Debug>>:QT_NO_DEBUG>) +function(qt_internal_apply_bitcode_flags target) + # See mkspecs/features/uikit/bitcode.prf + set(release_flags "-fembed-bitcode") + set(debug_flags "-fembed-bitcode-marker") + + set(is_release_genex "$<NOT:$<CONFIG:Debug>>") + set(flags_genex "$<IF:${is_release_genex},${release_flags},${debug_flags}>") + set(is_enabled_genex "$<NOT:$<BOOL:$<TARGET_PROPERTY:QT_NO_BITCODE>>>") + + set(bitcode_flags "$<${is_enabled_genex}:${flags_genex}>") + + target_link_options("${target}" INTERFACE ${bitcode_flags}) + target_compile_options("${target}" INTERFACE ${bitcode_flags}) +endfunction() + if(UIKIT) # Do what mkspecs/features/uikit/default_pre.prf does, aka enable sse2 for # simulator_and_device_builds. @@ -118,6 +133,7 @@ if(UIKIT) # TODO: Figure out if this ok or not (sounds ok to me). target_compile_definitions(PlatformCommonInternal INTERFACE QT_COMPILER_SUPPORTS_SSE2) endif() + qt_internal_apply_bitcode_flags(PlatformCommonInternal) endif() # Taken from mkspecs/common/msvc-version.conf and mkspecs/common/msvc-desktop.conf |