authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-12-01 00:49:55-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-12-06 12:15:04-07:00
log02456a32ad6fa672ea383b57a2b9f592b9e2b9ed
tree3fe4466fc18bf8b48f595347f31d747281812ea3
parent7ef745db59181654f90e2ad5b84c3cedf055635c

CI: make Windows build from source like everybody else

Now that OOM is no longer a problem, the Windows CI can do the same process every other system does instead of building from a recent Zig binary.

2 files changed, 36 insertions(+), 31 deletions(-)

CMakeLists.txt+2-2
......@@ -769,9 +769,9 @@ target_include_directories(zig2 PUBLIC "${CMAKE_SOURCE_DIR}/lib")
769769target_link_libraries(zig2 LINK_PUBLIC zigcpp)
770770
771771if(MSVC)
772 target_link_libraries(zig2 ntdll.lib)
772 target_link_libraries(zig2 LINK_PUBLIC ntdll.lib)
773773elseif(MINGW)
774 target_link_libraries(zig2 ntdll)
774 target_link_libraries(zig2 LINK_PUBLIC ntdll)
775775endif()
776776
777777if(NOT MSVC)
ci/x86_64-windows.ps1+34-29
......@@ -1,20 +1,17 @@
11$TARGET = "$($Env:ARCH)-windows-gnu"
22$ZIG_LLVM_CLANG_LLD_NAME = "zig+llvm+lld+clang-$TARGET-0.11.0-dev.448+e6e459e9e"
3$MCPU = "baseline"
34$ZIG_LLVM_CLANG_LLD_URL = "https://ziglang.org/deps/$ZIG_LLVM_CLANG_LLD_NAME.zip"
5$PREFIX_PATH = "$(Get-Location)\$ZIG_LLVM_CLANG_LLD_NAME"
6$ZIG = "$PREFIX_PATH\bin\zig.exe"
47
58Write-Output "Downloading $ZIG_LLVM_CLANG_LLD_URL"
6
79Invoke-WebRequest -Uri "$ZIG_LLVM_CLANG_LLD_URL" -OutFile "$ZIG_LLVM_CLANG_LLD_NAME.zip"
810
911Write-Output "Extracting..."
10
11Add-Type -AssemblyName System.IO.Compression.FileSystem ;
12Add-Type -AssemblyName System.IO.Compression.FileSystem ;
1213[System.IO.Compression.ZipFile]::ExtractToDirectory("$PWD/$ZIG_LLVM_CLANG_LLD_NAME.zip", "$PWD")
1314
14Set-Variable -Name ZIGLIBDIR -Value "$(Get-Location)\lib"
15Set-Variable -Name ZIGINSTALLDIR -Value "$(Get-Location)\stage3-release"
16Set-Variable -Name ZIGPREFIXPATH -Value "$(Get-Location)\$ZIG_LLVM_CLANG_LLD_NAME"
17
1815function CheckLastExitCode {
1916 if (!$?) {
2017 exit 1
......@@ -31,33 +28,41 @@ if ((git rev-parse --is-shallow-repository) -eq "true") {
3128 git fetch --unshallow # `git describe` won't work on a shallow repo
3229}
3330
34Write-Output "Building Zig..."
35
36& "$ZIGPREFIXPATH\bin\zig.exe" build `
37 --prefix "$ZIGINSTALLDIR" `
38 --search-prefix "$ZIGPREFIXPATH" `
39 --zig-lib-dir "$ZIGLIBDIR" `
40 -Denable-stage1 `
41 -Dstatic-llvm `
42 -Drelease `
43 -Duse-zig-libcxx `
44 -Dtarget="$TARGET"
45CheckLastExitCode
31Write-Output "Building from source..."
32Remove-Item -Path 'build-release' -Recurse -Force -ErrorAction Ignore
33New-Item -Path 'build-release' -ItemType Directory
34Set-Location -Path 'build-release'
4635
47Write-Output " zig build test docs..."
36# CMake gives a syntax error when file paths with backward slashes are used.
37# Here, we use forward slashes only to work around this.
38& cmake .. `
39 -GNinja `
40 -DCMAKE_INSTALL_PREFIX="stage3-release" `
41 -DCMAKE_PREFIX_PATH="$($PREFIX_PATH -Replace "\\", "/")" `
42 -DCMAKE_BUILD_TYPE=Release `
43 -DCMAKE_C_COMPILER="$($ZIG -Replace "\\", "/");cc;-target;$TARGET;-mcpu=$MCPU" `
44 -DCMAKE_CXX_COMPILER="$($ZIG -Replace "\\", "/");c++;-target;$TARGET;-mcpu=$MCPU" `
45 -DZIG_TARGET_TRIPLE="$TARGET" `
46 -DZIG_TARGET_MCPU="$MCPU" `
47 -DZIG_STATIC=ON
48CheckLastExitCode
4849
49& "$ZIGINSTALLDIR\bin\zig.exe" build test docs `
50 --search-prefix "$ZIGPREFIXPATH" `
51 -Dstatic-llvm `
52 -Dskip-non-native `
53 -Denable-symlinks-windows
50ninja install
5451CheckLastExitCode
5552
56# Produce the experimental std lib documentation.
57Write-Output "zig test std/std.zig..."
53Write-Output "Main test suite..."
54& "stage3-release\bin\zig.exe" build test docs `
55 --zig-lib-dir "..\lib" `
56 --search-prefix "../$ZIG_LLVM_CLANG_LLD_NAME" `
57 -Dstatic-llvm `
58 -Dskip-non-native `
59 -Denable-symlinks-windows
60CheckLastExitCode
5861
59& "$ZIGINSTALLDIR\bin\zig.exe" test "$ZIGLIBDIR\std\std.zig" `
60 --zig-lib-dir "$ZIGLIBDIR" `
62Write-Output "Testing Autodocs..."
63& "stage3-release\bin\zig.exe" test "..\lib\std\std.zig" `
64 --zig-lib-dir "..\lib" `
6165 -femit-docs `
6266 -fno-emit-bin
6367CheckLastExitCode
68