-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·96 lines (81 loc) · 2.37 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·96 lines (81 loc) · 2.37 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/bash
set -e # Exit on any error
echo "=============================================="
echo " LiDAR-Inertial Odometry Build Script"
echo "=============================================="
# Get number of CPU cores for parallel compilation (use half of available cores)
NPROC=$(($(nproc) / 2))
if [ $NPROC -lt 1 ]; then
NPROC=1
fi
echo "Using $NPROC cores for compilation (half of available)"
# Install system dependencies
echo ""
echo "Step 0: Installing system dependencies..."
echo "========================================"
# Check if running in Docker container
if [ -n "$DOCKER_CONTAINER" ]; then
echo "Running in Docker container - skipping apt updates (dependencies pre-installed)"
else
sudo apt update
sudo apt install -y \
cmake \
build-essential \
libeigen3-dev \
libgl1-mesa-dev \
libglu1-mesa-dev \
libglew-dev \
libyaml-cpp-dev
echo "System dependencies installed successfully!"
fi
# Build third-party dependencies
echo ""
echo "Step 1: Building third-party dependencies..."
echo "=============================================="
# Check if thirdparty directory exists
if [ ! -d "thirdparty" ]; then
echo "Error: thirdparty directory not found!"
echo "Please ensure the thirdparty directory with dependencies exists."
exit 1
fi
# Build Pangolin
echo "Building Pangolin..."
if [ ! -d "thirdparty/pangolin/build" ]; then
mkdir -p thirdparty/pangolin/build
fi
cd thirdparty/pangolin/build
cmake .. \
-DBUILD_EXAMPLES=OFF \
-DBUILD_TOOLS=OFF \
-DBUILD_PYPANGOLIN=OFF \
-DBUILD_PANGOLIN_PYTHON=OFF
make -j$NPROC
cd ../../..
# Header-only libraries (no build needed)
echo "spdlog: header-only library (no build needed)"
# Build main project
echo ""
echo "Step 2: Building main project..."
echo "================================="
# Create build directory for main project
if [ ! -d "build" ]; then
mkdir build
fi
cd build
# Configure and build main project
cmake ..
make -j$NPROC
echo ""
echo "=============================================="
echo " Build completed successfully!"
echo "=============================================="
echo ""
echo "To run the LiDAR-Inertial Odometry system:"
echo " cd build"
echo ""
echo "For R3LIVE dataset:"
echo " ./lio_player /path/to/dataset"
echo ""
echo "Example:"
echo " ./lio_player /home/eugene/data/R3LIVE/hku_main_building"
echo ""