-
Notifications
You must be signed in to change notification settings - Fork 33
/
build_jetson.sh
executable file
·60 lines (51 loc) · 2.19 KB
/
build_jetson.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
52
53
54
55
56
57
58
59
60
sudo apt-get install clang-format
clang-format -style=llvm -dump-config > .clang-format
if ! command -v pip &> /dev/null; then
# If pip is not available, download and install pip
curl -O https://bootstrap.pypa.io/get-pip.py
python3 get-pip.py
fi
pip install pre-commit
pre-commit install
chmod +x build_scripts/build_dependencies_jetson_cuda.sh
sudo ./build_scripts/build_dependencies_jetson_cuda.sh
if nvcc --version; then
USER_NAME=$(whoami)
TARGET_USER="$USER_NAME"
TARGET_HOME=$(eval echo ~$TARGET_USER)
# Append lines to the target user's ~/.bashrc
if ! grep -qxF 'export VCPKG_FORCE_SYSTEM_BINARIES=1' $TARGET_HOME/.bashrc; then
echo 'export VCPKG_FORCE_SYSTEM_BINARIES=1' | sudo -u $TARGET_USER tee -a $TARGET_HOME/.bashrc
echo "VCPKG_FORCE_SYSTEM_BINARIES flag added in .bashrc"
else
echo "VCPKG_FORCE_SYSTEM_BINARIES flag already exists in .bashrc"
fi
if ! grep -qxF 'export PATH=/usr/local/cuda/bin${PATH:+:${PATH}}' $TARGET_HOME/.bashrc; then
echo 'export PATH=/usr/local/cuda/bin${PATH:+:${PATH}}' | sudo -u $TARGET_USER tee -a $TARGET_HOME/.bashrc
echo "CUDA Binary Path added to .bashrc"
else
echo "CUDA Binary Path already exists in .bashrc"
fi
if ! grep -qxF 'export LD_LIBRARY_PATH=/usr/local/cuda/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}' $TARGET_HOME/.bashrc; then
echo 'export LD_LIBRARY_PATH=/usr/local/cuda/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}' | sudo -u $TARGET_USER tee -a $TARGET_HOME/.bashrc
echo "CUDA Library Path added to .bashrc"
else
echo "CUDA Library Path already exists in .bashrc"
fi
echo "Appended paths to ~/.bashrc and saved changes."
source ~/.bashrc
echo "Reloaded ~/.bashrc"
fi
if [[ $1 == "--build-doc" ]]; then
chmod +x build_documentation.sh
./build_documentation.sh
fi
cd vcpkg
./bootstrap-vcpkg.sh
./vcpkg integrate install
cd ..
CMAKE_THCOUNT=$(sh ./checkProc.sh)
mkdir -p _build
cd _build
export VCPKG_FORCE_SYSTEM_BINARIES=1 && export VCPKG_OVERLAY_PORTS=../thirdparty/custom-overlay && cmake -B . -DENABLE_ARM64=ON -DENABLE_WINDOWS=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo ../base -DCMAKE_TOOLCHAIN_FILE=../vcpkg/scripts/buildsystems/vcpkg.cmake
cmake --build . -- -j "$(($(nproc) - 1))"