Skip to content

Commit

Permalink
Detect vs2022 as build environment (open-telemetry#1212)
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomsonTan authored Feb 17, 2022
1 parent ef3a623 commit 3a9d087
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tools/build-vs2019.cmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
REM Build with Visual Studio 2017
REM Build with Visual Studio 2019
set "BUILDTOOLS_VERSION=vs2019"
set ARCH=x64
if NOT "%1"=="" (
Expand Down
13 changes: 13 additions & 0 deletions tools/build-vs2022.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
REM Build with Visual Studio 2022
set "BUILDTOOLS_VERSION=vs2022"
set ARCH=x64
if NOT "%1"=="" (
set ARCH=%1
)
if "%ARCH%"=="x64" (
REM Parameter needed for CMake Visual Studio 2022 generator
set CMAKE_ARCH=x64
)
cd %~dp0
call setup-buildtools.cmd
call build.cmd
39 changes: 39 additions & 0 deletions tools/vcvars.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ REM | Build Tools version may be specified as 1st argument. |
REM +-------------------------------------------------------------------+
REM | Description | Argument value |
REM +-----------------------------------------+-------------------------+
REM | Autodetect Visual Studio 2022 | vs2022 |
REM | Visual Studio 2022 Enterprise | vs2022_enterprise |
REM | Visual Studio 2022 Professional | vs2022_professional |
REM | Visual Studio 2022 Community | vs2022_community |
REM | Visual Studio 2022 Build Tools (no IDE) | vs2022_buildtools |
REM | | |
REM | Autodetect Visual Studio 2019 | vs2019 |
REM | Visual Studio 2019 Enterprise | vs2019_enterprise |
REM | Visual Studio 2019 Professional | vs2019_professional |
Expand Down Expand Up @@ -39,6 +45,39 @@ if defined BUILDTOOLS_VERSION (
goto %BUILDTOOLS_VERSION%
)

:vs2022
:vs2022_enterprise
set TOOLS_VS2022_ENTERPRISE="%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat"
if exist %TOOLS_VS2022_ENTERPRISE% (
echo Building with vs2022 Enterprise...
call %TOOLS_VS2022_ENTERPRISE% %ARCH%
goto tools_configured
)

:vs2022_professional
set TOOLS_VS2022_PRO="%ProgramFiles%\Microsoft Visual Studio\2022\Professional\VC\Auxiliary\Build\vcvarsall.bat"
if exist %TOOLS_VS2022_PRO% (
echo Building with vs2022 Professional...
call %TOOLS_VS2022_PRO% %ARCH%
goto tools_configured
)

:vs2022_community
set TOOLS_VS2022_COMMUNITY="%ProgramFiles%\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat"
if exist %TOOLS_VS2022_COMMUNITY% (
echo Building with vs2022 Community...
call %TOOLS_VS2022_COMMUNITY% %ARCH%
goto tools_configured
)

:vs2022_buildtools
set TOOLS_VS2022="%ProgramFiles%\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvarsall.bat"
if exist %TOOLS_VS2022% (
echo Building with vs2022 BuildTools...
call %TOOLS_VS2022% %ARCH%
goto tools_configured
)

:vs2019
:vs2019_enterprise
set TOOLS_VS2019_ENTERPRISE="%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat"
Expand Down

0 comments on commit 3a9d087

Please sign in to comment.