Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DepthAI] Add support for Windows & Android #1441

Merged
merged 5 commits into from
Dec 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 31 additions & 10 deletions .github/workflows/depthai.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,53 @@ env:
CI_DEPLOY_PASSWORD: ${{ secrets.CI_DEPLOY_PASSWORD }}
STAGING_REPOSITORY: ${{ secrets.STAGING_REPOSITORY }}
jobs:
linux-armhf:
# android-arm:
# runs-on: ubuntu-20.04
# steps:
# - uses: bytedeco/javacpp-presets/.github/actions/deploy-ubuntu@actions
android-arm64:
runs-on: ubuntu-20.04
container: ubuntu:bionic
steps:
- uses: bytedeco/javacpp-presets/.github/actions/deploy-ubuntu@actions
linux-arm64:
# android-x86:
# runs-on: ubuntu-20.04
# steps:
# - uses: bytedeco/javacpp-presets/.github/actions/deploy-ubuntu@actions
android-x86_64:
runs-on: ubuntu-20.04
container: ubuntu:bionic
steps:
- uses: bytedeco/javacpp-presets/.github/actions/deploy-ubuntu@actions
linux-x86:
# linux-armhf:
# runs-on: ubuntu-20.04
# steps:
# - uses: bytedeco/javacpp-presets/.github/actions/deploy-ubuntu@actions
linux-arm64:
runs-on: ubuntu-20.04
container: centos:7
steps:
- uses: bytedeco/javacpp-presets/.github/actions/deploy-centos@actions
- uses: bytedeco/javacpp-presets/.github/actions/deploy-ubuntu@actions
# linux-x86:
# runs-on: ubuntu-20.04
# steps:
# - uses: bytedeco/javacpp-presets/.github/actions/deploy-ubuntu@actions
linux-x86_64:
runs-on: ubuntu-20.04
container: centos:7
steps:
- uses: bytedeco/javacpp-presets/.github/actions/deploy-centos@actions
- uses: bytedeco/javacpp-presets/.github/actions/deploy-ubuntu@actions
macosx-x86_64:
runs-on: macos-11
steps:
- uses: bytedeco/javacpp-presets/.github/actions/deploy-macosx@actions
# windows-x86:
# runs-on: windows-2019
# steps:
# - uses: bytedeco/javacpp-presets/.github/actions/deploy-windows@actions
windows-x86_64:
runs-on: windows-2019
steps:
- uses: bytedeco/javacpp-presets/.github/actions/deploy-windows@actions
redeploy:
needs: [linux-armhf, linux-arm64, linux-x86, linux-x86_64, macosx-x86_64]
# needs: [android-arm, android-arm64, android-x86, android-x86_64, linux-armhf, linux-arm64, linux-x86, linux-x86_64, macosx-x86_64, windows-x86, windows-x86_64]
needs: [android-arm64, android-x86_64, linux-arm64, linux-x86_64, macosx-x86_64, windows-x86_64]
runs-on: ubuntu-20.04
steps:
- uses: bytedeco/javacpp-presets/.github/actions/redeploy@actions
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

