-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_linux.sh
More file actions
36 lines (27 loc) · 829 Bytes
/
build_linux.sh
File metadata and controls
36 lines (27 loc) · 829 Bytes
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
#!/usr/bin/env bash
# Linux build script for WeatherStack Core (SHELL script)
# -------------------------------------------------------
# Options:
# build_linux.sh "path/to/build" Debug/Release
# Example:
# build_linux.sh build Debug
set -e
if [ "$2" != "Debug" ] && [ "$2" != "Release" ]; then
echo "$2 must be either Debug or Release"
exit 1
fi
if [ ! -d "$1" ]; then
echo "Creating build path at $1"
mkdir -p "$1" || { echo "Failed to create directory at $1"; exit 1; }
fi
cd "$1" || exit 1
if [ "$2" = "Debug" ]; then
echo "Building with Debug configuration"
cmake .. -DCMAKE_BUILD_TYPE=Debug
cmake --build . -- -j$(nproc)
elif [ "$2" = "Release" ]; then
echo "Building with Release configuration"
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build . -- -j$(nproc)
fi
cd ..