This guide outlines the steps involved in building OpenVINO from the source files for Java development on Windows x86 64-bit systems. The OpenVINO components are installed to C:\lib\openvino_install
and the Java module jar is built to <openvino_contrib>\modules\java_api\build\libs
.
Note: Build instructions for Windows on ARM machines available here
- Windows 11 64-bit
- OpenJDK 1.8.0_382
- Gradle 8.1.1
- Microsoft Visual Studio 2019 version 16.11.26
- CMake 3.27.1
- CMake 3.13 or higher
- OpenJDK 8
- Windows 10 x86 64-bit or higher
- Git for Windows
- Gradle 7.1 or higher
- Microsoft Visual Studio 2019 or higher, version 16.3 or later
Ensure Java is installed and available in %PATH% by running
java -version
Validate CMake installation by running
cmake --version
-
Clone the source repositories and submodules from the release branches on Github
git clone https://github.com/openvinotoolkit/openvino.git -b releases/2023/0 git clone https://github.com/rajatkrishna/openvino_contrib.git -b ov-java-api cd openvino git submodule update --init --recursive
-
Create the build and install directories. Run
cmake
to fetch the project dependencies and generate a Visual Studio solution. Specify the location of the extras repository using the-DOPENVINO_EXTRA_MODULES
flag. You can disable/enable specific modules using CMake'sBUILD_<module_name>
boolean options. Additional build options can be found here. Finally, using cmake, build the generated solution from the command linemkdir build && cd build cmake -G "Visual Studio 16 2019" ^ -DBUILD_java_api=ON -DENABLE_PYTHON=OFF ^ -DCMAKE_INSTALL_PREFIX=C:\lib\openvino_install ^ -DBUILD_arm_plugin=OFF -DBUILD_nvidia_plugin=OFF ^ -DCMAKE_BUILD_TYPE=Release ^ -DOPENVINO_EXTRA_MODULES=<openvino_contrib>\modules ^ -S .. && cmake --build . --config Release --verbose -j8
-
Set up the install directory and install the artifacts using cmake
mkdir -p C:\lib\openvino_install cmake --install .
-
Before building the jar, navigate to the java module directory and run the
setupvars.bat
batch script to set up environment variables and make the OpenVINO components visiblecd <openvino_contrib>\modules\java_api C:\lib\openvino_install\setupvars.bat
-
Run the following
gradle
command to build. If successful, the jar file can be found atbuild/libs
directorygradle clean build --info
Alternately, you can download the OpenVINO pre-built binaries from the release archives. Follow these steps to set up the Java module for OpenVINO 2023.0.1 on Windows 10 or higher x86 64-bit machines.
- Git
- OpenJDK 8
- Gradle 7.1.1 or higher
- CMake 3.13 or higher
- Microsoft Visual Studio 2019 or higher, version 16.3 or later
-
Download the OpenVINO release version 2023.0.1 archive from the downloads page and extract the archive to
C:\lib
so that the OpenVINO components are installed toC:\lib\w_openvino_toolkit_windows_2023.0.1.11005.falc41994f3_x86_64
. -
Clone the OpenVINO Contrib repository to fetch the source files for the Java module.
git clone https://github.com/rajatkrishna/openvino_contrib.git -b ov-java-api
-
Run the
setupvars
batch script from Command Prompt to set up the OpenVINO environment variables and make the OpenVINO components visible. Note that the script works correctly only for Command Prompt, not Powershell. Then runcmake
to fetch project dependencies and perform build.C:\lib\w_openvino_toolkit_windows_2023.0.1.11005.falc41994f3_x86_64\setupvars.bat mkdir build && cd build cmake -G "Visual Studio 16 2019" .. cmake --build . --config Release --verbose
The library files will be installed to the
Release
folder. Copy theinference_engine_java_api.dll
file to the OpenVINO install directorycopy Release\inference_engine_java_api.dll C:\lib\w_openvino_toolkit_windows_2023.0.1.11005.falc41994f3_x86_64\runtime\bin\intel64\Release
-
Run the following gradle command from the java module root to build the jar at
build\libs
cd .. gradle clean build --info