From 8675d371a4c18448ce7d5908d9c40c1a581653c8 Mon Sep 17 00:00:00 2001 From: Peter Slattery Date: Fri, 22 Mar 2024 16:16:48 -0600 Subject: [PATCH] dedicated build-mac-release and build-mac-dev files in bin --- code/bin/{build-mac.sh => build-mac-dev.sh} | 6 +--- code/bin/build-mac-release.sh | 31 +++++++++++++++++++++ 2 files changed, 32 insertions(+), 5 deletions(-) rename code/bin/{build-mac.sh => build-mac-dev.sh} (89%) mode change 100755 => 100644 create mode 100755 code/bin/build-mac-release.sh diff --git a/code/bin/build-mac.sh b/code/bin/build-mac-dev.sh old mode 100755 new mode 100644 similarity index 89% rename from code/bin/build-mac.sh rename to code/bin/build-mac-dev.sh index adae8015..baebf4c5 --- a/code/bin/build-mac.sh +++ b/code/bin/build-mac-dev.sh @@ -17,11 +17,7 @@ BIN_ROOT="$SRC_ROOT/bin" CUSTOM_ROOT="$SRC_ROOT/custom" CUSTOM_BIN="$CUSTOM_ROOT/bin" -# Get the build mode -BUILD_MODE="$1" -if [ -z "$BUILD_MODE" ]; then - BUILD_MODE="-DDEV_BUILD" -fi +BUILD_MODE="-DDEV_BUILD" WARNINGS="-Wno-write-strings -Wno-comment -Wno-null-dereference -Wno-logical-op-parentheses -Wno-switch" diff --git a/code/bin/build-mac-release.sh b/code/bin/build-mac-release.sh new file mode 100755 index 00000000..d15ac2c7 --- /dev/null +++ b/code/bin/build-mac-release.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +# If any command errors, stop the script +set -e + +# Set up directories +# NOTE(yuval): Replaced readlink with realpath which works for both macOS and Linux +ME="$(realpath "$0")" +LOCATION="$(dirname "$ME")" +SRC_ROOT="$(dirname "$LOCATION")" +PROJECT_ROOT="$(dirname "$SRC_ROOT")" +if [ ! -d "$PROJECT_ROOT/build" ]; then +mkdir "$PROJECT_ROOT/build" +fi +BUILD_ROOT="$PROJECT_ROOT/build" +BIN_ROOT="$SRC_ROOT/bin" +CUSTOM_ROOT="$SRC_ROOT/custom" +CUSTOM_BIN="$CUSTOM_ROOT/bin" + +BUILD_MODE="-DOPT_BUILD" + +WARNINGS="-Wno-write-strings -Wno-comment -Wno-null-dereference -Wno-logical-op-parentheses -Wno-switch" + +FLAGS="-D_GNU_SOURCE -fPIC -fpermissive $BUILD_MODE" +INCLUDES="-I$SRC_ROOT -I$CUSTOM_ROOT" + +# Execute +clang++ $WARNINGS $FLAGS $INCLUDES "$BIN_ROOT/4ed_build.cpp" -g -o "$BUILD_ROOT/build" +pushd "$SRC_ROOT" +"$BUILD_ROOT/build" +popd