Skip to content

Commit b1f71ee

Browse files
committed
Skip building x86_64 release binaries on M1 Macs
1 parent 0555719 commit b1f71ee

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

genbindings.sh

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -540,17 +540,20 @@ if [ "$CLANGPP" != "" -a "$LLD" != "" ]; then
540540
LINK_ARG_FLAGS="$LINK_ARG_FLAGS -C link-arg="-isysroot$(xcrun --show-sdk-path)" -C link-arg=-mmacosx-version-min=10.9"
541541
RUSTFLAGS="$BASE_RUSTFLAGS -C target-cpu=apple-a14 -C embed-bitcode=yes -C linker-plugin-lto -C lto -C linker=$CLANG $LINK_ARG_FLAGS -C link-arg=-mcpu=apple-a14" CARGO_PROFILE_RELEASE_LTO=true cargo build $CARGO_BUILD_ARGS -v --release --target aarch64-apple-darwin
542542
fi
543-
export CFLAGS_$ENV_TARGET="$BASE_HOST_CFLAGS -O3 -fPIC -fembed-bitcode -march=sandybridge -mcpu=sandybridge -mtune=sandybridge"
544-
# Rust doesn't recognize CFLAGS changes, so we need to clean build artifacts
545-
cargo clean --release
546-
CARGO_PROFILE_RELEASE_LTO=true RUSTFLAGS="$RUSTFLAGS -C embed-bitcode=yes -C linker-plugin-lto -C lto -C linker=$CLANG $LINK_ARG_FLAGS -C link-arg=-march=sandybridge -C link-arg=-mcpu=sandybridge -C link-arg=-mtune=sandybridge" cargo build $CARGO_BUILD_ARGS -v --release
547-
548-
if [ "$2" = "true" ]; then
549-
$CLANGPP $LOCAL_CFLAGS -flto -fuse-ld=$LLD -O2 demo.cpp target/release/libldk.a -ldl
550-
strip ./a.out
551-
echo "C++ Bin size and runtime with cross-language LTO:"
552-
ls -lha a.out
553-
time ./a.out > /dev/null
543+
# If we're on an M1 don't bother building X86 binaries
544+
if [ "$HOST_PLATFORM" != "aarch64-apple-darwin" ]; then
545+
export CFLAGS_$ENV_TARGET="$BASE_HOST_CFLAGS -O3 -fPIC -fembed-bitcode -march=sandybridge -mcpu=sandybridge -mtune=sandybridge"
546+
# Rust doesn't recognize CFLAGS changes, so we need to clean build artifacts
547+
cargo clean --release
548+
CARGO_PROFILE_RELEASE_LTO=true RUSTFLAGS="$RUSTFLAGS -C embed-bitcode=yes -C linker-plugin-lto -C lto -C linker=$CLANG $LINK_ARG_FLAGS -C link-arg=-march=sandybridge -C link-arg=-mcpu=sandybridge -C link-arg=-mtune=sandybridge" cargo build $CARGO_BUILD_ARGS -v --release
549+
550+
if [ "$2" = "true" ]; then
551+
$CLANGPP $LOCAL_CFLAGS -flto -fuse-ld=$LLD -O2 demo.cpp target/release/libldk.a -ldl
552+
strip ./a.out
553+
echo "C++ Bin size and runtime with cross-language LTO:"
554+
ls -lha a.out
555+
time ./a.out > /dev/null
556+
fi
554557
fi
555558
else
556559
if [ "$CFLAGS_aarch64_apple_darwin" != "" ]; then

0 commit comments

Comments
 (0)