Skip to content

Comments

opencv: modify CMake config to avoid Cellar paths#208051

Closed
cho-m wants to merge 1 commit intomasterfrom
opencv-cellar-paths
Closed

opencv: modify CMake config to avoid Cellar paths#208051
cho-m wants to merge 1 commit intomasterfrom
opencv-cellar-paths

Conversation

@cho-m
Copy link
Member

@cho-m cho-m commented Feb 17, 2025

Homebrew-specific workaround due to our symlink directory structure.

REALPATH would usually be the better option since it avoids other symlink issues (e.g. if you only symlink CMake files and then try to use those, they can end up using incorrect paths if CMAKE_CURRENT_LIST_DIR isn't resolved first).

In Homebrew, for standard layout, this isn't usually not an issue as we symlink all parts of keg. It mainly becomes an issue if using libexec or other non-linked directories.


Specifically to avoid having to patch these up afterwards like in visp:

# Replace generated references to OpenCV's Cellar path
opencv = Formula["opencv"]
opencv_references = Dir[
"CMakeCache.txt",
"CMakeFiles/Export/lib/cmake/visp/VISPModules.cmake",
"VISPConfig.cmake",
"VISPGenerateConfigScript.info.cmake",
"VISPModules.cmake",
"modules/**/flags.make",
"unix-install/VISPConfig.cmake",
]
inreplace opencv_references, opencv.prefix.realpath, opencv.opt_prefix

# Make sure software built against visp don't reference opencv's cellar path either
inreplace [lib/"pkgconfig/visp.pc", lib/"cmake/visp/VISPConfig.cmake", lib/"cmake/visp/VISPModules.cmake"],
opencv.prefix.realpath, opencv.opt_prefix

@github-actions github-actions bot added python Python use is a significant feature of the PR or issue ffmpeg FFMPEG use is a significant feature of the PR or issue labels Feb 17, 2025
@cho-m cho-m marked this pull request as ready for review February 17, 2025 22:54
@github-actions
Copy link
Contributor

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@github-actions github-actions bot added the stale No recent activity label Mar 11, 2025
@cho-m cho-m removed the stale No recent activity label Mar 15, 2025
@cho-m cho-m marked this pull request as draft March 15, 2025 16:52
@cho-m cho-m added the brew Issue may be Homebrew/brew related label Mar 28, 2025
@cho-m
Copy link
Member Author

cho-m commented Apr 6, 2025

Closing for now until we can resolve the protobuf patchelf issue

@cho-m cho-m closed this Apr 6, 2025
@cho-m cho-m added the not merged PR was closed without being merged (and may need to be revisited) label Apr 6, 2025
@github-actions github-actions bot deleted the opencv-cellar-paths branch April 6, 2025 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

brew Issue may be Homebrew/brew related ffmpeg FFMPEG use is a significant feature of the PR or issue not merged PR was closed without being merged (and may need to be revisited) python Python use is a significant feature of the PR or issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant