mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[CMAKE] Add Plist creation to swiftCore (#77960)
* update Resync to copy plist template * include Plist in linked library for Darwin platforms * only embedd plist on apple platforms * formatting fix
This commit is contained in:
@@ -68,6 +68,7 @@ include(DefaultSettings)
|
|||||||
include(EmitSwiftInterface)
|
include(EmitSwiftInterface)
|
||||||
include(PlatformInfo)
|
include(PlatformInfo)
|
||||||
include(gyb)
|
include(gyb)
|
||||||
|
include(Plist)
|
||||||
|
|
||||||
include("${SwiftCore_VENDOR_MODULE_DIR}/Settings.cmake" OPTIONAL)
|
include("${SwiftCore_VENDOR_MODULE_DIR}/Settings.cmake" OPTIONAL)
|
||||||
|
|
||||||
|
|||||||
31
Runtimes/Core/cmake/modules/Plist.cmake
Normal file
31
Runtimes/Core/cmake/modules/Plist.cmake
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
function(generate_plist project_name project_version target)
|
||||||
|
set(PLIST_INFO_PLIST "Info.plist")
|
||||||
|
set(PLIST_INFO_NAME "${project_name}")
|
||||||
|
|
||||||
|
# Underscores aren't permitted in the bundle identifier.
|
||||||
|
string(REPLACE "_" "" PLIST_INFO_UTI "com.apple.dt.runtime.${PLIST_INFO_NAME}")
|
||||||
|
set(PLIST_INFO_VERSION "${project_version}")
|
||||||
|
set(PLIST_INFO_BUILD_VERSION "${project_version}")
|
||||||
|
|
||||||
|
set(PLIST_INFO_PLIST_OUT "${PLIST_INFO_PLIST}")
|
||||||
|
set(PLIST_INFO_PLIST_IN "${PROJECT_SOURCE_DIR}/${PLIST_INFO_PLIST}.in")
|
||||||
|
|
||||||
|
if(APPLE)
|
||||||
|
target_link_options(${target} PRIVATE
|
||||||
|
"SHELL:-Xlinker -sectcreate -Xlinker __TEXT -Xlinker __info_plist -Xlinker ${CMAKE_CURRENT_BINARY_DIR}/${PLIST_INFO_PLIST_OUT}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
configure_file(
|
||||||
|
"${PLIST_INFO_PLIST_IN}"
|
||||||
|
"${PLIST_INFO_PLIST_OUT}"
|
||||||
|
@ONLY
|
||||||
|
NEWLINE_STYLE UNIX)
|
||||||
|
|
||||||
|
set_property(TARGET ${target} APPEND PROPERTY LINK_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${PLIST_INFO_PLIST_OUT}")
|
||||||
|
|
||||||
|
# If Application Extensions are enabled, pass the linker flag marking
|
||||||
|
# the dylib as safe.
|
||||||
|
if (CXX_SUPPORTS_FAPPLICATION_EXTENSION AND (NOT DISABLE_APPLICATION_EXTENSION))
|
||||||
|
list(APPEND link_flags "-Wl,-application_extension")
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
@@ -347,6 +347,9 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/Swift.swiftmodule"
|
|||||||
emit_swift_interface(swiftCore)
|
emit_swift_interface(swiftCore)
|
||||||
install_swift_interface(swiftCore)
|
install_swift_interface(swiftCore)
|
||||||
|
|
||||||
|
# Configure plist creation for Darwin platforms.
|
||||||
|
generate_plist("${CMAKE_PROJECT_NAME}" "${CMAKE_PROJECT_VERSION}" swiftCore)
|
||||||
|
|
||||||
include("${SwiftCore_VENDOR_MODULE_DIR}/swiftCore.cmake" OPTIONAL)
|
include("${SwiftCore_VENDOR_MODULE_DIR}/swiftCore.cmake" OPTIONAL)
|
||||||
|
|
||||||
# TODO: Embedded SwiftCore builds
|
# TODO: Embedded SwiftCore builds
|
||||||
|
|||||||
@@ -59,6 +59,18 @@ copy_library_sources(include "" "Core")
|
|||||||
# Copy magic linker symbols
|
# Copy magic linker symbols
|
||||||
copy_library_sources("linker-support" "" "Core")
|
copy_library_sources("linker-support" "" "Core")
|
||||||
|
|
||||||
|
# Copy Plist
|
||||||
|
message(STATUS "plist[${StdlibSources}/Info.plist.in] -> Core/Info.plist.in")
|
||||||
|
file(COPY_FILE
|
||||||
|
"${StdlibSources}/Info.plist.in" # From
|
||||||
|
"${CMAKE_CURRENT_LIST_DIR}/Core/Info.plist.in" # To
|
||||||
|
RESULT _output
|
||||||
|
ONLY_IF_DIFFERENT)
|
||||||
|
if(_output)
|
||||||
|
message(SEND_ERROR
|
||||||
|
"Copy ${StdlibSources}/Info.plist.in] -> Core/Info.plist.in Failed: ${_output}")
|
||||||
|
endif()
|
||||||
|
|
||||||
set(CoreLibs
|
set(CoreLibs
|
||||||
LLVMSupport
|
LLVMSupport
|
||||||
SwiftShims
|
SwiftShims
|
||||||
|
|||||||
Reference in New Issue
Block a user