the doc for android/java custom build. (#260)

* the doc for android/java custom build.

* Update custom_build.md

* Update custom_build.md

* Update custom_build.md
This commit is contained in:
Wenbing Li 2022-07-08 10:26:00 -07:00 коммит произвёл GitHub
Родитель f12f42a007
Коммит a7f1a728d0
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 35 добавлений и 1 удалений

4
cmake/externals/opencv.cmake поставляемый
Просмотреть файл

@ -1,4 +1,3 @@
set(BUILD_ZLIB OFF CACHE INTERNAL "")
set(BUILD_TIFF OFF CACHE INTERNAL "")
set(BUILD_OPENJPEG OFF CACHE INTERNAL "")
set(BUILD_JASPER OFF CACHE INTERNAL "")
@ -119,3 +118,6 @@ if (OCOS_ENABLE_OPENCV_CODECS)
list(APPEND opencv_INCLUDE_DIRS ${OPENCV_MODULE_opencv_imgcodecs_LOCATION}/include)
list(APPEND opencv_LIBS opencv_imgcodecs)
endif()
# unset it to avoid affecting other projects.
unset(EXECUTABLE_OUTPUT_PATH CACHE)

32
docs/custom_build.md Normal file
Просмотреть файл

@ -0,0 +1,32 @@
# Build ONNX Runtime with onnxruntime-extensions for Java package
*The following step are demonstrated for Windows Platform only, the others like Linux and MacOS can be done similarly.*
> 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.
## Tools required
1. install visual studio 2022 (with cmake, git, desktop C++)
2. install miniconda to have Python support (for onnxruntime build)
3. OpenJDK: https://docs.microsoft.com/en-us/java/openjdk/download
(OpenJDK 11.0.15 LTS)
4. Gradle: https://gradle.org/releases/
(v6.9.2)
## Commands
Launch **Developer PowerShell for VS 2022** in Windows Tereminal
```
. $home\miniconda3\shell\condabin\conda-hook.ps1
conda activate base
$env:JAVA_HOME="C:\Program Files\Microsoft\jdk-11.0.15.10-hotspot"
# clone ONNXRuntime
git clone -b rel-1.12.0 https://github.com/microsoft/onnxruntime.git onnxruntime
# clone onnxruntime-extensions
git clone https://github.com/microsoft/onnxruntime-extensions.git onnxruntime_extensions
# build JAR package in this folder
mkdir ortall.build
cd ortall.build
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"
```