Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: add BUILDMODE #150

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion build
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,39 @@ set -eu

TARGET="$1" # Example: riscv64-linux-gnu
MCPU="$2" # Examples: `baseline`, `native`, `generic+v7a`, or `arm1176jzf_s`
BUILDMODE="$3" # Examples below

ROOTDIR="$(pwd)"
ZIG_VERSION="0.11.0-dev.2680+a1aa55ebe"

case "$BUILDMODE" in
ReleaseSafeDbgSym)
OPTIMIZE=ReleaseSafe
DBGSYM=Yes
ZIG_STRIP=
;;
ReleaseFastStrip)
OPTIMIZE=ReleaseFast
DBGSYM=No
ZIG_STRIP=-D
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be -Dstrip?

;;
*)
>&2 printf "Unsupported build mode %s. Expecting %s or %s\n" \
"$BUILDMODE" ReleaseSafeDbgSym ReleaseFastStrip
exit 1
;;
esac

cat <<EOF
Build configuration:
Version: $ZIG_VERSION
Target: $TARGET
MCPU: $MCPU
Optimize: $OPTIMIZE
Debug symbols: $DBGSYM

EOF

TARGET_OS_AND_ABI=${TARGET#*-} # Example: linux-gnu

# Here we map the OS from the target triple to the value that CMake expects.
Expand Down Expand Up @@ -192,7 +221,7 @@ $ZIG build \
--search-prefix "$ROOTDIR/out/$TARGET-$MCPU" \
-Dstatic-llvm \
-Doptimize=ReleaseFast \
-Dstrip \
$ZIG_STRIP \
-Dtarget="$TARGET" \
-Dcpu="$MCPU" \
-Dversion-string="$ZIG_VERSION"