ci: better handle of -mcpu

This commit is contained in:
Andrew Kelley 2021-04-15 00:18:21 -07:00
parent 553fbeba82
commit c59241bda0
3 changed files with 30 additions and 8 deletions

View File

@ -38,7 +38,7 @@ cmake .. \
-DCMAKE_PREFIX_PATH="$PREFIX" \
-DCMAKE_BUILD_TYPE=Release \
-DZIG_TARGET_TRIPLE="$ARCH-native-gnu" \
-DZIG_TARGET_MCPU="x86_64_v2" \
-DZIG_TARGET_MCPU="baseline" \
-DZIG_STATIC=ON
# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
@ -52,7 +52,7 @@ make $JOBS 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)/release/bin/zig"
cmake .. -DZIG_EXECUTABLE="$(pwd)/release/bin/zig" -DZIG_TARGET_MCPU="x86_64_v2"
make $JOBS install
release/bin/zig build test

View File

@ -25,18 +25,20 @@ git config core.abbrev 9
git fetch --unshallow || true
git fetch --tags
export CC="$ZIG cc"
export CXX="$ZIG c++"
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" \
-DZIG_OMIT_STAGE2=ON \
-DZIG_STATIC=ON \
-DZIG_TARGET_TRIPLE="x86_64-native-gnu" \
-DZIG_TARGET_MCPU="x86_64_v2" \
-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
@ -49,7 +51,7 @@ 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"
cmake .. -DZIG_EXECUTABLE="$(pwd)/dist/bin/zig.exe" -DZIG_TARGET_MCPU="x86_64_v2"
ninja install

View File

@ -14,6 +14,13 @@ cd $HOME
wget -nv "https://ziglang.org/deps/$CACHE_BASENAME.tar.xz"
tar xf "$CACHE_BASENAME.tar.xz"
ZIG="$PREFIX/bin/zig"
NATIVE_LIBC_TXT="$HOME/native_libc.txt"
$ZIG libc > "$NATIVE_LIBC_TXT"
export ZIG_LIBC="$NATIVE_LIBC_TXT"
export CC="$ZIG cc"
export CXX="$ZIG c++"
cd $ZIGDIR
# Make the `zig version` number consistent.
@ -35,8 +42,21 @@ cmake .. \
"-DCMAKE_INSTALL_PREFIX=$(pwd)/release" \
-DZIG_STATIC=ON \
-DZIG_TARGET_TRIPLE="x86_64-native-gnu" \
-DZIG_TARGET_MCPU="x86_64_v2" \
-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
unset ZIG_LIBC
samu 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)/release/bin/zig" -DZIG_TARGET_MCPU="x86_64_v2"
samu install
# Here we skip some tests to save time.