@@ -696,6 +696,7 @@ enum Project {
696
696
BuildTools
697
697
RegsGen2
698
698
699
+ CDispatch
699
700
Compilers
700
701
FoundationMacros
701
702
TestingMacros
@@ -1946,6 +1947,20 @@ function Load-LitTestOverrides($Filename) {
1946
1947
}
1947
1948
}
1948
1949
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
+
1949
1964
function Get-CompilersDefines ([Hashtable ] $Platform , [string ] $Variant , [switch ] $Test ) {
1950
1965
$BuildTools = [IO.Path ]::Combine((Get-ProjectBinaryCache $BuildPlatform BuildTools), " bin" )
1951
1966
$PythonRoot = [IO.Path ]::Combine((Get-PythonPath $Platform ), " tools" )
@@ -2556,17 +2571,11 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa
2556
2571
- UseGNUDriver `
2557
2572
- Defines @ {
2558
2573
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 { @ () });
2562
2574
CMAKE_STATIC_LIBRARY_PREFIX_Swift = " lib" ;
2563
2575
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`.
2570
2579
SwiftCore_ENABLE_CONCURRENCY = " YES" ;
2571
2580
}
2572
2581
@@ -3018,6 +3027,8 @@ function Build-SDK([Hashtable] $Platform, [switch] $IncludeMacros = $false) {
3018
3027
}
3019
3028
3020
3029
function Build-ExperimentalSDK ([Hashtable ] $Platform ) {
3030
+ Invoke-BuildStep Build-CDispatch $Platform
3031
+
3021
3032
# TODO(compnerd) we currently build the experimental SDK with just the static
3022
3033
# variant. We should aim to build both dynamic and static variants.
3023
3034
Invoke-BuildStep Build-ExperimentalRuntime $Platform - Static
@@ -3725,6 +3736,7 @@ if (-not $SkipBuild) {
3725
3736
3726
3737
Invoke-BuildStep Build-CMark $HostPlatform
3727
3738
Invoke-BuildStep Build-XML2 $HostPlatform
3739
+ Invoke-BuildStep Build-CDispatch $HostPlatform
3728
3740
Invoke-BuildStep Build-Compilers $HostPlatform - Variant " Asserts"
3729
3741
3730
3742
Invoke-BuildStep Build-SDK $BuildPlatform - IncludeMacros
0 commit comments