-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·111 lines (96 loc) · 1.97 KB
/
build.sh
File metadata and controls
executable file
·111 lines (96 loc) · 1.97 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/bin/bash
__BuildOS=""
__CleanBuild=0
case $OSTYPE in
msys|cygwin)
__BuildOS=win
;;
*)
__BuildOS=linux
;;
esac
__BuildArch=x64
__BuildType=Debug
__COMPILER=gcc
__CC=gcc
__CXX=g++
for i in "$@"
do
lowerI=${i,,}
case $lowerI in
-?|-h|--help)
usage
exit 1
;;
x64)
__BuildArch=x64
;;
x86)
__BuildArch=x86
;;
debug)
__BuildType=Debug
;;
release)
__BuildType=Release
;;
iaca)
__BuildType=IACA
;;
clang)
__COMPILER=clang
__CC=clang-6.0
__CXX=clang++-6.0
;;
gcc)
__COMPILER=gcc
__CC=gcc
__CXX=g++
;;
test)
__RunTests=1
;;
clean)
__CleanBuild=1
;;
*)
__UnprocessedBuildArgs="$__UnprocessedBuildArgs $i"
esac
done
if [ $__CleanBuild == "1" ]; then
rm -rf dist
rm -rf build-{debug,release}
exit 0
fi
__DistDir=build-${__BuildType,,}-${__COMPILER}
mkdir -p ${__DistDir}
pushd ${__DistDir}
if [ $__BuildOS == "win" ]; then
cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_BUILD_TYPE=${__BuildType^^} ..
vs=$(/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/Installer/vswhere.exe -latest | grep installationPath | cut -f 2- -d : -d " ")
__MSBuildExePath="$vs/MSBuild/15.0/Bin/MSBuild.exe"
if [ ! -f "$__MSBuildExePath" ]; then
echo Error: Could not find MSBuild.exe
exit 1
fi
${__MSBuildExePath} -p:Platform=${__BuildArch} -p:Configuration=${__BuildType} dodo.sln
build_result=$?
fi
if [ $__BuildOS == "linux" ]; then
CC=${__CC} CXX=${__CXX} cmake -DCMAKE_BUILD_TYPE=${__BuildType^^} ..
make -j4
build_result=$?
fi
build_result=$?
if [ "$__RunTests" == "1" ]; then
./tests/bitgoo_tests
fi
# Build complete
if [ ${build_result} == 0 ]; then
echo bitgoo successfully built. ✔
echo "binaries are available at ${__DistDir}"
else
echo "build failed miserably (${build_result}), you suck, 💩💩💩"
exit $build_result
fi
popd