diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2020-11-09 15:42:05 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2020-11-10 16:53:31 +0100 |
commit | 4b063c8467071e1c2d40f5fc493b7e3ec5a08520 (patch) | |
tree | 1b5f214ae39c7786e285cc78ab637e124eb8635b /src/entrypoint/CMakeLists.txt | |
parent | 6e9a0f6688bd8554321f8eff10af2c9d9db564a0 (diff) |
Move iOS entrypoint logic to entrypoint library
Change-Id: Ie0fc8368953a59d06a31847ed417bc3c35f29b90
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'src/entrypoint/CMakeLists.txt')
-rw-r--r-- | src/entrypoint/CMakeLists.txt | 72 |
1 files changed, 43 insertions, 29 deletions
diff --git a/src/entrypoint/CMakeLists.txt b/src/entrypoint/CMakeLists.txt index 4045416dbf..4445f29940 100644 --- a/src/entrypoint/CMakeLists.txt +++ b/src/entrypoint/CMakeLists.txt @@ -1,6 +1,6 @@ # special case begin # special case skip regeneration -if (NOT WIN32) +if (NOT WIN32 AND NOT CMAKE_SYSTEM_NAME STREQUAL "iOS") return() endif() @@ -25,18 +25,25 @@ set_target_properties(EntryPoint PROPERTIES INTERFACE_COMPILE_DEFINITIONS "" ) -# ---- While the static library target does the work ---- -qt_internal_add_cmake_library(EntryPointImplementation STATIC - INCLUDE_DIRECTORIES - $<TARGET_PROPERTY:Qt::Core,INTERFACE_INCLUDE_DIRECTORIES> -) +if(WIN32) + # Not all platforms require the static library + set(using_entrypoint_library "yes") +endif() -set_target_properties(EntryPointImplementation PROPERTIES - OUTPUT_NAME "${INSTALL_CMAKE_NAMESPACE}EntryPoint${QT_LIBINFIX}" - ARCHIVE_OUTPUT_DIRECTORY "${QT_BUILD_DIR}/${INSTALL_LIBDIR}" -) +if(using_entrypoint_library) + # ---- While the static library target does the work ---- + qt_internal_add_cmake_library(EntryPointImplementation STATIC + INCLUDE_DIRECTORIES + $<TARGET_PROPERTY:Qt::Core,INTERFACE_INCLUDE_DIRECTORIES> + ) + + set_target_properties(EntryPointImplementation PROPERTIES + OUTPUT_NAME "${INSTALL_CMAKE_NAMESPACE}EntryPoint${QT_LIBINFIX}" + 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 ---- @@ -66,26 +73,33 @@ if(WIN32) endif() endif() -# ---- Finally, make sure the static library can be consumed by clients ----- - -target_link_libraries(EntryPoint INTERFACE EntryPointImplementation) +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() -qt_internal_get_target_property(entrypoint_implementation_ldflags - EntryPointImplementation QT_MODULE_LDFLAGS) +# ---- Finally, make sure the static library can be consumed by clients ----- -set_target_properties(EntryPoint PROPERTIES - INTERFACE_QT_MODULE_PRI_EXTRA_CONTENT " -QT.entrypoint_implementation.name = QtEntryPointImplementation -QT.entrypoint_implementation.module = Qt6EntryPoint -QT.entrypoint_implementation.ldflags = ${entrypoint_implementation_ldflags} -QT.entrypoint_implementation.libs = $$QT_MODULE_LIB_BASE -QT.entrypoint_implementation.module_config = staticlib v2 internal_module -" - INTERFACE_QT_MODULE_DEPENDS "entrypoint_implementation" -) +if(using_entrypoint_library) + target_link_libraries(EntryPoint INTERFACE EntryPointImplementation) + + qt_internal_get_target_property(entrypoint_implementation_ldflags + EntryPointImplementation QT_MODULE_LDFLAGS) + + set_target_properties(EntryPoint PROPERTIES + INTERFACE_QT_MODULE_PRI_EXTRA_CONTENT " + QT.entrypoint_implementation.name = QtEntryPointImplementation + QT.entrypoint_implementation.module = Qt6EntryPoint + QT.entrypoint_implementation.ldflags = ${entrypoint_implementation_ldflags} + QT.entrypoint_implementation.libs = $$QT_MODULE_LIB_BASE + QT.entrypoint_implementation.module_config = staticlib v2 internal_module + " + INTERFACE_QT_MODULE_DEPENDS "entrypoint_implementation" + ) -set(export_name "${INSTALL_CMAKE_NAMESPACE}EntryPointTargets") -qt_install(TARGETS EntryPointImplementation EXPORT ${export_name}) -qt_generate_prl_file(EntryPointImplementation "${INSTALL_LIBDIR}") + set(export_name "${INSTALL_CMAKE_NAMESPACE}EntryPointTargets") + qt_install(TARGETS EntryPointImplementation EXPORT ${export_name}) + qt_generate_prl_file(EntryPointImplementation "${INSTALL_LIBDIR}") +endif() # special case end |