-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·96 lines (83 loc) · 2.24 KB
/
build.sh
File metadata and controls
executable file
·96 lines (83 loc) · 2.24 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 " Lightweight VIO Build Script with ThirdParty"
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 "========================================"
sudo apt update
sudo apt install -y \
cmake \
build-essential \
libopencv-dev \
libeigen3-dev \
libgl1-mesa-dev \
libglu1-mesa-dev \
libglew-dev \
libyaml-cpp-dev \
libgflags-dev \
libgoogle-glog-dev \
libatlas-base-dev \
libsuitesparse-dev
echo "System dependencies installed successfully!"
# Build third-party dependencies
echo ""
echo "Step 1: Building third-party dependencies..."
echo "=============================================="
# Build Ceres Solver
echo "Building Ceres Solver..."
if [ ! -d "thirdparty/ceres-solver/build" ]; then
mkdir -p thirdparty/ceres-solver/build
fi
cd thirdparty/ceres-solver/build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_TESTING=OFF \
-DBUILD_EXAMPLES=OFF \
-DBUILD_BENCHMARKS=OFF \
-DUSE_TBB=OFF \
-DUSE_OPENMP=ON \
-DSUITESPARSE=OFF \
-DCXSPARSE=OFF \
-DMINIGLOG=ON \
-DEIGENSPARSE=ON
make -j$NPROC
cd ../../..
# Build Pangolin
echo "Building Pangolin..."
if [ ! -d "thirdparty/pangolin/build" ]; then
mkdir -p thirdparty/pangolin/build
fi
cd thirdparty/pangolin/build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_EXAMPLES=OFF \
-DBUILD_TOOLS=OFF \
-DBUILD_PYPANGOLIN=OFF \
-DBUILD_PANGOLIN_PYTHON=OFF
make -j$NPROC
cd ../../..
# 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 .. -DCMAKE_BUILD_TYPE=Release
make -j$NPROC
echo ""
echo "=============================================="
echo " Build completed successfully!"
echo "=============================================="