Dynamsoft Barcode Reader is an enterprise-class barcode SDK implemented in C/C++. Although the SDK is available for Windows, Linux, and macOS, there is only one Windows sample showing how to invoke the latest video APIs in version 7.x. To make developers experience the example in Linux or other platforms, I decided to refactor the project build environment with CMake.
The article is not about how to create Java native methods invoking C/C++ APIs. It aims to help developers to build a jar package containing JNI shared library, made with Dynamsoft Barcode Reader, for Windows, Linux, and macOS from scratch. I will demonstrate how to create JNI shared libraries with CMake, as well as how to package class files and shared libraries into jar files with Eclipse and Maven.
If you have a program designed for multiple platforms, you definitely don’t want to waste time configuring and maintaining the building environment. I was thinking how to compile my C/C++ code for Windows, Linux and macOS more conveniently, and after that, I decided to learn CMake. CMake is an open-source, cross-platform tool designed to build, test and package software. This post is just the start for Windows platform.