Fix build on macOS
This commit is contained in:
16
build
16
build
@@ -6,7 +6,7 @@ BOLD="\033[1m"
|
||||
NC="\033[0m" # No Color
|
||||
|
||||
BUILD_TYPE="Debug"
|
||||
ACCEPTED_BUILD_TYPES=("RelWithDebInfo" "Debug" "Release")
|
||||
ACCEPTED_BUILD_TYPES=("Debug" "RelWithDebInfo" "Release")
|
||||
KERNEL="$(uname -s)"
|
||||
ARGS=""
|
||||
|
||||
@@ -15,6 +15,15 @@ join_array_elements() {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
contains() {
|
||||
local item="$1"; shift
|
||||
local e
|
||||
for e; do
|
||||
[[ "$e" == "$item" ]] && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
print_usage() {
|
||||
echo -e "Usage: build [-b build_type] ..."
|
||||
echo -e " Options:"
|
||||
@@ -40,10 +49,7 @@ while [[ $# > 0 ]];do
|
||||
esac
|
||||
done
|
||||
|
||||
# Compare build type against array
|
||||
# From this: https://www.baeldung.com/linux/check-bash-array-contains-value#using-anifcondition-with-aregex-pattern
|
||||
build_regex="\<${BUILD_TYPE}\>"
|
||||
if [[ ! ${ACCEPTED_BUILD_TYPES[@]} =~ $build_regex ]]; then
|
||||
if ! contains ${BUILD_TYPE} "${ACCEPTED_BUILD_TYPES[@]}"; then
|
||||
echo -e "${RED}${BOLD}Unknown build type: ${BUILD_TYPE}${NC}\n"
|
||||
print_usage
|
||||
exit 1
|
||||
|
Reference in New Issue
Block a user