Statically link genai samples to OpenCV#4092
Conversation
da46a4f to
14ac712
Compare
14ac712 to
eb86b08
Compare
There was a problem hiding this comment.
Pull request overview
This PR updates the CMake logic for GenAI C++ samples to prefer (and, when needed, build) a statically linked OpenCV, reducing runtime dependencies like OpenCV DLL/SO deployment for sample binaries.
Changes:
- Prefer static OpenCV when a system OpenCV package is available (
OpenCV_STATIC=ONbeforefind_package). - When OpenCV must be fetched via
FetchContent, configure it to build static libraries and disable plugin-based runtime backends. - Remove Windows-specific OpenCV DLL installation logic from the image generation sample.
Note: The PR description still contains template placeholders (e.g. Fixes #(issue)) and the documentation checklist item is checked but does not include the required “built docs” link; please update the PR description accordingly.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| samples/cpp/image_generation/CMakeLists.txt | Removes Windows OpenCV DLL deployment logic for the denoising_process sample. |
| samples/cpp/fetch_opencv.cmake | Switches OpenCV integration to prefer and fetch/build static OpenCV (including disabling plugin architecture). |
| set(required_components core imgproc videoio imgcodecs) | ||
| endif() | ||
|
|
||
| set(OpenCV_STATIC ON) |
There was a problem hiding this comment.
Is there a significant change to compiled samples size?
There was a problem hiding this comment.
yes. text2video on Linux:
~3Mb -> ~70Mb for Debug
~130Kb -> 28Mb for Release
Description
Statically link genai samples to OpenCV
CVS-190341
Fixes #(issue)
Checklist: