-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·39 lines (35 loc) · 1.46 KB
/
build.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
#!/usr/bin/env bash
build_system="DEFAULT"
compiler="DEFAULT"
compiler_path=""
if [ $# -ge 1 ]; then
build_system="$1"
fi
if [ $# -ge 2 ]; then
compiler="$2"
if [ "${compiler}" = "DEFAULT" ]; then
compiler_path=""
elif [ "${compiler}" = "gcc" ]; then
compiler_path="/opt/homebrew/bin/gcc-13"
else
echo "${compiler} is not a valid compiler option"
exit 1
fi
fi
if [ "${compiler}" = "DEFAULT" ]; then
echo "CMake'ing to ${build_system} build system using DEFAULT compiler"
if [ "${build_system}" = "DEFAULT" ]; then
cmake -B "./build/${build_system}_DEFAULT" -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH="../../bin/${build_system}_DEFAULT"
else
cmake -B "./build/${build_system}_DEFAULT" -G "${build_system}" -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH="../../bin/${build_system}_DEFAULT"
fi
cmake --build "./build/${build_system}_DEFAULT"
else
echo "CMake'ing to ${build_system} build system using ${compiler} compiler"
if [ "${build_system}" = "DEFAULT" ]; then
cmake -B "./build/${build_system}_${compiler}" -DCMAKE_C_COMPILER="${compiler_path}" -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH="../../bin/${build_system}_${compiler}"
else
cmake -B "./build/${build_system}_${compiler}" -G "${build_system}" -DCMAKE_C_COMPILER="${compiler_path}" -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH="../../bin/${build_system}_${compiler}"
fi
cmake --build "./build/${build_system}_${compiler}"
fi