forked from apple/swift-corelibs-foundation
-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
185 lines (180 loc) · 4.56 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
if(NOT CMAKE_SYSTEM_NAME STREQUAL WASI)
list(APPEND FOUNDATION_WASI_UNAVAILABLE_SOURCES
Bundle.swift
FileManager+POSIX.swift
FileManager+Win32.swift
FileManager+XDG.swift
Host.swift
Notification.swift
NotificationQueue.swift
NSKeyedArchiver.swift
NSKeyedArchiverHelpers.swift
NSKeyedCoderOldStyleArray.swift
NSKeyedUnarchiver.swift
NSNotification.swift
NSSpecialValue.swift
Port.swift
PortMessage.swift
Process.swift
ProcessInfo.swift
PropertyListEncoder.swift
RunLoop.swift
Stream.swift
Thread.swift
Timer.swift
UserDefaults.swift)
endif()
add_library(Foundation
AffineTransform.swift
Array.swift
Boxing.swift
Bridging.swift
ByteCountFormatter.swift
Calendar.swift
CGFloat.swift
CharacterSet.swift
Codable.swift
Collections+DataProtocol.swift
ContiguousBytes.swift
Data.swift
DataProtocol.swift
Date.swift
DateComponents.swift
DateComponentsFormatter.swift
DateFormatter.swift
DateInterval.swift
DateIntervalFormatter.swift
Decimal.swift
Dictionary.swift
DispatchData+DataProtocol.swift
EnergyFormatter.swift
ExtraStringAPIs.swift
FileHandle.swift
FileManager.swift
Formatter.swift
FoundationErrors.swift
IndexPath.swift
IndexSet.swift
ISO8601DateFormatter.swift
JSONEncoder.swift
JSONSerialization.swift
LengthFormatter.swift
Locale.swift
MassFormatter.swift
Measurement.swift
MeasurementFormatter.swift
NSArray.swift
NSAttributedString.swift
NSCache.swift
NSCalendar.swift
NSCFArray.swift
NSCFBoolean.swift
NSCFCharacterSet.swift
NSCFDictionary.swift
NSCFSet.swift
NSCFString.swift
NSCharacterSet.swift
NSCoder.swift
NSComparisonPredicate.swift
NSCompoundPredicate.swift
NSConcreteValue.swift
NSData+DataProtocol.swift
NSData.swift
NSDate.swift
NSDecimalNumber.swift
NSDictionary.swift
NSEnumerator.swift
NSError.swift
NSExpression.swift
NSGeometry.swift
NSIndexPath.swift
NSIndexSet.swift
NSLocale.swift
NSLock.swift
NSLog.swift
NSMeasurement.swift
NSNull.swift
NSNumber.swift
NSObjCRuntime.swift
NSObject.swift
NSOrderedSet.swift
NSPathUtilities.swift
NSPersonNameComponents.swift
NSPlatform.swift
NSPredicate.swift
NSRange.swift
NSRegularExpression.swift
NSSet.swift
NSSortDescriptor.swift
NSString.swift
NSStringAPI.swift
NSSwiftRuntime.swift
NSTextCheckingResult.swift
NSTimeZone.swift
NSURL.swift
NSURLError.swift
NSUUID.swift
NSValue.swift
NumberFormatter.swift
Operation.swift
PersonNameComponents.swift
PersonNameComponentsFormatter.swift
Pointers+DataProtocol.swift
Progress.swift
ProgressFraction.swift
PropertyListSerialization.swift
ReferenceConvertible.swift
Scanner.swift
ScannerAPI.swift
Set.swift
String.swift
StringEncodings.swift
TimeZone.swift
Unit.swift
URL.swift
URLComponents.swift
UUID.swift
${FOUNDATION_WASI_UNAVAILABLE_SOURCES})
target_compile_definitions(Foundation PRIVATE
DEPLOYMENT_RUNTIME_SWIFT)
target_compile_options(Foundation PUBLIC
$<$<BOOL:${ENABLE_TESTING}>:-enable-testing>
"SHELL:-Xcc -F${CMAKE_BINARY_DIR}")
target_link_libraries(Foundation
PRIVATE
$<$<PLATFORM_ID:Windows>:CoreFoundationResources>
$<$<PLATFORM_ID:Windows>:Ole32>
$<$<PLATFORM_ID:Windows>:Shell32>
$<$<PLATFORM_ID:Windows>:pathcch>
CoreFoundation
uuid
PUBLIC
swiftDispatch)
set_target_properties(Foundation PROPERTIES
INSTALL_RPATH "$ORIGIN"
BUILD_RPATH "$<TARGET_FILE_DIR:swiftDispatch>"
Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_BINARY_DIR}/swift)
if(CMAKE_SYSTEM_NAME STREQUAL Windows)
# NOTE: workaround for CMake which doesn't link in OBJECT libraries properly
add_dependencies(Foundation CoreFoundationResources)
target_link_options(Foundation PRIVATE
$<TARGET_OBJECTS:CoreFoundationResources>)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL WASI)
target_compile_options(Foundation
PRIVATE
-sdk ${CMAKE_SYSROOT}
-target wasm32-unknown-wasi
)
endif()
set_property(GLOBAL APPEND PROPERTY Foundation_EXPORTS Foundation)
install(TARGETS Foundation
ARCHIVE DESTINATION lib/swift$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:_static>/$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>
LIBRARY DESTINATION lib/swift$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:_static>/$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>
RUNTIME DESTINATION bin)
get_swift_host_arch(swift_arch)
install(FILES
$<TARGET_PROPERTY:Foundation,Swift_MODULE_DIRECTORY>/Foundation.swiftdoc
$<TARGET_PROPERTY:Foundation,Swift_MODULE_DIRECTORY>/Foundation.swiftmodule
DESTINATION lib/swift/$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>/${swift_arch})