@@ -19,7 +19,6 @@ option(FOUNDATION_PATH_TO_XCTEST_BUILD "Path to XCTest build" "")
19
19
find_package (CURL REQUIRED )
20
20
find_package (ICU COMPONENTS uc i18n REQUIRED )
21
21
find_package (LibXml2 REQUIRED )
22
- find_package (UUID REQUIRED )
23
22
24
23
include (SwiftSupport )
25
24
include (GNUInstallDirs )
@@ -35,8 +34,11 @@ ExternalProject_Add(CoreFoundation
35
34
${CMAKE_COMMAND}
36
35
CMAKE_ARGS
37
36
-DBUILD_SHARED_LIBS=NO
38
- -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
39
37
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
38
+ -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
39
+ # NOTE(compnerd) ensure that we build it as a DLL as we
40
+ # wish to re-export the symbols from Foundation
41
+ -DCMAKE_C_FLAGS=-D_USRDLL
40
42
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
41
43
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
42
44
-DCMAKE_INSTALL_LIBDIR=usr/lib
@@ -57,6 +59,27 @@ ExternalProject_Add(CoreFoundation
57
59
${CMAKE_COMMAND} -E env --unset=DESTDIR ${CMAKE_COMMAND} --build . --target install )
58
60
ExternalProject_Get_Property (CoreFoundation install_dir )
59
61
62
+ add_library (uuid
63
+ STATIC
64
+ uuid/uuid.h
65
+ uuid/uuid.c )
66
+ set_target_properties (uuid
67
+ PROPERTIES
68
+ POSITION_INDEPENDENT_CODE YES )
69
+ # Add an include directory for the CoreFoundation framework headers to satisfy
70
+ # the dependency on TargetConditionals.h
71
+ target_compile_options (uuid
72
+ PUBLIC
73
+ -I${install_dir}/System/Library/Frameworks/CoreFoundation.framework/Headers )
74
+ if (CMAKE_SYSTEM_NAME STREQUAL Windows )
75
+ target_compile_definitions (uuid
76
+ PRIVATE
77
+ _CRT_NONSTDC_NO_WARNINGS
78
+ _CRT_SECURE_NO_DEPRECATE
79
+ _CRT_SECURE_NO_WARNINGS )
80
+ endif ()
81
+ add_dependencies (uuid CoreFoundation )
82
+
60
83
set (swift_optimization_flags )
61
84
if (CMAKE_BUILD_TYPE MATCHES Release )
62
85
set (swift_optimization_flags -O )
@@ -71,18 +94,20 @@ set(libdispatch_ldflags)
71
94
if (FOUNDATION_ENABLE_LIBDISPATCH )
72
95
set (deployment_enable_libdispatch -DDEPLOYMENT_ENABLE_LIBDISPATCH )
73
96
set (libdispatch_cflags -I;${FOUNDATION_PATH_TO_LIBDISPATCH_SOURCE};-I;${FOUNDATION_PATH_TO_LIBDISPATCH_BUILD}/src/swift;-Xcc;-fblocks )
74
- set (libdispatch_ldflags -L;${FOUNDATION_PATH_TO_LIBDISPATCH_BUILD};-L;${FOUNDATION_PATH_TO_LIBDISPATCH_BUILD}/src;-ldispatch )
97
+ set (libdispatch_ldflags -L;${FOUNDATION_PATH_TO_LIBDISPATCH_BUILD};-L;${FOUNDATION_PATH_TO_LIBDISPATCH_BUILD}/src;-ldispatch;-lswiftDispatch )
75
98
if (CMAKE_SYSTEM_NAME STREQUAL Linux OR CMAKE_SYSTEM_NAME STREQUAL Android OR CMAKE_SYSTEM_NAME STREQUAL FreeBSD )
76
99
list (APPEND libdispatch_ldflags -Xlinker;-rpath;-Xlinker;${FOUNDATION_PATH_TO_LIBDISPATCH_BUILD}/src )
77
100
endif ()
78
101
endif ()
79
102
80
103
if (CMAKE_SYSTEM_NAME STREQUAL Android OR CMAKE_SYSTEM_NAME STREQUAL Linux )
81
104
set (deployment_target -DDEPLOYMENT_TARGET_LINUX )
105
+ set (Foundation_rpath_flags -Xlinker;-rpath;-Xlinker; "\\\$\$ ORIGIN" )
82
106
elseif (CMAKE_SYSTEM_NAME STREQUAL Darwin )
83
107
set (deployment_target -DDEPLOYMENT_TARGET_MACOSX )
84
108
elseif (CMAKE_SYSTEM_NAME STREQUAL FreeBSD )
85
109
set (deployment_target -DDEPLOYMENT_TARGET_FREEBSD )
110
+ set (Foundation_rpath_flags -Xlinker;-rpath;-Xlinker; "\\\$\$ ORIGIN" )
86
111
elseif (CMAKE_SYSTEM_NAME STREQUAL Windows )
87
112
set (deployment_target -DDEPLOYMENT_TARGET_WINDOWS )
88
113
endif ()
@@ -105,15 +130,19 @@ add_swift_library(Foundation
105
130
Foundation/CGFloat.swift
106
131
Foundation/CharacterSet.swift
107
132
Foundation/Codable.swift
133
+ Foundation/Collections+DataProtocol.swift
134
+ Foundation/ContiguousBytes.swift
108
135
Foundation/Data.swift
109
- Foundation/DateComponentsFormatter.swift
136
+ Foundation/DataProtocol.swift
137
+ Foundation/Date.swift
110
138
Foundation/DateComponents.swift
139
+ Foundation/DateComponentsFormatter.swift
111
140
Foundation/DateFormatter.swift
112
- Foundation/DateIntervalFormatter.swift
113
141
Foundation/DateInterval.swift
114
- Foundation/Date .swift
142
+ Foundation/DateIntervalFormatter .swift
115
143
Foundation/Decimal.swift
116
144
Foundation/Dictionary.swift
145
+ Foundation/DispatchData+DataProtocol.swift
117
146
Foundation/EnergyFormatter.swift
118
147
Foundation/ExtraStringAPIs.swift
119
148
Foundation/FileHandle.swift
@@ -122,8 +151,8 @@ add_swift_library(Foundation
122
151
Foundation/Formatter.swift
123
152
Foundation/FoundationErrors.swift
124
153
Foundation/Host.swift
125
- Foundation/HTTPCookieStorage.swift
126
154
Foundation/HTTPCookie.swift
155
+ Foundation/HTTPCookieStorage.swift
127
156
Foundation/IndexPath.swift
128
157
Foundation/IndexSet.swift
129
158
Foundation/ISO8601DateFormatter.swift
@@ -132,10 +161,10 @@ add_swift_library(Foundation
132
161
Foundation/LengthFormatter.swift
133
162
Foundation/Locale.swift
134
163
Foundation/MassFormatter.swift
135
- Foundation/MeasurementFormatter.swift
136
164
Foundation/Measurement.swift
137
- Foundation/NotificationQueue .swift
165
+ Foundation/MeasurementFormatter .swift
138
166
Foundation/Notification.swift
167
+ Foundation/NotificationQueue.swift
139
168
Foundation/NSArray.swift
140
169
Foundation/NSAttributedString.swift
141
170
Foundation/NSCache.swift
@@ -151,6 +180,7 @@ add_swift_library(Foundation
151
180
Foundation/NSComparisonPredicate.swift
152
181
Foundation/NSCompoundPredicate.swift
153
182
Foundation/NSConcreteValue.swift
183
+ Foundation/NSData+DataProtocol.swift
154
184
Foundation/NSData.swift
155
185
Foundation/NSDate.swift
156
186
Foundation/NSDecimalNumber.swift
@@ -161,8 +191,8 @@ add_swift_library(Foundation
161
191
Foundation/NSGeometry.swift
162
192
Foundation/NSIndexPath.swift
163
193
Foundation/NSIndexSet.swift
164
- Foundation/NSKeyedArchiverHelpers.swift
165
194
Foundation/NSKeyedArchiver.swift
195
+ Foundation/NSKeyedArchiverHelpers.swift
166
196
Foundation/NSKeyedCoderOldStyleArray.swift
167
197
Foundation/NSKeyedUnarchiver.swift
168
198
Foundation/NSLocale.swift
@@ -184,68 +214,70 @@ add_swift_library(Foundation
184
214
Foundation/NSSet.swift
185
215
Foundation/NSSortDescriptor.swift
186
216
Foundation/NSSpecialValue.swift
187
- Foundation/NSStringAPI.swift
188
217
Foundation/NSString.swift
218
+ Foundation/NSStringAPI.swift
189
219
Foundation/NSSwiftRuntime.swift
190
220
Foundation/NSTextCheckingResult.swift
191
221
Foundation/NSTimeZone.swift
222
+ Foundation/NSURL.swift
192
223
Foundation/NSURLError.swift
193
224
Foundation/NSURLRequest.swift
194
- Foundation/NSURL.swift
195
225
Foundation/NSUUID.swift
196
226
Foundation/NSValue.swift
197
227
Foundation/NumberFormatter.swift
198
228
Foundation/Operation.swift
199
- Foundation/PersonNameComponentsFormatter.swift
200
229
Foundation/PersonNameComponents.swift
201
- Foundation/PortMessage.swift
230
+ Foundation/PersonNameComponentsFormatter.swift
231
+ Foundation/Pointers+DataProtocol.swift
202
232
Foundation/Port.swift
203
- Foundation/ProcessInfo .swift
233
+ Foundation/PortMessage .swift
204
234
Foundation/Process.swift
205
- Foundation/ProgressFraction .swift
235
+ Foundation/ProcessInfo .swift
206
236
Foundation/Progress.swift
237
+ Foundation/ProgressFraction.swift
238
+ Foundation/PropertyListEncoder.swift
207
239
Foundation/PropertyListSerialization.swift
208
240
Foundation/ReferenceConvertible.swift
209
241
Foundation/RunLoop.swift
210
242
Foundation/Scanner.swift
211
243
Foundation/Set.swift
212
244
Foundation/Stream.swift
213
- Foundation/StringEncodings.swift
214
245
Foundation/String.swift
246
+ Foundation/StringEncodings.swift
215
247
Foundation/Thread.swift
216
248
Foundation/Timer.swift
217
249
Foundation/TimeZone.swift
218
250
Foundation/Unit.swift
251
+ Foundation/URL.swift
219
252
Foundation/URLAuthenticationChallenge.swift
220
253
Foundation/URLCache.swift
221
254
Foundation/URLComponents.swift
222
- Foundation/URLCredentialStorage.swift
223
255
Foundation/URLCredential.swift
256
+ Foundation/URLCredentialStorage.swift
224
257
Foundation/URLProtectionSpace.swift
225
258
Foundation/URLProtocol.swift
226
259
Foundation/URLRequest.swift
227
260
Foundation/URLResponse.swift
228
261
Foundation/URLSession/BodySource.swift
229
262
Foundation/URLSession/Configuration.swift
230
- Foundation/URLSession/Message.swift
231
263
Foundation/URLSession/http/HTTPMessage.swift
232
264
Foundation/URLSession/http/HTTPURLProtocol.swift
233
265
Foundation/URLSession/libcurl/EasyHandle.swift
234
266
Foundation/URLSession/libcurl/libcurlHelpers.swift
235
267
Foundation/URLSession/libcurl/MultiHandle.swift
268
+ Foundation/URLSession/Message.swift
236
269
Foundation/URLSession/NativeProtocol.swift
237
270
Foundation/URLSession/TaskRegistry.swift
238
271
Foundation/URLSession/TransferState.swift
272
+ Foundation/URLSession/URLSession.swift
239
273
Foundation/URLSession/URLSessionConfiguration.swift
240
274
Foundation/URLSession/URLSessionDelegate.swift
241
- Foundation/URLSession/URLSession.swift
242
275
Foundation/URLSession/URLSessionTask.swift
243
- Foundation/URL.swift
244
276
Foundation/UserDefaults.swift
245
277
Foundation/UUID.swift
246
278
Foundation/XMLDocument.swift
247
- Foundation/XMLDTDNode.swift
248
279
Foundation/XMLDTD.swift
280
+ Foundation/XMLDTDNode.swift
249
281
Foundation/XMLElement.swift
250
282
Foundation/XMLNode.swift
251
283
Foundation/XMLParser.swift
@@ -255,15 +287,17 @@ add_swift_library(Foundation
255
287
${deployment_target}
256
288
${deployment_enable_libdispatch}
257
289
-F${install_dir}/System/Library/Frameworks
290
+ -D_DLL
258
291
LINK_FLAGS
259
292
-L${install_dir}/usr/lib
260
293
-lCoreFoundation
261
294
${CURL_LIBRARIES}
262
295
${ICU_UC_LIBRARY} ${ICU_I18N_LIBRARY}
263
296
${LIBXML2_LIBRARIES}
264
297
${libdispatch_ldflags}
265
- ${uuid_LIBRARIES}
266
- -Xlinker;-rpath;-Xlinker; "\\\$\$ ORIGIN"
298
+ -L${CMAKE_CURRENT_BINARY_DIR}
299
+ -luuid
300
+ ${Foundation_rpath_flags}
267
301
SWIFT_FLAGS
268
302
-DDEPLOYMENT_RUNTIME_SWIFT
269
303
${deployment_enable_libdispatch}
@@ -278,11 +312,12 @@ if(NOT BUILD_SHARED_LIBS)
278
312
set (Foundation_INTERFACE_LIBRARIES
279
313
-L${install_dir}/usr/lib
280
314
-lCoreFoundation
315
+ -L${CMAKE_CURRENT_BINARY_DIR}
316
+ -luuid
281
317
${CURL_LIBRARIES}
282
318
${ICU_UC_LIBRARY}
283
319
${ICU_I18N_LIBRARY}
284
- ${LIBXML2_LIBRARIES}
285
- ${uuid_LIBRARIES} )
320
+ ${LIBXML2_LIBRARIES} )
286
321
endif ()
287
322
288
323
add_swift_executable (plutil
@@ -293,8 +328,8 @@ add_swift_executable(plutil
293
328
${deployment_enable_libdispatch}
294
329
-F${install_dir}/System/Library/Frameworks
295
330
LINK_FLAGS
296
- -L${CMAKE_CURRENT_BINARY_DIR}
297
331
${libdispatch_ldflags}
332
+ -L${CMAKE_CURRENT_BINARY_DIR}
298
333
-lFoundation
299
334
${Foundation_INTERFACE_LIBRARIES}
300
335
-Xlinker;-rpath;-Xlinker; "\\\$\$ ORIGIN/../lib/swift/${swift_os} "
@@ -307,6 +342,7 @@ add_swift_executable(plutil
307
342
${swift_enable_testing}
308
343
${swift_optimization_flags}
309
344
DEPENDS
345
+ uuid
310
346
Foundation
311
347
CoreFoundation )
312
348
@@ -328,6 +364,7 @@ if(ENABLE_TESTING)
328
364
-I;${ICU_INCLUDE_DIR}
329
365
${libdispatch_cflags}
330
366
DEPENDS
367
+ uuid
331
368
Foundation
332
369
CoreFoundation )
333
370
@@ -359,6 +396,7 @@ if(ENABLE_TESTING)
359
396
TestFoundation/TestIndexSet.swift
360
397
TestFoundation/TestISO8601DateFormatter.swift
361
398
TestFoundation/TestJSONEncoder.swift
399
+ TestFoundation/TestPropertyListEncoder.swift
362
400
TestFoundation/TestJSONSerialization.swift
363
401
TestFoundation/TestLengthFormatter.swift
364
402
TestFoundation/TestMassFormatter.swift
@@ -418,6 +456,7 @@ if(ENABLE_TESTING)
418
456
TestFoundation/TestURL.swift
419
457
TestFoundation/TestUserDefaults.swift
420
458
TestFoundation/TestUtils.swift
459
+ TestFoundation/TestUUID.swift
421
460
TestFoundation/TestXMLDocument.swift
422
461
TestFoundation/TestXMLParser.swift
423
462
CFLAGS
0 commit comments