Closed db4 closed 1 week ago
I think using self.dependencies["opencv"].cpp_info.components["opencv_imgproc"]
you get access to that information, is that what you are looking for?
@memsharded I need to walk all dependencies recursively and create the merged CppInfo. For a package, it can be done with
res = CppInfo(root)
deps = root.dependencies.host.topological_sort
deps = [dep for dep in reversed(deps.values())]
for dep in deps:
dep_cppinfo = dep.cpp_info.aggregated_components()
res.merge(dep_cppinfo)
but how to do the same for a package component? (in the example above for opencv::opencv_imgproc)
Hi @db4
Sorry this was not followed up back then.
it is not very clear what would be the question. If you want all the components aggregated, you can use .aggregated_components
, if you want an individual component, then accessing that component .components["opencv_imgproc"]
would get access to the data.
Hi @memsharded
I needed aggregated dependencies (e.g. all libs and headers including transitive ones) for a given component. Since then I've done without them, but they could be useful.
Maybe you need the merge()
method in https://docs.conan.io/2/reference/tools/cpp_info.html#aggregating-information-in-custom-generators?
You can iterate self.dependencies
and merging all the cpp_info
from those dependencies.
If you want to limit to a subset of all dependencies for that given component, that subset can be computed from the .requires
of that component.
Doesn't sound trivial, but it looks possible. Have you tried that?
Not yet. The question is old enough, I managed to get by with PkgConfigDeps generator. I close the issue right now and may follow your advice in the future. Thanks!
What is your question?
Say, I require "opencv/4.5.3" and need to fully resolve
includedirs
,libs
, andlibdirs
foropencv::opencv_imgproc
component. For the entire dependency, it's quite easy:Edit: not exactly, see the corrected code below.cpp_info = self.dependencies["opencv"].cpp_info.aggregated_components()
Have you read the CONTRIBUTING guide?