-
Notifications
You must be signed in to change notification settings - Fork 1
/
config
executable file
·99 lines (90 loc) · 2.47 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
#!/bin/bash
function print_prompt
{
cat << CONFEOF
Usage: $0 [OPTION]... [VAR=VALUE]...
Configuration:
--help display this help and exit
--debug build for debug
--build-dir=DIR build directory
--build-demo toggle for build demo
--prefix=PREFIX install prefix
--cmake-modules=DIR directory of cmake modules file exist
--find-root-path=DIR root dir for search dependencies libs
--search-node-headers
Dependencies:
--mutils=DIR specify mutils install dir
--flora=DIR specify flora install dir
--iotjs=DIR specify iotjs install dir
--napi=DIR specify napi headers 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)
;;
--build-dir=*)
builddir=$conf_optarg
;;
--prefix=*)
CMAKE_ARGS=(${CMAKE_ARGS[@]} -DCMAKE_INSTALL_PREFIX=$conf_optarg)
;;
--build-demo)
CMAKE_ARGS=(${CMAKE_ARGS[@]} -DBUILD_DEMO=ON)
;;
--cmake-modules=*)
cmake_modules_dir=$conf_optarg
;;
--find-root-path=*)
CMAKE_ARGS=(${CMAKE_ARGS[@]} -DCMAKE_FIND_ROOT_PATH=$conf_optarg)
;;
--mutils=*)
CMAKE_ARGS=(${CMAKE_ARGS[@]} -DmutilsPrefix=$conf_optarg)
;;
--flora=*)
CMAKE_ARGS=(${CMAKE_ARGS[@]} -DfloraPrefix=$conf_optarg)
;;
--iotjs=*)
CMAKE_ARGS=(${CMAKE_ARGS[@]} -DiotjsPrefix=$conf_optarg)
;;
--napi=*)
CMAKE_ARGS=(${CMAKE_ARGS[@]} -DnapiPrefix=$conf_optarg)
;;
--toolchain=*)
CMAKE_ARGS=(${CMAKE_ARGS[@]} -DTOOLCHAIN_HOME=$conf_optarg)
CROSS_COMPILE=yes
;;
--cross-prefix=*)
CMAKE_ARGS=(${CMAKE_ARGS[@]} -DCROSS_PREFIX=$conf_optarg)
;;
--search-node-headers)
CMAKE_ARGS=(${CMAKE_ARGS[@]} -DSEARCH_NODE_HEADERS=ON)
;;
esac
done
CUR_DIR=`pwd`
CMAKE_ARGS=(${CMAKE_ARGS[@]} -DCUSTOM_CMAKE_MODULES=$cmake_modules_dir)
if [ x$CROSS_COMPILE = x"yes" ]; then
CMAKE_ARGS=(${CMAKE_ARGS[@]} -DCMAKE_TOOLCHAIN_FILE=$cmake_modules_dir/toolchain.cmake)
fi
CMAKE_ARGS=(${CMAKE_ARGS[@]} -DBUILD_INDEPENDENT=ON)
mkdir -p $builddir
cd $builddir
cmake $CUR_DIR \
${CMAKE_ARGS[@]}