-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_lcd_cpp.sh
More file actions
executable file
·66 lines (53 loc) · 1.67 KB
/
build_lcd_cpp.sh
File metadata and controls
executable file
·66 lines (53 loc) · 1.67 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
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
# build_lcd_cpp.sh - Build script for LCD C++ application on the current system
echo "=== Building LCD C++ Application ==="
# Get the current working directory
CURRENT_DIR=$(pwd)
PROJECT_ROOT="$CURRENT_DIR"
echo "Project root: $PROJECT_ROOT"
# Check if we're on a Raspberry Pi or similar ARM system
ARCH=$(uname -m)
if [[ $ARCH == "arm"* || $ARCH == "aarch64" ]]; then
IS_RASPBERRY_PI=true
echo "Detected ARM architecture: $ARCH - enabling GPIO support"
else
IS_RASPBERRY_PI=false
echo "Detected architecture: $ARCH - GPIO support will be disabled"
fi
# Navigate to the project directory
cd "$PROJECT_ROOT/spot_lcd_cpp"
# Create build directory
BUILD_DIR="build"
if [ -d "$BUILD_DIR" ]; then
echo "Removing existing build directory..."
rm -rf "$BUILD_DIR"
fi
mkdir -p "$BUILD_DIR"
cd "$BUILD_DIR"
# Determine build options based on platform
if [ "$IS_RASPBERRY_PI" = true ]; then
# On Raspberry Pi, enable GPIO support
echo "Configuring for Raspberry Pi with GPIO support..."
cmake .. -DENABLE_GPIO=ON -DENABLE_ROS2=OFF -DCMAKE_BUILD_TYPE=Release
else
# On non-Raspberry Pi systems, disable GPIO support
echo "Configuring for non-Raspberry Pi system without GPIO support..."
cmake .. -DENABLE_GPIO=OFF -DENABLE_ROS2=OFF -DCMAKE_BUILD_TYPE=Release
fi
if [ $? -ne 0 ]; then
echo "Error: CMake configuration failed!"
exit 1
fi
# Build the project
echo "Building the project..."
JOBS=$(nproc)
echo "Using $JOBS parallel jobs..."
make -j$JOBS
if [ $? -ne 0 ]; then
echo "Error: Build failed!"
exit 1
fi
echo "Build completed successfully!"
echo "Built executables:"
ls -la ./spot_lcd_cpp_*
echo "=== Build process finished ==="