-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sh
31 lines (25 loc) · 837 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
26
27
28
29
30
31
#!/bin/bash
# Quick-and-dirty build script for the whole project.
# Build directory is used by cmake and make.
# Bin directory is where the project just works.
# Extract binary executable name from the cmake
# This might not take into account different targets.
TARGET_NAME=$(cat CMakeLists.txt | grep "set(TARGET" | awk '{print substr($0, index($0, " ") + 1, index($0, ")") - index($0, " ") - 1);}')
# Create auxillary directories if they are not yet created
if [ ! -d "build" ]; then
mkdir build
fi
if [ ! -d "bin" ]; then
mkdir bin
fi
# Generate project and compile
cd build
cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
make
# Move executable to the bin folder
mv $TARGET_NAME ../bin/
# Move all necessary resources that the app needs to the bin/ directory
cd ..
if [ -d "resources" ]; then
cp -a resources/. bin/
fi