microsoft/onnxruntime-extensions
Publicmirrored fromhttps://github.com/microsoft/onnxruntime-extensionsAvailable
docs/custom_build.md
32lines · modecode
| 1 | # Build ONNX Runtime with onnxruntime-extensions for Java package |
| 2 | |
| 3 | *The following step are demonstrated for Windows Platform only, the others like Linux and MacOS can be done similarly.* |
| 4 | |
| 5 | > Android build was supported as well; check [here](https://onnxruntime.ai/docs/build/android.html#cross-compiling-on-windows) for arguments to build AAR package. |
| 6 | |
| 7 | ## Tools required |
| 8 | 1. install visual studio 2022 (with cmake, git, desktop C++) |
| 9 | 2. install miniconda to have Python support (for onnxruntime build) |
| 10 | 3. OpenJDK: https://docs.microsoft.com/en-us/java/openjdk/download |
| 11 | (OpenJDK 11.0.15 LTS) |
| 12 | 4. Gradle: https://gradle.org/releases/ |
| 13 | (v6.9.2) |
| 14 | |
| 15 | ## Commands |
| 16 | Launch **Developer PowerShell for VS 2022** in Windows Tereminal |
| 17 | ``` |
| 18 | . $home\miniconda3\shell\condabin\conda-hook.ps1 |
| 19 | conda activate base |
| 20 | |
| 21 | $env:JAVA_HOME="C:\Program Files\Microsoft\jdk-11.0.15.10-hotspot" |
| 22 | # clone ONNXRuntime |
| 23 | git clone -b rel-1.12.0 https://github.com/microsoft/onnxruntime.git onnxruntime |
| 24 | |
| 25 | # clone onnxruntime-extensions |
| 26 | git clone https://github.com/microsoft/onnxruntime-extensions.git onnxruntime_extensions |
| 27 | |
| 28 | # build JAR package in this folder |
| 29 | mkdir ortall.build |
| 30 | cd ortall.build |
| 31 | python ..\onnxruntime\tools\ci_build\build.py --config Release --cmake_generator "Visual Studio 17 2022" --build_java --build_dir . --use_extensions --extensions_overridden_path "..\onnxruntime-extensions" |
| 32 | ``` |