Mercurial > vim
annotate src/msvc-latest.bat @ 30551:b2b10228a466
Added tag v9.0.0610 for changeset 2c169fec56f2a360763156927213bad32b1b7ab5
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 27 Sep 2022 19:15:03 +0200 |
parents | 54dda39c5bb3 |
children |
rev | line source |
---|---|
30385
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1 @echo off |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2 rem To be used on MS-Windows for Visual C++ 2017 or later. |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3 rem See INSTALLpc.txt for information. |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4 rem |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
5 rem Usage: |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
6 rem For x86 builds run this with "x86" option: |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
7 rem msvc-latest x86 |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
8 rem For x64 builds run this with "x86_amd64" option or "x64" option: |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
9 rem msvc-latest x86_amd64 |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
10 rem msvc-latest x64 |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
11 rem |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
12 rem Optional environment variables: |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
13 rem VSWHERE: |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
14 rem Full path to vswhere.exe. |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
15 rem VSVEROPT: |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
16 rem Option to search specific version of Visual Studio. |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
17 rem Default: -latest |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
18 rem To search VS2017: |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
19 rem set "VSVEROPT=-version [15.0^,16.0^)" |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
20 rem To search VS2019: |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
21 rem set "VSVEROPT=-version [16.0^,17.0^)" |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
22 rem To search VS2022: |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
23 rem set "VSVEROPT=-version [17.0^,18.0^)" |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
24 |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
25 if "%VSWHERE%"=="" ( |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
26 set "VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
27 set VSWHERE_SET=yes |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
28 ) |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
29 if not exist "%VSWHERE%" ( |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
30 echo Error: vswhere not found. |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
31 set VSWHERE= |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
32 set VSWHERE_SET= |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
33 exit /b 1 |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
34 ) |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
35 |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
36 if "%VSVEROPT%"=="" ( |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
37 set VSVEROPT=-latest |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
38 set VSVEROPT_SET=yes |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
39 ) |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
40 |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
41 rem Search Visual Studio Community, Professional or above. |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
42 for /f "usebackq tokens=*" %%i in (`"%VSWHERE%" %VSVEROPT% -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do ( |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
43 set InstallDir=%%i |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
44 ) |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
45 if exist "%InstallDir%\VC\Auxiliary\Build\vcvarsall.bat" ( |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
46 call "%InstallDir%\VC\Auxiliary\Build\vcvarsall.bat" %* |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
47 goto done |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
48 ) |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
49 |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
50 rem Search Visual Studio 2017 Express. |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
51 rem (Visual Studio 2017 Express uses different component IDs.) |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
52 for /f "usebackq tokens=*" %%i in (`"%VSWHERE%" %VSVEROPT% -products Microsoft.VisualStudio.Product.WDExpress -property installationPath`) do ( |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
53 set InstallDir=%%i |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
54 ) |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
55 if exist "%InstallDir%\VC\Auxiliary\Build\vcvarsall.bat" ( |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
56 call "%InstallDir%\VC\Auxiliary\Build\vcvarsall.bat" %* |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
57 ) else ( |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
58 echo Error: vcvarsall.bat not found. |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
59 rem Set ERRORLEVEL to 1. |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
60 call |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
61 ) |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
62 |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
63 :done |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
64 if "%VSWHERE_SET%"=="yes" ( |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
65 set VSWHERE= |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
66 set VSWHERE_SET= |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
67 ) |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
68 if "%VSVEROPT_SET%"=="yes" ( |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
69 set VSVEROPT= |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
70 set VSVEROPT_SET= |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
71 ) |
54dda39c5bb3
patch 9.0.0528: MS-Windows: no batch files for more recent MSVC versions
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
72 set InstallDir= |