-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcleanbuild.sh
executable file
·51 lines (41 loc) · 1.26 KB
/
cleanbuild.sh
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
#!/bin/bash
# Set the environment variables to use clang
export CC="/usr/bin/clang-19"
export CXX="/usr/bin/clang++-19"
# Define the build directory (assuming you're using an out-of-source build)
buildDir="tests/release_bin"
rm "CMakeCache.txt"
rm "cmale_install.cmake"
rm "ClangExeProject.sln"
rm "build.ninja"
rm "CMakeFiles/*"
rm ".ninja_deps"
rm ".ninja_log"
rm "build.ninja"
rm "cmake_install.cmake"
# If the build directory exists, delete it to clean the build
if [ -d "$buildDir" ]; then
echo "Cleaning the build directory..."
rm -rf "$buildDir"
else
echo "Build directory not found. Creating a new one."
fi
# Create the build directory
mkdir -p "$buildDir"
# Navigate to the build directory
cd "$buildDir" || exit
# Run cmake to configure the project with Ninja (or MinGW Makefiles) and clang
cmake -G "Ninja" ..
# Run the build (this will compile everything from scratch)
cmake --build .. --config Release
# Loop through each file in the current directory
for file in *; do
# Check if the file is an executable and a regular file (not a directory or symlink)
if [[ -x "$file" && -f "$file" ]]; then
echo "Executing $file..."
./"$file"
echo "$file finished execution."
fi
done
# Navigate back to the original directory after building
cd ..