microsoft/onnxruntime-extensions
Publicmirrored fromhttps://github.com/microsoft/onnxruntime-extensionsAvailable
docs/development.md
39lines · modecode
| 1 | # Build and Development |
| 2 | |
| 3 | This project supports Python and can be built from source easily, or a simple cmake build without Python dependency. |
| 4 | ## Python package |
| 5 | The package contains all custom operators and some Python scripts to manipulate the ONNX models. |
| 6 | - Install Visual Studio with C++ development tools on Windows, or gcc(>8.0) for Linux or xcode for macOS, and cmake on the unix-like platform. (**hints**: in Windows platform, if cmake bundled in Visual Studio was used, please specify the set _VSDEVCMD=%ProgramFiles(x86)%\Microsoft Visual Studio\<VERSION_YEAR>\<Edition>\Common7\Tools\VsDevCmd.bat_) |
| 7 | - If running on Windows, ensure that long file names are enabled, both for the [operating system](https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=cmd) and for git: `git config --system core.longpaths true` |
| 8 | - Prepare Python env and install the pip packages in the requirements.txt. |
| 9 | - `pip install .` to build and install the package.<br/> OR `pip install -e .` to install the package in the development mode, which is more friendly for the developer since the Python code change will take effect without having to copy the files to a different location in the disk.(**hints**: debug=1 in setup.cfg wil make C++ code be debuggable in a Python process.) |
| 10 | |
| 11 | Test: |
| 12 | - 'pip install -r requirements-dev.txt' to install pip packages for development. |
| 13 | - run `pytest test` in the project root directory. |
| 14 | |
| 15 | For a complete list of verified build configurations see [here](<./ci_matrix.md>) |
| 16 | |
| 17 | ## Java package |
| 18 | `bash ./build.sh -DOCOS_BUILD_JAVA=ON` to build jar package in out/<OS>/Release folder |
| 19 | |
| 20 | ## Android package |
| 21 | - pre-requisites: [Android Studio](https://developer.android.com/studio) |
| 22 | |
| 23 | Use `./tools/android/build_aar.py` to build an Android AAR package. |
| 24 | |
| 25 | ## iOS package |
| 26 | Use `./tools/ios/build_xcframework.py` to build an iOS xcframework package. |
| 27 | |
| 28 | ## Web-Assembly |
| 29 | ONNXRuntime-Extensions will be built as a static library and linked with ONNXRuntime due to the lack of a good dynamic linking mechanism in WASM. Here are two additional arguments [–-use_extensions and --extensions_overridden_path](https://github.com/microsoft/onnxruntime/blob/860ba8820b72d13a61f0d08b915cd433b738ffdc/tools/ci_build/build.py#L416) on building onnxruntime to include ONNXRuntime-Extensions footprint in the ONNXRuntime package. |
| 30 | |
| 31 | ## The C++ shared library |
| 32 | for any other cases, please run `build.bat` or `bash ./build.sh` to build the library. By default, the DLL or the library will be generated in the directory `out/<OS>/<FLAVOR>`. There is a unit test to help verify the build. |
| 33 | |
| 34 | |
| 35 | **VC Runtime static linkage** |
| 36 | If you want to build the binary with VC Runtime static linkage, please add a parameter _-DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded$<$<CONFIG:Debug>:Debug>"_ on running build.bat |
| 37 | |
| 38 | ## Copyright guidance |
| 39 | check this link https://docs.opensource.microsoft.com/releasing/general-guidance/copyright-headers/ for source file copyright header. |
| 40 | |