-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
25 lines (19 loc) · 877 Bytes
/
build.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
#!/bin/bash
# Reading arguments
testing=$1
# Set /usr/local/lib in the library path
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
# Create build folder
mkdir -p build && cd build
# Configure: Unix Makefiles, Debug enables testing and code coverage
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER=g++-8 -DCMAKE_C_COMPILER=gcc-8 ..
# Build (for Make on Unix equivalent to `make -j $(nproc)`)
# using cmake: cmake --build . --config Debug -- -j8
make -j4
# Testing is performed using CTest, taking full advantage of CMake suite.
# Therefore, testing can be called either using Makefile or ctest. For
# simplicity, I think using Makefile is better, as there are no input
# parameters, only make test. Anyways, ctest could be done using something like:
# OMP_NUM_THREADS=1 ctest --rerun-failed
ctest
[ $? -eq 0 ] && echo "TESTING command was successful" || exit 1