forked from zhanggyb/opengl-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·96 lines (82 loc) · 2.21 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/bin/sh
#
# A simple script to run cmake with pre-defined options
#
SCRIPT_FILE=`readlink -f $0`
SOURCE_DIR=`dirname $SCRIPT_FILE`
CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Debug $@"
#CMAKE_OPTIONS="-DBUILD_STATIC_LIBRARY=TRUE -DCMAKE_BUILD_TYPE=Debug $@"
SYSTEM=`uname -o`
# help info
#
print_help () {
cat << EOF
ARGUMENTS for $SCRIPT_FILE:
-h, --help
Show this message and exit.
--debug
Build source code in debug mode.
-p <path>, --prefix=<path>
Path where to install (defaults is /usr/local).
--demo
If build all demos.
--test
If build unit test code.
EOF
}
if [ "x$SOURCE_DIR" = "x$PWD" ]
then
echo "Error: cannot create build files in source directory, exit"
exit 1
fi
if [ "$SYSTEM"x = "GNU/Linux"x ]
then
#echo "Generate Eclipse CDT4 - Unix Makefiles"
#cmake $SOURCE_DIR -G"Eclipse CDT4 - Unix Makefiles" \
# -DCMAKE_ECLIPSE_VERSION="3.7" $CMAKE_OPTIONS
#cmake $SOURCE_DIR -G"Eclipse CDT4 - Unix Makefiles" $CMAKE_OPTIONS
cmake $SOURCE_DIR $CMAKE_OPTIONS
elif [ "$SYSTEM"x = "Darwin"x ]
then
#echo "OS is Mac OS X"
#cmake $SOURCE_DIR -G"Xcode" $CMAKE_OPTIONS
#cmake $SOURCE_DIR -G"Eclipse CDT4 - Unix Makefiles" $CMAKE_OPTIONS
#cmake $SOURCE_DIR -G"Eclipse CDT4 - Unix Makefiles" \
# -DCMAKE_ECLIPSE_VERSION="3.7" $CMAKE_OPTIONS
cmake $SOURCE_DIR $CMAKE_OPTIONS
fi
exit 0
# not workable yet
ARGS=`getopt -o "hdp:ot" -l "help,debug,prefix:,demo,test" -n "getopt.sh" -- "$@"`
if [ $? != 0 ]; then echo "Terminating..." >&2; exit 2; fi
eval set -- "$ARGS"
while true; do
case $1 in
-h|--help)
print_help
shift
exit 0
;;
-d|--debug)
CMAKE_OPTIONS="$CMAKE_OPTIONS -DCMAKE_BUILD_TYPE=Debug"
shift
;;
-p|--prefix)
PREFIX="$2"
shift 2
;;
-o|--demo)
CMAKE_OPTIONS="$CMAKE_OPTIONS -DWITH_ALL_DEMOS=True"
shift
;;
-t|--test)
CMAKE_OPTIONS="$CMAKE_OPTIONS -DWITH_UNIT_TEST=True"
shift
;;
*)
echo "Wrong parameter!"
exit 3
;;
esac
done
echo $CMAKE_OPTIONS