2019-07-21 06:59:35 +00:00
|
|
|
#!/bin/bash
|
|
|
|
## Author: Shaun Reed | Contact: shaunrd0@gmail.com | URL: www.shaunreed.com ##
|
|
|
|
## A custom bash script for building cmake projects. ##
|
|
|
|
## Intended to be ran in root directory of the project alongside CMakeLists ##
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
# Infinite while loop - break on conditions
|
|
|
|
while true
|
|
|
|
do
|
|
|
|
|
|
|
|
printf "\nEnter 1 to build, 2 to cleanup previous build, 0 to exit.\n"
|
|
|
|
read bChoice
|
|
|
|
|
2019-07-28 05:16:23 +00:00
|
|
|
if [ $bChoice -eq 1 ] # Build project
|
2019-07-21 06:59:35 +00:00
|
|
|
then
|
|
|
|
mkdir build
|
|
|
|
(cd build && cmake .. && cmake --build .)
|
2019-07-28 05:16:23 +00:00
|
|
|
elif [ $bChoice -eq 2 ] ; then # Cleanup build
|
2019-07-21 06:59:35 +00:00
|
|
|
rm -Rv build/*
|
2019-07-28 05:16:23 +00:00
|
|
|
elif [ $bChoice -eq 0 ] ; then # Exit script
|
2019-07-21 06:59:35 +00:00
|
|
|
break
|
2019-07-28 05:16:23 +00:00
|
|
|
else
|
|
|
|
continue
|
2019-07-21 06:59:35 +00:00
|
|
|
fi
|
2019-07-28 05:16:23 +00:00
|
|
|
|
2019-07-21 06:59:35 +00:00
|
|
|
done
|
|
|
|
|