-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.sh
58 lines (46 loc) · 1.47 KB
/
configure.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
#!/bin/bash
# *** LIBPRIMES 1.0.0 INSTALLER ***
# *** developed by <franzageek> ***
#
# /*************************************************
# * libprimes is a free & open-source project *
# * developed & maintained by <franzageek>. *
# * You can discover it at the following link: *
# * [https://github.com/franzageek/libprimes] *
# * *
# * The code is licensed to you under the *
# * MIT License (https://mit-license.org/). *
# *************************************************/
# Build subdirectory {$CURRENT_DIR/$BUILD_DIR}
BUILD_DIR="build"
# Build configuration [Release||Debug]
BUILD_CONFIG="Release"
# Decide whether or not to run tests [true||false]
RUN_TESTS="true"
echo "// libprimes v1.0.0 //"
echo "// made by <franzageek> //"
for cmd in cmake make ctest; do
if ! command -v $cmd &> /dev/null; then
echo "Error: $cmd is not installed."
exit 1
fi
done
if [ ! -d "$BUILD_DIR" ]; then
mkdir "$BUILD_DIR"
fi
cd "$BUILD_DIR"
if [ $RUN_TESTS == "true" ]; then
cmake -DBUILD_TESTS=ON -DCMAKE_BUILD_TYPE=$BUILD_CONFIG ..
make -j
ctest -VV -j
if [ $? -ne 0 ]; then
echo "One or more tests failed. Aborting installation (build files will be kept)."
exit 1
fi
echo "All tests passed, proceeding."
make install -j
exit 0
fi
cmake -DBUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=$BUILD_CONFIG ..
make install -j
exit 0