-
Notifications
You must be signed in to change notification settings - Fork 994
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cppinfo
improvements: components, exe, system deps...
#5090
Comments
For component deps, I think it is very important to be able to have granularity with specifying package dependencies component deps, and whether they are part of the public interface or not. For instance, lets say I'm creating a package This sort of logic already exists in modern cmake targets, it would be nice to be able to get that information through the conan generator cmake targets as well. Right now to get this fine-tuned information, you have to create various config.cmake files to export this information, and then import it with |
Yes, the next needed features would be to improve the generators to allow, for example, to use |
This is an ongoing effort, moving to 1.17, I didn't expected to have it completed this iteration. |
Some conclusions for ongoing development after discussion:
|
If you find a clean to detect when doing both adjustments would be better. |
What if a component Y in package B depends on a component X in package A? The component ID cannot be done like this:
Because it means that in X, it names component X
Unless Conan adds the However, this way, the Conan CMake generators should not use the I think this would probably be most popular:
To avoid ambiguities and ensure portability, you might want to restrict unqualified component IDs to match |
The requirements between different packages are not modeled in the |
Hmm, I don't quite understand what you wrote after the first sentence... |
After having a look at PR #5242 there are some thing I would want to consider related to this new feature, some of them have already been mentioned in this thread:
|
It can be fine if Conan provides a convenient method or property to aggregate attributes over transitive dependencies, but there should remain a way to read only what the user explicitly assigned. Please do not lose that information, if you envision Conan as a platform for other tools. There will exist some downstream component that wants to know. In @jgsogo's second example, I would expect |
Agree and agree 😸 We must keep the raw information too, sure, it could be useful. (Implementation detail: ) IMO, I think that the logic about aggregating libraries/paths in the proper order must be inside the
Yes, I was thinking about a PRIVATE dependency. Here there is nothing as the |
I agree that would be a nicer model to have the information automatically aggregated for a component, but not for the About the second general concern about specifying which components of requirements are required by a component, yes, I think you are right, even if the library depending on Boost knows which components need to link (for example, by using the small targets from the boost), unless it declares that circumstance in the |
This feature should also allow to, independently from cmake, define multiple That's why I believe it's important this feature allows to differentiate between cmake and pkg_config. |
Please @danimtb, open at least 2 new issues:
Probably the should go for 1.25 release. |
Done! |
@memsharded and all, apologies for posting on a closed issue. I'm quite new to Conan and making good progress with adopting it in our CMake meta-builds. One thing that I'm missing is the ability to use |
Yes, that is the final goal. We have started this feature by first implementing the model (just released in Conan 1.24) for conanfile.py recipes. Then next steps are to automatically build the in-package order based on the local dependencies between components, then propagate downstream to the consumer (at the model level first, that is, to In the meantime, what you can try is to "filter" or remove the components you don't want to (in most cases, it is not an issue to link with all of them, as linkers are typically smart enough to not include what is not necessary). For example, the base Please make sure to track the issues above, and feedback and testing will be very appreciated! |
Thanks, @memsharded, that makes perfect sense. Yes, the linker's doing the work fine now, just felt a little inelegant 🙂 I'll try to dig into the filtering idea, and certainly track and feedback on developments from now. |
Intro
The idea is to be able to specify different components (different libs, different exes) in the
cpp_info
object so it can help with:protoc
.Proposition
New fields to
cpp_info
:self.cpp_info.name
: It could be used by the generators to name the targets, config files etc. E.g: ZLIB. By default, the package name will be used.self.cpp_info.exes
: List of executable names (located in anyself.cpp_info.bindirs
). It could be used by the generators to export variables with the paths etc.self.cpp_info.system_deps
: List of system dependencies. (["dl", "pthread"]
)Subcomponents:
Enable
self.cpp_info["component_id"]
, that is a very similar object tocpp_info
with some exceptions:component_id
already gives the name of the component, can be used by the generators for example to name the component of the target:OpenSSL::Crypto
forself.cpp_info["Crypto"]
.self.cpp_info["component_id"].name
: The name for the subcomponent, by default thecomponent_id
will be the name.self.cpp_info["component_id"].lib
: The library nameself.cpp_info["component_id"].exe
: The executable name (incompatible with specifying.lib
)self.cpp_info["component_id"].deps
: List withcomponen_id
s.self.cpp_info["component_id"].system_deps
: List with system library names.self.cpp_info["component_id"].libs: That won't existself.cpp_info["component_id"].exes: That won't existself.cpp_info["component_id"].name: The name doesn't exist, the "component_id" gives the name already.self.cpp_info["component_id"].rootpath: No senseThe subcomponents will also have available:
If some of these elements are adjusted in the "general" object, the subcomponents will extend the values automatically, even if they do not use the
append
syntax:That will propagate
["include2", "include3"]
as the include dirs for thecrypto
component.Related to #4430
The text was updated successfully, but these errors were encountered: