Skip to content

Statically link genai samples to OpenCV#4092

Open
olpipi wants to merge 2 commits into
openvinotoolkit:masterfrom
olpipi:opencv_video_samples
Open

Statically link genai samples to OpenCV#4092
olpipi wants to merge 2 commits into
openvinotoolkit:masterfrom
olpipi:opencv_video_samples

Conversation

@olpipi

@olpipi olpipi commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Description

Statically link genai samples to OpenCV

CVS-190341

Fixes #(issue)

Checklist:

  • This PR follows GenAI Contributing guidelines.
  • Tests have been updated or added to cover the new code.
  • This PR fully addresses the ticket.
  • I have made corresponding changes to the documentation.

Copilot AI review requested due to automatic review settings July 6, 2026 17:41
@github-actions github-actions Bot added category: cmake / build Cmake scripts category: Image generation samples GenAI Image generation samples labels Jul 6, 2026
@olpipi olpipi force-pushed the opencv_video_samples branch from da46a4f to 14ac712 Compare July 6, 2026 17:42
@olpipi olpipi force-pushed the opencv_video_samples branch from 14ac712 to eb86b08 Compare July 6, 2026 17:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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=ON before find_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).

Comment thread samples/cpp/fetch_opencv.cmake Outdated
Copilot AI review requested due to automatic review settings July 6, 2026 17:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Comment thread samples/cpp/fetch_opencv.cmake Outdated
Comment thread samples/cpp/fetch_opencv.cmake
set(required_components core imgproc videoio imgcodecs)
endif()

set(OpenCV_STATIC ON)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is there a significant change to compiled samples size?

@olpipi olpipi Jul 7, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

yes. text2video on Linux:
~3Mb -> ~70Mb for Debug
~130Kb -> 28Mb for Release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: cmake / build Cmake scripts category: Image generation samples GenAI Image generation samples

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants