iOS: Set LD_ENTRY_POINT for generated Xcode project
We normally override the entrypoint to _qt_main_wrapper via the -e flag to the linker, but if a Swift file is added to the Xcode project, Xcode does some magic, building the app as a shared library, and wrapping it with the Swift code into a custom executable. The -e flag will then be a noop when linking our shared library. To work around this we set the custom LD_ENTRY_POINT Xcode build setting, which triggers Xcode to pass -e when linking the wrapper-executable. This works in practice, but produces a warning on the console that the entrypoint is not found, which has been reported as FB16519113. Fixes: QTBUG-133577 Pick-to: 6.8 Change-Id: I9d8310b39ac5a4900693df55c2e5bfa346c0300a Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 430ba7c0f826ee6f91fbfdc861525cb62b8e725c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
4488dfcbf6
commit
9fbb8e0090
@ -754,6 +754,25 @@ function(_qt_internal_set_ios_simulator_arch target)
|
||||
"x86_64")
|
||||
endfunction()
|
||||
|
||||
function(_qt_internal_set_xcode_entrypoint_attribute target entrypoint)
|
||||
if(CMAKE_XCODE_ATTRIBUTE_LD_ENTRY_POINT
|
||||
OR QT_NO_SET_XCODE_LD_ENTRY_POINT)
|
||||
return()
|
||||
endif()
|
||||
|
||||
get_target_property(existing_entrypoint
|
||||
"${target}" XCODE_ATTRIBUTE_LD_ENTRY_POINT)
|
||||
if(NOT existing_entrypoint MATCHES "-NOTFOUND")
|
||||
return()
|
||||
endif()
|
||||
|
||||
set_target_properties("${target}"
|
||||
PROPERTIES
|
||||
"XCODE_ATTRIBUTE_LD_ENTRY_POINT"
|
||||
"${entrypoint}")
|
||||
endfunction()
|
||||
|
||||
|
||||
# Export Apple platform sdk and xcode version requirements to Qt6ConfigExtras.cmake.
|
||||
# Always exported, even on non-Apple platforms, so that we can use them when building
|
||||
# documentation.
|
||||
@ -1022,6 +1041,8 @@ function(_qt_internal_finalize_ios_app target)
|
||||
_qt_internal_set_xcode_targeted_device_family("${target}")
|
||||
_qt_internal_set_xcode_bitcode_enablement("${target}")
|
||||
_qt_internal_set_ios_simulator_arch("${target}")
|
||||
|
||||
_qt_internal_set_xcode_entrypoint_attribute("${target}" "_qt_main_wrapper")
|
||||
endfunction()
|
||||
|
||||
function(_qt_internal_finalize_macos_app target)
|
||||
|
@ -48,6 +48,12 @@ macx-xcode {
|
||||
QMAKE_MAC_XCODE_SETTINGS += supported_platforms
|
||||
}
|
||||
|
||||
# Override the entry point explicitly, in case a Swift file is
|
||||
# added to the Xcode project
|
||||
ld_entry_point.name = LD_ENTRY_POINT
|
||||
ld_entry_point.value = _qt_main_wrapper
|
||||
QMAKE_MAC_XCODE_SETTINGS += ld_entry_point
|
||||
|
||||
# In a simulator specific build the device config will set the SDK
|
||||
# to the simulator SDK, but for Xcode we always want the SDKROOT
|
||||
# to be the device SDK.
|
||||
|
Loading…
x
Reference in New Issue
Block a user