@@ -2356,13 +2356,17 @@ function Build-ExperimentalRuntime {
2356
2356
CMAKE_FIND_PACKAGE_PREFER_CONFIG = " YES" ;
2357
2357
CMAKE_Swift_COMPILER_TARGET = (Get-ModuleTriple $Platform );
2358
2358
CMAKE_Swift_COMPILER_WORKS = " YES" ;
2359
+ # TODO(compnerd) enforce dynamic linking of BlocksRuntime and dispatch.
2360
+ CMAKE_Swift_FLAGS = $ (if ($Static ) { @ (" -Xcc" , " -static-libclosure" , " -Xcc" , " -Ddispatch_STATIC" ) } else { @ () });
2359
2361
CMAKE_STATIC_LIBRARY_PREFIX_Swift = " lib" ;
2360
2362
CMAKE_SYSTEM_NAME = $Platform.OS.ToString ();
2361
2363
CMAKE_NINJA_FORCE_RESPONSE_FILE = " YES" ;
2362
2364
2363
2365
# NOTE(compnerd) we can get away with this currently because we only
2364
- # use the C portion of the dispatch build, which is always built
2365
- # dynamically.
2366
+ # use the C portion of the dispatch build, which is supposed to always
2367
+ # be built dynamically. Currently, we do not do this due to limitations
2368
+ # of the build system, but because we are building statically, we do
2369
+ # not link against the runtime and can get away with it.
2366
2370
dispatch_DIR = (Get-ProjectCMakeModules $Platform Dispatch);
2367
2371
SwiftCore_ENABLE_CONCURRENCY = " YES" ;
2368
2372
}
@@ -2758,7 +2762,8 @@ function Build-ExperimentalSDK([Hashtable] $Platform) {
2758
2762
CMAKE_FIND_PACKAGE_PREFER_CONFIG = " YES" ;
2759
2763
CMAKE_Swift_COMPILER_TARGET = (Get-ModuleTriple $Platform );
2760
2764
CMAKE_Swift_COMPILER_WORKS = " YES" ;
2761
- CMAKE_Swift_FLAGS = @ (" -static-stdlib" , " -Xfrontend" , " -use-static-resource-dir" );
2765
+ # TODO(compnerd) enforce dynamic linking of BlocksRuntime and dispatch.
2766
+ CMAKE_Swift_FLAGS = @ (" -static-stdlib" , " -Xfrontend" , " -use-static-resource-dir" , " -Xcc" , " -Ddispatch_STATIC" );
2762
2767
CMAKE_STATIC_LIBRARY_PREFIX_Swift = " lib" ;
2763
2768
CMAKE_SYSTEM_NAME = $Platform.OS.ToString ();
2764
2769
0 commit comments