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

Adding preset for leapmotion controller #1056

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion cppbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ function sedinplace {
}

if [[ -z ${PROJECTS:-} ]]; then
PROJECTS=(opencv ffmpeg flycapture spinnaker libdc1394 libfreenect libfreenect2 librealsense librealsense2 videoinput artoolkitplus chilitags flandmark arrow hdf5 hyperscan mkl mkl-dnn dnnl openblas arpack-ng cminpack fftw gsl cpython numpy scipy gym llvm libpostal leptonica tesseract caffe openpose cuda nvcodec opencl mxnet pytorch tensorflow tensorflow-lite tensorrt depthai ale onnx ngraph onnxruntime tvm liquidfun qt skia cpu_features modsecurity systems)
PROJECTS=(opencv ffmpeg flycapture spinnaker libdc1394 libfreenect libfreenect2 librealsense librealsense2 videoinput artoolkitplus chilitags flandmark arrow hdf5 hyperscan mkl mkl-dnn dnnl openblas arpack-ng cminpack fftw gsl cpython numpy scipy gym llvm libpostal leptonica tesseract caffe openpose cuda nvcodec opencl mxnet pytorch tensorflow tensorflow-lite tensorrt depthai ale onnx ngraph onnxruntime tvm liquidfun qt skia cpu_features modsecurity systems leapmotion)
fi

for PROJECT in ${PROJECTS[@]}; do
Expand Down
29 changes: 29 additions & 0 deletions leapmotion/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
JavaCPP Presets for leapmotion
===============================

