49 lines
905 B
Bash
49 lines
905 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
base_path=$(pwd)
|
||
|
libraries_root="/opt/Libraries"
|
||
|
if [ $base_path == /home/* ] || [ -n "${DRONE}" ]; then
|
||
|
build_path=${base_path}/build
|
||
|
else
|
||
|
build_path=/tmp/build
|
||
|
fi
|
||
|
echo "build directory: $build_path"
|
||
|
|
||
|
function cmake_scan() {
|
||
|
if [ ! -d ${build_path} ]; then
|
||
|
mkdir ${build_path}
|
||
|
fi
|
||
|
/opt/Qt/Tools/CMake/bin/cmake \
|
||
|
-G Ninja \
|
||
|
-S ${base_path} \
|
||
|
-B ${build_path} \
|
||
|
-DCMAKE_BUILD_TYPE=Debug \
|
||
|
-DBOOST_ROOT=${libraries_root}/boost_1_82_0
|
||
|
}
|
||
|
|
||
|
function build() {
|
||
|
if [ ! -f "${build_path}/CMakeCache.txt" ]; then
|
||
|
cmake_scan
|
||
|
fi
|
||
|
if [ $? -ne 0 ]; then
|
||
|
exit 1
|
||
|
fi
|
||
|
/opt/Qt/Tools/CMake/bin/cmake \
|
||
|
--build ${build_path} \
|
||
|
--target all
|
||
|
}
|
||
|
|
||
|
function main() {
|
||
|
local cmd=$1
|
||
|
shift 1
|
||
|
case $cmd in
|
||
|
build)
|
||
|
build
|
||
|
;;
|
||
|
*)
|
||
|
build
|
||
|
;;
|
||
|
esac
|
||
|
}
|
||
|
|
||
|
main $@
|