Skip to content

Conversation

@umireon
Copy link
Collaborator

@umireon umireon commented Nov 10, 2025

This pull request updates the build configuration to enable the use of system-installed ONNX Runtime and pkg-config by default, and refines how these options are handled across different platforms. It also ensures that platform-specific logic for ONNX Runtime is clearer and more robust. The most important changes are grouped below.

Default build options:

  • The default values for USE_PKGCONFIG and USE_SYSTEM_ONNXRUNTIME are now set to ON in CMakeLists.txt, meaning the build will prefer pkg-config and the system ONNX Runtime unless specified otherwise.

Platform-specific ONNX Runtime handling:

  • The logic in CMakeLists.txt for handling USE_SYSTEM_ONNXRUNTIME is refactored:
    • Linux: Now expects ONNX Runtime to be found via find_package, with appropriate include and link settings.
    • macOS: Always links to onnxruntime::onnxruntime, but only adds the ONNX Runtime dylib as a source if not using the system runtime.
    • Windows: Explicitly errors if USE_SYSTEM_ONNXRUNTIME is enabled, as it is unsupported.
  • On non-Windows, non-macOS platforms, ONNX Runtime is only bundled and installed if USE_SYSTEM_ONNXRUNTIME is OFF.

Build presets and overrides:

  • The CMakePresets.json file is updated so that all provided presets explicitly set USE_PKGCONFIG and USE_SYSTEM_ONNXRUNTIME to false, ensuring consistent behavior in CI and developer environments regardless of the new defaults. [1] [2] [3]

Minor refactoring:

  • Some redundant or misplaced lines in CMakeLists.txt are cleaned up to improve readability and maintainability.

Set USE_PKGCONFIG and USE_SYSTEM_ONNXRUNTIME to ON by default in CMakeLists.txt, and refactor ONNX Runtime handling to better support system and bundled builds across platforms. Update CMakePresets.json to explicitly set these options to false in all presets, ensuring consistent build configurations.
@umireon umireon requested a review from royshil November 10, 2025 21:15
Copy link
Owner

@royshil royshil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks legit

@umireon umireon merged commit a5ebc9e into main Nov 10, 2025
8 checks passed
@umireon umireon deleted the umireon/use-system-onnxruntime branch November 10, 2025 23:28
sobalap pushed a commit to sobalap/obs-backgroundremoval that referenced this pull request Jan 7, 2026
)

Set USE_PKGCONFIG and USE_SYSTEM_ONNXRUNTIME to ON by default in CMakeLists.txt, and refactor ONNX Runtime handling to better support system and bundled builds across platforms. Update CMakePresets.json to explicitly set these options to false in all presets, ensuring consistent build configurations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants