-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
35 lines (26 loc) · 726 Bytes
/
build.sh
File metadata and controls
35 lines (26 loc) · 726 Bytes
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
#!/bin/bash
# Set the build directory
BUILD_DIR="build"
# Check if the first argument is "clean"
if [ "$1" == "--clean" ]; then
echo "Performing a clean build..."
# If the build directory exists, delete it for a clean build
if [ -d "$BUILD_DIR" ]; then
rm -rf $BUILD_DIR
echo "Previous build directory deleted."
fi
fi
# Create the build directory if it doesn't exist
if [ ! -d "$BUILD_DIR" ]; then
mkdir $BUILD_DIR
fi
# Navigate to the build directory
cd $BUILD_DIR
# Run CMake to generate Makefiles
cmake .. -G "Unix Makefiles"
# Run make to build the project
make
# Return to the original directory
cd ..
# Print success message
echo "Build complete. Executable is in the $BUILD_DIR directory."