-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·52 lines (42 loc) · 1.23 KB
/
configure
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
#!/bin/bash
print_usage() {
(cat | fold -w 80) << EOF
Usage: configure [--prefix=<install prefix>]
Configures either a debug or release build, with the given installation prefix.
--prefix=PREFIX installation prefix
EOF
exit 0
}
build_type="release"
cmake_install_prefix="/usr/local"
for arg in "$@"; do
case $arg in
-h|--help)
print_usage
shift;
;;
--prefix=*)
cmake_install_prefix=${arg#*=}
shift
;;
esac
done
if [ ! -e build/ ]; then
mkdir build
fi
# Determine the CMake build type from the build type specified by the user. In
# case an invalid build type is specified, issue an error and exit.
if [ $build_type = "debug" ]; then
cmake_build_type="Debug"
elif [ $build_type = "release" ]; then
cmake_build_type="Release"
else
echo "Invalid build type '${build_type}' specified, specify either 'debug' or 'release'."
exit 1
fi
printf "** Configuring a ${build_type} build, with installation prefix '${cmake_install_prefix}'...\n\n"
cd build && cmake ../ -GNinja \
-DCMAKE_MAKE_PROGRAM="$(command -v ninja)" \
-DCMAKE_INSTALL_PREFIX="$cmake_install_prefix" \
-DCMAKE_BUILD_TYPE=${cmake_build_type}
printf "\n** Configuration complete, to build issue 'ninja -C build'.\n"