Conan: [feature] visual_studio generator that generates a .prop file for each dep

Created on 14 May 2020  路  8Comments  路  Source: conan-io/conan

While creating a recipe for cpython, I had to patch the Visual Studio solution to make it use the conan dependencies.
For this, I made use of the visual_studio generator.

But the generated property files (conanbuildinfo.props) automatically includes the directories of all dependencies and links to all the dependencies.
This means that each project where I include this prop file will link to all conan dependencies.

What I want it to do is have a property file for each dependency.
That way the conan dependencies can be included with greater accuracy.

This feature can be added to the visual_studio generator:
e.g.

conanbuildinfo.props          <= the current property file to keep current behavior
conanbuildinfo_zlib.props     <= property file for zlib
conanbuildinfo_sqlite3.props  <= property file for sqlite3
conanbuildinfo_ffi.props      <= ...
conanbuildinfo_tcl.props
conanbuildinfo_mpdec.props
medium Build medium feature

Most helpful comment

Yes!
We definitely want to do this, not the first time it is requested. It is in our todo list.

This was proposed first time by https://github.com/conan-io/conan/issues/1338, cc/ @birsoyo, and we have good tips from them to implement this.

All 8 comments

Yes!
We definitely want to do this, not the first time it is requested. It is in our todo list.

This was proposed first time by https://github.com/conan-io/conan/issues/1338, cc/ @birsoyo, and we have good tips from them to implement this.

I have decided to give it a go, because I had good info from @birsoyo, and proposed https://github.com/conan-io/conan/pull/7035, in case you want to try it, would be a good feedback.

At the moment it is a new generator, I don't want to mess with the existing one, even if we aim to provide backwards compatibility it is so easy to break users code. We can discuss later if it is interesting to provide a global conanbuildinfo.props that gathers all dependencies together.

@memsharded
I've just tested #7035 on top of the cpython recipe and the required changes are minimal.

https://github.com/madebr/conan-center-index/commit/91d723f038b2cf960d9dcc78dc46d37cb9bc3da8

The only issue I was facing is that I had to import the props files at the correct location because $(PlatformToolset) is not defined everywhere apparently.
But once I found the correct location, the usage was flawless.

So 馃憤 from me.

Cool, thanks for trying @madebr and the feedback. I see in https://github.com/madebr/conan-center-index/commit/91d723f038b2cf960d9dcc78dc46d37cb9bc3da8 a few other changes, regarding the build, that hopefully are not related to this change. In theory, this shouldn't affect or modify the build, just the dependencies info, so changes like "armv8_32": "ARM", are totally unrelated.

@memsharded
Indeed. These are totally unrelated.
I had to start my Windows box for implementing this and used the opportunity to test all variants again.

Merged, will be released in 1.26.

Testing and feedback (cc @birsoyo) when released would be appreciated.

I updated my cpython recipe at https://github.com/conan-io/conan-center-index/pull/1510

It built fine locally. 馃 for the CI 馃槃

Thanks for the super addition.

Cool, let me know if you find any issue with it!

Was this page helpful?
0 / 5 - 0 ratings