Browse Source

standalone

master
Nareshkumar Rao 4 years ago
parent
commit
5f8d458fff
  1. 1
      .gitignore
  2. 18
      build.sh
  3. 9
      toolchain.cmake.template

1
.gitignore

@ -3,3 +3,4 @@ tools/
librealsense/ librealsense/
sysroot-relativelinks.py sysroot-relativelinks.py
toolchain.cmake toolchain.cmake
output

18
build.sh

@ -29,6 +29,7 @@ rsync -avz --rsync-path="sudo rsync" $PI_USER_HOST:/usr/include sysroot/usr/
rsync -avz --rsync-path="sudo rsync" $PI_USER_HOST:/usr/lib sysroot/usr/ rsync -avz --rsync-path="sudo rsync" $PI_USER_HOST:/usr/lib sysroot/usr/
#rsync -avz --rsync-path="sudo rsync" $PI_USER_HOST:/opt/vc sysroot/opt/ #rsync -avz --rsync-path="sudo rsync" $PI_USER_HOST:/opt/vc sysroot/opt/
SYSROOT=$(readlink -f ./sysroot) SYSROOT=$(readlink -f ./sysroot)
if [ ! -f ./sysroot-relativelinks.py ] if [ ! -f ./sysroot-relativelinks.py ]
@ -61,4 +62,19 @@ cmake ../ -DBUILD_EXAMPLES=false \
-DLIBUSB_LIB="${SYSROOT}/usr/lib/aarch64-linux-gnu/libusb-1.0.so.0.2.0" \ -DLIBUSB_LIB="${SYSROOT}/usr/lib/aarch64-linux-gnu/libusb-1.0.so.0.2.0" \
-DCMAKE_TOOLCHAIN_FILE=${CURDIR}/toolchain.cmake -DCMAKE_TOOLCHAIN_FILE=${CURDIR}/toolchain.cmake
make -j14 make -j14
tar cvzf $CURDIR/librealsensecompiled.tar.gz $(find . -name "*.so*")
# Collect built binaries and tar up
mkdir -p $CURDIR/output
make DESTDIR=$CURDIR/output install
cd $CURDIR/output
tar cvzf ./librealsense2_pyrealsense2_aarch64.tar.gz ./*
cd $CURDIR
read -p "Remove generated build files (incl. toolchain, librealsense source and Raspi libraries)? " -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
rm -rf ./sysroot ./tools ./librealsense ./output
fi

9
toolchain.cmake.template

@ -1,13 +1,15 @@
set(CMAKE_SYSTEM_NAME Linux) set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(CMAKE_SYSTEM_PROCESSOR aarch64)
set(CMAKE_CROSSCOMPILING TRUE)
set(CMAKE_SYSROOT TEMPLATESYSROOT)
set(CMAKE_FIND_ROOT_PATH TEMPLATESYSROOT)
set(tools TEMPLATETOOLCHAIN) set(tools TEMPLATETOOLCHAIN)
set(CMAKE_C_COMPILER ${tools}/bin/aarch64-none-linux-gnu-gcc) set(CMAKE_C_COMPILER ${tools}/bin/aarch64-none-linux-gnu-gcc)
set(CMAKE_CXX_COMPILER ${tools}/bin/aarch64-none-linux-gnu-g++) set(CMAKE_CXX_COMPILER ${tools}/bin/aarch64-none-linux-gnu-g++)
set(CMAKE_LIBRARY_ARCHITECTURE aarch64-linux-gnu)
include_directories(SYSTEM TEMPLATESYSROOT/usr/include/aarch64-linux-gnu)
include_directories(SYSTEM TEMPLATESYSROOT/usr/include)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
@ -15,4 +17,3 @@ set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
set(CMAKE_THREAD_LIBS_INIT "-lpthread") set(CMAKE_THREAD_LIBS_INIT "-lpthread")

Loading…
Cancel
Save