* Add Android and Windows builds to presets for DepthAI ([pull #1441](https://github.com/bytedeco/javacpp-presets/pull/1441))
* Add presets for SentencePiece 0.1.99 ([pull #1384](https://github.com/bytedeco/javacpp-presets/pull/1384))
* Refactor and improve presets for PyTorch ([pull #1360](https://github.com/bytedeco/javacpp-presets/pull/1360))
* Include `mkl_lapack.h` header file in presets for MKL ([issue #1388](https://github.com/bytedeco/javacpp-presets/issues/1388))
Expand Down
6 changes: 3 additions & 3 deletions depthai/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,20 @@ We can use [Maven 3](http://maven.apache.org/) to download and install automatic
<modelVersion>4.0.0</modelVersion>
<groupId>org.bytedeco.depthai</groupId>
<artifactId>examples</artifactId>
<version>1.5.9</version>
<version>1.5.10-SNAPSHOT</version>
<properties>
<exec.mainClass>CameraPreviewExample</exec.mainClass>
</properties>
<dependencies>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>depthai-platform</artifactId>
<version>2.21.2-1.5.9</version>
<version>2.21.2-1.5.10-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>opencv-platform</artifactId>
<version>4.7.0-1.5.9</version>
<version>4.8.1-1.5.10-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
Expand Down
34 changes: 34 additions & 0 deletions depthai/cppbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,26 @@ fi
export OpenCV_DIR="$OPENCV_PATH/lib/cmake/opencv4"

case $PLATFORM in
android-arm)
sedinplace 's:BUILD_SHARED_LIBS=ON:BUILD_SHARED_LIBS=OFF:g' cmake/Hunter/config.cmake
"$CMAKE" -DCMAKE_TOOLCHAIN_FILE=${PLATFORM_ROOT}/build/cmake/android.toolchain.cmake -DOpenCV_DIR=$OPENCV_PATH/sdk/native/jni/abi-armeabi-v7a/ -DANDROID_ABI=armeabi-v7a -DANDROID_PLATFORM=24 -DCMAKE_INSTALL_PREFIX="$INSTALL_PATH" -DCMAKE_INSTALL_LIBDIR="lib" -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release -DDEPTHAI_OPENCV_SUPPORT=ON .
"$CMAKE" --build . --config Release --target install/strip -j $MAKEJ
;;
android-arm64)
sedinplace 's:BUILD_SHARED_LIBS=ON:BUILD_SHARED_LIBS=OFF:g' cmake/Hunter/config.cmake
"$CMAKE" -DCMAKE_TOOLCHAIN_FILE=${PLATFORM_ROOT}/build/cmake/android.toolchain.cmake -DOpenCV_DIR=$OPENCV_PATH/sdk/native/jni/abi-arm64-v8a/ -DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=24 -DCMAKE_INSTALL_PREFIX="$INSTALL_PATH" -DCMAKE_INSTALL_LIBDIR="lib" -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release -DDEPTHAI_OPENCV_SUPPORT=ON .
"$CMAKE" --build . --config Release --target install/strip -j $MAKEJ
;;
android-x86)
sedinplace 's:BUILD_SHARED_LIBS=ON:BUILD_SHARED_LIBS=OFF:g' cmake/Hunter/config.cmake
"$CMAKE" -DCMAKE_TOOLCHAIN_FILE=${PLATFORM_ROOT}/build/cmake/android.toolchain.cmake -DOpenCV_DIR=$OPENCV_PATH/sdk/native/jni/abi-x86/ -DANDROID_ABI=x86 -DANDROID_PLATFORM=24 -DCMAKE_INSTALL_PREFIX="$INSTALL_PATH" -DCMAKE_INSTALL_LIBDIR="lib" -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release -DDEPTHAI_OPENCV_SUPPORT=ON .
"$CMAKE" --build . --config Release --target install/strip -j $MAKEJ
;;
android-x86_64)
sedinplace 's:BUILD_SHARED_LIBS=ON:BUILD_SHARED_LIBS=OFF:g' cmake/Hunter/config.cmake
"$CMAKE" -DCMAKE_TOOLCHAIN_FILE=${PLATFORM_ROOT}/build/cmake/android.toolchain.cmake -DOpenCV_DIR=$OPENCV_PATH/sdk/native/jni/abi-x86_64/ -DANDROID_ABI=x86_64 -DANDROID_PLATFORM=24 -DCMAKE_INSTALL_PREFIX="$INSTALL_PATH" -DCMAKE_INSTALL_LIBDIR="lib" -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release -DDEPTHAI_OPENCV_SUPPORT=ON .
"$CMAKE" --build . --config Release --target install/strip -j $MAKEJ
;;
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
Expand Down Expand Up @@ -107,6 +127,20 @@ case $PLATFORM in
make install/strip
install_name_tool -change /usr/local/opt/libusb/lib/libusb-1.0.0.dylib @rpath/libusb-1.0.0.dylib ../lib/libdepthai-core.dylib
;;
windows-x86)
export CC="cl.exe"
export CXX="cl.exe"
sedinplace 's:BUILD_SHARED_LIBS=ON:BUILD_SHARED_LIBS=OFF:g' cmake/Hunter/config.cmake
"$CMAKE" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$INSTALL_PATH" -DCMAKE_INSTALL_LIBDIR="lib" -DDEPTHAI_ENABLE_BACKWARD=OFF -DBUILD_SHARED_LIBS=ON -DDEPTHAI_OPENCV_SUPPORT=ON .
"$CMAKE" --build . --config Release --target install -j $MAKEJ
;;
windows-x86_64)
export CC="cl.exe"
export CXX="cl.exe"
sedinplace 's:BUILD_SHARED_LIBS=ON:BUILD_SHARED_LIBS=OFF:g' cmake/Hunter/config.cmake
"$CMAKE" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$INSTALL_PATH" -DCMAKE_INSTALL_LIBDIR="lib" -DDEPTHAI_ENABLE_BACKWARD=OFF -DBUILD_SHARED_LIBS=ON -DDEPTHAI_OPENCV_SUPPORT=ON .
"$CMAKE" --build . --config Release --target install -j $MAKEJ
;;
*)
echo "Error: Platform \"$PLATFORM\" is not supported"
;;
Expand Down
58 changes: 50 additions & 8 deletions depthai/platform/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.bytedeco</groupId>
<artifactId>javacpp-presets</artifactId>
<version>1.5.9</version>
<version>1.5.10-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>

Expand All @@ -23,7 +23,7 @@
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>opencv-platform</artifactId>
<version>4.7.0-${project.parent.version}</version>
<version>4.8.1-${project.parent.version}</version>
</dependency>
<dependency>
<groupId>org.bytedeco</groupId>
Expand All @@ -35,24 +35,48 @@
<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.android-arm}</classifier>-->
<!-- </dependency>-->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>${javacpp.moduleId}</artifactId>
<version>${project.version}</version>
<classifier>${javacpp.platform.linux-armhf}</classifier>
<classifier>${javacpp.platform.android-arm64}</classifier>
</dependency>
<!-- <dependency>-->
<!-- <groupId>${project.groupId}</groupId>-->
<!-- <artifactId>${javacpp.moduleId}</artifactId>-->
<!-- <version>${project.version}</version>-->
<!-- <classifier>${javacpp.platform.android-x86}</classifier>-->
<!-- </dependency>-->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>${javacpp.moduleId}</artifactId>
<version>${project.version}</version>
<classifier>${javacpp.platform.linux-arm64}</classifier>
<classifier>${javacpp.platform.android-x86_64}</classifier>
</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-x86}</classifier>
<classifier>${javacpp.platform.linux-arm64}</classifier>
</dependency>
<!-- <dependency>-->
<!-- <groupId>${project.groupId}</groupId>-->
<!-- <artifactId>${javacpp.moduleId}</artifactId>-->
<!-- <version>${project.version}</version>-->
<!-- <classifier>${javacpp.platform.linux-x86}</classifier>-->
<!-- </dependency>-->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>${javacpp.moduleId}</artifactId>
Expand All @@ -65,6 +89,18 @@
<version>${project.version}</version>
<classifier>${javacpp.platform.macosx-x86_64}</classifier>
</dependency>
<!-- <dependency>-->
<!-- <groupId>${project.groupId}</groupId>-->
<!-- <artifactId>${javacpp.moduleId}</artifactId>-->
<!-- <version>${project.version}</version>-->
<!-- <classifier>${javacpp.platform.windows-x86}</classifier>-->
<!-- </dependency>-->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>${javacpp.moduleId}</artifactId>
<version>${project.version}</version>
<classifier>${javacpp.platform.windows-x86_64}</classifier>
</dependency>
</dependencies>

