-
Notifications
You must be signed in to change notification settings - Fork 8
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
Supporting multiple Location
s for a single configuration
#29
Comments
Another open-source library I can find that puts multiple libraries in their
|
You don't have to create separate cps files, you can have just one file with multiple components (each component represents 0..1 artifacts). |
Yeah I guess you're right. I don't have any hard argument for why multiple locations are needed, but I have the following soft argument: You could consider a component in a CPS file as part of the "public interface" of the CPS file. In that sense, the maintainer of a library might not want to create a separate component (that consumers of the CPS can name) to represent an archive that they want their main component to link against. For instance, maybe the maintainers of I guess I'm making this request because it'd make my life a bit easier when transforming .pc files into CPS files. I can workaround the issue by creating the extra components that you mention. It will involve more work on my side but may be worth it anyway. What are the main advantages of having a single |
I'm flexible on how to sort out the use cases here. I think specific examples like Another use case I've seen is for multiple libraries in a Is that messy and possibly error prone? Yep. We should develop some docs and, if we can, tools around what works, what doesn't, and what's a hack to buy time for packaging cleanup (like providing CPS data for system-installed Anyway, I think the "visibility" of a CPS entity could be interesting to explore. I could see there being use cases for "private" and "package protected" (in the Java sense) entities. I don't want to overcomplicate design and educational materials now if we can avoid it though. My instinct would be to keep it as simple as possible for now and add complexity in the face of compelling adoption hurdles that can't be otherwise worked around. Possibly the |
+1. I also wanted to propose something similar. You should be able to mark components as internal so that they are not directly consumable. This could be helpful for common settings or libs that only contains data. Afaik this is also done often in cmake with targets. |
...it doesn't require redesigning CMake? 🙂 Note that this largely stems from components being equivalent to targets in the build system, so I'm not convinced it's a non-sensible distinction. What's the disadvantage to having one component per library? Would allowing "private" components mitigate the concern of users linking to something not intended to be visible to consumers? Offhand, component visibility seems like a reasonable addition.
There's no "perhaps" about it; libuuid is an external dependency and should be expressed as such. |
I'm going to tag this "need feedback". If we agree that component visibility is the right / satisfactory fix, we should either "rebrand" this issue or close it in favor of a new one (I'd lean toward the latter). Otherwise, let's keep discussing and figure out what we do want 🙂. |
Are you saying that this would require a redesign of CMake because You of course know more CMake than I ever will, but changing CMake so that
(Note that I'm not coming to this problem as a library author that wants to have more than one location for my library. I agree with you that ideally libraries are architected such that they only need one It feels a bit boilerplatey to add a new component just for adding another one archive to your link line. Supporting multiple locations felt to me like the lean way to cover this use-case. Conan's package representation also supports multiple "locations" (the Would you consider supporting multiple locations if it was widespread for packages in conancenter to specify multiple If I have a component with 3 libs :
Component visibility fees like a more complicated addition (conceptually) to the specification. I acknoweldge it would solve my problem (albeit in a more verbose way). Of course, not opposed to it if it solves other problems that library authors/packagers want to solve wrt how to structure their packages. |
I'm currently leaning towards keeping the design simpler for now and expecting a unique location per library. It is possible to model libraries with no source interfaces (headers, modules, etc.) and with link requirements. One reason for this is that I have seen projects adding, for instance, If If it helps, I can draw some diagrams somehow. Someone let me know if that would be helpful. If we take the approach I'm suggesting, we should add some docs about this reasoning and some examples of what is preferred. I'm willing to concede that there may be a major adoption hurdle resulting from a simpler model. If that happens or we feel like that's already the case, let's be clear about that. Adoptability is important to me. Some things can be messy but emit warnings or something. |
I generally agree with keeping the specification simple, and supporting single
In a world where multiple |
In the most recent Ecosystem Evolution meeting, we decided we want component visibility, regardless. We should open an issue to that effect and revisit whether that is an acceptable resolution to this. |
Based on the most recent comments, I believe this can be closed (at least for now). We retain #53 as a relevant action-item; if that isn't sufficient, we can revisit. |
I have been looking into transforming
pkg-config
files into CPS files. One mismatch I've found is that theLibs
field in a.pc
file may contain several different libs, whereas theLocation
field in a CPS component may point to just one path.You can find one example of such a
.pc
file in https://github.com/apache/activemq-cpp/blob/master/activemq-cpp/activemq-cpp.pc.in#L27 , where (besidespthread
andlibdl
), the pc file is linking both the activemq library andlibuuid
. You could perhaps argue that activemq should use theirRequires
to specify a dependency onlibuuid
but it doesn't.I can think of other cases where one could want to have several libraries in your
.pc
Libs
without creating separate.pc
files and usingRequires
to define the dependencies between them.Would it be possible to make
Location
an array? Or perhaps add aExtra-Locations
field? I knowIMPORTED_LOCATION
in CMake (which corresponds very closely toLocation
in CPS) also only supports one path, but maybe a similar new property can be added to CMake... Otherwise, what I had to do to model these multilibrary.pc
files as CPS files was to pass the paths to the extra locations asLink-Flags
, but that attribute is discouraged (and reasonably so).The text was updated successfully, but these errors were encountered: