diff options
-rw-r--r-- | cmake/QtBuild.cmake | 10 | ||||
-rw-r--r-- | cmake/QtInternalTargets.cmake | 16 |
2 files changed, 23 insertions, 3 deletions
diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index ec4a156d54..f0adaf9379 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -1667,7 +1667,7 @@ function(qt_internal_apply_gc_binaries target visibility) message(FATAL_ERROR "Visibitily setting must be one of PRIVATE, INTERFACE or PUBLIC.") endif() - if ((GCC OR CLANG) AND NOT EMSCRIPTEN) + if ((GCC OR CLANG) AND NOT EMSCRIPTEN AND NOT UIKIT) if(APPLE) set(gc_sections_flag "-Wl,-dead_strip") elseif(SOLARIS) @@ -1680,7 +1680,7 @@ function(qt_internal_apply_gc_binaries target visibility) target_link_options("${target}" ${visibility} "${gc_sections_flag}") endif() - if((GCC OR CLANG OR ICC) AND NOT EMSCRIPTEN) + if((GCC OR CLANG OR ICC) AND NOT EMSCRIPTEN AND NOT UIKIT) set(split_sections_flags "-ffunction-sections" "-fdata-sections") endif() if(split_sections_flags) @@ -3835,6 +3835,10 @@ function(qt_add_resource target resourceName) set(rcc_object_file_path $<TARGET_OBJECTS:$<TARGET_NAME:${out_target}>>) endif() set_property(TARGET ${target} APPEND PROPERTY QT_RCC_OBJECTS "${rcc_object_file_path}") + + # Make sure that the target cpp files are compiled with the regular Qt internal compile + # flags, needed for building iOS apps with qmake where bitcode is involved. + target_link_libraries("${out_target}" PRIVATE Qt::PlatformModuleInternal) endforeach() endif() @@ -4520,7 +4524,7 @@ function(qt_add_3rdparty_library target) DEFINES ${arg_DEFINES} PUBLIC_LIBRARIES ${arg_PUBLIC_LIBRARIES} - LIBRARIES ${arg_LIBRARIES} + LIBRARIES ${arg_LIBRARIES} Qt::PlatformModuleInternal COMPILE_OPTIONS ${arg_COMPILE_OPTIONS} PUBLIC_COMPILE_OPTIONS ${arg_PUBLIC_COMPILE_OPTIONS} LINK_OPTIONS ${arg_LINK_OPTIONS} 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 |