-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake
executable file
·50 lines (38 loc) · 942 Bytes
/
make
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
#!/bin/bash
# Initialization
PROJECT_NAME="cpp-codebase"
BUILD_DIR="build"
# Create the build directory if it doesn't exist
if [ ! -d "$BUILD_DIR" ]; then
echo "Creating build directory..."
mkdir "$BUILD_DIR"
fi
# Navigate into the build directory
cd "$BUILD_DIR" || exit
# Run CMake to configure the project
echo "Configuring the project..."
cmake ..
# Check if the configuration was successful
if [ $? -ne 0 ]; then
echo "CMake configuration failed!"
exit 1
fi
# Build the project
echo "Building the project..."
cmake --build .
# Check if the build was successful
if [ $? -ne 0 ]; then
echo "Build failed!"
exit 1
fi
echo "Build completed successfully!"
# Separate the build from the output
echo "----------------------------------------"
# Run the executable if it exists
EXECUTABLE="./output"
if [ -f "$EXECUTABLE" ]; then
$EXECUTABLE
else
echo "Executable 'output' not found!"
exit 1
fi