@@ -696,6 +696,7 @@ enum Project {
696696 BuildTools
697697 RegsGen2
698698
699+ CDispatch
699700 Compilers
700701 FoundationMacros
701702 TestingMacros
@@ -1946,6 +1947,20 @@ function Load-LitTestOverrides($Filename) {
19461947 }
19471948}
19481949
1950+ function Build-CDispatch ([Hashtable ] $Platform , [switch ] $Static = $false ) {
1951+ Build-CMakeProject `
1952+ - Src $SourceCache \swift- corelibs- libdispatch `
1953+ - Bin (Get-ProjectBinaryCache $Platform CDispatch) `
1954+ - BuildTargets default `
1955+ - Platform $Platform `
1956+ - UsePinnedCompilers C, CXX `
1957+ - Defines @ {
1958+ BUILD_SHARED_LIBS = " YES" ;
1959+ BUILD_TESTING = " NO" ;
1960+ ENABLE_SWIFT = " NO" ;
1961+ }
1962+ }
1963+
19491964function Get-CompilersDefines ([Hashtable ] $Platform , [string ] $Variant , [switch ] $Test ) {
19501965 $BuildTools = [IO.Path ]::Combine((Get-ProjectBinaryCache $BuildPlatform BuildTools), " bin" )
19511966 $PythonRoot = [IO.Path ]::Combine((Get-PythonPath $Platform ), " tools" )
@@ -2556,17 +2571,11 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
25562571 - UseGNUDriver `
25572572 - Defines @ {
25582573 BUILD_SHARED_LIBS = if ($Static ) { " NO" } else { " YES" };
2559- # TODO(compnerd) enforce dynamic linking of BlocksRuntime and dispatch.
2560- CMAKE_CXX_FLAGS = $ (if ($Static ) { @ (" -Ddispatch_STATIC" ) } else { @ () });
2561- CMAKE_Swift_FLAGS = $ (if ($Static ) { @ (" -Xcc" , " -static-libclosure" ) } else { @ () });
25622574 CMAKE_STATIC_LIBRARY_PREFIX_Swift = " lib" ;
25632575
2564- # NOTE(compnerd) we can get away with this currently because we only
2565- # use the C portion of the dispatch build, which is supposed to always
2566- # be built dynamically. Currently, we do not do this due to limitations
2567- # of the build system, but because we are building statically, we do
2568- # not link against the runtime and can get away with it.
2569- dispatch_DIR = (Get-ProjectCMakeModules $Platform Dispatch);
2576+ dispatch_DIR = (Get-ProjectCMakeModules $Platform CDispatch);
2577+
2578+ # FIXME(compnerd) remove this once the default option is flipped to `ON`.
25702579 SwiftCore_ENABLE_CONCURRENCY = " YES" ;
25712580 }
25722581
@@ -3018,6 +3027,8 @@ function Build-SDK([Hashtable] $Platform, [switch] $IncludeMacros = $false) {
30183027}
30193028
30203029function Build-ExperimentalSDK ([Hashtable ] $Platform ) {
3030+ Invoke-BuildStep Build-CDispatch $Platform
3031+
30213032 # TODO(compnerd) we currently build the experimental SDK with just the static
30223033 # variant. We should aim to build both dynamic and static variants.
30233034 Invoke-BuildStep Build-ExperimentalRuntime $Platform - Static
@@ -3725,6 +3736,7 @@ if (-not $SkipBuild) {
37253736
37263737 Invoke-BuildStep Build-CMark $HostPlatform
37273738 Invoke-BuildStep Build-XML2 $HostPlatform
3739+ Invoke-BuildStep Build-CDispatch $HostPlatform
37283740 Invoke-BuildStep Build-Compilers $HostPlatform - Variant " Asserts"
37293741
37303742 Invoke-BuildStep Build-SDK $BuildPlatform - IncludeMacros
0 commit comments