javacpp-presets  by bytedeco

Java configuration/interface classes for native C++ libs

created 11 years ago
2,765 stars

Top 17.6% on sourcepulse

GitHubView on GitHub
Project Summary

This repository provides Java bindings for a vast array of native C/C++ libraries, enabling Java developers to leverage powerful C/C++ functionalities like computer vision, machine learning, and multimedia processing directly within their Java applications. It targets developers needing to integrate complex native libraries without writing JNI code themselves.

How It Works

JavaCPP Presets uses a parser to translate C/C++ header files into Java interface classes. These interfaces are then used by a generator and native C++ compiler to produce JNI libraries. Helper classes simplify the integration and usage of these native functionalities within the Java ecosystem, including Android. This approach automates the often complex and error-prone process of JNI development.

Quick Start & Requirements

  • Installation: Add the relevant org.bytedeco:<moduleName>-platform dependency to your Maven, Gradle, or Leiningen project.
  • Prerequisites: Java SE 7 or newer. For Android development, Android SDK API 24 or newer is required.
  • Customization: Binaries can be filtered by platform using the javacpp.platform system property (e.g., -Djavacpp.platform=linux-x86_64).
  • Documentation: Wiki and Discussion Group.

Highlighted Details

  • Supports over 50 popular C/C++ libraries including OpenCV, FFmpeg, TensorFlow, PyTorch, CUDA, and more.
  • Cross-platform builds for Android, iOS, Linux, macOS, and Windows.
  • Automated native library installation via Maven build or cppbuild.sh scripts.
  • Includes options for GPU acceleration (e.g., CUDA) and Python integration.

Maintenance & Community

The project is actively maintained by Samuel Audet and welcomes community contributions. Discussion occurs via a Google Groups mailing list.

Licensing & Compatibility

The project itself is licensed under Apache License 2.0. However, the included presets inherit the licenses of the underlying C/C++ libraries they wrap, which may include restrictive licenses (e.g., GPL, commercial licenses for some SDKs). Users must verify compatibility with their specific use case and the licenses of individual wrapped libraries.

Limitations & Caveats

The maturity and quality of presets can vary between different C/C++ libraries. Some complex C++ features might not be perfectly translated by the parser, requiring manual adjustments or reference to original C++ documentation. Building from source requires a robust build environment setup.

Health Check
Last commit

2 days ago

Responsiveness

Inactive

Pull Requests (30d)
11
Issues (30d)
10
Star History
40 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.