@@ -2356,13 +2356,17 @@ function Build-ExperimentalRuntime {
23562356 CMAKE_FIND_PACKAGE_PREFER_CONFIG = " YES" ;
23572357 CMAKE_Swift_COMPILER_TARGET = (Get-ModuleTriple $Platform );
23582358 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 { @ () });
23592361 CMAKE_STATIC_LIBRARY_PREFIX_Swift = " lib" ;
23602362 CMAKE_SYSTEM_NAME = $Platform.OS.ToString ();
23612363 CMAKE_NINJA_FORCE_RESPONSE_FILE = " YES" ;
23622364
23632365 # 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.
23662370 dispatch_DIR = (Get-ProjectCMakeModules $Platform Dispatch);
23672371 SwiftCore_ENABLE_CONCURRENCY = " YES" ;
23682372 }
@@ -2758,7 +2762,8 @@ function Build-ExperimentalSDK([Hashtable] $Platform) {
27582762 CMAKE_FIND_PACKAGE_PREFER_CONFIG = " YES" ;
27592763 CMAKE_Swift_COMPILER_TARGET = (Get-ModuleTriple $Platform );
27602764 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" );
27622767 CMAKE_STATIC_LIBRARY_PREFIX_Swift = " lib" ;
27632768 CMAKE_SYSTEM_NAME = $Platform.OS.ToString ();
27642769
0 commit comments