Move iOS entrypoint logic to entrypoint library
Change-Id: Ie0fc8368953a59d06a31847ed417bc3c35f29b90 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
6e9a0f6688
commit
4b063c8467
@ -8,9 +8,9 @@
|
|||||||
function(qt_internal_setup_startup_target)
|
function(qt_internal_setup_startup_target)
|
||||||
set(dependent_target "Core")
|
set(dependent_target "Core")
|
||||||
|
|
||||||
# On windows, find_package(Qt6Core) should call find_package(Qt6EntryPoint) so that Startup can
|
# On platforms that have a Qt entry-point, find_package(Qt6Core) should call
|
||||||
# link against EntryPoint.
|
# find_package(Qt6EntryPoint) so that we can link against EntryPoint.
|
||||||
if(WIN32)
|
if(WIN32 OR CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
||||||
qt_record_extra_qt_package_dependency("${dependent_target}" EntryPoint "${PROJECT_VERSION}")
|
qt_record_extra_qt_package_dependency("${dependent_target}" EntryPoint "${PROJECT_VERSION}")
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
@ -1,2 +1,10 @@
|
|||||||
qt:!console:contains(TEMPLATE, ".*app"): \
|
!qt: return()
|
||||||
|
|
||||||
|
win32 {
|
||||||
|
!console:contains(TEMPLATE, ".*app"): \
|
||||||
QT_PRIVATE += entrypoint_private
|
QT_PRIVATE += entrypoint_private
|
||||||
|
} else:uikit {
|
||||||
|
qt_depends = $$resolve_depends(QT, "QT.")
|
||||||
|
!watchos:equals(TEMPLATE, app):contains(qt_depends, gui(-private)?): \
|
||||||
|
QT_PRIVATE += entrypoint_private
|
||||||
|
}
|
||||||
|
@ -16,6 +16,8 @@ $$sim_and_dev {
|
|||||||
DEFINES += QT_COMPILER_SUPPORTS_SSE2
|
DEFINES += QT_COMPILER_SUPPORTS_SSE2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CONFIG += entrypoint
|
||||||
|
|
||||||
unset(sim_and_dev)
|
unset(sim_and_dev)
|
||||||
|
|
||||||
load(default_pre)
|
load(default_pre)
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
|
|
||||||
qt_depends = $$resolve_depends(QT, "QT.")
|
|
||||||
!watchos:equals(TEMPLATE, app):contains(qt_depends, gui(-private)?) {
|
|
||||||
!no_main_wrapper {
|
|
||||||
# The LC_MAIN load command available in iOS 6.0 and above allows dyld to
|
|
||||||
# directly call the entrypoint instead of going through _start in crt.o.
|
|
||||||
# Passing -e to the linker changes the entrypoint from _main to our custom
|
|
||||||
# wrapper that calls UIApplicationMain and dispatches back to main() once
|
|
||||||
# the application has started up and is ready to initialize QApplication.
|
|
||||||
QMAKE_LFLAGS += -Wl,-e,_qt_main_wrapper
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
load(qt)
|
|
@ -1415,8 +1415,7 @@ function(_qt_internal_setup_startup_target)
|
|||||||
# error out when called multiple times from different scopes.
|
# error out when called multiple times from different scopes.
|
||||||
set_target_properties("${target}" PROPERTIES INTERFACE_LINK_LIBRARIES "${finalGenex}")
|
set_target_properties("${target}" PROPERTIES INTERFACE_LINK_LIBRARIES "${finalGenex}")
|
||||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
||||||
set(flag "-Wl,-e,_qt_main_wrapper")
|
set(finalGenex "$<$<AND:${isExe},${isNotExcluded}>Qt::EntryPoint>")
|
||||||
set(finalGenex "$<$<AND:${isExe},${isNotExcluded}>:${flag}>")
|
|
||||||
|
|
||||||
set_target_properties("${target}" PROPERTIES INTERFACE_LINK_OPTIONS "${finalGenex}")
|
set_target_properties("${target}" PROPERTIES INTERFACE_LINK_OPTIONS "${finalGenex}")
|
||||||
endif()
|
endif()
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# special case begin
|
# special case begin
|
||||||
# special case skip regeneration
|
# special case skip regeneration
|
||||||
if (NOT WIN32)
|
if (NOT WIN32 AND NOT CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -25,18 +25,25 @@ set_target_properties(EntryPoint PROPERTIES
|
|||||||
INTERFACE_COMPILE_DEFINITIONS ""
|
INTERFACE_COMPILE_DEFINITIONS ""
|
||||||
)
|
)
|
||||||
|
|
||||||
# ---- While the static library target does the work ----
|
if(WIN32)
|
||||||
qt_internal_add_cmake_library(EntryPointImplementation STATIC
|
# Not all platforms require the static library
|
||||||
|
set(using_entrypoint_library "yes")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(using_entrypoint_library)
|
||||||
|
# ---- While the static library target does the work ----
|
||||||
|
qt_internal_add_cmake_library(EntryPointImplementation STATIC
|
||||||
INCLUDE_DIRECTORIES
|
INCLUDE_DIRECTORIES
|
||||||
$<TARGET_PROPERTY:Qt::Core,INTERFACE_INCLUDE_DIRECTORIES>
|
$<TARGET_PROPERTY:Qt::Core,INTERFACE_INCLUDE_DIRECTORIES>
|
||||||
)
|
)
|
||||||
|
|
||||||
set_target_properties(EntryPointImplementation PROPERTIES
|
set_target_properties(EntryPointImplementation PROPERTIES
|
||||||
OUTPUT_NAME "${INSTALL_CMAKE_NAMESPACE}EntryPoint${QT_LIBINFIX}"
|
OUTPUT_NAME "${INSTALL_CMAKE_NAMESPACE}EntryPoint${QT_LIBINFIX}"
|
||||||
ARCHIVE_OUTPUT_DIRECTORY "${QT_BUILD_DIR}/${INSTALL_LIBDIR}"
|
ARCHIVE_OUTPUT_DIRECTORY "${QT_BUILD_DIR}/${INSTALL_LIBDIR}"
|
||||||
)
|
)
|
||||||
|
|
||||||
qt_internal_add_target_aliases(EntryPointImplementation)
|
qt_internal_add_target_aliases(EntryPointImplementation)
|
||||||
|
endif()
|
||||||
|
|
||||||
# ---- Now we're ready to set up the platform specifics ----
|
# ---- Now we're ready to set up the platform specifics ----
|
||||||
|
|
||||||
@ -66,26 +73,33 @@ if(WIN32)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
||||||
|
set_target_properties(EntryPoint PROPERTIES INTERFACE_LINK_OPTIONS "-Wl,-e,_qt_main_wrapper")
|
||||||
|
set_property(TARGET EntryPoint APPEND PROPERTY INTERFACE_QT_MODULE_LDFLAGS "-Wl,-e,_qt_main_wrapper")
|
||||||
|
endif()
|
||||||
|
|
||||||
# ---- Finally, make sure the static library can be consumed by clients -----
|
# ---- Finally, make sure the static library can be consumed by clients -----
|
||||||
|
|
||||||
target_link_libraries(EntryPoint INTERFACE EntryPointImplementation)
|
if(using_entrypoint_library)
|
||||||
|
target_link_libraries(EntryPoint INTERFACE EntryPointImplementation)
|
||||||
|
|
||||||
qt_internal_get_target_property(entrypoint_implementation_ldflags
|
qt_internal_get_target_property(entrypoint_implementation_ldflags
|
||||||
EntryPointImplementation QT_MODULE_LDFLAGS)
|
EntryPointImplementation QT_MODULE_LDFLAGS)
|
||||||
|
|
||||||
set_target_properties(EntryPoint PROPERTIES
|
set_target_properties(EntryPoint PROPERTIES
|
||||||
INTERFACE_QT_MODULE_PRI_EXTRA_CONTENT "
|
INTERFACE_QT_MODULE_PRI_EXTRA_CONTENT "
|
||||||
QT.entrypoint_implementation.name = QtEntryPointImplementation
|
QT.entrypoint_implementation.name = QtEntryPointImplementation
|
||||||
QT.entrypoint_implementation.module = Qt6EntryPoint
|
QT.entrypoint_implementation.module = Qt6EntryPoint
|
||||||
QT.entrypoint_implementation.ldflags = ${entrypoint_implementation_ldflags}
|
QT.entrypoint_implementation.ldflags = ${entrypoint_implementation_ldflags}
|
||||||
QT.entrypoint_implementation.libs = $$QT_MODULE_LIB_BASE
|
QT.entrypoint_implementation.libs = $$QT_MODULE_LIB_BASE
|
||||||
QT.entrypoint_implementation.module_config = staticlib v2 internal_module
|
QT.entrypoint_implementation.module_config = staticlib v2 internal_module
|
||||||
"
|
"
|
||||||
INTERFACE_QT_MODULE_DEPENDS "entrypoint_implementation"
|
INTERFACE_QT_MODULE_DEPENDS "entrypoint_implementation"
|
||||||
)
|
)
|
||||||
|
|
||||||
set(export_name "${INSTALL_CMAKE_NAMESPACE}EntryPointTargets")
|
set(export_name "${INSTALL_CMAKE_NAMESPACE}EntryPointTargets")
|
||||||
qt_install(TARGETS EntryPointImplementation EXPORT ${export_name})
|
qt_install(TARGETS EntryPointImplementation EXPORT ${export_name})
|
||||||
qt_generate_prl_file(EntryPointImplementation "${INSTALL_LIBDIR}")
|
qt_generate_prl_file(EntryPointImplementation "${INSTALL_LIBDIR}")
|
||||||
|
endif()
|
||||||
|
|
||||||
# special case end
|
# special case end
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
# Additional Qt project file for QtEntryPoint lib
|
|
||||||
!win32:error("$$_FILE_ is intended only for Windows!")
|
|
||||||
|
|
||||||
TEMPLATE = subdirs
|
TEMPLATE = subdirs
|
||||||
CONFIG += ordered
|
CONFIG += ordered
|
||||||
|
|
||||||
SUBDIRS += entrypoint_module.pro
|
SUBDIRS += entrypoint_module.pro
|
||||||
SUBDIRS += entrypoint_implementation.pro
|
|
||||||
|
win32 {
|
||||||
|
SUBDIRS += entrypoint_implementation.pro
|
||||||
|
}
|
||||||
|
@ -4,22 +4,36 @@ MODULE = entrypoint
|
|||||||
|
|
||||||
CONFIG += header_module no_module_headers internal_module
|
CONFIG += header_module no_module_headers internal_module
|
||||||
|
|
||||||
MODULE_DEPENDS = entrypoint_implementation
|
|
||||||
QT =
|
QT =
|
||||||
|
|
||||||
mingw {
|
win32 {
|
||||||
|
MODULE_DEPENDS = entrypoint_implementation
|
||||||
|
|
||||||
|
mingw {
|
||||||
MODULE_DEFINES += QT_NEEDS_QMAIN
|
MODULE_DEFINES += QT_NEEDS_QMAIN
|
||||||
|
|
||||||
# This library needs to come before the entry-point library in the
|
# This library needs to come before the entry-point library in the
|
||||||
# linker line, so that the static linker will pick up the WinMain
|
# linker line, so that the static linker will pick up the WinMain
|
||||||
# symbol from the entry-point library.
|
# symbol from the entry-point library.
|
||||||
MODULE_LDFLAGS += -lmingw32
|
MODULE_LDFLAGS += -lmingw32
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MODULE_PRI_EXTRA_CONTENT = \
|
uikit {
|
||||||
|
# The LC_MAIN load command available in iOS 6.0 and above allows dyld to
|
||||||
|
# directly call the entrypoint instead of going through _start in crt.o.
|
||||||
|
# Passing -e to the linker changes the entrypoint from _main to our custom
|
||||||
|
# wrapper that calls UIApplicationMain and dispatches back to main() once
|
||||||
|
# the application has started up and is ready to initialize QApplication.
|
||||||
|
MODULE_LDFLAGS += -Wl,-e,_qt_main_wrapper
|
||||||
|
}
|
||||||
|
|
||||||
|
contains(MODULE_DEPENDS, entrypoint_implementation) {
|
||||||
|
MODULE_PRI_EXTRA_CONTENT = \
|
||||||
"QT.entrypoint_implementation.name = QtEntryPointImplementation" \
|
"QT.entrypoint_implementation.name = QtEntryPointImplementation" \
|
||||||
"QT.entrypoint_implementation.module = Qt6EntryPoint" \
|
"QT.entrypoint_implementation.module = Qt6EntryPoint" \
|
||||||
"QT.entrypoint_implementation.libs = \$\$QT_MODULE_LIB_BASE" \
|
"QT.entrypoint_implementation.libs = \$\$QT_MODULE_LIB_BASE" \
|
||||||
"QT.entrypoint_implementation.module_config = staticlib v2 internal_module"
|
"QT.entrypoint_implementation.module_config = staticlib v2 internal_module"
|
||||||
|
}
|
||||||
|
|
||||||
load(qt_module)
|
load(qt_module)
|
||||||
|
@ -158,7 +158,7 @@ qtConfig(regularexpression):!qtConfig(system-pcre2):pcre2 {
|
|||||||
TOOLS = src_tools_moc src_tools_rcc src_tools_tracegen src_tools_qlalr
|
TOOLS = src_tools_moc src_tools_rcc src_tools_tracegen src_tools_qlalr
|
||||||
SUBDIRS += src_corelib src_tools_qlalr
|
SUBDIRS += src_corelib src_tools_qlalr
|
||||||
|
|
||||||
win32:SUBDIRS += src_entrypoint
|
uikit|win32:SUBDIRS += src_entrypoint
|
||||||
|
|
||||||
qtConfig(network) {
|
qtConfig(network) {
|
||||||
SUBDIRS += src_network
|
SUBDIRS += src_network
|
||||||
|
Loading…
Reference in New Issue
Block a user