<build>
Expand All @@ -77,7 +113,7 @@
<configuration>
<archive>
<manifestEntries>
<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</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 @@ -122,11 +158,17 @@
<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}.android.arm;
// requires static org.bytedeco.${javacpp.moduleId}.android.arm64;
// requires static org.bytedeco.${javacpp.moduleId}.android.x86;
// requires static org.bytedeco.${javacpp.moduleId}.android.x86_64;
// 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;
requires static org.bytedeco.${javacpp.moduleId}.linux.x86_64;
requires static org.bytedeco.${javacpp.moduleId}.macosx.x86_64;
// requires static org.bytedeco.${javacpp.moduleId}.windows.x86;
requires static org.bytedeco.${javacpp.moduleId}.windows.x86_64;
}
</moduleInfoSource>
</module>
Expand Down
12 changes: 6 additions & 6 deletions depthai/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.bytedeco</groupId>
<artifactId>javacpp-presets</artifactId>
<version>1.5.9</version>
<version>1.5.10-SNAPSHOT</version>
</parent>

<groupId>org.bytedeco</groupId>
Expand All @@ -18,7 +18,7 @@
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>opencv</artifactId>
<version>4.7.0-${project.parent.version}</version>
<version>4.8.1-${project.parent.version}</version>
<optional>true</optional>
</dependency>
<dependency>
Expand All @@ -42,23 +42,23 @@
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>openblas</artifactId>
<version>0.3.23-${project.parent.version}</version>
<version>0.3.24-${project.parent.version}</version>
</dependency>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>opencv</artifactId>
<version>4.7.0-${project.parent.version}</version>
<version>4.8.1-${project.parent.version}</version>
</dependency>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>openblas</artifactId>
<version>0.3.23-${project.parent.version}</version>
<version>0.3.24-${project.parent.version}</version>
<classifier>${javacpp.platform}</classifier>
</dependency>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>opencv</artifactId>
<version>4.7.0-${project.parent.version}</version>
<version>4.8.1-${project.parent.version}</version>
<classifier>${javacpp.platform}</classifier>
</dependency>
</dependencies>
Expand Down
6 changes: 3 additions & 3 deletions depthai/samples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.bytedeco.depthai</groupId>
<artifactId>examples</artifactId>
<version>1.5.9</version>
<version>1.5.10-SNAPSHOT</version>
<properties>
<exec.mainClass>CameraPreviewExample</exec.mainClass>
<maven.compiler.source>1.7</maven.compiler.source>
Expand All @@ -12,12 +12,12 @@
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>depthai-platform</artifactId>
<version>2.21.2-1.5.9</version>
<version>2.21.2-1.5.10-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>opencv-platform</artifactId>
<version>4.7.0-1.5.9</version>
<version>4.8.1-1.5.10-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
Expand Down
10 changes: 5 additions & 5 deletions depthai/src/main/java/org/bytedeco/depthai/presets/depthai.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
inherit = opencv_imgproc.class,
value = {
@Platform(
value = {"linux-arm", "linux-x86", "macosx-x86"},
value = {"android", "linux-arm", "linux-x86", "macosx-x86", "Windows-x86"},
compiler = "cpp14",
define = {"SHARED_PTR_NAMESPACE std", "UNIQUE_PTR_NAMESPACE std", "XLINK_USE_MX_ID_NAME ON"},
include = {
Expand Down Expand Up @@ -485,11 +485,11 @@ public void map(InfoMap infoMap) {
.put(new Info("dai::DeviceBootloader::Version::toString", "dai::Version::toString",
"dai::DeviceInfo::toString", "dai::Node::toString").javaText("public native @StdString String toString();"))

.put(new Info("std::function<std::shared_ptr<dai::RawBuffer>(std::shared_ptr<RawBuffer>)>").valueTypes("RawBufferCallback"))
.put(new Info("std::function<void(LogMessage)>").valueTypes("LogCallback"))
.put(new Info("std::function<std::shared_ptr<dai::RawBuffer>(dai::RawBuffer*)>").valueTypes("RawBufferCallback"))
.put(new Info("std::function<void(dai::LogMessage)>").valueTypes("LogCallback"))
.put(new Info("std::function<void(float)>").valueTypes("ProgressCallback"))
.put(new Info("std::function<void(std::string,std::shared_ptr<ADatatype>)>").valueTypes("NameMessageCallback"))
.put(new Info("std::function<void(std::shared_ptr<ADatatype>)>").valueTypes("MessageCallback"))
.put(new Info("std::function<void(std::string,std::shared_ptr<dai::ADatatype>)>").valueTypes("NameMessageCallback"))
.put(new Info("std::function<void(std::shared_ptr<dai::ADatatype>)>").valueTypes("MessageCallback"))
.put(new Info("std::function<void()>").valueTypes("Callback"))
;
}
Expand Down
Loading