File tree Expand file tree Collapse file tree 4 files changed +47
-0
lines changed Expand file tree Collapse file tree 4 files changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ include(DefaultSettings)
68
68
include (EmitSwiftInterface )
69
69
include (PlatformInfo )
70
70
include (gyb )
71
+ include (Plist )
71
72
72
73
include ("${SwiftCore_VENDOR_MODULE_DIR} /Settings.cmake" OPTIONAL )
73
74
Original file line number Diff line number Diff line change
1
+ function (generate_plist project_name project_version target )
2
+ set (PLIST_INFO_PLIST "Info.plist" )
3
+ set (PLIST_INFO_NAME "${project_name} " )
4
+
5
+ # Underscores aren't permitted in the bundle identifier.
6
+ string (REPLACE "_" "" PLIST_INFO_UTI "com.apple.dt.runtime.${PLIST_INFO_NAME} " )
7
+ set (PLIST_INFO_VERSION "${project_version} " )
8
+ set (PLIST_INFO_BUILD_VERSION "${project_version} " )
9
+
10
+ set (PLIST_INFO_PLIST_OUT "${PLIST_INFO_PLIST} " )
11
+ set (PLIST_INFO_PLIST_IN "${PROJECT_SOURCE_DIR} /${PLIST_INFO_PLIST} .in" )
12
+
13
+ if (APPLE )
14
+ target_link_options (${target} PRIVATE
15
+ "SHELL:-Xlinker -sectcreate -Xlinker __TEXT -Xlinker __info_plist -Xlinker ${CMAKE_CURRENT_BINARY_DIR} /${PLIST_INFO_PLIST_OUT} " )
16
+ endif ()
17
+
18
+ configure_file (
19
+ "${PLIST_INFO_PLIST_IN} "
20
+ "${PLIST_INFO_PLIST_OUT} "
21
+ @ONLY
22
+ NEWLINE_STYLE UNIX )
23
+
24
+ set_property (TARGET ${target} APPEND PROPERTY LINK_DEPENDS "${CMAKE_CURRENT_BINARY_DIR} /${PLIST_INFO_PLIST_OUT} " )
25
+
26
+ # If Application Extensions are enabled, pass the linker flag marking
27
+ # the dylib as safe.
28
+ if (CXX_SUPPORTS_FAPPLICATION_EXTENSION AND (NOT DISABLE_APPLICATION_EXTENSION ))
29
+ list (APPEND link_flags "-Wl,-application_extension" )
30
+ endif ()
31
+ endfunction ()
Original file line number Diff line number Diff line change @@ -347,6 +347,9 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/Swift.swiftmodule"
347
347
emit_swift_interface (swiftCore )
348
348
install_swift_interface (swiftCore )
349
349
350
+ # Configure plist creation for Darwin platforms.
351
+ generate_plist ("${CMAKE_PROJECT_NAME} " "${CMAKE_PROJECT_VERSION} " swiftCore )
352
+
350
353
include ("${SwiftCore_VENDOR_MODULE_DIR} /swiftCore.cmake" OPTIONAL )
351
354
352
355
# TODO: Embedded SwiftCore builds
Original file line number Diff line number Diff line change @@ -59,6 +59,18 @@ copy_library_sources(include "" "Core")
59
59
# Copy magic linker symbols
60
60
copy_library_sources ("linker-support" "" "Core" )
61
61
62
+ # Copy Plist
63
+ message (STATUS "plist[${StdlibSources} /Info.plist.in] -> Core/Info.plist.in" )
64
+ file (COPY_FILE
65
+ "${StdlibSources} /Info.plist.in" # From
66
+ "${CMAKE_CURRENT_LIST_DIR} /Core/Info.plist.in" # To
67
+ RESULT _output
68
+ ONLY_IF_DIFFERENT )
69
+ if (_output )
70
+ message (SEND_ERROR
71
+ "Copy ${StdlibSources} /Info.plist.in] -> Core/Info.plist.in Failed: ${_output} " )
72
+ endif ()
73
+
62
74
set (CoreLibs
63
75
LLVMSupport
64
76
SwiftShims
You can’t perform that action at this time.
0 commit comments