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

Hans Wennborg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 6 01:19:49 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG86e23c4e1f89: Detect Visual Studio in Windows packaging script (authored by pbo-linaro, committed by hans).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D135173

Files:
  llvm/utils/release/build_llvm_release.bat


Index: llvm/utils/release/build_llvm_release.bat
===================================================================
--- llvm/utils/release/build_llvm_release.bat
+++ llvm/utils/release/build_llvm_release.bat
@@ -1,4 +1,4 @@
- at echo on
+ at echo off
 setlocal enabledelayedexpansion
 
 if "%1"=="" goto usage
@@ -52,9 +52,22 @@
 REM   https://github.com/swig/swig/issues/769
 
 
-REM You need to modify the paths below:
-set vsdevcmd=C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\Tools\VsDevCmd.bat
+set vsdevcmd=
+set vs_2019_prefix=C:\Program Files (x86)\Microsoft Visual Studio\2019
+:: try potential activated visual studio, then 2019, with different editions
+call :find_visual_studio "%VSINSTALLDIR%"
+call :find_visual_studio "%vs_2019_prefix%\Enterprise"
+call :find_visual_studio "%vs_2019_prefix%\Professional"
+call :find_visual_studio "%vs_2019_prefix%\Community"
+call :find_visual_studio "%vs_2019_prefix%\BuildTools"
+if not exist "%vsdevcmd%" (
+  echo Can't find any installation of Visual Studio
+  exit /b 1
+)
+echo Using VS devcmd: %vsdevcmd%
 
+:: start echoing what we do
+ at echo on
 set python32_dir=C:\Users\%USERNAME%\AppData\Local\Programs\Python\Python310-32
 set python64_dir=C:\Users\%USERNAME%\AppData\Local\Programs\Python\Python310
 
@@ -314,3 +327,13 @@
 :parse_args_done
 exit /b 0
 ::==============================================================================
+:find_visual_studio
+set "vs_install=%~1"
+if "%vs_install%" == "" exit /b 1
+
+if "%vsdevcmd%" NEQ "" exit /b 0 :: already found
+
+set "candidate=%vs_install%\Common7\Tools\VsDevCmd.bat"
+echo trying VS devcmd: %candidate%
+if exist "%candidate%" set "vsdevcmd=%candidate%"
+exit /b 0


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135173.465679.patch
Type: text/x-patch
Size: 1751 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221006/b45da755/attachment.bin>


More information about the llvm-commits mailing list