question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[feature] Expose `vs_ide_version()` in conan.tools.microsoft

See original GitHub issue

vs_ide_version in visual.py is useful for recipes aiming to support both legacy compiler=Visual Studio and new compiler=msvc during conan v2 transition.

I’ve started to use it in few conan-center recipes with from conan.tools.microsoft.visual import vs_ide_version, but it would make sense to import this function the same way than is_msvc, is_msvc_static_runtime etc

In grpc recipe for example we could write something like this:

    def validate(self):
        if is_msvc(self) and tools.Version(vs_ide_version(self)) < "14":
            raise ConanInvalidConfiguration("gRPC can only be built with Visual Studio 2015 or higher.")

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
SpaceImcommented, Sep 20, 2022

Actually, check_min_vs is too specific, it doesn’t help when we want to test versions without raising. vs_ide_version is more versatile.

How to translate something like this?

if self.settings.compiler == "Visual Studio":
    msvc_folder = "vs2017" if Version(self.settings.compiler) >= "15" else "vs2013"
    [...]

Currently:

if is_msvc(self):
    if (self.settings.compiler == "Visual Studio" and Version(self.settings.compiler) >= "15") or \
       (self.settings.compiler == "msvc" and Version(self.settings.compiler) >= "191"):
        msvc_folder = "vs2017"
    else:
        msvc_folder = "vs2013"
    [...]

I would prefer

if is_msvc(self):
    msvc_folder = "vs2017" if vs_ide_version(self) >= "15" else "vs2013"
    [...]

Even when we want to raise, check_min_vs is not used in conan-center because usually we have more generic logic to handle all compilers min compatible version in a dictionary.

0reactions
SpaceImcommented, May 23, 2022

thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

conan.tools.microsoft — conan 1.43.4 documentation
The MSBuildDeps is the dependency information generator for Microsoft MSBuild build system. It will generate multiple xxxx.props properties files one per ...
Read more >
conan Changelog - pyup.io
Fix: When using the new layout() feature of Conan 2.0, change the default ... Feature: New `conan.tool.microsoft.unix_path` to convert paths to any ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found