-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.bash
More file actions
executable file
·54 lines (44 loc) · 1.4 KB
/
build.bash
File metadata and controls
executable file
·54 lines (44 loc) · 1.4 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
#!/bin/bash
# Define the build directory
BUILD_DIR="build"
VENV_DIR="venv"
# Create a virtual environment
if [ ! -d "$VENV_DIR" ]; then
echo "Creating a virtual environment..."
python3 -m venv "$VENV_DIR"
else
echo "Virtual environment already exists."
fi
# Activate the virtual environment
source "$VENV_DIR/bin/activate"
if [ -f "requirements.txt" ]; then
echo "Checking and installing missing Python packages from requirements.txt..."
# Upgrade pip to the latest version
pip install --upgrade pip
# Read through the requirements.txt and install missing packages
while IFS= read -r package || [ -n "$package" ]; do
if ! pip show "$(echo "$package" | cut -d '=' -f 1)" > /dev/null 2>&1; then
echo "Package '$package' not found. Installing..."
pip install "$package"
else
echo "Package '$package' is already installed."
fi
done < requirements.txt
else
echo "No requirements.txt file found."
fi
# Remove the build directory if it exists
if [ -d "$BUILD_DIR" ]; then
echo "Removing existing build directory..."
rm -rf "$BUILD_DIR"
fi
# Create a new build directory and run CMake commands
echo "Running build tasks..."
cmake -S . -B build
export CTEST_OUTPUT_ON_FAILURE=1
cmake --build build --clean-first
cmake --build build --target test
# Notify that the build is complete
echo "Build completed."
# Start an interactive shell to keep the container open
exec /bin/bash