Skip to content

Commit

Permalink
Add extra arg & env var support to linux-build.sh
Browse files Browse the repository at this point in the history
- You can now provide a full $CONFIG env var to directly set "debug_x64"
  or another value of your choice.
- You can now provide an extra argument "release" or "debug".
- Both parameters (arch, build type) now have input validation.
  • Loading branch information
qaisjp committed May 19, 2019
1 parent 22a276e commit ebec3f2
Showing 1 changed file with 35 additions and 5 deletions.
40 changes: 35 additions & 5 deletions linux-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,44 @@ else
PREMAKE5=utils/premake5
fi

ENV_CONFIG=$CONFIG
DEFAULT=2

# Debug vs Release
if [[ $2 = "release" ]] || [[ $2 = "debug" ]]; then
CONFIG=$2
elif [[ $2 != "" ]]; then
printf "Unknown build type \"$2\" provided\n"
exit 1
else
CONFIG=release
((DEFAULT--))
fi

# 32bit vs 64bit
if [[ $1 = "32" ]]; then
CONFIG=release_x86
if [[ $1 = "32" ]] || [[ $1 = "x86" ]]; then
CONFIG=${CONFIG}_x86
elif [[ $1 = "64" ]] || [[ $1 = "x64" ]]; then
CONFIG=${CONFIG}_x64
elif [[ $1 != "" ]]; then
printf "Unknown architecture \"$1\" provided\n"
exit 1
else
CONFIG=release_x64
CONFIG=${CONFIG}_x64
((DEFAULT--))
fi

# Only apply $CONFIG from environment if no args provided
if [[ $ENV_CONFIG != "" ]]; then
if [[ $DEFAULT != 0 ]]; then
printf "Ignoring provided \$CONFIG environment variable, "
else
CONFIG=$ENV_CONFIG
fi
fi

printf "\$CONFIG=$CONFIG\n"

# Clean old build files
rm -Rf Build/
rm -Rf Bin/
Expand All @@ -29,5 +60,4 @@ else
fi

# Build!
cd Build/
make -j$NUM_CORES config=$CONFIG all
make -C Build/ -j$NUM_CORES config=$CONFIG all

0 comments on commit ebec3f2

Please sign in to comment.