forked from sonic-pi-net/sonic-pi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmac-config.sh
executable file
·56 lines (48 loc) · 1.38 KB
/
mac-config.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
set -e # Quit script on error
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
WORKING_DIR="$(pwd)"
args=("$@")
config=""
no_imgui=false
# extract options and their arguments into variables.
while [ -n "$1" ]; do
case "$1" in
-c|--config)
case $2 in
Release|Debug|RelWithDebInfo|MinSizeRel)
config="$2"
;;
*)
echo "`basename $0`: Error: invalid configuration: '${2}'" 1>&2
echo "Valid configurations: Release, Debug, RelWithDebInfo, MinSizeRel" 1>&2
exit 1
;;
esac
shift 2
;;
-n|--no-imgui)
no_imgui=true
shift
;;
-s|--system-libs|-o|--offline-build)
shift
;;
--) shift ; break ;;
*) echo "Invalid argument: $1" ; exit 1 ;;
esac
done
echo "Creating build directory..."
mkdir -p "${SCRIPT_DIR}/build"
echo "Generating makefiles..."
cd "${SCRIPT_DIR}/build"
option() {
if [ "$1" == "true" ] || [ "$1" == "!" ] || [ "$1" == "!false" ]; then
echo ON
else
echo OFF
fi
}
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE="$config" -DBUILD_IMGUI_INTERFACE="$(option "!$no_imgui")" ..
# Restore working directory as it was prior to this script running...
cd "${WORKING_DIR}"