[![Gitter](https://badges.gitter.im/bytedeco/javacpp.svg)](https://gitter.im/bytedeco/javacpp) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.bytedeco/leapmotion/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.bytedeco/leapmotion) [![Sonatype Nexus (Snapshots)](https://img.shields.io/nexus/s/https/oss.sonatype.org/org.bytedeco/leapmotion.svg)](http://bytedeco.org/builds/)
<sup>Build status for all platforms:</sup> [![leapmotion](https://github.com/bytedeco/javacpp-presets/workflows/leapmotion/badge.svg)](https://github.com/bytedeco/javacpp-presets/actions?query=workflow%3Aleapmotion) <sup>Commercial support:</sup> [![xscode](https://img.shields.io/badge/Available%20on-xs%3Acode-blue?style=?style=plastic&logo=appveyor&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAZQTFRF////////VXz1bAAAAAJ0Uk5T/wDltzBKAAAAlUlEQVR42uzXSwqAMAwE0Mn9L+3Ggtgkk35QwcnSJo9S+yGwM9DCooCbgn4YrJ4CIPUcQF7/XSBbx2TEz4sAZ2q1RAECBAiYBlCtvwN+KiYAlG7UDGj59MViT9hOwEqAhYCtAsUZvL6I6W8c2wcbd+LIWSCHSTeSAAECngN4xxIDSK9f4B9t377Wd7H5Nt7/Xz8eAgwAvesLRjYYPuUAAAAASUVORK5CYII=)](https://xscode.com/bytedeco/javacpp-presets)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also add the workflow status badge to the main README.md as well as listing leapmotion as one of the available presets.



Introduction
------------
This directory contains the JavaCPP Presets module for:

* leapmotion 4.1.0 https://developer.leapmotion.com/sdk-leap-motion-controller/

Please refer to the parent README.md file for more detailed information about the JavaCPP Presets.

Prerequisites
------------
Please download the SDK archive for the leapmotion controller [here](https://developer.leapmotion.com/sdk-leap-motion-controller/) and place it in the `/javacpp-presets/leapmotion` directory before building.


TODO - Documentation
-------------
Java API documentation is available here:

* http://bytedeco.org/javacpp-presets/leapmotion/apidocs/


TODO - Sample Usage
------------
93 changes: 93 additions & 0 deletions leapmotion/cppbuild.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
#!/bin/bash
# This file is meant to be included by the parent cppbuild.sh script

if [[ -z "$PLATFORM" ]]; then
pushd ..
bash cppbuild.sh "$@" leapmotion
popd
exit
fi

mkdir -p $PLATFORM
cd $PLATFORM

case $PLATFORM in
# android-arm)
# CC="$ANDROID_CC" CFLAGS="$ANDROID_FLAGS" ./configure --prefix=.. --static
# make -j $MAKEJ
# make install
# ;;
# android-arm64)
# CC="$ANDROID_CC" CFLAGS="$ANDROID_FLAGS" ./configure --prefix=.. --static
# make -j $MAKEJ
# make install
# ;;
# android-x86)
# CC="$ANDROID_CC" CFLAGS="$ANDROID_FLAGS" ./configure --prefix=.. --static
# make -j $MAKEJ
# make install
# ;;
# android-x86_64)
# CC="$ANDROID_CC" CFLAGS="$ANDROID_FLAGS" ./configure --prefix=.. --static
# make -j $MAKEJ
# make install
# ;;
# linux-x86)
# CC="gcc -m32 -fPIC" ./configure --prefix=.. --static
# make -j $MAKEJ
# make install
# ;;
# linux-x86_64)
# CC="gcc -m64 -fPIC" ./configure --prefix=.. --static
# make -j $MAKEJ
# make install
# ;;
# macosx-x86_64)
# ./configure --prefix=.. --static
# make -j $MAKEJ
# make install
# ;;
windows-x86)
LEAPMOTION_VERSION=4.1.0
EXTENSION=.zip
FOLDER=LeapDeveloperKit_$LEAPMOTION_VERSION+52211_win
FILE=$FOLDER$EXTENSION
cd ../../
if [ -f $FILE ];then
echo "$FILE exists, unzipping..."
else
echo "$FILE not found. Please download it and place it into this directory."
exit 1
fi
unzip $FILE
cd cppbuild/$PLATFORM/
mkdir -p lib
cp ../../$FOLDER/LeapSDK/lib/x86/LeapC.lib lib/
cp -r ../../$FOLDER/LeapSDK/include include
rm -rf ../../$FOLDER
;;
windows-x86_64)
LEAPMOTION_VERSION=4.1.0
EXTENSION=.zip
FOLDER=LeapDeveloperKit_$LEAPMOTION_VERSION+52211_win
FILE=$FOLDER$EXTENSION
cd ../../
if [ -f $FILE ];then
echo "$FILE exists, unzipping..."
else
echo "$FILE not found. Please download it and place it into this directory."
exit 1
fi
unzip $FILE
cd cppbuild/$PLATFORM/
mkdir -p lib
cp ../../$FOLDER/LeapSDK/lib/x64/LeapC.lib lib/
cp -r ../../$FOLDER/LeapSDK/include include
rm -rf ../../$FOLDER
;;
*)
echo "Error: Platform \"$PLATFORM\" is not supported"
;;
esac

cd ../..
158 changes: 158 additions & 0 deletions leapmotion/platform/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.bytedeco</groupId>
<artifactId>javacpp-presets</artifactId>
<version>1.5.6-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>

<groupId>org.bytedeco</groupId>
<artifactId>leapmotion-platform</artifactId>
<version>4.1.0-${project.parent.version}</version>
<name>JavaCPP Presets Platform for Leap Motion Controller</name>

<properties>
<javacpp.moduleId>leapmotion</javacpp.moduleId>
</properties>

<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<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.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.android-x86_64}</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>
<version>${project.version}</version>
<classifier>${javacpp.platform.linux-x86_64}</classifier>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>${javacpp.moduleId}</artifactId>
<version>${project.version}</version>
<classifier>${javacpp.platform.macosx-x86_64}</classifier>
</dependency>
Comment on lines +28 to +69
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Judging from the current cppbuild.sh we're currently building windows-x86_64 and windows-x86. The other platforms which are not supported yet should be removed from the dependency list.

<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>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>default-jar</id>
<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>
</manifestEntries>
</archive>
</configuration>
</execution>
<execution>
<id>empty-javadoc-jar</id>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classifier>javadoc</classifier>
</configuration>
</execution>
<execution>
<id>empty-sources-jar</id>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classifier>sources</classifier>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.moditect</groupId>
<artifactId>moditect-maven-plugin</artifactId>
<executions>
<execution>
<id>add-module-infos</id>
<phase>none</phase>
</execution>
<execution>
<id>add-platform-module-info</id>
<phase>package</phase>
<goals>
<goal>add-module-info</goal>
</goals>
<configuration>
<modules>
<module>
<file>${project.build.directory}/${project.artifactId}.jar</file>
<moduleInfoSource>
module org.bytedeco.${javacpp.moduleId}.platform {
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.x86;
requires static org.bytedeco.${javacpp.moduleId}.linux.x86_64;
requires static org.bytedeco.${javacpp.moduleId}.macosx.x86_64;
Comment on lines +139 to +145
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly to how we're only adding dependencies for existing platforms, we only want the available platforms listed here. These entries should be removed until more platforms are added.

requires static org.bytedeco.${javacpp.moduleId}.windows.x86;
requires static org.bytedeco.${javacpp.moduleId}.windows.x86_64;
}
</moduleInfoSource>
</module>
</modules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
55 changes: 55 additions & 0 deletions leapmotion/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.bytedeco</groupId>
<artifactId>javacpp-presets</artifactId>
<version>1.5.6-SNAPSHOT</version>
</parent>

<groupId>org.bytedeco</groupId>
<artifactId>leapmotion</artifactId>
<version>4.1.0-${project.parent.version}</version>
<name>JavaCPP Presets for Leap Motion Controller</name>

<dependencies>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>javacpp</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.bytedeco</groupId>
<artifactId>javacpp</artifactId>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.moditect</groupId>
<artifactId>moditect-maven-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package org.bytedeco.leapmotion.presets;

import org.bytedeco.javacpp.*;
import org.bytedeco.javacpp.annotation.*;
import org.bytedeco.javacpp.tools.*;

@Properties(
value = {
@Platform(
value = "windows",
include = "LeapC.h",
link = "LeapC")
},
target = "org.bytedeco.leapmotion",
global = "org.bytedeco.leapmotion.global.leapmotion"
)
public class leapmotion implements InfoMapper {
static { Loader.checkVersion("org.bytedeco", "leapmotion"); }

public void map(InfoMap infoMap) {

infoMap.put(new Info("LEAP_EXPORT","LEAP_CALL","LEAP_STATIC_ASSERT","static_assert").cppTypes().annotations())

.put(new Info("_LEAP_CONNECTION").pointerTypes("LEAP_CONNECTION"))
.put(new Info("LEAP_CONNECTION").valueTypes("LEAP_CONNECTION").pointerTypes("@Cast(\"LEAP_CONNECTION*\") _LEAP_CONNECTION", "@ByPtrPtr LEAP_CONNECTION"))

.put(new Info("_LEAP_DEVICE").pointerTypes("LEAP_DEVICE"))
.put(new Info("LEAP_DEVICE").valueTypes("LEAP_DEVICE").pointerTypes("@Cast(\"LEAP_DEVICE*\") _LEAP_DEVICE", "@ByPtrPtr LEAP_DEVICE"))

.put(new Info("_LEAP_CLOCK_REBASER").pointerTypes("LEAP_CLOCK_REBASER"))
.put(new Info("LEAP_CLOCK_REBASER").valueTypes("LEAP_CLOCK_REBASER").pointerTypes("@Cast(\"LEAP_CLOCK_REBASER*\") _LEAP_CLOCK_REBASER", "@ByPtrPtr LEAP_CLOCK_REBASER"))

.put(new Info("_LEAP_RECORDING").pointerTypes("LEAP_RECORDING"))
.put(new Info("LEAP_RECORDING").valueTypes("LEAP_RECORDING").pointerTypes("@Cast(\"LEAP_RECORDING*\") _LEAP_RECORDING", "@ByPtrPtr LEAP_RECORDING"))

.put(new Info("_LEAP_CALIBRATION").pointerTypes("LEAP_CALIBRATION"))
.put(new Info("LEAP_CALIBRATION").valueTypes("LEAP_CALIBRATION").pointerTypes("@Cast(\"LEAP_CALIBRATION*\") _LEAP_CALIBRATION", "@ByPtrPtr LEAP_CALIBRATION"));

// .put(new Info("_LEAP_DISTORTION_MATRIX").pointerTypes("LEAP_DISTORTION_MATRIX"));
// .put(new Info("LEAP_DISTORTION_MATRIX").valueTypes("distortion_matrix").pointerTypes("@Cast(\"LEAP_DISTORTION_MATRIX*\") PointerPointer", "@ByPtrPtr distortion_matrix"));
}
}
Loading