-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile.sh
executable file
·127 lines (113 loc) · 2.38 KB
/
compile.sh
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#!/bin/bash
apt-get install cowsay
cowsay "hello motherfucker"
rootDir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
buildDIR="${rootDir}/build"
installDIR="${rootDir}/app"
# delete and re-create build directory at every time
if [ ! -d ${buildDIR} ]; then
mkdir ${buildDIR}
else
rm -r ${buildDIR}
mkdir ${buildDIR}
fi
# delete and re-create install directory at every time
if [ ! -d ${installDIR} ]; then
mkdir ${installDIR}
else
rm -r ${installDIR}
mkdir ${installDIR}
fi
# # create build dir if dows not exists
# if [ ! -d ${buildDIR} ]; then
# mkdir ${buildDIR}
# fi
# # create install dir if dows not exists
# if [ ! -d ${installDIR} ]; then
# mkdir ${installDIR}
# fi
# -----------------------------------
# CONFIGURE
# -----------------------------------
echo ""
echo " Configure Begin "
echo ""
#
# cmake -G "MinGW Makefiles" -S . -B ./build
# cmake -DUSE_MYMATH=OFF -S . -B ./build
cmake -DUSE_MYMATH=ON -S . -B ${buildDIR}
#
echo ""
echo " Configure End "
echo ""
# -----------------------------------
# BUILD
# -----------------------------------
#
echo ""
echo " Build Begin "
echo ""
#
cd ${buildDIR}
cmake --build .
# or
# mingw32-make
cd ${rootDir}
#
echo ""
echo " Build End "
echo ""
# -----------------------------------
# INSTALL
# -----------------------------------
echo ""
echo " Install Begin"
echo ""
#
cd ${buildDIR}
cmake --install . --prefix ${installDIR}
cd ${rootDir}
#
echo ""
echo " Install End "
echo ""
# -----------------------------------
# TEST
# -----------------------------------
echo ""
echo " Test Begin"
echo ""
#
cd ${buildDIR}
ctest -C Debug -VV
#ctest -C Release -VV
# -N : will display the list of tests but not actually run them.
# -C : to specify the configuration type
#
# For more information, check the CMake Documentation or run:
# cmake --help-command enable_testing
# cmake --help-command add_test
# cmake --help-property "<CONFIG>_POSTFIX"
# cmake --help-command set_property
cd ${rootDir}
#
echo ""
echo " Test End "
echo ""
# -----------------------------------
# PACKING
# -----------------------------------
echo ""
echo " PACKING Begin"
echo ""
#
cd ${buildDIR}
cpack -C Debug
#
# To create an archive of the full source tree you would type:
# cpack --config CPackSourceConfig.cmake
cd ${rootDir}
#
echo ""
echo " Test End "
echo ""