Skip to content

Commit

Permalink
* Add linux-armhf and linux-arm64 builds for librealsense and li…
Browse files Browse the repository at this point in the history
…brealsense2 (pull #951)
  • Loading branch information
ICH88 committed Oct 3, 2020
1 parent 30d9922 commit 3d86d0e
Show file tree
Hide file tree
Showing 11 changed files with 96 additions and 15 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,9 @@ jobs:
install: true
script: ./ci/install-travis.sh
- os: linux
env: PROJ=flycapture,libdc1394,libfreenect OS=linux-armhf
env: PROJ=flycapture,libdc1394,libfreenect,librealsense,librealsense2 OS=linux-armhf
install: true
script: ./ci/install-travis.sh
script: ./ci/install-arm.sh
- os: linux
env: PROJ=hdf5 OS=linux-armhf
install: true
Expand Down Expand Up @@ -235,7 +235,7 @@ jobs:
install: true
script: ./ci/install-arm.sh
- os: linux
env: PROJ=flycapture,libdc1394,libfreenect OS=linux-arm64
env: PROJ=flycapture,libdc1394,libfreenect,librealsense,librealsense2 OS=linux-arm64
install: true
script: ./ci/install-arm.sh
- os: linux
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

* Add `linux-armhf` and `linux-arm64` builds for librealsense and librealsense2 ([pull #951](https://github.com/bytedeco/javacpp-presets/pull/951))
* License default builds of FFmpeg under LGPL v3 and move GPL-enabled builds to `-gpl` extension ([pull #950](https://github.com/bytedeco/javacpp-presets/pull/950))
* Upgrade presets for DNNL 1.6.3, NumPy 1.19.2, Gym 0.17.3, TensorFlow 1.15.4, ONNX Runtime 1.5.1, Qt 5.15.1, cpu_features 0.5.0, and their dependencies

Expand Down
12 changes: 10 additions & 2 deletions ci/install-arm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,23 @@ if [[ "$PROJ" =~ cuda ]]; then
docker exec -ti $DOCKER_CONTAINER_ID /bin/bash -xec "for f in /usr/local/cuda/lib64/*.so.10; do ln -s \$f \${f:0:-1}1; done"
fi

if [ "$OS" == "linux-arm64" ]; then
if [[ "$PROJ" =~ flycapture ]]; then
if [[ "$PROJ" =~ flycapture ]]; then
if [ "$OS" == "linux-arm64" ]; then
if [[ $(find $HOME/downloads/flycapture.2.13.3.31_arm64.tar.gz -type f -size +1000000c 2>/dev/null) ]]; then
echo "Found flycap-arm64 in cache and size seems ok"
else
echo "Downloading flycap-arm64 as not found in cache or too small"
python $TRAVIS_BUILD_DIR/ci/gDownload.py 1LhnuRMT3urYsApCcuBEcaotGRK8h4kJv $HOME/downloads/flycapture.2.13.3.31_arm64.tar.gz
fi
cp $HOME/downloads/flycapture.2.13.3.31_arm64.tar.gz $TRAVIS_BUILD_DIR/downloads/
elif [ "$OS" == "linux-armhf" ]; then
if [[ $(find $HOME/downloads/flycapture.2.13.3.31_armhf.tar.gz -type f -size +1000000c 2>/dev/null) ]]; then
echo "Found flycap-armhf in cache and size seems ok"
else
echo "Downloading flycap-armhf as not found in cache or too small"
python $TRAVIS_BUILD_DIR/ci/gDownload.py 16NuUBs2MXQpVYqzDCEr9KdMng-6rHuDI $HOME/downloads/flycapture.2.13.3.31_armhf.tar.gz
fi
cp $HOME/downloads/flycapture.2.13.3.31_armhf.tar.gz $TRAVIS_BUILD_DIR/downloads/
fi
fi

Expand Down
2 changes: 1 addition & 1 deletion libfreenect/cppbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ case $PLATFORM in
;;
linux-armhf)
cd ../libusb-$LIBUSB_VERSION
CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ CFLAGS="-march=armv6 -marm -mfpu=vfp -mfloat-abi=hard" CXXFLAGS="-march=armv6 -marm -mfpu=vfp -mfloat-abi=hard" CPPFLAGS="-march=armv6 -marm -mfpu=vfp -mfloat-abi=hard" ./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --host=arm-linux-gnueabihf --disable-udev
CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ ./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --host=arm-linux-gnueabihf --disable-udev
make -j $MAKEJ
make install
cd ../libfreenect-$LIBFREENECT_VERSION
Expand Down
30 changes: 25 additions & 5 deletions librealsense/cppbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,33 @@ cd librealsense-$LIBREALSENSE_VERSION
patch -Np1 --binary < ../../../librealsense.patch || true

case $PLATFORM in
linux-armhf)
cd ../libusb-$LIBUSB_VERSION
CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ ./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --host=arm-linux-gnueabihf --disable-udev
make -j $MAKEJ
make install
cd ../librealsense-$LIBREALSENSE_VERSION
PKG_CONFIG_PATH="../lib/pkgconfig" CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ LDFLAGS="-lstdc++" "$CMAKE" -DCMAKE_INSTALL_PREFIX="$INSTALL_PATH" -DLIBUSB1_INCLUDE_DIRS=$INSTALL_PATH/include/libusb-1.0/ -DLIBUSB1_LIBRARY_DIRS=$INSTALL_PATH/lib/ -DBUILD_UNIT_TESTS=OFF .
make -j $MAKEJ
make install/strip
;;
linux-arm64)
cd ../libusb-$LIBUSB_VERSION
CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ CFLAGS="-march=armv8-a -mcpu=cortex-a57" CXXFLAGS="-march=armv8-a -mcpu=cortex-a57" CPPFLAGS="-march=armv8-a -mcpu=cortex-a57" ./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --host=aarch64-linux-gnu --disable-udev
make -j $MAKEJ
make install
cd ../librealsense-$LIBREALSENSE_VERSION
PKG_CONFIG_PATH="../lib/pkgconfig" CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ LDFLAGS="-lstdc++" "$CMAKE" -DCMAKE_INSTALL_PREFIX="$INSTALL_PATH" -DLIBUSB1_INCLUDE_DIRS=$INSTALL_PATH/include/libusb-1.0/ -DLIBUSB1_LIBRARY_DIRS=$INSTALL_PATH/lib/ -DBUILD_UNIT_TESTS=OFF .
make -j $MAKEJ
make install/strip
;;
linux-x86)
cd ../libusb-$LIBUSB_VERSION
CC="gcc -m32" CXX="g++ -m32" ./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --host=i686-linux --disable-udev
make -j $MAKEJ
make install
cd ../librealsense-$LIBREALSENSE_VERSION
CC="gcc -m32" CXX="g++ -m32 --std=c++11" LDFLAGS="-lstdc++" "$CMAKE" -DCMAKE_INSTALL_PREFIX="$INSTALL_PATH" -DLIBUSB1_INCLUDE_DIRS=$INSTALL_PATH/include/libusb-1.0/ -DLIBUSB1_LIBRARY_DIRS=$INSTALL_PATH/lib/ -DBUILD_UNIT_TESTS=OFF .
PKG_CONFIG_PATH="../lib/pkgconfig" CC="gcc -m32" CXX="g++ -m32 --std=c++11" LDFLAGS="-lstdc++" "$CMAKE" -DCMAKE_INSTALL_PREFIX="$INSTALL_PATH" -DLIBUSB1_INCLUDE_DIRS=$INSTALL_PATH/include/libusb-1.0/ -DLIBUSB1_LIBRARY_DIRS=$INSTALL_PATH/lib/ -DBUILD_UNIT_TESTS=OFF .
make -j $MAKEJ
make install/strip
;;
Expand All @@ -40,23 +60,23 @@ case $PLATFORM in
make -j $MAKEJ
make install
cd ../librealsense-$LIBREALSENSE_VERSION
CC="gcc -m64" CXX="g++ -m64 --std=c++11" LDFLAGS="-lstdc++" "$CMAKE" -DCMAKE_INSTALL_PREFIX="$INSTALL_PATH" -DLIBUSB1_INCLUDE_DIRS=$INSTALL_PATH/include/libusb-1.0/ -DLIBUSB1_LIBRARY_DIRS=$INSTALL_PATH/lib/ -DBUILD_UNIT_TESTS=OFF .
PKG_CONFIG_PATH="../lib/pkgconfig" CC="gcc -m64" CXX="g++ -m64 --std=c++11" LDFLAGS="-lstdc++" "$CMAKE" -DCMAKE_INSTALL_PREFIX="$INSTALL_PATH" -DLIBUSB1_INCLUDE_DIRS=$INSTALL_PATH/include/libusb-1.0/ -DLIBUSB1_LIBRARY_DIRS=$INSTALL_PATH/lib/ -DBUILD_UNIT_TESTS=OFF .
make -j $MAKEJ
make install/strip
;;
macosx-x86_64)
"$CMAKE" -DCMAKE_INSTALL_PREFIX="$INSTALL_PATH" -DCMAKE_MACOSX_RPATH=ON -DBUILD_UNIT_TESTS=OFF .
PKG_CONFIG_PATH="../lib/pkgconfig" "$CMAKE" -DCMAKE_INSTALL_PREFIX="$INSTALL_PATH" -DCMAKE_MACOSX_RPATH=ON -DBUILD_UNIT_TESTS=OFF .
make -j $MAKEJ
make install/strip
;;
windows-x86)
"$CMAKE" -G "Visual Studio 15 2017" -DCMAKE_INSTALL_PREFIX="$INSTALL_PATH" -DBUILD_UNIT_TESTS=OFF .
PKG_CONFIG_PATH="../lib/pkgconfig" "$CMAKE" -G "Visual Studio 15 2017" -DCMAKE_INSTALL_PREFIX="$INSTALL_PATH" -DBUILD_UNIT_TESTS=OFF .
MSBuild.exe INSTALL.vcxproj //p:Configuration=Release
cp -a include/* ../include/
cp -a Release/* ../lib/
;;
windows-x86_64)
"$CMAKE" -G "Visual Studio 15 2017 Win64" -DCMAKE_INSTALL_PREFIX="$INSTALL_PATH" -DBUILD_UNIT_TESTS=OFF .
PKG_CONFIG_PATH="../lib/pkgconfig" "$CMAKE" -G "Visual Studio 15 2017 Win64" -DCMAKE_INSTALL_PREFIX="$INSTALL_PATH" -DBUILD_UNIT_TESTS=OFF .
MSBuild.exe INSTALL.vcxproj //p:Configuration=Release
cp -a include/* ../include/
cp -a Release/* ../lib/
Expand Down
16 changes: 15 additions & 1 deletion librealsense/platform/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@
<artifactId>${javacpp.moduleId}</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>${javacpp.moduleId}</artifactId>
<version>${project.version}</version>
<classifier>${javacpp.platform.linux-armhf}</classifier>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>${javacpp.moduleId}</artifactId>
<version>${project.version}</version>
<classifier>${javacpp.platform.linux-arm64}</classifier>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>${javacpp.moduleId}</artifactId>
Expand Down Expand Up @@ -72,7 +84,7 @@
<configuration>
<archive>
<manifestEntries>
<Class-Path>${javacpp.moduleId}.jar ${javacpp.moduleId}-linux-x86.jar ${javacpp.moduleId}-linux-x86_64.jar ${javacpp.moduleId}-macosx-x86_64.jar ${javacpp.moduleId}-windows-x86.jar ${javacpp.moduleId}-windows-x86_64.jar</Class-Path>
<Class-Path>${javacpp.moduleId}.jar ${javacpp.moduleId}-linux-armhf.jar ${javacpp.moduleId}-linux-arm64.jar ${javacpp.moduleId}-linux-x86.jar ${javacpp.moduleId}-linux-x86_64.jar ${javacpp.moduleId}-macosx-x86_64.jar ${javacpp.moduleId}-windows-x86.jar ${javacpp.moduleId}-windows-x86_64.jar</Class-Path>
</manifestEntries>
</archive>
</configuration>
Expand Down Expand Up @@ -117,6 +129,8 @@
<file>${project.build.directory}/${project.artifactId}.jar</file>
<moduleInfoSource>
module org.bytedeco.${javacpp.moduleId}.platform {
requires static org.bytedeco.${javacpp.moduleId}.linux.armhf;
requires static org.bytedeco.${javacpp.moduleId}.linux.arm64;
requires static org.bytedeco.${javacpp.moduleId}.linux.x86;
requires static org.bytedeco.${javacpp.moduleId}.linux.x86_64;
requires static org.bytedeco.${javacpp.moduleId}.macosx.x86_64;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
* @author Jérémy Laviole
*/
@Properties(inherit = javacpp.class, target = "org.bytedeco.librealsense", global = "org.bytedeco.librealsense.global.RealSense", value = {
@Platform(value = {"linux-x86", "macosx-x86", "windows-x86"}, compiler = "cpp11",
@Platform(value = {"linux-armhf", "linux-arm64", "linux-x86", "macosx-x86", "windows-x86"}, compiler = "cpp11",
include = {"<librealsense/rs.h>", "<librealsense/rs.hpp>", "<librealsense/rscore.hpp>", "<librealsense/rsutil.h>"},
link = "realsense@.1"),
@Platform(value = "macosx", preload = "usb-1.0@.0", preloadpath = "/usr/local/lib/") })
Expand Down
20 changes: 20 additions & 0 deletions librealsense2/cppbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,26 @@ patch -Np1 < ../../../librealsense2.patch || true
sedinplace 's/float_t/float/g' `find third-party/libtm/ -type f`

case $PLATFORM in
linux-armhf)
cd ../libusb-$LIBUSB_VERSION
CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ ./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --host=arm-linux-gnueabihf --disable-udev
make -j $MAKEJ
make install
cd ../librealsense-$LIBREALSENSE2_VERSION
CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ "$CMAKE" -DCMAKE_INSTALL_PREFIX="$INSTALL_PATH" -DLIBUSB_INC=$INSTALL_PATH/include/libusb-1.0/ -DLIBUSB_LIB=$INSTALL_PATH/lib/libusb-1.0.a -DBUILD_UNIT_TESTS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_GRAPHICAL_EXAMPLES=OFF .
make -j $MAKEJ
make install/strip
;;
linux-arm64)
cd ../libusb-$LIBUSB_VERSION
CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ CFLAGS="-march=armv8-a -mcpu=cortex-a57" CXXFLAGS="-march=armv8-a -mcpu=cortex-a57" CPPFLAGS="-march=armv8-a -mcpu=cortex-a57" ./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --host=aarch64-linux-gnu --disable-udev
make -j $MAKEJ
make install
cd ../librealsense-$LIBREALSENSE2_VERSION
CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ "$CMAKE" -DCMAKE_INSTALL_PREFIX="$INSTALL_PATH" -DLIBUSB_INC=$INSTALL_PATH/include/libusb-1.0/ -DLIBUSB_LIB=$INSTALL_PATH/lib/libusb-1.0.a -DBUILD_UNIT_TESTS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_GRAPHICAL_EXAMPLES=OFF .
make -j $MAKEJ
make install/strip
;;
linux-x86)
cd ../libusb-$LIBUSB_VERSION
CC="gcc -m32" CXX="g++ -m32" ./configure --prefix=$INSTALL_PATH --disable-shared --with-pic --host=i686-linux --disable-udev
Expand Down
16 changes: 15 additions & 1 deletion librealsense2/platform/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@
<artifactId>${javacpp.moduleId}</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>${javacpp.moduleId}</artifactId>
<version>${project.version}</version>
<classifier>${javacpp.platform.linux-armhf}</classifier>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>${javacpp.moduleId}</artifactId>
<version>${project.version}</version>
<classifier>${javacpp.platform.linux-arm64}</classifier>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>${javacpp.moduleId}</artifactId>
Expand Down Expand Up @@ -72,7 +84,7 @@
<configuration>
<archive>
<manifestEntries>
<Class-Path>${javacpp.moduleId}.jar ${javacpp.moduleId}-linux-x86.jar ${javacpp.moduleId}-linux-x86_64.jar ${javacpp.moduleId}-macosx-x86_64.jar ${javacpp.moduleId}-windows-x86.jar ${javacpp.moduleId}-windows-x86_64.jar</Class-Path>
<Class-Path>${javacpp.moduleId}.jar ${javacpp.moduleId}-linux-armhf.jar ${javacpp.moduleId}-linux-arm64.jar ${javacpp.moduleId}-linux-x86.jar ${javacpp.moduleId}-linux-x86_64.jar ${javacpp.moduleId}-macosx-x86_64.jar ${javacpp.moduleId}-windows-x86.jar ${javacpp.moduleId}-windows-x86_64.jar</Class-Path>
</manifestEntries>
</archive>
</configuration>
Expand Down Expand Up @@ -117,6 +129,8 @@
<file>${project.build.directory}/${project.artifactId}.jar</file>
<moduleInfoSource>
module org.bytedeco.${javacpp.moduleId}.platform {
requires static org.bytedeco.${javacpp.moduleId}.linux.armhf;
requires static org.bytedeco.${javacpp.moduleId}.linux.arm64;
requires static org.bytedeco.${javacpp.moduleId}.linux.x86;
requires static org.bytedeco.${javacpp.moduleId}.linux.x86_64;
requires static org.bytedeco.${javacpp.moduleId}.macosx.x86_64;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
inherit = javacpp.class,
value = {
@Platform(
value = {"linux-x86", "macosx-x86", "windows-x86"},
value = {"linux-armhf", "linux-arm64", "linux-x86", "macosx-x86", "windows-x86"},
compiler = "cpp11",
include = {
"librealsense2/h/rs_types.h",
Expand Down
4 changes: 4 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,8 @@
<module>flycapture</module>
<module>libdc1394</module>
<module>libfreenect</module>
<module>librealsense</module>
<module>librealsense2</module>
<module>artoolkitplus</module>
<module>chilitags</module>
<module>flandmark</module>
Expand Down Expand Up @@ -1131,6 +1133,8 @@
<module>flycapture</module>
<module>libdc1394</module>
<module>libfreenect</module>
<module>librealsense</module>
<module>librealsense2</module>
<module>artoolkitplus</module>
<module>chilitags</module>
<module>flandmark</module>
Expand Down

0 comments on commit 3d86d0e

Please sign in to comment.