ci: windows: try the dev kit strategy

This commit is contained in:
Andrew Kelley 2021-04-15 01:44:17 -07:00
parent 4a1d3465cc
commit fa633a658f

View File

@ -17,8 +17,6 @@ cd "$HOME"
wget -nv "https://ziglang.org/deps/$CACHE_BASENAME.tar.xz"
tar xf "$CACHE_BASENAME.tar.xz"
ln -s "$PREFIX/bin/llvm-ar.exe" "$PREFIX/bin/llvm-ranlib.exe"
cd "$ZIGDIR"
# Make the `zig version` number consistent.
@ -27,37 +25,12 @@ git config core.abbrev 9
git fetch --unshallow || true
git fetch --tags
export CC="$ZIG cc -fno-sanitize=all -target x86_64-windows-gnu -mcpu=native"
export CXX="$ZIG c++ -fno-sanitize=all -target x86_64-windows-gnu -mcpu=native"
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release \
"-DCMAKE_PREFIX_PATH=$PREFIX" \
"-DCMAKE_INSTALL_PREFIX=$(pwd)/dist" \
-DCMAKE_CROSSCOMPILING=True \
-DCMAKE_SYSTEM_NAME="Windows" \
-DCMAKE_AR="$PREFIX/bin/llvm-ar.exe" \
-DCMAKE_RANLIB="$PREFIX/bin/llvm-ranlib.exe" \
-DZIG_OMIT_STAGE2=ON \
-DZIG_STATIC=ON \
-DZIG_TARGET_TRIPLE="x86_64-windows-gnu" \
-DZIG_TARGET_MCPU="baseline" \
-GNinja
# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
# so that installation and testing do not get affected by them.
unset CC
unset CXX
ninja install
# Here we rebuild zig but this time using the Zig binary we just now produced to
# build zig1.o rather than relying on the one built with stage0. See
# https://github.com/ziglang/zig/issues/6830 for more details.
cmake .. -DZIG_EXECUTABLE="$(pwd)/dist/bin/zig.exe" -DZIG_TARGET_MCPU="x86_64_v2"
ninja install
"$ZIG" build -Dstage1 -Dtarget=x86_64-windows-gnu \
--search-prefix "$PREFIX" \
--override-lib-dir "$ZIGDIR/lib" \
--prefix "$(pwd)/dist"
dist/bin/zig.exe build test-behavior -Dskip-non-native
# Disabled to prevent OOM