Skip to content

Commit 582acb6

Browse files
authored
Merge branch 'master' into nsorderedset-revisited
2 parents e42b83f + 988e631 commit 582acb6

File tree

113 files changed

+9087
-3882
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+9087
-3882
lines changed

CMakeLists.txt

Lines changed: 66 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ option(FOUNDATION_PATH_TO_XCTEST_BUILD "Path to XCTest build" "")
1919
find_package(CURL REQUIRED)
2020
find_package(ICU COMPONENTS uc i18n REQUIRED)
2121
find_package(LibXml2 REQUIRED)
22-
find_package(UUID REQUIRED)
2322

2423
include(SwiftSupport)
2524
include(GNUInstallDirs)
@@ -35,8 +34,11 @@ ExternalProject_Add(CoreFoundation
3534
${CMAKE_COMMAND}
3635
CMAKE_ARGS
3736
-DBUILD_SHARED_LIBS=NO
38-
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
3937
-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
4042
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
4143
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
4244
-DCMAKE_INSTALL_LIBDIR=usr/lib
@@ -57,6 +59,27 @@ ExternalProject_Add(CoreFoundation
5759
${CMAKE_COMMAND} -E env --unset=DESTDIR ${CMAKE_COMMAND} --build . --target install)
5860
ExternalProject_Get_Property(CoreFoundation install_dir)
5961

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+
6083
set(swift_optimization_flags)
6184
if(CMAKE_BUILD_TYPE MATCHES Release)
6285
set(swift_optimization_flags -O)
@@ -71,18 +94,20 @@ set(libdispatch_ldflags)
7194
if(FOUNDATION_ENABLE_LIBDISPATCH)
7295
set(deployment_enable_libdispatch -DDEPLOYMENT_ENABLE_LIBDISPATCH)
7396
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)
7598
if(CMAKE_SYSTEM_NAME STREQUAL Linux OR CMAKE_SYSTEM_NAME STREQUAL Android OR CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
7699
list(APPEND libdispatch_ldflags -Xlinker;-rpath;-Xlinker;${FOUNDATION_PATH_TO_LIBDISPATCH_BUILD}/src)
77100
endif()
78101
endif()
79102

80103
if(CMAKE_SYSTEM_NAME STREQUAL Android OR CMAKE_SYSTEM_NAME STREQUAL Linux)
81104
set(deployment_target -DDEPLOYMENT_TARGET_LINUX)
105+
set(Foundation_rpath_flags -Xlinker;-rpath;-Xlinker;"\\\$\$ORIGIN")
82106
elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
83107
set(deployment_target -DDEPLOYMENT_TARGET_MACOSX)
84108
elseif(CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
85109
set(deployment_target -DDEPLOYMENT_TARGET_FREEBSD)
110+
set(Foundation_rpath_flags -Xlinker;-rpath;-Xlinker;"\\\$\$ORIGIN")
86111
elseif(CMAKE_SYSTEM_NAME STREQUAL Windows)
87112
set(deployment_target -DDEPLOYMENT_TARGET_WINDOWS)
88113
endif()
@@ -105,15 +130,19 @@ add_swift_library(Foundation
105130
Foundation/CGFloat.swift
106131
Foundation/CharacterSet.swift
107132
Foundation/Codable.swift
133+
Foundation/Collections+DataProtocol.swift
134+
Foundation/ContiguousBytes.swift
108135
Foundation/Data.swift
109-
Foundation/DateComponentsFormatter.swift
136+
Foundation/DataProtocol.swift
137+
Foundation/Date.swift
110138
Foundation/DateComponents.swift
139+
Foundation/DateComponentsFormatter.swift
111140
Foundation/DateFormatter.swift
112-
Foundation/DateIntervalFormatter.swift
113141
Foundation/DateInterval.swift
114-
Foundation/Date.swift
142+
Foundation/DateIntervalFormatter.swift
115143
Foundation/Decimal.swift
116144
Foundation/Dictionary.swift
145+
Foundation/DispatchData+DataProtocol.swift
117146
Foundation/EnergyFormatter.swift
118147
Foundation/ExtraStringAPIs.swift
119148
Foundation/FileHandle.swift
@@ -122,8 +151,8 @@ add_swift_library(Foundation
122151
Foundation/Formatter.swift
123152
Foundation/FoundationErrors.swift
124153
Foundation/Host.swift
125-
Foundation/HTTPCookieStorage.swift
126154
Foundation/HTTPCookie.swift
155+
Foundation/HTTPCookieStorage.swift
127156
Foundation/IndexPath.swift
128157
Foundation/IndexSet.swift
129158
Foundation/ISO8601DateFormatter.swift
@@ -132,10 +161,10 @@ add_swift_library(Foundation
132161
Foundation/LengthFormatter.swift
133162
Foundation/Locale.swift
134163
Foundation/MassFormatter.swift
135-
Foundation/MeasurementFormatter.swift
136164
Foundation/Measurement.swift
137-
Foundation/NotificationQueue.swift
165+
Foundation/MeasurementFormatter.swift
138166
Foundation/Notification.swift
167+
Foundation/NotificationQueue.swift
139168
Foundation/NSArray.swift
140169
Foundation/NSAttributedString.swift
141170
Foundation/NSCache.swift
@@ -151,6 +180,7 @@ add_swift_library(Foundation
151180
Foundation/NSComparisonPredicate.swift
152181
Foundation/NSCompoundPredicate.swift
153182
Foundation/NSConcreteValue.swift
183+
Foundation/NSData+DataProtocol.swift
154184
Foundation/NSData.swift
155185
Foundation/NSDate.swift
156186
Foundation/NSDecimalNumber.swift
@@ -161,8 +191,8 @@ add_swift_library(Foundation
161191
Foundation/NSGeometry.swift
162192
Foundation/NSIndexPath.swift
163193
Foundation/NSIndexSet.swift
164-
Foundation/NSKeyedArchiverHelpers.swift
165194
Foundation/NSKeyedArchiver.swift
195+
Foundation/NSKeyedArchiverHelpers.swift
166196
Foundation/NSKeyedCoderOldStyleArray.swift
167197
Foundation/NSKeyedUnarchiver.swift
168198
Foundation/NSLocale.swift
@@ -184,68 +214,70 @@ add_swift_library(Foundation
184214
Foundation/NSSet.swift
185215
Foundation/NSSortDescriptor.swift
186216
Foundation/NSSpecialValue.swift
187-
Foundation/NSStringAPI.swift
188217
Foundation/NSString.swift
218+
Foundation/NSStringAPI.swift
189219
Foundation/NSSwiftRuntime.swift
190220
Foundation/NSTextCheckingResult.swift
191221
Foundation/NSTimeZone.swift
222+
Foundation/NSURL.swift
192223
Foundation/NSURLError.swift
193224
Foundation/NSURLRequest.swift
194-
Foundation/NSURL.swift
195225
Foundation/NSUUID.swift
196226
Foundation/NSValue.swift
197227
Foundation/NumberFormatter.swift
198228
Foundation/Operation.swift
199-
Foundation/PersonNameComponentsFormatter.swift
200229
Foundation/PersonNameComponents.swift
201-
Foundation/PortMessage.swift
230+
Foundation/PersonNameComponentsFormatter.swift
231+
Foundation/Pointers+DataProtocol.swift
202232
Foundation/Port.swift
203-
Foundation/ProcessInfo.swift
233+
Foundation/PortMessage.swift
204234
Foundation/Process.swift
205-
Foundation/ProgressFraction.swift
235+
Foundation/ProcessInfo.swift
206236
Foundation/Progress.swift
237+
Foundation/ProgressFraction.swift
238+
Foundation/PropertyListEncoder.swift
207239
Foundation/PropertyListSerialization.swift
208240
Foundation/ReferenceConvertible.swift
209241
Foundation/RunLoop.swift
210242
Foundation/Scanner.swift
211243
Foundation/Set.swift
212244
Foundation/Stream.swift
213-
Foundation/StringEncodings.swift
214245
Foundation/String.swift
246+
Foundation/StringEncodings.swift
215247
Foundation/Thread.swift
216248
Foundation/Timer.swift
217249
Foundation/TimeZone.swift
218250
Foundation/Unit.swift
251+
Foundation/URL.swift
219252
Foundation/URLAuthenticationChallenge.swift
220253
Foundation/URLCache.swift
221254
Foundation/URLComponents.swift
222-
Foundation/URLCredentialStorage.swift
223255
Foundation/URLCredential.swift
256+
Foundation/URLCredentialStorage.swift
224257
Foundation/URLProtectionSpace.swift
225258
Foundation/URLProtocol.swift
226259
Foundation/URLRequest.swift
227260
Foundation/URLResponse.swift
228261
Foundation/URLSession/BodySource.swift
229262
Foundation/URLSession/Configuration.swift
230-
Foundation/URLSession/Message.swift
231263
Foundation/URLSession/http/HTTPMessage.swift
232264
Foundation/URLSession/http/HTTPURLProtocol.swift
233265
Foundation/URLSession/libcurl/EasyHandle.swift
234266
Foundation/URLSession/libcurl/libcurlHelpers.swift
235267
Foundation/URLSession/libcurl/MultiHandle.swift
268+
Foundation/URLSession/Message.swift
236269
Foundation/URLSession/NativeProtocol.swift
237270
Foundation/URLSession/TaskRegistry.swift
238271
Foundation/URLSession/TransferState.swift
272+
Foundation/URLSession/URLSession.swift
239273
Foundation/URLSession/URLSessionConfiguration.swift
240274
Foundation/URLSession/URLSessionDelegate.swift
241-
Foundation/URLSession/URLSession.swift
242275
Foundation/URLSession/URLSessionTask.swift
243-
Foundation/URL.swift
244276
Foundation/UserDefaults.swift
245277
Foundation/UUID.swift
246278
Foundation/XMLDocument.swift
247-
Foundation/XMLDTDNode.swift
248279
Foundation/XMLDTD.swift
280+
Foundation/XMLDTDNode.swift
249281
Foundation/XMLElement.swift
250282
Foundation/XMLNode.swift
251283
Foundation/XMLParser.swift
@@ -255,15 +287,17 @@ add_swift_library(Foundation
255287
${deployment_target}
256288
${deployment_enable_libdispatch}
257289
-F${install_dir}/System/Library/Frameworks
290+
-D_DLL
258291
LINK_FLAGS
259292
-L${install_dir}/usr/lib
260293
-lCoreFoundation
261294
${CURL_LIBRARIES}
262295
${ICU_UC_LIBRARY} ${ICU_I18N_LIBRARY}
263296
${LIBXML2_LIBRARIES}
264297
${libdispatch_ldflags}
265-
${uuid_LIBRARIES}
266-
-Xlinker;-rpath;-Xlinker;"\\\$\$ORIGIN"
298+
-L${CMAKE_CURRENT_BINARY_DIR}
299+
-luuid
300+
${Foundation_rpath_flags}
267301
SWIFT_FLAGS
268302
-DDEPLOYMENT_RUNTIME_SWIFT
269303
${deployment_enable_libdispatch}
@@ -278,11 +312,12 @@ if(NOT BUILD_SHARED_LIBS)
278312
set(Foundation_INTERFACE_LIBRARIES
279313
-L${install_dir}/usr/lib
280314
-lCoreFoundation
315+
-L${CMAKE_CURRENT_BINARY_DIR}
316+
-luuid
281317
${CURL_LIBRARIES}
282318
${ICU_UC_LIBRARY}
283319
${ICU_I18N_LIBRARY}
284-
${LIBXML2_LIBRARIES}
285-
${uuid_LIBRARIES})
320+
${LIBXML2_LIBRARIES})
286321
endif()
287322

288323
add_swift_executable(plutil
@@ -293,8 +328,8 @@ add_swift_executable(plutil
293328
${deployment_enable_libdispatch}
294329
-F${install_dir}/System/Library/Frameworks
295330
LINK_FLAGS
296-
-L${CMAKE_CURRENT_BINARY_DIR}
297331
${libdispatch_ldflags}
332+
-L${CMAKE_CURRENT_BINARY_DIR}
298333
-lFoundation
299334
${Foundation_INTERFACE_LIBRARIES}
300335
-Xlinker;-rpath;-Xlinker;"\\\$\$ORIGIN/../lib/swift/${swift_os}"
@@ -307,6 +342,7 @@ add_swift_executable(plutil
307342
${swift_enable_testing}
308343
${swift_optimization_flags}
309344
DEPENDS
345+
uuid
310346
Foundation
311347
CoreFoundation)
312348

@@ -328,6 +364,7 @@ if(ENABLE_TESTING)
328364
-I;${ICU_INCLUDE_DIR}
329365
${libdispatch_cflags}
330366
DEPENDS
367+
uuid
331368
Foundation
332369
CoreFoundation)
333370

@@ -359,6 +396,7 @@ if(ENABLE_TESTING)
359396
TestFoundation/TestIndexSet.swift
360397
TestFoundation/TestISO8601DateFormatter.swift
361398
TestFoundation/TestJSONEncoder.swift
399+
TestFoundation/TestPropertyListEncoder.swift
362400
TestFoundation/TestJSONSerialization.swift
363401
TestFoundation/TestLengthFormatter.swift
364402
TestFoundation/TestMassFormatter.swift
@@ -418,6 +456,7 @@ if(ENABLE_TESTING)
418456
TestFoundation/TestURL.swift
419457
TestFoundation/TestUserDefaults.swift
420458
TestFoundation/TestUtils.swift
459+
TestFoundation/TestUUID.swift
421460
TestFoundation/TestXMLDocument.swift
422461
TestFoundation/TestXMLParser.swift
423462
CFLAGS

CoreFoundation/Base.subproj/CFBase.h

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -127,16 +127,20 @@
127127
#endif
128128

129129
#if TARGET_OS_WIN32
130-
#if !defined(CF_EXPORT)
131-
#if defined(CF_BUILDING_CF) && defined(__cplusplus)
132-
#define CF_EXPORT extern "C" __declspec(dllexport)
133-
#elif defined(CF_BUILDING_CF) && !defined(__cplusplus)
134-
#define CF_EXPORT extern __declspec(dllexport)
135-
#elif defined(__cplusplus)
136-
#define CF_EXPORT extern "C" __declspec(dllimport)
130+
#if defined(__cplusplus)
131+
#define _CF_EXTERN extern "C"
132+
#else
133+
#define _CF_EXTERN extern
134+
#endif
135+
136+
#if defined(_USRDLL)
137+
#if defined(CoreFoundation_EXPORTS) || defined(CF_BUILDING_CF)
138+
#define CF_EXPORT _CF_EXTERN __declspec(dllexport)
137139
#else
138-
#define CF_EXPORT extern __declspec(dllimport)
140+
#define CF_EXPORT _CF_EXTERN __declspec(dllimport)
139141
#endif
142+
#else
143+
#define CF_EXPORT _CF_EXTERN
140144
#endif
141145
#else
142146
#define CF_EXPORT extern

0 commit comments

Comments
 (0)