conan-io / conan

Conan - The open-source C and C++ package manager
https://conan.io
MIT License
8.17k stars 974 forks source link

[feature] Customization options for vcvars #16392

Open sykhro opened 4 months ago

sykhro commented 4 months ago

What is your suggestion?

The following is a very loose proposal for customization of vcvars with a couple of my usecases:


Example:

[conf]
tools.microsoft.vcvars:path="C:\ExtractedGDK\220300\Microsoft GDK\Command Prompts\GamingDesktopVars.cmd"
tools.microsoft.vcvats:args=["GamingDesktopVS2022"]
[conf]
tools.microsoft.vcvars:path="C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvarsall.bat"
tools.microsoft.vcvats:args=["x86_arm", "onecore", "10.0.10240.0", "-vcvars_ver=14.0"]

Have you read the CONTRIBUTING guide?

sykhro commented 3 months ago

Additional note: when using GDK + VS Build Tools, the GamingDesktopVars.cmd doesn't source vcvars automatically. I find that at this point it would be useful to inject call to arbitrary scripts in the conanenv scripts; so in this case, I would set tools.microsoft.vcvars:path="" and then have the conanenv do something like:

call "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
call "C:\ExtractedGDK\220300\Microsoft GDK\Command Prompts\GamingDesktopVars.cmd" "GamingDesktopVS2022"

assuming I want conan to handle it. The alternative is just setting tools.microsoft.vcvars:path="" and calling conan in the pre-init env (which I understand isn't the way conan is designed to work?)