-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·73 lines (63 loc) · 1.65 KB
/
build.sh
File metadata and controls
executable file
·73 lines (63 loc) · 1.65 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
# Exit on error
set -e
# Default build type
BUILD_TYPE="Debug"
BUILD_DIR="build"
CLEAN=false
RUN_TESTS=false
# Parse command line arguments
while [[ $# -gt 0 ]]; do
case $1 in
--release)
BUILD_TYPE="Release"
shift
;;
--clean)
CLEAN=true
shift
;;
--build-dir)
BUILD_DIR="$2"
shift 2
;;
--test)
RUN_TESTS=true
shift
;;
*)
echo "Unknown option: $1"
echo "Usage: $0 [--release] [--clean] [--build-dir <directory>] [--test]"
echo "Options:"
echo " --release Build in Release mode"
echo " --clean Clean build directory before building"
echo " --build-dir Specify build directory (default: build)"
echo " --test Build and run tests"
exit 1
;;
esac
done
# Clean build directory if requested
if [ "$CLEAN" = true ]; then
echo "Cleaning build directory..."
rm -rf "$BUILD_DIR"
fi
# Create build directory if it doesn't exist
if [ ! -d "$BUILD_DIR" ]; then
echo "Creating build directory: $BUILD_DIR"
mkdir -p "$BUILD_DIR"
fi
# Navigate to build directory
cd "$BUILD_DIR"
# Configure CMake
echo "Configuring CMake with build type: $BUILD_TYPE"
cmake -DCMAKE_BUILD_TYPE="$BUILD_TYPE" ..
# Build the project
echo "Building project..."
cmake --build . -- -j$(nproc)
if [ "$RUN_TESTS" = true ]; then
echo "Running tests..."
./editor_test --reporter console -s
./config_test --reporter console -s
fi
echo "Build completed successfully!"