std.crypto: make ff.ct_unprotected.limbsCmpLt compile (#19741)
[zig.git] / ci / x86_64-windows-release.ps1
blob68d22c9eaba0a31815498415471ae7fcca62eb96
1 $TARGET = "$($Env:ARCH)-windows-gnu"
2 $ZIG_LLVM_CLANG_LLD_NAME = "zig+llvm+lld+clang-$TARGET-0.12.0-dev.2073+402fe565a"
3 $MCPU = "baseline"
4 $PREFIX_PATH = "$($Env:USERPROFILE)\$ZIG_LLVM_CLANG_LLD_NAME"
5 $ZIG = "$PREFIX_PATH\bin\zig.exe"
6 $ZIG_LIB_DIR = "$(Get-Location)\lib"
8 function CheckLastExitCode {
9 if (!$?) {
10 exit 1
12 return 0
15 # Make the `zig version` number consistent.
16 # This will affect the `zig build` command below which uses `git describe`.
17 git fetch --tags
19 if ((git rev-parse --is-shallow-repository) -eq "true") {
20 git fetch --unshallow # `git describe` won't work on a shallow repo
23 Write-Output "Building from source..."
24 Remove-Item -Path 'build-release' -Recurse -Force -ErrorAction Ignore
25 New-Item -Path 'build-release' -ItemType Directory
26 Set-Location -Path 'build-release'
28 # CMake gives a syntax error when file paths with backward slashes are used.
29 # Here, we use forward slashes only to work around this.
30 & cmake .. `
31 -GNinja `
32 -DCMAKE_INSTALL_PREFIX="stage3-release" `
33 -DCMAKE_PREFIX_PATH="$($PREFIX_PATH -Replace "\\", "/")" `
34 -DCMAKE_BUILD_TYPE=Release `
35 -DCMAKE_C_COMPILER="$($ZIG -Replace "\\", "/");cc;-target;$TARGET;-mcpu=$MCPU" `
36 -DCMAKE_CXX_COMPILER="$($ZIG -Replace "\\", "/");c++;-target;$TARGET;-mcpu=$MCPU" `
37 -DCMAKE_AR="$($ZIG -Replace "\\", "/")" `
38 -DZIG_AR_WORKAROUND=ON `
39 -DZIG_TARGET_TRIPLE="$TARGET" `
40 -DZIG_TARGET_MCPU="$MCPU" `
41 -DZIG_STATIC=ON `
42 -DZIG_NO_LIB=ON
43 CheckLastExitCode
45 ninja install
46 CheckLastExitCode
48 Write-Output "Main test suite..."
49 & "stage3-release\bin\zig.exe" build test docs `
50 --zig-lib-dir "$ZIG_LIB_DIR" `
51 --search-prefix "$PREFIX_PATH" `
52 -Dstatic-llvm `
53 -Dskip-non-native `
54 -Denable-symlinks-windows
55 CheckLastExitCode
57 Write-Output "Build x86_64-windows-msvc behavior tests using the C backend..."
58 & "stage3-release\bin\zig.exe" test `
59 ..\test\behavior.zig `
60 --zig-lib-dir "$ZIG_LIB_DIR" `
61 -ofmt=c `
62 -femit-bin="test-x86_64-windows-msvc.c" `
63 --test-no-exec `
64 -target x86_64-windows-msvc `
65 -lc
66 CheckLastExitCode
68 & "stage3-release\bin\zig.exe" build-obj `
69 --zig-lib-dir "$ZIG_LIB_DIR" `
70 -ofmt=c `
71 -OReleaseSmall `
72 --name compiler_rt `
73 -femit-bin="compiler_rt-x86_64-windows-msvc.c" `
74 --dep build_options `
75 -target x86_64-windows-msvc `
76 --mod root ..\lib\compiler_rt.zig `
77 --mod build_options config.zig
78 CheckLastExitCode
80 Import-Module "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
81 CheckLastExitCode
83 Enter-VsDevShell -VsInstallPath "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools" `
84 -DevCmdArguments '-arch=x64 -no_logo' `
85 -StartInPath $(Get-Location)
86 CheckLastExitCode
88 Write-Output "Build and run behavior tests with msvc..."
89 & cl.exe -I..\lib test-x86_64-windows-msvc.c compiler_rt-x86_64-windows-msvc.c /W3 /Z7 -link -nologo -debug -subsystem:console kernel32.lib ntdll.lib libcmt.lib
90 CheckLastExitCode
92 & .\test-x86_64-windows-msvc.exe
93 CheckLastExitCode