[PATCH] D135173: Detect Visual Studio in Windows packaging script

Pierrick Bouvier via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 6 10:59:44 PDT 2022


pbo-linaro marked an inline comment as done.
pbo-linaro added inline comments.


================
Comment at: llvm/utils/release/build_llvm_release.bat:339
+if exist "%candidate%" set "vsdevcmd=%candidate%"
+exit /b 0
----------------
compnerd wrote:
> I think that this is better done through `vswhere` which is packaged up in the Visual Studio installation as of 2019 and newer.
> 
> ```
> SET vswhere=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe
> FOR /F "delims=" %%r IN ('^""%vswhere%" -nologo -latest -products "*" -all -prerelease -property installationPath^"') DO set VsDevCmd=%%r\Common7\Tools\VsDevCmd.bat
> ```
> 
> Will give you the path to the latest vsdevcmd available in `VsDevCmd`.  It will also implicitly scan different editions, and avoids the need to scan for it manually.
As VS2019 was hardcoded before, I thought their was a strong requirement to use this, so I didn't go the vswhere way.
As we discussed about adding a VS2022 flag, I can switch to that if others prefer it.

After trying, on my machine, it says:
$ "%vswhere%" -nologo -latest -products "*" -all -prerelease -property installationPath
C:\Program Files\Microsoft Visual Studio\2022\Preview

Alas, I definitely don't want to use a preview to compile this, but maybe there is a switch or something to have only stable.
I'd like to leave an override possibilty (detecting a VS prompt), so people can do as they want.

@hans @thieta Do you prefer that one?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135173/new/

https://reviews.llvm.org/D135173



More information about the llvm-commits mailing list