Skip to content

Commit 4518009

Browse files
committed
build: add some workarounds for Windows
SR-9138 has not yet been resolved, so work around the spew. Additionally, we do not yet have /MT and /MD supported in the frontend, so manually control that (as is done in the swift repo).
1 parent e2dd087 commit 4518009

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

CMakeLists.txt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,21 +108,28 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
108108
elseif(CMAKE_SYSTEM_NAME STREQUAL Windows)
109109
set(deployment_target -DDEPLOYMENT_TARGET_WINDOWS)
110110
# FIXME(compnerd) these are not all CoreFoundation dependencies, some of them
111-
# are Foundation's. We should split them up accordingly.
111+
# are Foundation's and others are libcurl's. We should split them up
112+
# accordingly.
112113
set(CoreFoundation_INTERFACE_LIBRARIES
113114
-lAdvAPI32
115+
-lCrypt32
114116
-lDbgHelp
115117
-lShell32
116118
-lOle32
117119
-lRpcRT4
118120
-lSecur32
119121
-lShLwApi
120122
-lUser32
123+
-lWldap32
121124
-lWS2_32
122125
-liphlpapi
126+
-lmincore
127+
-lnormaliz
123128
-lpathcch
124129
-lucrt
125130
-lshell32)
131+
set(WORKAROUND_SR9138 -Xlinker;-ignore:4217)
132+
set(WORKAROUND_MTMD -Xlinker;-nodefaultlib:libcmt)
126133
endif()
127134

128135
add_swift_library(Foundation
@@ -313,6 +320,8 @@ add_swift_library(Foundation
313320
-luuid
314321
${Foundation_RPATH}
315322
${CoreFoundation_INTERFACE_LIBRARIES}
323+
${WORKAROUND_SR9138}
324+
${WORKAROUND_MTMD}
316325
SWIFT_FLAGS
317326
-DDEPLOYMENT_RUNTIME_SWIFT
318327
${deployment_enable_libdispatch}
@@ -347,7 +356,8 @@ add_swift_executable(plutil
347356
-L${CMAKE_CURRENT_BINARY_DIR}
348357
-lFoundation
349358
${Foundation_INTERFACE_LIBRARIES}
350-
-Xlinker;-rpath;-Xlinker;"\\\$\$ORIGIN/../lib/swift/${swift_os}"
359+
${Foundation_RPATH}
360+
${WORKAROUND_MTMD}
351361
SWIFT_FLAGS
352362
-DDEPLOYMENT_RUNTIME_SWIFT
353363
${deployment_enable_libdispatch}

CoreFoundation/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,9 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL Windows)
339339
PRIVATE
340340
-D_WINDLL)
341341
endif()
342+
target_compile_definitions(CoreFoundation
343+
PRIVATE
344+
-DCURL_STATICLIB)
342345
endif()
343346
target_compile_definitions(CoreFoundation
344347
PRIVATE

0 commit comments

Comments
 (0)