-
Notifications
You must be signed in to change notification settings - Fork 2
/
configure
executable file
·73 lines (65 loc) · 1.71 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/sh
usage()
{
echo "Usage: ./configure [OPTIONS]"
echo
echo "Available options:"
echo " --prefix=[PATH] - Specifies the path to install the project."
echo " /usr/local is used by default."
echo " --mode=[MODE] - Specifies the build type used. \"debug\" and"
echo " \"release\" is supported. \"release\" is default"
exit 1
}
# Detect needed directories
if [ -n "`echo "$0" | grep ^/`" ]; then
script_dir="`dirname "$0"`"
else
script_dir="`dirname "${PWD}/${0}"`"
fi
script_dir="`echo "$script_dir" | sed -e 's%/\.$%%'`"
current_dir=`pwd`
cmake_module_dir="${script_dir}/CMake"
# Show help
if [ "$1" = "--help" -o "$1" = "-h" ]; then
usage
fi
# Default action
build_mode=release
build_prefix=/usr/local
# Parsing the parameters
while true
do
case ${1} in
--prefix=*)
build_prefix=`echo $1 | sed -e 's/--prefix=//g'`
shift
;;
--mode=*)
mode=`echo ${1} | sed -e 's/--mode=//g'`
if [ ${mode} = "debug" -o ${mode} = "release" ]; then
build_mode=${mode}
else
echo "Error: unrecognised build mode ${mode}. Use \"debug\" or \"release\""
exit 1
fi
shift
;;
-*)
echo "Error: Unrecognized flag: \"$1\""
usage
;;
*)
break
;;
esac
done
# ... and configure now
echo "Configuring using prefix \"${build_prefix}\" and mode \"${build_mode}\""
echo
cmake . -DCMAKE_BUILD_TYPE=${build_mode} -DCMAKE_INSTALL_PREFIX=${build_prefix} -DCMAKE_MODULE_PATH=${cmake_module_dir}
echo
if [ $? -eq 0 ]; then
echo "Configuring using cmake went well. You may run \"make\" now."
else
echo "There was errors while configuring. Make will not start properly."
fi