diff --git a/librealsense2/cppbuild.sh b/librealsense2/cppbuild.sh index c29a8d587c4..0cc0a72dbee 100755 --- a/librealsense2/cppbuild.sh +++ b/librealsense2/cppbuild.sh @@ -12,8 +12,8 @@ LIBUSB_VERSION=1.0.22 download https://github.com/IntelRealSense/librealsense/archive/v$LIBREALSENSE2_VERSION.tar.gz librealsense-$LIBREALSENSE2_VERSION.tar.gz download http://sourceforge.net/projects/libusb/files/libusb-1.0/libusb-$LIBUSB_VERSION/libusb-$LIBUSB_VERSION.tar.bz2/download libusb-$LIBUSB_VERSION.tar.bz2 -mkdir -p $PLATFORM -cd $PLATFORM +mkdir -p "$PLATFORM$EXTENSION" +cd "$PLATFORM$EXTENSION" mkdir -p include lib bin INSTALL_PATH=`pwd` echo "Decompressing archives..." @@ -24,6 +24,11 @@ cd librealsense-$LIBREALSENSE2_VERSION patch -Np1 < ../../../librealsense2.patch || true sedinplace 's/float_t/float/g' `find src/tm2/ -type f` +GPU_FLAGS="-DBUILD_WITH_CUDA=OFF" +if [[ "$EXTENSION" == *gpu ]]; then + GPU_FLAGS="-DBUILD_WITH_CUDA=ON" +fi + case $PLATFORM in linux-armhf) cd ../libusb-$LIBUSB_VERSION @@ -41,7 +46,7 @@ case $PLATFORM in make -j $MAKEJ make install cd ../librealsense-$LIBREALSENSE2_VERSION - CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ "$CMAKE" -DCMAKE_BUILD_TYPE=Release -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 . + CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ "$CMAKE" -DCMAKE_BUILD_TYPE=Release -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 $GPU_FLAGS . make -j $MAKEJ make install/strip ;; @@ -61,7 +66,7 @@ case $PLATFORM in make -j $MAKEJ make install cd ../librealsense-$LIBREALSENSE2_VERSION - CC="gcc -m64" CXX="g++ -m64" "$CMAKE" -DCMAKE_BUILD_TYPE=Release -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 . + CC="gcc -m64" CXX="g++ -m64" "$CMAKE" -DCMAKE_BUILD_TYPE=Release -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 $GPU_FLAGS . make -j $MAKEJ make install/strip ;; @@ -87,7 +92,7 @@ case $PLATFORM in cd build export CC="cl.exe" export CXX="cl.exe" - "$CMAKE" -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$INSTALL_PATH" -DBUILD_UNIT_TESTS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_GRAPHICAL_EXAMPLES=OFF .. + "$CMAKE" -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$INSTALL_PATH" -DBUILD_UNIT_TESTS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_GRAPHICAL_EXAMPLES=OFF $GPU_FLAGS .. ninja -j $MAKEJ cd .. cp -a include/* ../include/ diff --git a/librealsense2/platform/gpu/pom.xml b/librealsense2/platform/gpu/pom.xml new file mode 100644 index 00000000000..12feb42722f --- /dev/null +++ b/librealsense2/platform/gpu/pom.xml @@ -0,0 +1,128 @@ + + + 4.0.0 + + + org.bytedeco + javacpp-presets + 1.5.9-SNAPSHOT + ../../ + + + org.bytedeco + librealsense2-platform-gpu + 2.50.0-${project.parent.version} + JavaCPP Presets Platform GPU for librealsense2 + + + librealsense2 + -gpu + + + + + org.bytedeco + javacpp-platform + ${project.parent.version} + + + ${project.groupId} + ${javacpp.moduleId} + ${project.version} + + + ${project.groupId} + ${javacpp.moduleId} + ${project.version} + ${javacpp.platform.linux-arm64} + + + ${project.groupId} + ${javacpp.moduleId} + ${project.version} + ${javacpp.platform.linux-x86_64} + + + ${project.groupId} + ${javacpp.moduleId} + ${project.version} + ${javacpp.platform.windows-x86_64} + + + + + + + maven-jar-plugin + + + default-jar + + + + + ${javacpp.moduleId}.jar + ${javacpp.moduleId}-linux-arm64-gpu.jar + ${javacpp.moduleId}-linux-x86_64-gpu.jar + ${javacpp.moduleId}-windows-x86_64-gpu.jar + + + + + + + empty-javadoc-jar + + jar + + + javadoc + + + + empty-sources-jar + + jar + + + sources + + + + + + org.moditect + moditect-maven-plugin + + + add-module-infos + none + + + add-platform-module-info + package + + add-module-info + + + + + ${project.build.directory}/${project.artifactId}.jar + + module org.bytedeco.${javacpp.moduleId}.platform.gpu { + requires static org.bytedeco.${javacpp.moduleId}.linux.arm64.gpu; + requires static org.bytedeco.${javacpp.moduleId}.linux.x86_64.gpu; + requires static org.bytedeco.${javacpp.moduleId}.windows.x86_64.gpu; + } + + + + + + + + + + + diff --git a/librealsense2/pom.xml b/librealsense2/pom.xml index 16105d31f34..47c7d9a1e07 100644 --- a/librealsense2/pom.xml +++ b/librealsense2/pom.xml @@ -38,8 +38,8 @@ ISO-8859-1 - ${basedir}/cppbuild/${javacpp.platform}/lib/ - ${basedir}/cppbuild/${javacpp.platform}/lib64/ + ${basedir}/cppbuild/${javacpp.platform}${javacpp.platform.extension}/lib/ + ${basedir}/cppbuild/${javacpp.platform}${javacpp.platform.extension}/lib64/ diff --git a/librealsense2/src/main/java/org/bytedeco/librealsense2/presets/realsense2.java b/librealsense2/src/main/java/org/bytedeco/librealsense2/presets/realsense2.java index 94b9ff8c279..4d824df71f5 100644 --- a/librealsense2/src/main/java/org/bytedeco/librealsense2/presets/realsense2.java +++ b/librealsense2/src/main/java/org/bytedeco/librealsense2/presets/realsense2.java @@ -58,7 +58,10 @@ }, link = "realsense2@.2.50" ), - @Platform(value = "macosx", preload = "usb-1.0@.0", preloadpath = "/usr/local/lib/") + @Platform(value = "macosx", preload = "usb-1.0@.0", preloadpath = "/usr/local/lib/"), + @Platform(value = {"linux-arm64", "linux-x86_64", "windows-x86_64"}, + extension = "-gpu" + ) }, target = "org.bytedeco.librealsense2", global = "org.bytedeco.librealsense2.global.realsense2"