Skip to content

Commit 3ab18f9

Browse files
committed
WIP/Foundation: port to Windows
Unformalised changes to port Foundation to Windows
1 parent 1a81780 commit 3ab18f9

File tree

5 files changed

+741
-41
lines changed

5 files changed

+741
-41
lines changed

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
110110
set(Foundation_rpath_flags -Xlinker;-rpath;-Xlinker;"\\\$\$ORIGIN")
111111
elseif(CMAKE_SYSTEM_NAME STREQUAL Windows)
112112
set(deployment_target -DDEPLOYMENT_TARGET_WINDOWS)
113+
set(CoreFoundation_INTERFACE_LIBRARIES -lWS2_32 -lUser32 -lmsvcrt -ladvapi32 -lshell32 -lrpcrt4 -lsecur32 -lPathcch -lOle32 -lCrypt32 -lwldap32 -lNormaliz -lDbgHelp -lIphlpapi)
113114
endif()
114115

115116
add_swift_library(Foundation
@@ -298,13 +299,15 @@ add_swift_library(Foundation
298299
-L${CMAKE_CURRENT_BINARY_DIR}
299300
-luuid
300301
${Foundation_rpath_flags}
302+
${CoreFoundation_INTERFACE_LIBRARIES}
301303
SWIFT_FLAGS
302304
-DDEPLOYMENT_RUNTIME_SWIFT
303305
${deployment_enable_libdispatch}
304306
-I;${ICU_INCLUDE_DIR}
305307
${libdispatch_cflags}
306308
${swift_enable_testing}
307309
${swift_optimization_flags}
310+
-Xcc -D_DLL
308311
DEPENDS
309312
CoreFoundation)
310313

CoreFoundation/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,12 @@ if(CF_DEPLOYMENT_SWIFT)
353353
target_compile_definitions(CoreFoundation
354354
PRIVATE
355355
-DDEPLOYMENT_RUNTIME_SWIFT)
356+
if(CMAKE_SYSTEM_NAME STREQUAL Windows)
357+
target_compile_definitions(CoreFoundation
358+
PRIVATE
359+
-D_DLL
360+
-DCURL_STATICLIB)
361+
endif()
356362
else()
357363
target_compile_definitions(CoreFoundation
358364
PRIVATE

Foundation/FileHandle.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ open class FileHandle : NSObject, NSSecureCoding {
2727
#if os(Windows)
2828
private var _handle: HANDLE
2929

30+
internal var handle: HANDLE {
31+
return _handle
32+
}
33+
3034
@available(Windows, unavailable, message: "Cannot perform non-owning handle to fd conversion")
3135
open var fileDescriptor: Int32 {
3236
NSUnsupported()

0 commit comments

Comments
 (0)