microsoft / vcpkg

C++ Library Manager for Windows, Linux, and MacOS
MIT License
22.98k stars 6.34k forks source link

Reference installed libraries in other vcpkg instance port #3370

Closed martin-s closed 5 years ago

martin-s commented 6 years ago

I want to setup two vcpkg instances and try to include the installed libraries in the first vcpkg from the second vcpkg. I have setup a portfile in the second instance that sets the cmake_toolchain_file but that doesn't help. What else do I have to take care of?

Cheney-W commented 5 years ago

Please add following sentences into the CMakeList.txt of the second port:

find_package( REQUIRED) include_directories() target_link_libraries()

Rastaban commented 5 years ago

Having dependent instances of vcpkg is not a supported scenario. If you are doing this to try to avoid building they you may want to take a look at the --binarycaching switch. This is designed to cache builds to avoid rebuilds. If you are doing this because you have a different set of ports in each instance than you may want to look into the recently added ports-overlay feature which allows an instance of vcpkg to look in other places to find some of the ports it builds.

martin-s commented 5 years ago

I think we're getting closer to a sound solution with the ports-overlay feature. The only issue is that in the current scenario it's assumed that there is one single installed folder. For my scenario, I assume that there exist several of them. This is because I have a set of core libraries (ports) that do not change at all. Then, I have other group of ports that make up another set of libraries (and which can link to some of the core libraries). And they change more often than the core libraries. As I want to group them, every set of libraries resides in a specific folder for which it has to be assured that there is a installed folder. There can't be only one single installed folder for all libraries. I hope the explication makes the custom scenario more clear now. It could also be that my scenario is not the way to go.

Rastaban commented 5 years ago

Interesting, I'm not sure we have explored having layered install directories. Do the libraries need their own installed folder because it makes it easier to manage the changes, or are there other technical/external requirements for it? Do you currently use vcpkg as part of your setup? If so, what is your current solution (or partial solution)?

martin-s commented 5 years ago

The setup is using the parameter --vpkg-root in combination with in-source builds. Few of them are located in a separate (git) repository. For theses cases, it makes sense that they take care of the installed folder, too.

Rastaban commented 5 years ago

We have decided to not directly address this at this time. We are continuing to improve the ports-overlay feature as well as local caching that hope will help work around the issue for now. If anyone is interested in working on this issue then feel free to reopen it.