更新:1、升级编译器版本至MSVC2022,升级C++至C++17;
Signed-off-by: waiwaylee <waiwaylee@foxmail.com>
This commit is contained in:
Vendored
+50
@@ -0,0 +1,50 @@
|
||||
@echo off
|
||||
rem ===========================================================================
|
||||
rem Shared MSVC 2022 (v143) environment setup.
|
||||
rem
|
||||
rem Called by configure.bat / build.bat / clean.bat. It:
|
||||
rem 1) locates the MSVC 2022 toolset and cl.exe (default Hostx64\x64);
|
||||
rem 2) calls vcvarsall.bat to set PATH / INCLUDE / LIB (nmake comes with it).
|
||||
rem
|
||||
rem NOTE: this script does NOT use setlocal, so the variables it defines stay
|
||||
rem in the caller's environment (all callers run under setlocal).
|
||||
rem
|
||||
rem Override the defaults with these environment variables:
|
||||
rem VS2022_DIR Visual Studio 2022 install root
|
||||
rem MSVC_TOOLSET_VERSION MSVC toolset version
|
||||
rem MSVC_HOST_ARCH compiler host architecture (x64 / x86)
|
||||
rem MSVC_TARGET_ARCH target architecture (x64 / x86)
|
||||
rem
|
||||
rem Exit code: 0 = ok, non-zero = setup failed (caller must abort).
|
||||
rem
|
||||
rem Encoding: keep this file ASCII-only (cmd.exe parses .bat in the OEM code
|
||||
rem page, UTF-8 comments would break parsing on non-UTF-8 consoles).
|
||||
rem ===========================================================================
|
||||
|
||||
if not defined VS2022_DIR set "VS2022_DIR=D:\APP\VisualStudio2022"
|
||||
if not defined MSVC_TOOLSET_VERSION set "MSVC_TOOLSET_VERSION=14.44.35207"
|
||||
if not defined MSVC_HOST_ARCH set "MSVC_HOST_ARCH=x64"
|
||||
if not defined MSVC_TARGET_ARCH set "MSVC_TARGET_ARCH=x64"
|
||||
|
||||
set "MSVC_TOOLSET_DIR=%VS2022_DIR%\VC\Tools\MSVC\%MSVC_TOOLSET_VERSION%"
|
||||
set "MSVC_CXX_COMPILER=%MSVC_TOOLSET_DIR%\bin\Host%MSVC_HOST_ARCH%\%MSVC_TARGET_ARCH%\cl.exe"
|
||||
set "VCVARS_BAT=%VS2022_DIR%\VC\Auxiliary\Build\vcvarsall.bat"
|
||||
|
||||
if not exist "%VCVARS_BAT%" (
|
||||
echo [ERROR] vcvarsall.bat not found: "%VCVARS_BAT%"
|
||||
echo Please set VS2022_DIR to the Visual Studio 2022 install root.
|
||||
exit /b 1
|
||||
)
|
||||
if not exist "%MSVC_CXX_COMPILER%" (
|
||||
echo [ERROR] cl.exe not found: "%MSVC_CXX_COMPILER%"
|
||||
echo Please check MSVC_TOOLSET_VERSION / MSVC_HOST_ARCH / MSVC_TARGET_ARCH.
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
call "%VCVARS_BAT%" %MSVC_TARGET_ARCH% >nul
|
||||
if errorlevel 1 (
|
||||
echo [ERROR] "vcvarsall.bat %MSVC_TARGET_ARCH%" failed.
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
exit /b 0
|
||||
Reference in New Issue
Block a user