All Projects → bytedeco → Javacpp Presets

bytedeco / Javacpp Presets

Licence: other
The missing Java distribution of native C++ libraries

Programming Languages

java
68154 projects - #9 most used programming language
shell
77523 projects
c
50402 projects - #5 most used programming language
C++
36643 projects - #6 most used programming language
Cuda
1817 projects
Batchfile
5799 projects

Projects that are alternatives of or similar to Javacpp Presets

Libsass Maven Plugin
libsass wrapper for maven
Stars: ✭ 114 (-94.19%)
Mutual labels:  maven
Ssm Demo
🍌Spring+SpringMVC+Mybatis+easyUI实现简单的后台管理系统
Stars: ✭ 1,639 (-16.51%)
Mutual labels:  maven
Publiccms
现代化java cms,由天津黑核科技有限公司开发,轻松支撑千万数据、千万PV;支持静态化,服务器端包含; 目前已经拥有全球0.0002%的用户,语言支持中、繁、日、英;是一个已走向海外的成熟CMS产品
Stars: ✭ 1,750 (-10.85%)
Mutual labels:  maven
Jgitver Maven Plugin
maven core extension to automatically define versions using jgitver & git tags
Stars: ✭ 117 (-94.04%)
Mutual labels:  maven
Aem Guides Wknd
Tutorial Code companion for Getting Started Developing with AEM Sites WKND Tutorial
Stars: ✭ 121 (-93.84%)
Mutual labels:  maven
Nimrod
Nimrod - 基于 Spring Boot 构建 的 Java Web 平台企业级单体应用快速开发框架,适合中小型项目的应用和开发。所采用的技术栈包括 Spring Boot、Spring、Spring Web MVC、MyBatis、Thymeleaf 等,遵守阿里巴巴 Java 开发规约,帮助养成良好的编码习惯。整体采用 RBAC ( Role-Based Access Control ,基于角色的访问控制),具有严格的权限控制模块,支持系统与模块分离开发。最后希望这个项目能够对你有所帮助。Nimrod 开发交流群:547252502(QQ 群)
Stars: ✭ 125 (-93.63%)
Mutual labels:  maven
Confluence Publisher
Maven plugin and Docker image to convert AsciiDoc and publish it to Confluence
Stars: ✭ 112 (-94.29%)
Mutual labels:  maven
Wgpu
Safe and portable GPU abstraction in Rust, implementing WebGPU API.
Stars: ✭ 3,305 (+68.36%)
Mutual labels:  native-libraries
Git Code Format Maven Plugin
A maven plugin that automatically deploys https://github.com/google/google-java-format code formatter as a pre-commit git hook
Stars: ✭ 121 (-93.84%)
Mutual labels:  maven
Almost Famous
🌟 Almost-Famous(成名之路) ——卡牌游戏开源项目,架构使用SpringBoot+Netty+Maven+SpringCloud来搭建多进程分布式框架,包括Cloud、Unique、Login、Game、Match、Battle 等服务。
Stars: ✭ 131 (-93.33%)
Mutual labels:  maven
Kft Activiti Demo
Demo for workflow framework and BPM platform -- Activiti
Stars: ✭ 1,548 (-21.14%)
Mutual labels:  maven
Webdrivermanager
WebDriverManager (Copyright © 2015-2021) is a project created and maintained by Boni Garcia and licensed under the terms of the Apache 2.0 License.
Stars: ✭ 1,808 (-7.9%)
Mutual labels:  maven
Jib
🏗 Build container images for your Java applications.
Stars: ✭ 11,370 (+479.22%)
Mutual labels:  maven
Maven S3 Wagon
Multi-threaded wagon to connect Maven with Amazon S3
Stars: ✭ 114 (-94.19%)
Mutual labels:  maven
Vertx Maven Starter
Maven project template for Vert.x
Stars: ✭ 135 (-93.12%)
Mutual labels:  maven
Spring Cloud Build
Common build concerns, shared plugin configuration, etc. for Spring Cloud modules
Stars: ✭ 114 (-94.19%)
Mutual labels:  maven
Gradle Maven Plugin
Gradle 5.x Maven Publish Plugin to deploy artifacts
Stars: ✭ 124 (-93.68%)
Mutual labels:  maven
Javadevjournal
Source code for the tutorials published on the Javadevjournal site.
Stars: ✭ 141 (-92.82%)
Mutual labels:  maven
Java.webdriver
Browser test automation using Selenium WebDriver in Java
Stars: ✭ 135 (-93.12%)
Mutual labels:  maven
Spring Boot Quick
🌿 基于springboot的快速学习示例,整合自己遇到的开源框架,如:rabbitmq(延迟队列)、Kafka、jpa、redies、oauth2、swagger、jsp、docker、spring-batch、异常处理、日志输出、多模块开发、多环境打包、缓存cache、爬虫、jwt、GraphQL、dubbo、zookeeper和Async等等📌
Stars: ✭ 1,819 (-7.34%)
Mutual labels:  maven

JavaCPP Presets

Gitter Maven Central Sonatype Nexus (Snapshots)
Build status for all platforms (Android, iOS, Linux, Mac OS X, Windows): opencv ffmpeg flycapture spinnaker libdc1394 libfreenect libfreenect2 librealsense librealsense2 videoinput artoolkitplus chilitags flandmark arrow hdf5 hyperscan lz4 mkl mkl-dnn dnnl openblas arpack-ng cminpack fftw gsl cpython numpy scipy gym llvm libffi libpostal leptonica tesseract caffe openpose cuda nvcodec opencl mxnet pytorch tensorflow tensorflow-lite tensorrt tritonserver ale depthai onnx ngraph onnxruntime tvm liquidfun qt skia cpu_features modsecurity systems
Commercial support and paid services for custom presets: xscode

Introduction

The JavaCPP Presets modules contain Java configuration and interface classes for widely used C/C++ libraries. The configuration files in the org.bytedeco.<moduleName>.presets packages are used by the Parser to create from C/C++ header files the Java interface files targeting the org.bytedeco.<moduleName> packages, which is turn are used by the Generator and the native C++ compiler to produce the required JNI libraries. Moreover, helper classes make their functionality easier to use on the Java platform, including Android.

For orientation purposes, the documentation of this repository can be thought of as being split into 2 levels:

  1. The directory where this parent README.md document is located belongs to the upper level, the javacpp-presets module itself, and
  2. The subdirectories in it are the actual child modules, with their README.md files, presets, and packages, as the lower level.

This parent README.md file contains general information applicable to all modules to solve issues concerning downloads, common requirements, installation procedures, and build instructions. The respective README.md files in each subdirectory contain extra information, links, and notes concerning API documentation, specific requirements, dependencies for pom.xml files, and sample usage code, for the presets and packages of each module. Please be aware that not all of the presets have the same level of maturity, and the style and layout may also differ from one to another since they are based on the APIs of third-party libraries.

Please refer to the wiki page for more information about how to create new presets. Since additional documentation is currently lacking, please also feel free to ask questions on the mailing list or the discussion forum.

Downloads

JAR files containing binaries for all child modules and builds for all supported platforms (Android, iOS, Linux, Mac OS X, and Windows) can be obtained from the Maven Central Repository. Archives containing these JAR files are also available as releases.

To install manually the JAR files, follow the instructions in the Manual Installation section below.

We can also have everything downloaded and installed automatically with:

  • Maven (inside the pom.xml file)
  <dependency>
    <groupId>org.bytedeco</groupId>
    <artifactId>${moduleName}-platform</artifactId>
    <version>${moduleVersion}-1.5.6</version>
  </dependency>
  • Gradle (inside the build.gradle file)
  dependencies {
    implementation group: 'org.bytedeco', name: moduleName + '-platform', version: moduleVersion + '-1.5.6'
  }
  • Leiningen (inside the project.clj file)
  :dependencies [
    [~(symbol (str "org.bytedeco/" moduleName "-platform")) ~(str moduleVersion "-1.5.6")]
  ]
  • sbt (inside the build.sbt file)
  libraryDependencies += "org.bytedeco" % moduleName + "-platform" % moduleVersion + "-1.5.6"

where the moduleName and moduleVersion variables correspond to the desired module. This downloads binaries for all platforms, but to get binaries for only one platform we can set the javacpp.platform system property (via the -D command line option) to something like android-arm, linux-x86_64, macosx-x86_64, windows-x86_64, etc. We can also specify more than one platform, see the examples at Reducing the Number of Dependencies. Another option available to Gradle users is Gradle JavaCPP, and similarly for Scala users there is SBT-JavaCPP.

Required Software

To use the JavaCPP Presets, you will need to download and install the following software:

Further, in the case of Android, the JavaCPP Presets also rely on:

Manual Installation

Simply put all the desired JAR files (opencv*.jar, ffmpeg*.jar, etc.), in addition to javacpp.jar, somewhere in your class path. The JAR files available as pre-built artifacts are meant to be used with JavaCPP. The binaries for Linux were built for CentOS 6 and 7, so they should work on most distributions currently in use. The ones for Android were compiled for ARMv7 processors featuring an FPU, so they will not work on ancient devices such as the HTC Magic or some others with an ARMv6 CPU. Here are some more specific instructions for common cases:

NetBeans (Java SE 7 or newer):

  1. In the Projects window, right-click the Libraries node of your project, and select "Add JAR/Folder...".
  2. Locate the JAR files, select them, and click OK.

Eclipse (Java SE 7 or newer):

  1. Navigate to Project > Properties > Java Build Path > Libraries and click "Add External JARs...".
  2. Locate the JAR files, select them, and click OK.

IntelliJ IDEA (Android 7.0 or newer):

  1. Follow the instructions on this page: http://developer.android.com/training/basics/firstapp/
  2. Copy all the JAR files into the app/libs subdirectory.
  3. Navigate to File > Project Structure > app > Dependencies, click +, and select "2 File dependency".
  4. Select all the JAR files from the libs subdirectory.

After that, we can access almost transparently the corresponding C/C++ APIs through the interface classes found in the org.bytedeco.<moduleName> packages. Indeed, the Parser translates the code comments from the C/C++ header files into the Java interface files, (almost) ready to be consumed by Javadoc. However, since their translation still leaves to be desired, one may wish to refer to the original documentation pages. For instance, the ones for OpenCV and FFmpeg can be found online at:

Build Instructions

If the binary files available above are not enough for your needs, you might need to rebuild them from the source code. To this end, project files on the Java side were created as Maven modules. By default, the Maven build also installs the native libraries on the native C/C++ side with the cppbuild.sh scripts, but they can also be installed by other means.

Additionally, one can find on the wiki page additional information about the recommended build environments for the major platforms.

The Maven modules

The JavaCPP Presets depend on Maven, a powerful build system for Java, so before attempting a build, be sure to install and read up on:

Each child module in turn relies by default on the included cppbuild.sh scripts, explained below, to install its corresponding native libraries in the cppbuild subdirectory. To use native libraries already installed somewhere else on the system, other installation directories than cppbuild can also be specified either in the pom.xml files or in the .java configuration files. The following versions are supported:

Once everything installed and configured, simply execute

$ mvn install --projects .,opencv,ffmpeg,etc. -Djavacpp.platform.root=/path/to/android-ndk/

inside the directory containing the parent pom.xml file, by specifying only the desired child modules in the command, but without the leading period "." in the comma-separated list of projects, the parent pom.xml file itself might not get installed. (The -Djavacpp.platform.root=... option is required only for Android builds.) Also specify -Djavacpp.cppbuild.skip as option to skip the execution of the cppbuild.sh scripts. In addition to -Djavacpp.platform=..., some of the presets can also be built against CUDA with -Djavacpp.platform.extension=-gpu or CPython with -Djavacpp.platform.extension=-python. Please refer to the comments inside the pom.xml file for further details. From the "platform" subdirectory, we can also install the "platform" artifacts with a similar command:

$ cd platform
$ mvn install --projects ../opencv/platform,../ffmpeg/platform,etc. -Djavacpp.platform.host

The cppbuild.sh scripts

Running the scripts allows us to install easily the native libraries on multiple platforms, but additional software is required:

With the above in working order, the scripts get launched automatically as part of the Maven build lifecycle, but we can also manually execute

$ ANDROID_NDK=/path/to/android-ndk/ bash cppbuild.sh [-platform <name>] [-extension <name>] <install | clean> [projects]

where possible platform names are: android-arm, android-x86, linux-x86, linux-x86_64, linux-armhf, linux-ppc64le, linux-mips64el, macosx-x86_64, windows-x86, windows-x86_64, etc. The -gpu extension as supported by some builds also require CUDA to be installed. (The ANDROID_NDK variable is required only for Android builds.) Please note that the scripts download source archives from appropriate sites as necessary.

To compile binaries for an Android device with no FPU, first make sure this is what you want. Without FPU, the performance of either OpenCV or FFmpeg is bound to be unacceptable. If you still wish to continue down that road, then replace "armeabi-v7a" by "armeabi" and "-march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16" with "-march=armv5te -mtune=xscale -msoft-float", inside various files.

Although JavaCPP can pick up native libraries installed on the system, the scripts exist to facilitate the build process across multiple platforms. They also allow JavaCPP to copy the native libraries and load them at runtime from the JAR files created above by Maven, a useful feature for standalone applications or Java applets. Moreover, tricks such as the following work with JNLP:

    <resources os="Linux" arch="x86 i386 i486 i586 i686">
        <jar href="lib/opencv-linux-x86.jar"/>
        <jar href="lib/ffmpeg-linux-x86.jar"/>
    </resources>
    <resources os="Linux" arch="x86_64 amd64">
        <jar href="lib/opencv-linux-x86_64.jar"/>
        <jar href="lib/ffmpeg-linux-x86_64.jar"/>
    </resources>

Thanks to Jose Gómez for testing this out!

How Can I Help?

Contributions of any kind are highly welcome! At the moment, the Parser has limited capabilities, so I plan to improve it gradually to the point where it can successfully parse large C++ header files that are even more convoluted than the ones from OpenCV, Caffe, or TensorFlow, but the build system could also be improved. Consequently, I am looking for help especially with the five following tasks, in no particular order:

  • Setting up continuous integration, preferably free on the cloud (Travis CI?)
  • Improving the Parser (by using the presets for LLVM and Clang?)
  • Providing builds for more platforms, as with linux-armhf for Raspberry Pi, etc.
  • Replacing the Bash/Maven build combo by something easier to use (Gradle?)
  • Adding new presets as child modules for other C/C++ libraries (Caffe2, OpenNI, OpenMesh, PCL, etc.)

To contribute, please fork and create pull requests, or post your suggestions as a new "issue". Thank you very much in advance for your contribution!


Project lead: Samuel Audet samuel.audet at gmail.com
Developer site: https://github.com/bytedeco/javacpp-presets
Discussion group: http://groups.google.com/group/javacpp-project

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].