Skip to content

Commit

Permalink
allow build script customizations (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
copperlight authored Dec 3, 2024
1 parent fac07e6 commit 63a1ccc
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,21 @@ set -e

# usage: ./build.sh [clean|clean --confirm|skiptest]

BUILD_DIR=cmake-build
# Choose: Debug, Release, RelWithDebInfo and MinSizeRel. Use Debug for asan checking locally.
BUILD_TYPE=Debug
if [[ -z "$BUILD_DIR" ]]; then
BUILD_DIR="cmake-build"
fi

if [[ -z "$BUILD_TYPE" ]]; then
# Choose: Debug, Release, RelWithDebInfo and MinSizeRel. Use Debug for asan checking locally.
BUILD_TYPE="Debug"
fi

BLUE="\033[0;34m"
NC="\033[0m"

if [[ "$1" == "clean" ]]; then
echo -e "${BLUE}==== clean ====${NC}"
rm -rf $BUILD_DIR
rm -rf "$BUILD_DIR"
rm -rf lib/spectator
if [[ "$2" == "--confirm" ]]; then
# remove all packages from the conan cache, to allow swapping between Release/Debug builds
Expand All @@ -34,16 +39,16 @@ fi
if [[ ! -d $BUILD_DIR ]]; then
echo -e "${BLUE}==== install required dependencies ====${NC}"
if [[ "$BUILD_TYPE" == "Debug" ]]; then
conan install . --output-folder=$BUILD_DIR --build="*" --settings=build_type=$BUILD_TYPE --profile=./sanitized
conan install . --output-folder="$BUILD_DIR" --build="*" --settings=build_type="$BUILD_TYPE" --profile=./sanitized
else
conan install . --output-folder=$BUILD_DIR --build=missing
conan install . --output-folder="$BUILD_DIR" --build=missing
fi

echo -e "${BLUE}==== install source dependencies ====${NC}"
conan source .
fi

pushd $BUILD_DIR
pushd "$BUILD_DIR"

echo -e "${BLUE}==== configure conan environment to access tools ====${NC}"
source conanbuild.sh
Expand All @@ -56,7 +61,7 @@ echo -e "${BLUE}==== generate build files ====${NC}"
if [[ "$TITUS_SYSTEM_SERVICE" != "ON" ]]; then
TITUS_SYSTEM_SERVICE=OFF
fi
cmake .. -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DTITUS_SYSTEM_SERVICE="$TITUS_SYSTEM_SERVICE"
cmake .. -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE="$BUILD_TYPE" -DTITUS_SYSTEM_SERVICE="$TITUS_SYSTEM_SERVICE"

echo -e "${BLUE}==== build ====${NC}"
cmake --build .
Expand Down

0 comments on commit 63a1ccc

Please sign in to comment.