You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi I'm not sure if this is a general rust question, or something related specifically to this build.rs.
I see that modules are generated based on what the found opencv library what compiled with. So if let's say sfm is disabled, no function for the opencv::sfm modules will exists.
How to get access to that in my crate so I can do some fallback if the function wasn't generated on avoid build failure?
From my small understanding:
cfg can be defined by a build.rs, but then I would have to reimplement all of the Library::probe() logic.
How can I consume the library used in the build script of this repo?
An alternative would be to use features flags, but I would like to keep that as last resort.
The text was updated successfully, but these errors were encountered:
OlivierLDff
changed the title
How to propagate #[cfg(ocvrs_has_module_xxx)] to other crates
How to propagate #[cfg(ocvrs_has_module_xxx)] to user crates
Apr 26, 2025
That information is unfortunately not readily available to the dependent crates in cargo. I have manually implemented some helper macros for the OpenCV branch detection, e.g. opencv_branch_4. Maybe generating those can be automated in the build script together with the similar ones for the modules.
I see what you mean!
I don't have time to investigate on that or work on a PR right now. For my use case right now I will just force the correct module to be here for now. But I will definitely need something like that on the future, so maybe I will put some work into it.
Hi I'm not sure if this is a general rust question, or something related specifically to this
build.rs
.I see that modules are generated based on what the found opencv library what compiled with. So if let's say
sfm
is disabled, no function for theopencv::sfm
modules will exists.How to get access to that in my crate so I can do some fallback if the function wasn't generated on avoid build failure?
From my small understanding:
cfg
can be defined by abuild.rs
, but then I would have to reimplement all of theLibrary::probe()
logic.An alternative would be to use features flags, but I would like to keep that as last resort.
The text was updated successfully, but these errors were encountered: