Updating build.sh to output build_local.sh on osx
This commit is contained in:
parent
7ffca4d1bc
commit
8edc9511cc
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
# --------------------------------------------
|
||||
# Usage
|
||||
# Usage
|
||||
|
||||
VALID_VALUES_COMPILER=("clang" "clang++" "msvc")
|
||||
VALID_VALUES_MODE=("debug" "release")
|
||||
|
@ -97,7 +97,7 @@ PACKAGE=$INPUT_FLAG_UNSET
|
|||
|
||||
BLD_LOCAL_FILE="${BLD_DIR}/build_local.sh"
|
||||
|
||||
if [ ! -f $BLD_LOCAL_FILE ]
|
||||
if [ ! -f $BLD_LOCAL_FILE ]
|
||||
then
|
||||
|
||||
printf "Creating a build/build_local.sh file for you."
|
||||
|
@ -105,14 +105,14 @@ then
|
|||
printf "This file is excluded in the .gitignore. It is for you to set local compilation targets"
|
||||
|
||||
touch $BLD_LOCAL_FILE
|
||||
printf "#!/bin/bash" >> $BLD_LOCAL_FILE
|
||||
printf >> $BLD_LOCAL_FILE
|
||||
printf "COMPILER=\"clang\"" >> $BLD_LOCAL_FILE
|
||||
printf "MODE=\"debug\"" >> $BLD_LOCAL_FILE
|
||||
printf "PLATFORM=\"osx\"" >> $BLD_LOCAL_FILE
|
||||
printf "ARCH=\"arm64\"" >> $BLD_LOCAL_FILE
|
||||
printf "PACKAGE=\"false\"" >> $BLD_LOCAL_FILE
|
||||
printf "TEST_FILE=\"\"" >> $BLD_LOCAL_FILE
|
||||
printf "#!/bin/bash\n" >> $BLD_LOCAL_FILE
|
||||
printf "\n" >> $BLD_LOCAL_FILE
|
||||
printf "COMPILER=\"clang\"\n" >> $BLD_LOCAL_FILE
|
||||
printf "MODE=\"debug\"\n" >> $BLD_LOCAL_FILE
|
||||
printf "PLATFORM=\"osx\"\n" >> $BLD_LOCAL_FILE
|
||||
printf "ARCH=\"arm64\"\n" >> $BLD_LOCAL_FILE
|
||||
printf "PACKAGE=\"false\"\n" >> $BLD_LOCAL_FILE
|
||||
printf "TEST_FILE=\"\"\n" >> $BLD_LOCAL_FILE
|
||||
fi
|
||||
|
||||
# --------------------------------------------
|
||||
|
@ -132,7 +132,7 @@ if [ "${#OPTS[@]}" -gt "0" ]; then
|
|||
print_usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
COMPILER=${OPTS[0]}
|
||||
MODE=${OPTS[1]}
|
||||
PLATFORM=${OPTS[2]}
|
||||
|
@ -160,7 +160,7 @@ check_valid_flag () {
|
|||
local VALID_VALUES=("${!VALID_VALUES_NAME}")
|
||||
local VALUE_GIVEN=$2
|
||||
local VALUE_ID=$3
|
||||
|
||||
|
||||
if [[ ! " ${VALID_VALUES[*]} " =~ " ${VALUE_GIVEN} " ]]; then
|
||||
printf_r "Error: Invalid ${VALUE_ID} provided: ${VALUE_GIVEN}"
|
||||
printf " Must be one of: "
|
||||
|
@ -180,7 +180,7 @@ if [[ ! " ${VALID_VALUES_PACKAGE[*]} " =~ " ${PACKAGE} " ]]; then
|
|||
ALL_VALID_VALUES="false"
|
||||
fi
|
||||
|
||||
if [ "${ALL_VALID_VALUES}" != "true" ]; then
|
||||
if [ "${ALL_VALID_VALUES}" != "true" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -275,12 +275,12 @@ parse_flags_from_selectors() {
|
|||
for ((i=1; i<=$#; i+=1)); do
|
||||
SELECTORS+=(${!i})
|
||||
done
|
||||
|
||||
|
||||
FLAGS=()
|
||||
for i in "${FILE_LINES[@]}"; do
|
||||
LINE=$i
|
||||
FLAG="${LINE##*>}"
|
||||
|
||||
|
||||
INCLUDE_FLAG="true"
|
||||
while [ "${LINE}" != "${FLAG}" ]; do
|
||||
NEXT_SELECTOR="${LINE%%>*}"
|
||||
|
@ -289,7 +289,7 @@ parse_flags_from_selectors() {
|
|||
INCLUDE_FLAG="false"
|
||||
break
|
||||
fi
|
||||
|
||||
|
||||
done
|
||||
|
||||
if [ "${INCLUDE_FLAG}" == "true" ]; then
|
||||
|
@ -346,12 +346,12 @@ COMPILER_OUTPUT=()
|
|||
FAILED_COMPILES=()
|
||||
for i in "${COMPILER_INPUTS[@]}"; do
|
||||
INPUT="${i}"
|
||||
|
||||
|
||||
INPUT_FILE="${INPUT##*/}"
|
||||
INPUT_EXTENSION="${INPUT_FILE##*.}"
|
||||
INPUT_NAME="${INPUT_FILE%.*}"
|
||||
OUTPUT_FILE="${INPUT_NAME}_${INPUT_EXTENSION}.o"
|
||||
|
||||
|
||||
COMPILER_ARGS="-o ${OUTPUT_FILE} -c ${COMPILER_FLAGS[@]} -DPLATFORM_$PLATFORM=1 -DMODE_$MODE=1 -DARCH_$ARCH=1 $INPUT"
|
||||
|
||||
# echo $COMPILER $COMPILER_ARGS
|
||||
|
|
Loading…
Reference in New Issue