Older/resources/build.sh
2025-02-26 13:26:50 +00:00

52 lines
949 B
Bash
Executable File

#!/bin/bash
base_path=$(pwd)
build_path=${base_path}/build
libraries_root="/opt/Libraries"
if command -v cmake >/dev/null 2>&1; then
cmake_exe=cmake
else
cmake_exe=/opt/Qt/Tools/CMake/bin/cmake
fi
function cmake_scan() {
echo "scanning the project..."
if [ ! -d ${build_path} ]; then
mkdir -p ${build_path}
fi
cd ${build_path}
${cmake_exe} -G Ninja -S ${base_path} -B ${build_path} \
-DCMAKE_BUILD_TYPE=Debug \
-DBOOST_ROOT=${libraries_root}/boost_1_87_0
}
function build() {
echo "building the project..."
if [ ! -f "${build_path}/CMakeCache.txt" ]; then
cmake_scan
fi
if [ $? -ne 0 ]; then
exit 1
fi
${cmake_exe} --build ${build_path} --target all
if [ $? -ne 0 ]; then
exit 1
fi
}
function main() {
local cmd=$1
shift 1
case $cmd in
build)
build
;;
*)
build
;;
esac
}
main $@