@@ -15,6 +15,9 @@ function(_report_sdk prefix)
15
15
message (STATUS " Swift Standard Library Path: ${SWIFT_SDK_${prefix} _LIB_SUBDIR}" )
16
16
message (STATUS " Threading Package: ${SWIFT_SDK_${prefix} _THREADING_PACKAGE}" )
17
17
18
+ message (STATUS " Static linking supported: ${SWIFT_SDK_${prefix} _STATIC_LINKING_SUPPORTED}" )
19
+ message (STATUS " Static link only: ${SWIFT_SDK_${prefix} _STATIC_ONLY}" )
20
+
18
21
if ("${prefix} " STREQUAL "WINDOWS" )
19
22
message (STATUS " UCRT Version: ${UCRTVersion} " )
20
23
message (STATUS " UCRT SDK Path: ${UniversalCRTSdkDir} " )
@@ -148,20 +151,23 @@ endfunction()
148
151
# This macro attempts to configure a given SDK. When successful, it
149
152
# defines a number of variables:
150
153
#
151
- # SWIFT_SDK_${prefix}_NAME Display name for the SDK
152
- # SWIFT_SDK_${prefix}_VERSION SDK version number (e.g., 10.9, 7.0)
153
- # SWIFT_SDK_${prefix}_BUILD_NUMBER SDK build number (e.g., 14A389a)
154
- # SWIFT_SDK_${prefix}_DEPLOYMENT_VERSION Deployment version (e.g., 10.9, 7.0)
155
- # SWIFT_SDK_${prefix}_LIB_SUBDIR Library subdir for this SDK
156
- # SWIFT_SDK_${prefix}_TRIPLE_NAME Triple name for this SDK
157
- # SWIFT_SDK_${prefix}_OBJECT_FORMAT The object file format (e.g. MACHO)
158
- # SWIFT_SDK_${prefix}_USE_ISYSROOT Whether to use -isysroot
159
- # SWIFT_SDK_${prefix}_SHARED_LIBRARY_PREFIX Shared library prefix for this SDK (e.g. 'lib')
160
- # SWIFT_SDK_${prefix}_SHARED_LIBRARY_SUFFIX Shared library suffix for this SDK (e.g. 'dylib')
161
- # SWIFT_SDK_${prefix}_ARCHITECTURES Architectures (as a list)
162
- # SWIFT_SDK_${prefix}_IS_SIMULATOR Whether this is a simulator target.
163
- # SWIFT_SDK_${prefix}_ARCH_${ARCH}_TRIPLE Triple name
164
- # SWIFT_SDK_${prefix}_ARCH_${ARCH}_MODULE Module triple name for this SDK
154
+ # SWIFT_SDK_${prefix}_NAME Display name for the SDK
155
+ # SWIFT_SDK_${prefix}_VERSION SDK version number (e.g., 10.9, 7.0)
156
+ # SWIFT_SDK_${prefix}_BUILD_NUMBER SDK build number (e.g., 14A389a)
157
+ # SWIFT_SDK_${prefix}_DEPLOYMENT_VERSION Deployment version (e.g., 10.9, 7.0)
158
+ # SWIFT_SDK_${prefix}_LIB_SUBDIR Library subdir for this SDK
159
+ # SWIFT_SDK_${prefix}_TRIPLE_NAME Triple name for this SDK
160
+ # SWIFT_SDK_${prefix}_OBJECT_FORMAT The object file format (e.g. MACHO)
161
+ # SWIFT_SDK_${prefix}_USE_ISYSROOT Whether to use -isysroot
162
+ # SWIFT_SDK_${prefix}_SHARED_LIBRARY_PREFIX Shared library prefix for this SDK (e.g. 'lib')
163
+ # SWIFT_SDK_${prefix}_SHARED_LIBRARY_SUFFIX Shared library suffix for this SDK (e.g. 'dylib')
164
+ # SWIFT_SDK_${prefix}_STATIC_LINKING_SUPPORTED Whether static linking is supported for this SDK
165
+ # SWIFT_SDK_${prefix}_STATIC_ONLY Whether to build *only* static libraries
166
+
167
+ # SWIFT_SDK_${prefix}_ARCHITECTURES Architectures (as a list)
168
+ # SWIFT_SDK_${prefix}_IS_SIMULATOR Whether this is a simulator target.
169
+ # SWIFT_SDK_${prefix}_ARCH_${ARCH}_TRIPLE Triple name
170
+ # SWIFT_SDK_${prefix}_ARCH_${ARCH}_MODULE Module triple name for this SDK
165
171
macro (configure_sdk_darwin
166
172
prefix name deployment_version xcrun_name
167
173
triple_name module_name architectures )
@@ -206,6 +212,8 @@ macro(configure_sdk_darwin
206
212
set (SWIFT_SDK_${prefix}_STATIC_LIBRARY_SUFFIX ".a" )
207
213
set (SWIFT_SDK_${prefix}_IMPORT_LIBRARY_PREFIX "" )
208
214
set (SWIFT_SDK_${prefix}_IMPORT_LIBRARY_SUFFIX "" )
215
+ set (SWIFT_SDK_${prefix}_STATIC_LINKING_SUPPORTED FALSE )
216
+ set (SWIFT_SDK_${prefix}_STATIC_ONLY FALSE )
209
217
get_threading_package (${prefix} "darwin" SWIFT_SDK_${prefix}_THREADING_PACKAGE )
210
218
211
219
set (SWIFT_SDK_${prefix}_ARCHITECTURES ${architectures} )
@@ -279,6 +287,7 @@ macro(configure_sdk_unix name architectures)
279
287
280
288
string (TOUPPER ${name} prefix )
281
289
string (TOLOWER ${name} platform )
290
+ string (REPLACE "_" "-" platform "${platform} " )
282
291
283
292
set (SWIFT_SDK_${prefix}_NAME "${name} " )
284
293
set (SWIFT_SDK_${prefix}_LIB_SUBDIR "${platform} " )
@@ -310,6 +319,14 @@ macro(configure_sdk_unix name architectures)
310
319
endif ()
311
320
set (SWIFT_SDK_${prefix}_USE_ISYSROOT FALSE )
312
321
322
+ # Static linking is suported on Linux and WASI
323
+ if ("${prefix} " STREQUAL "LINUX"
324
+ OR "${prefix} " STREQUAL "WASI" )
325
+ set (SWIFT_SDK_${prefix}_STATIC_LINKING_SUPPORTED TRUE )
326
+ else ()
327
+ set (SWIFT_SDK_${prefix}_STATIC_LINKING_SUPPORTED FALSE )
328
+ endif ()
329
+
313
330
# GCC on Linux is usually located under `/usr`.
314
331
# However, Ubuntu 20.04 ships with another GCC installation under `/`, which
315
332
# does not include libstdc++. Swift build scripts pass `--sysroot=/` to
@@ -456,6 +473,8 @@ macro(configure_sdk_windows name environment architectures)
456
473
set (SWIFT_SDK_${prefix}_STATIC_LIBRARY_SUFFIX ".lib" )
457
474
set (SWIFT_SDK_${prefix}_IMPORT_LIBRARY_PREFIX "" )
458
475
set (SWIFT_SDK_${prefix}_IMPORT_LIBRARY_SUFFIX ".lib" )
476
+ set (SWIFT_SDK_${prefix}_STATIC_LINKING_SUPPORTED FALSE )
477
+ set (SWIFT_SDK_${prefix}_STATIC_ONLY FALSE )
459
478
get_threading_package (${prefix} "win32" SWIFT_SDK_${prefix}_THREADING_PACKAGE )
460
479
461
480
foreach (arch ${architectures} )
@@ -523,6 +542,8 @@ function(configure_target_variant prefix name sdk build_config lib_subdir)
523
542
set (SWIFT_VARIANT_${prefix}_STATIC_LIBRARY_SUFFIX ${SWIFT_SDK_${sdk}_STATIC_LIBRARY_SUFFIX} )
524
543
set (SWIFT_VARIANT_${prefix}_IMPORT_LIBRARY_PREFIX ${SWIFT_SDK_${sdk}_IMPORT_LIBRARY_PREFIX} )
525
544
set (SWIFT_VARIANT_${prefix}_IMPORT_LIBRARY_SUFFIX ${SWIFT_SDK_${sdk}_IMPORT_LIBRARY_SUFFIX} )
545
+ set (SWIFT_VARIANT_${prefix}_STATIC_LINKING_SUPPORTED ${SWIFT_SDK_${sdk}_STATIC_LINKING_SUPPORTED} )
546
+ set (SWIFT_VARIANT_${prefix}_STATIC_ONLY ${SWIFT_SDK_${sdk}_STATIC_ONLY} )
526
547
get_threading_package (${prefix} ${SWIFT_SDK_${sdk}_THREADING_PACKAGE} SWIFT_VARIANT_${prefix}_THREADING_PACKAGE )
527
548
endfunction ()
528
549
0 commit comments