forked from AmokHuginnsson/replxx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-all.sh
executable file
·63 lines (54 loc) · 1.35 KB
/
build-all.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
#! /bin/sh
while [ ${#} -gt 0 ] ; do
if [ \( ${#} -gt 0 \) -a \( "x${1}" = "xpurge" \) ] ; then
/bin/rm -rf build
shift
continue
fi
if [ \( ${#} -gt 0 \) -a \( "x${1}" = "xsudo" \) ] ; then
sudo="sudo"
shift
continue
fi
if [ \( ${#} -gt 0 \) -a \( "x${1}" = "xmsvcxx" \) ] ; then
msvcxx=1
shift
continue
fi
if [ \( ${#} -gt 0 \) -a \( "x${1}" = "xstatic-only" \) ] ; then
staticOnly="-DBUILD_SHARED_LIBS=OFF"
shift
continue
fi
if [ \( ${#} -gt 0 \) -a \( "x${1}" = "xshared-only" \) ] ; then
sharedOnly="-DBUILD_STATIC_LIBS=OFF -DREPLXX_BuildExamples=OFF"
shift
continue
fi
if [ ${#} -gt 0 ] ; then
installPrefix="-DCMAKE_INSTALL_PREFIX=${1}"
shift
continue
fi
done
build_target() {
target="${1}"
mkdir -p "build/${target}"
cd "build/${target}"
if [ "x${msvcxx}" = "x1" ] ; then
CMAKE="/cygdrive/c/Program Files/CMake/bin/cmake.exe"
"${CMAKE}" ${sharedOnly} ${staticOnly} -G 'Visual Studio 14' ${installPrefix} ../../
"${CMAKE}" --build . --config Debug
"${CMAKE}" --build . --config Release
"${CMAKE}" --build . --config Debug --target Install
"${CMAKE}" --build . --config Release --target Install
else
cmake -DCMAKE_BUILD_TYPE=${target} ${sharedOnly} ${staticOnly} ${installPrefix} ../../
make
${sudo} make install
fi
cd ../..
}
for target in debug release ; do
build_target "${target}"
done