-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·47 lines (36 loc) · 1.12 KB
/
Copy pathrun.sh
File metadata and controls
executable file
·47 lines (36 loc) · 1.12 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
#!/bin/bash
# Iterate over each directory in the current directory
cd "src"
for dir in */; do
# Enter the directory
cd "$dir"
# Check if CMakeLists.txt exists in the directory
if [ -f "CMakeLists.txt" ]; then
echo "Processing directory: $dir"
# Check if the build folder exists
if [ -d "build" ]; then
echo "Build folder exists. Clearing it..."
# Remove the contents of the build folder
rm -rf "build"/*
else
echo "Build folder not found."
fi
# Create a build directory and navigate into it
mkdir -p build && cd build
# Run CMake to generate the build files
cmake -DCMAKE_RULE_MESSAGES=OFF --log-level=ERROR ..
# Compile the project with Make
make
cmake --build .
# Check if the executable exists
if [ -f "run" ]; then
echo "Running program..."
# Run the output program
./run
else
echo "Executable not found. Make sure the project compiled successfully."
fi
cd ..
fi
cd ..
done