-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathconfig
executable file
·102 lines (93 loc) · 2.79 KB
/
config
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
96
97
98
99
100
101
102
#!/bin/bash
function print_prompt
{
cat << CONFEOF
Usage: $0 [OPTION]... [VAR=VALUE]...
Configuration:
--help display this help and exit
--debug build for debug
--test build unit-tests
--build-dir=DIR build directory
--prefix=PREFIX install prefix
--cmake-modules=DIR directory of cmake modules file exist
--find-root-path=DIR root dir for search dependencies libs
--svc-log-level=* log level of flora service(verbose|debug|info|warning|error|none)
--cli-log-level=* log level of flora client(verbose|debug|info|warning|error|none)
--use-gcc force use gcc compiler (in macosx)
Dependencies:
--mutils=DIR specify mutils install dir
--ncurses=DIR specify ncurses install dir
--gtest=DIR specify gtest install dir
Cross Compile:
--toolchain=DIR toolchain install dir
--cross-prefix=PREFIX compiler name prefix
CONFEOF
}
builddir="build"
cmake_modules_dir="cmake"
CMAKE_ARGS=
for conf_opt
do
case $conf_opt in
*=?*) conf_optarg=`expr "X$conf_opt" : '[^=]*=\(.*\)'` ;;
*) conf_optarg= ;;
esac
case $conf_opt in
--help)
print_prompt
exit 0
;;
--debug)
CMAKE_ARGS=(${CMAKE_ARGS[@]} -DBUILD_DEBUG=ON)
;;
--test)
CMAKE_ARGS=(${CMAKE_ARGS[@]} -DBUILD_TEST=ON)
;;
--build-dir=*)
builddir=$conf_optarg
;;
--prefix=*)
CMAKE_ARGS=(${CMAKE_ARGS[@]} -DCMAKE_INSTALL_PREFIX=$conf_optarg)
;;
--cmake-modules=*)
cmake_modules_dir=$conf_optarg
;;
--svc-log-level=*)
CMAKE_ARGS=(${CMAKE_ARGS[@]} -DSVC_LOGLEVEL=$conf_optarg)
;;
--cli-log-level=*)
CMAKE_ARGS=(${CMAKE_ARGS[@]} -DCLI_LOGLEVEL=$conf_optarg)
;;
--use-gcc)
CMAKE_ARGS=(${CMAKE_ARGS[@]} -DUSE_GCC=ON)
;;
--mutils=*)
CMAKE_ARGS=(${CMAKE_ARGS[@]} -DmutilsPrefix=$conf_optarg)
;;
--ncurses=*)
CMAKE_ARGS=(${CMAKE_ARGS[@]} -DncursesPrefix=$conf_optarg)
;;
--gtest=*)
CMAKE_ARGS=(${CMAKE_ARGS[@]} -DgtestPrefix=$conf_optarg)
;;
--toolchain=*)
CMAKE_ARGS=(${CMAKE_ARGS[@]} -DTOOLCHAIN_HOME=$conf_optarg)
CROSS_COMPILE=yes
;;
--cross-prefix=*)
CMAKE_ARGS=(${CMAKE_ARGS[@]} -DCROSS_PREFIX=$conf_optarg)
;;
--find-root-path=*)
CMAKE_ARGS=(${CMAKE_ARGS[@]} -DCMAKE_FIND_ROOT_PATH=$conf_optarg)
;;
esac
done
CMAKE_ARGS=(${CMAKE_ARGS[@]} -DCUSTOM_CMAKE_MODULES=$cmake_modules_dir)
CUR_DIR=`pwd`
if [ x$CROSS_COMPILE = x"yes" ]; then
CMAKE_ARGS=(${CMAKE_ARGS[@]} -DCMAKE_TOOLCHAIN_FILE=$cmake_modules_dir/toolchain.cmake)
fi
mkdir -p $builddir
cd $builddir
cmake $CUR_DIR \
${CMAKE_ARGS[@]}