Skip to content
2 changes: 1 addition & 1 deletion docs/build/android.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ If your device has a supported Qualcomm Snapdragon SOC, and you want to use QNN
### Build Instructions

Download and install [Qualcomm AI Engine Direct SDK](https://qpm.qualcomm.com/main/tools/details/qualcomm_ai_engine_direct)
QNN Execution Provider can be built using building commands in [Android Build instructions](#android-build-instructions) with `--use_qnn --qnn_home [QNN_SDK path]`
QNN Execution Provider can be built using building commands in [Android Build instructions](#android-build-instructions) with `--use_qnn static_lib --qnn_home [QNN_SDK path]`

## Test Android changes using emulator (not applicable for QNN Execution Provider)

Expand Down
33 changes: 22 additions & 11 deletions docs/build/eps.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ redirect_from: /docs/how-to/build/eps

## Execution Provider Shared Libraries

The oneDNN, TensorRT, OpenVINO™, and CANN providers are built as shared libraries vs being statically linked into the main onnxruntime. This enables them to be loaded only when needed, and if the dependent libraries of the provider are not installed onnxruntime will still run fine, it just will not be able to use that provider. For non shared library providers, all dependencies of the provider must exist to load onnxruntime.
The oneDNN, TensorRT, OpenVINO™, CANN, and QNN providers are built as shared libraries vs being statically linked into the main onnxruntime. This enables them to be loaded only when needed, and if the dependent libraries of the provider are not installed onnxruntime will still run fine, it just will not be able to use that provider. For non shared library providers, all dependencies of the provider must exist to load onnxruntime.

### Built files
{: .no_toc }
Expand Down Expand Up @@ -358,31 +358,42 @@ See more information on the QNN execution provider [here](../execution-providers
{: .no_toc }
* Qualcomm AI Engine Direct SDK (Qualcomm Neural Network SDK) [Linux/Android/Windows](https://qpm.qualcomm.com/main/tools/details/qualcomm_ai_engine_direct)

### Build Options
{: .no_toc }

* `--use_qnn [QNN_LIBRARY_KIND]`: Builds the QNN Execution provider. `QNN_LIBRARY_KIND` is optional and specifies whether to build the QNN Execution Provider as a shared library (default) or static library.
* `--use_qnn` or `--use_qnn shared_lib`: Builds the QNN Execution Provider as a shared library.
* `--use_qnn static_lib`: Builds QNN Execution Provider as a static library linked into ONNX Runtime. This is required for Android builds.
* `--qnn_home QNN_SDK_PATH`: The path to the Qualcomm AI Engine Direct SDK.
* Example on Windows: `--qnn_home 'C:\Qualcomm\AIStack\QAIRT\2.31.0.250130'`
* Example on Linux: `--qnn_home /opt/qcom/aistack/qairt/2.31.0.250130`
* `--build_wheel`: Enables Python bindings and builds Python wheel.
* `--arm64`: Cross-compile for ARM64.

### Build Instructions
{: .no_toc }

#### Windows (arm64 native build)
#### Windows
```
build.bat --arm64 --use_qnn --qnn_home=[QNN_SDK path] --build_shared_lib --cmake_generator "Visual Studio 17 2022" --skip_submodule_sync --config Release --build_dir \build\Windows
build.bat --use_qnn --qnn_home=[QNN_SDK_PATH] --build_shared_lib --build_wheel --cmake_generator "Visual Studio 17 2022" --config Release --build_dir build\Windows
```

build python bindings
#### Windows (x86_64 host, ARM64 cross-compile target)
```
build.bat --arm64 --use_qnn --qnn_home=[QNN_SDK path] --build_wheel --cmake_generator "Visual Studio 17 2022" --skip_submodule_sync --config Release --build_dir \build\Windows
build.bat --arm64 --use_qnn --qnn_home=[QNN_SDK_PATH] --build_shared_lib --build_wheel --cmake_generator "Visual Studio 17 2022" --config Release --build_dir build\Windows
```
#### Linux (x64)
#### Linux (x86_64)
```
build.py --use_qnn --qnn_home=[QNN_SDK path] --build_shared_lib --skip_submodule_sync --config Release
build.sh --use_qnn --qnn_home=[QNN_SDK_PATH] --build_shared_lib --build_wheel --config Release --build_dir build/Linux
```
#### Android (Cross-Compile):
#### Android (cross-compile):

Please reference [Build OnnxRuntime For Android](android.md)
```
# on Windows
build.bat --build_shared_lib --skip_submodule_sync --android --config Release --use_qnn --qnn_home [QNN_SDK path] --android_sdk_path [android_SDK path] --android_ndk_path [android_NDK path] --android_abi arm64-v8a --android_api [api-version] --cmake_generator Ninja --build_dir build\Android
build.bat --build_shared_lib --android --config Release --use_qnn static_lib --qnn_home [QNN_SDK_PATH] --android_sdk_path [android_SDK path] --android_ndk_path [android_NDK path] --android_abi arm64-v8a --android_api [api-version] --cmake_generator Ninja --build_dir build\Android

# on Linux
build.sh --build_shared_lib --skip_submodule_sync --android --config Release --use_qnn --qnn_home [QNN_SDK path] --android_sdk_path [android_SDK path] --android_ndk_path [android_NDK path] --android_abi arm64-v8a --android_api [api-version] --cmake_generator Ninja --build_dir build/Android
build.sh --build_shared_lib --android --config Release --use_qnn static_lib --qnn_home [QNN_SDK_PATH] --android_sdk_path [android_SDK path] --android_ndk_path [android_NDK path] --android_abi arm64-v8a --android_api [api-version] --cmake_generator Ninja --build_dir build/Android

```

Expand Down
Loading