-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·87 lines (68 loc) · 1.82 KB
/
build.sh
File metadata and controls
executable file
·87 lines (68 loc) · 1.82 KB
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
#!/bin/bash
set -e
script_dir=$(cd `dirname $0`; pwd)
RELEASE_BUILD=1
CMAKE_OPTIONS=""
# --- usage ---
function usage()
{
cat <<- EOT
Usage: $0 [options]
Options:
-r|release release build (default)
-d|debug debug build
-h|help usage help
Example:
./build.sh -d
EOT
}
# --- end of usage() ---
#---------------------------------#
# Handle command line arguments #
#---------------------------------#
while getopts "rdh" opt
do
case $opt in
r|release)
RELEASE_BUILD=1
;;
d|debug)
RELEASE_BUILD=0
;;
h|help)
usage
exit 0
;;
\?)
usage
exit 1
;;
esac # --- end of case ---
done
if [[ $RELEASE_BUILD -eq 1 ]]; then
CMAKE_OPTIONS="$CMAKE_OPTIONS: -DCMAKE_BUILD_TYPE=Release"
else
CMAKE_OPTIONS="$CMAKE_OPTIONS: -DCMAKE_BUILD_TYPE=Debug"
fi
echo "==== Starting build ===="
rm -rf $script_dir/build
rm -rf $script_dir/dist
mkdir -p $script_dir/build
mkdir -p $script_dir/dist
dist_dir=$script_dir/dist
mkdir -p $dist_dir
mkdir -p $dist_dir/include
mkdir -p $dist_dir/lib
mkdir -p $dist_dir/bin
cd build
cmake $CMAKE_OPTIONS ../src
make -j
mkdir -p $dist_dir/include/org/jinsha/imachine
cp -f ./lib/libimachine.so $dist_dir/lib/libimachine.so
cp -f ../src/org/jinsha/imachine/State.h $dist_dir/include/org/jinsha/imachine/State.h
cp -f ../src/org/jinsha/imachine/Transition.h $dist_dir/include/org/jinsha/imachine/Transition.h
cp -f ../src/org/jinsha/imachine/StateMachine.h $dist_dir/include/org/jinsha/imachine/StateMachine.h
cp -f ../src/org/jinsha/imachine/StateMachineEngine.h $dist_dir/include/org/jinsha/imachine/StateMachineEngine.h
cp -f ./bin/* $dist_dir/bin
cd ..
echo "==== Build finished successfully ===="