Skip to content

Commit 7d0c87b

Browse files
authored
Merge pull request swiftlang#77757 from compnerd/inspection-cmake
utils: use CMake to build swift-inspect for Windows
2 parents eaef8e7 + c72246c commit 7d0c87b

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

Diff for: utils/build.ps1

+15-15
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,7 @@ enum HostComponent {
454454
LMDB
455455
SymbolKit
456456
DocC
457+
SwiftInspect
457458
}
458459

459460
function Get-HostProjectBinaryCache([HostComponent]$Project) {
@@ -2636,18 +2637,20 @@ function Install-HostToolchain() {
26362637
}
26372638

26382639
function Build-Inspect() {
2639-
$OutDir = Join-Path -Path $HostArch.BinaryCache -ChildPath swift-inspect
2640-
$SDKInstallRoot = (Get-HostSwiftSDK) `
2640+
$SDKRoot = Get-HostSwiftSDK
26412641

2642-
Isolate-EnvVars {
2643-
$env:SWIFTCI_USE_LOCAL_DEPS=1
2644-
Build-SPMProject `
2645-
-Action Build `
2646-
-Src $SourceCache\swift\tools\swift-inspect `
2647-
-Bin $OutDir `
2648-
-Arch $HostArch `
2649-
-Xcc "-I$SDKInstallRoot\usr\include\swift\SwiftRemoteMirror" -Xlinker "$SDKInstallRoot\usr\lib\swift\windows\$($HostArch.LLVMName)\swiftRemoteMirror.lib"
2650-
}
2642+
Build-CMakeProject `
2643+
-Src $SourceCache\swift\tools\swift-inspect `
2644+
-Bin (Get-HostProjectBinaryCache SwiftInspect) `
2645+
-InstallTo "$($HostArch.ToolchainInstallRoot)\usr" `
2646+
-Arch $HostArch `
2647+
-UseBuiltCompilers Swift `
2648+
-UseSwiftSwiftDriver `
2649+
-SwiftSDK $SDKRoot `
2650+
-Defines @{
2651+
CMAKE_Swift_FLAGS = @("-Xcc", "-I$SDKRoot\usr\include\swift\SwiftRemoteMirror");
2652+
ArgumentParser_DIR = (Get-HostProjectCMakeModules ArgumentParser);
2653+
}
26512654
}
26522655

26532656
function Build-DocC() {
@@ -2686,17 +2689,14 @@ function Test-PackageManager() {
26862689
function Build-Installer($Arch) {
26872690
# TODO(hjyamauchi) Re-enable the swift-inspect and swift-docc builds
26882691
# when cross-compiling https://github.com/apple/swift/issues/71655
2689-
$INCLUDE_SWIFT_INSPECT = if ($IsCrossCompiling) { "false" } else { "true" }
26902692
$INCLUDE_SWIFT_DOCC = if ($IsCrossCompiling) { "false" } else { "true" }
26912693
$ENABLE_MIMALLOC = if ($Allocator -eq "mimalloc" -and $Arch -eq $ArchX64) { "true" } else { "false" }
26922694

26932695
$Properties = @{
26942696
BundleFlavor = "offline";
26952697
TOOLCHAIN_ROOT = "$($Arch.ToolchainInstallRoot)\";
2696-
INCLUDE_SWIFT_INSPECT = $INCLUDE_SWIFT_INSPECT;
2697-
SWIFT_INSPECT_BUILD = "$($Arch.BinaryCache)\swift-inspect\release";
2698-
INCLUDE_SWIFT_DOCC = $INCLUDE_SWIFT_DOCC;
26992698
ENABLE_MIMALLOC = $ENABLE_MIMALLOC;
2699+
INCLUDE_SWIFT_DOCC = $INCLUDE_SWIFT_DOCC;
27002700
SWIFT_DOCC_BUILD = "$($Arch.BinaryCache)\swift-docc\release";
27012701
SWIFT_DOCC_RENDER_ARTIFACT_ROOT = "${SourceCache}\swift-docc-render-artifact";
27022702
}

0 commit comments

Comments
 (0)