diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template index 9b34e80dad..57837fc11f 100755 --- a/BaseTools/Conf/tools_def.template +++ b/BaseTools/Conf/tools_def.template @@ -23,8 +23,9 @@ # 3.01 - Add toolchain for VS2022 # 3.02 - Enable stack cookies for IA32, X64, ARM, and AARCH64 builds for GCC and MSVC # 3.03 - Drop ARM32 Support +# 3.04 - Add toolchain for VS2026 # -#!VERSION=3.03 +#!VERSION=3.04 IDENTIFIER = Default TOOL_CHAIN_CONF @@ -57,6 +58,12 @@ DEFINE VS2022_BIN_IA32 = DEF(VS2022_BIN)\HostDEF(VS_HOST)\x86 DEFINE VS2022_BIN_X64 = DEF(VS2022_BIN)\HostDEF(VS_HOST)\x64 DEFINE VS2022_BIN_AARCH64 = DEF(VS2022_BIN)\HostDEF(VS_HOST)\arm64 +DEFINE VS2026_BIN = ENV(VS2026_PREFIX)bin +DEFINE VS2026_BIN_HOST = DEF(VS2026_BIN)\HostDEF(VS_HOST)\DEF(VS_HOST) +DEFINE VS2026_BIN_IA32 = DEF(VS2026_BIN)\HostDEF(VS_HOST)\x86 +DEFINE VS2026_BIN_X64 = DEF(VS2026_BIN)\HostDEF(VS_HOST)\x64 +DEFINE VS2026_BIN_AARCH64 = DEF(VS2026_BIN)\HostDEF(VS_HOST)\arm64 + # # Resource compiler # @@ -69,7 +76,7 @@ DEFINE WINSDKx86_BIN = ENV(WINSDKx86_PREFIX) DEFINE WINSDK81_BIN = ENV(WINSDK81_PREFIX)x64 DEFINE WINSDK81x86_BIN = ENV(WINSDK81x86_PREFIX)x86 -# Microsoft Visual Studio 2017/2019/2022 Professional Edition +# Microsoft Visual Studio 2017/2019/2022/2026 Professional Edition DEFINE WINSDK10_BIN = ENV(WINSDK10_PREFIX)DEF(VS_HOST) # These defines are needed for certain Microsoft Visual Studio tools that @@ -170,6 +177,11 @@ DEFINE DTC_BIN = ENV(DTC_PREFIX)dtc # Optional: # Required to build EBC drivers: # Intel(r) Compiler for Efi Byte Code (Intel(r) EBC Compiler) +# VS2026 -win32,win64- Requires: +# Microsoft Visual Studio 2026 version 18.0 or later +# Optional: +# Required to build EBC drivers: +# Intel(r) Compiler for Efi Byte Code (Intel(r) EBC Compiler) # GCCNOLTO -Linux,Windows- Requires: # GCC 4.9 targeting x86_64-linux-gnu or aarch64-linux-gnu # Optional: @@ -821,6 +833,142 @@ NOOPT_VS2022_AARCH64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE: # BaseTools cannot handle XIP modules with different section and file alignment *_VS2022_AARCH64_DLINK_XIPFLAGS = /ALIGN:64 +#################################################################################### +# VS2026 - Microsoft Visual Studio 2026 with Intel ASL +# ASL - Intel ACPI Source Language Compiler (iasl.exe) +#################################################################################### +# VS2026 - Microsoft Visual Studio 2026 with Intel ASL +*_VS2026_*_*_FAMILY = MSFT +*_VS2026_*_*_DLL = DEF(VS2026_BIN_HOST) + +*_VS2026_*_MAKE_PATH = DEF(VS2026_BIN_HOST)\nmake.exe +*_VS2026_*_MAKE_FLAG = /nologo +*_VS2026_*_RC_PATH = DEF(RC_PATH) + +*_VS2026_*_MAKE_FLAGS = /nologo +*_VS2026_*_SLINK_FLAGS = /NOLOGO /LTCG +*_VS2026_*_APP_FLAGS = /nologo /E /TC +*_VS2026_*_PP_FLAGS = /nologo /E /TC /FIAutoGen.h +*_VS2026_*_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h +*_VS2026_*_DLINK2_FLAGS = /WHOLEARCHIVE +*_VS2026_*_ASM16_PATH = DEF(VS2026_BIN_IA32)\ml.exe +*_VS2026_*_DEPS_FLAGS = DEF(MSFT_DEPS_FLAGS) +################## +# ASL definitions +################## +*_VS2026_*_ASL_PATH = DEF(WIN_IASL_BIN) +*_VS2026_*_ASL_FLAGS = DEF(DEFAULT_WIN_ASL_FLAGS) +*_VS2026_*_ASL_OUTFLAGS = DEF(DEFAULT_WIN_ASL_OUTFLAGS) +*_VS2026_*_ASLCC_FLAGS = DEF(MSFT_ASLCC_FLAGS) +*_VS2026_*_ASLPP_FLAGS = DEF(MSFT_ASLPP_FLAGS) +*_VS2026_*_ASLDLINK_FLAGS = DEF(MSFT_ASLDLINK_FLAGS) + +################## +# IA32 definitions +################## +*_VS2026_IA32_CC_PATH = DEF(VS2026_BIN_IA32)\cl.exe +*_VS2026_IA32_VFRPP_PATH = DEF(VS2026_BIN_IA32)\cl.exe +*_VS2026_IA32_ASLCC_PATH = DEF(VS2026_BIN_IA32)\cl.exe +*_VS2026_IA32_ASLPP_PATH = DEF(VS2026_BIN_IA32)\cl.exe +*_VS2026_IA32_SLINK_PATH = DEF(VS2026_BIN_IA32)\lib.exe +*_VS2026_IA32_DLINK_PATH = DEF(VS2026_BIN_IA32)\link.exe +*_VS2026_IA32_ASLDLINK_PATH= DEF(VS2026_BIN_IA32)\link.exe +*_VS2026_IA32_APP_PATH = DEF(VS2026_BIN_IA32)\cl.exe +*_VS2026_IA32_PP_PATH = DEF(VS2026_BIN_IA32)\cl.exe +*_VS2026_IA32_ASM_PATH = DEF(VS2026_BIN_IA32)\ml.exe + + *_VS2026_IA32_MAKE_FLAGS = /nologo + DEBUG_VS2026_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Z7 /Gw +RELEASE_VS2026_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gw +NOOPT_VS2026_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS /W4 /Gs32768 /D UNICODE /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Z7 /Od + + DEBUG_VS2026_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi +RELEASE_VS2026_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd +NOOPT_VS2026_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi + + DEBUG_VS2026_IA32_NASM_FLAGS = -Ox -f win32 -g +RELEASE_VS2026_IA32_NASM_FLAGS = -Ox -f win32 +NOOPT_VS2026_IA32_NASM_FLAGS = -O0 -f win32 -g + +# Linker warning 4210 is disabled globally, because it checks if static initializers are present and the VCRuntime is +# linked. We do not link the VCRuntime (except for HOST_APPLICATIONs) so this warning can be generated erroneously +# whenever there are static initializers, because we will always fail the VCRuntime linking check + DEBUG_VS2026_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG /WX /IGNORE:4210 +RELEASE_VS2026_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data /WX /IGNORE:4210 +NOOPT_VS2026_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG /WX /IGNORE:4210 + +# BaseTools cannot handle XIP modules with different section and file alignment +*_VS2026_IA32_DLINK_XIPFLAGS = /ALIGN:32 + +################## +# X64 definitions +################## +*_VS2026_X64_CC_PATH = DEF(VS2026_BIN_X64)\cl.exe +*_VS2026_X64_PP_PATH = DEF(VS2026_BIN_X64)\cl.exe +*_VS2026_X64_APP_PATH = DEF(VS2026_BIN_X64)\cl.exe +*_VS2026_X64_VFRPP_PATH = DEF(VS2026_BIN_X64)\cl.exe +*_VS2026_X64_ASLCC_PATH = DEF(VS2026_BIN_X64)\cl.exe +*_VS2026_X64_ASLPP_PATH = DEF(VS2026_BIN_X64)\cl.exe +*_VS2026_X64_ASM_PATH = DEF(VS2026_BIN_X64)\ml64.exe +*_VS2026_X64_SLINK_PATH = DEF(VS2026_BIN_X64)\lib.exe +*_VS2026_X64_DLINK_PATH = DEF(VS2026_BIN_X64)\link.exe +*_VS2026_X64_ASLDLINK_PATH = DEF(VS2026_BIN_X64)\link.exe + + DEBUG_VS2026_X64_CC_FLAGS = /nologo /c /WX /GS /W4 /Gs32768 /D UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Z7 /Gw /volatileMetadata- +RELEASE_VS2026_X64_CC_FLAGS = /nologo /c /WX /GS /W4 /Gs32768 /D UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Gw /volatileMetadata- +NOOPT_VS2026_X64_CC_FLAGS = /nologo /c /WX /GS /W4 /Gs32768 /D UNICODE /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Z7 /Od /volatileMetadata- + + DEBUG_VS2026_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi +RELEASE_VS2026_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd +NOOPT_VS2026_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi + + DEBUG_VS2026_X64_NASM_FLAGS = -Ox -f win64 -g +RELEASE_VS2026_X64_NASM_FLAGS = -Ox -f win64 +NOOPT_VS2026_X64_NASM_FLAGS = -O0 -f win64 -g + +# Linker warning 4210 is disabled globally, because it checks if static initializers are present and the VCRuntime is +# linked. We do not link the VCRuntime (except for HOST_APPLICATIONs) so this warning can be generated erroneously +# whenever there are static initializers, because we will always fail the VCRuntime linking check + DEBUG_VS2026_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4281 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG /ALIGN:4096 /DLL /WX /IGNORE:4210 +RELEASE_VS2026_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4281 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data /ALIGN:4096 /DLL /WX /IGNORE:4210 +NOOPT_VS2026_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4281 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG /ALIGN:4096 /DLL /WX /IGNORE:4210 + +# BaseTools cannot handle XIP modules with different section and file alignment +*_VS2026_X64_DLINK_XIPFLAGS = /ALIGN:32 + +##################### +# AARCH64 definitions +##################### +*_VS2026_AARCH64_CC_PATH = DEF(VS2026_BIN_AARCH64)\cl.exe +*_VS2026_AARCH64_VFRPP_PATH = DEF(VS2026_BIN_AARCH64)\cl.exe +*_VS2026_AARCH64_SLINK_PATH = DEF(VS2026_BIN_AARCH64)\lib.exe +*_VS2026_AARCH64_DLINK_PATH = DEF(VS2026_BIN_AARCH64)\link.exe +*_VS2026_AARCH64_APP_PATH = DEF(VS2026_BIN_AARCH64)\cl.exe +*_VS2026_AARCH64_PP_PATH = DEF(VS2026_BIN_AARCH64)\cl.exe +*_VS2026_AARCH64_ASM_PATH = DEF(VS2026_BIN_AARCH64)\armasm64.exe +*_VS2026_AARCH64_ASLCC_PATH = DEF(VS2026_BIN_AARCH64)\cl.exe +*_VS2026_AARCH64_ASLPP_PATH = DEF(VS2026_BIN_AARCH64)\cl.exe +*_VS2026_AARCH64_ASLDLINK_PATH = DEF(VS2026_BIN_AARCH64)\link.exe + + *_VS2026_AARCH64_MAKE_FLAGS = /nologo + DEBUG_VS2026_AARCH64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Zi /Gw /Oi- +RELEASE_VS2026_AARCH64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gw /Oi- +NOOPT_VS2026_AARCH64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Zi /Od /Oi- + + DEBUG_VS2026_AARCH64_ASM_FLAGS = /nologo /g +RELEASE_VS2026_AARCH64_ASM_FLAGS = /nologo +NOOPT_VS2026_AARCH64_ASM_FLAGS = /nologo + +# Linker warning 4210 is disabled globally, because it checks if static initializers are present and the VCRuntime is +# linked. We do not link the VCRuntime (except for HOST_APPLICATIONs) so this warning can be generated erroneously +# whenever there are static initializers, because we will always fail the VCRuntime linking check + DEBUG_VS2026_AARCH64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4226 /OPT:REF /OPT:ICF=10 /MAP /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:ARM64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /DRIVER /DEBUG /WX /IGNORE:4210 +RELEASE_VS2026_AARCH64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4226 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:ARM64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /DRIVER /MERGE:.rdata=.data /WX /IGNORE:4210 +NOOPT_VS2026_AARCH64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4226 /OPT:REF /OPT:ICF=10 /MAP /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:ARM64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /DRIVER /DEBUG /WX /IGNORE:4210 + +# BaseTools cannot handle XIP modules with different section and file alignment +*_VS2026_AARCH64_DLINK_XIPFLAGS = /ALIGN:64 + #################################################################################### # GCC Common #################################################################################### diff --git a/BaseTools/Plugin/WindowsVsToolChain/WindowsVsToolChain.py b/BaseTools/Plugin/WindowsVsToolChain/WindowsVsToolChain.py index 611b9899f7..472a637197 100644 --- a/BaseTools/Plugin/WindowsVsToolChain/WindowsVsToolChain.py +++ b/BaseTools/Plugin/WindowsVsToolChain/WindowsVsToolChain.py @@ -1,5 +1,5 @@ # @file WindowsVsToolChain.py -# Plugin to configure the environment for the VS2017, VS2019, and VS2022 toolchains +# Plugin to configure the environment for the VS2017, VS2019, VS2022, and VS2026 toolchains # # This plugin also runs for CLANGPDB toolchain on Windows as that toolchain # leverages nmake from VS and needs to the SDK paths for unit tests @@ -246,6 +246,78 @@ class WindowsVsToolChain(IUefiBuildPlugin): self.Logger.error("Path for VS2022 toolchain is invalid") return -2 + # + # VS2026 - VS2026 allows a user to install many copies/versions of the tools. + # If a specific version is required then the user must set both env variables: + # VS170INSTALLPATH: base install path on system to VC install dir. Here you will find the VC folder, etc + # VS170TOOLVER: version number for the VC compiler tools + # VS2026_PREFIX: path to MSVC compiler folder with trailing slash (can be used instead of two vars above) + # VS2026_HOST: set the host architecture to use for host tools, and host libs, etc + elif thebuilder.env.GetValue("TOOL_CHAIN_TAG") == "VS2026": + + # check to see if host is configured + # HostType for VS2026 should be (defined in tools_def): + # x86 == 32bit Intel + # x64 == 64bit Intel + # arm64 == 64bit Arm + # + HostType = shell_environment.GetEnvironment().get_shell_var("VS2026_HOST") + if HostType is not None: + HostType = HostType.lower() + self.Logger.info( + f"HOST TYPE defined by environment. Host Type is {HostType}") + else: + HostInfo = GetHostInfo() + if HostInfo.arch == "x86": + if HostInfo.bit == "32": + HostType = "x86" + elif HostInfo.bit == "64": + HostType = "x64" + else: + raise NotImplementedError() + + # VS2026_HOST options are not exactly the same as QueryVcVariables. This translates. + VC_HOST_ARCH_TRANSLATOR = { + "x86": "x86", "x64": "AMD64", "arm64": "not supported"} + + # check to see if full path already configured + if shell_environment.GetEnvironment().get_shell_var("VS2026_PREFIX") is not None: + self.Logger.debug("VS2026_PREFIX is already set.") + + else: + install_path = self._get_vs_install_path( + "VS2026".lower(), "VS180INSTALLPATH") + vc_ver = self._get_vc_version(install_path, "VS180TOOLVER") + + if install_path is None or vc_ver is None: + self.Logger.error( + "Failed to configure environment for VS2026") + return -1 + + version_aggregator.GetVersionAggregator().ReportVersion( + "Visual Studio Install Path", install_path, version_aggregator.VersionTypes.INFO) + version_aggregator.GetVersionAggregator().ReportVersion( + "VC Version", vc_ver, version_aggregator.VersionTypes.TOOL) + + # make VS2026_PREFIX to align with tools_def.txt + prefix = os.path.join(install_path, "VC", + "Tools", "MSVC", vc_ver) + prefix = prefix + os.path.sep + shell_environment.GetEnvironment().set_shell_var("VS2026_PREFIX", prefix) + shell_environment.GetEnvironment().set_shell_var("VS2026_HOST", HostType) + + shell_env = shell_environment.GetEnvironment() + # Use the tools lib to determine the correct values for the vars that interest us. + vs_vars = locate_tools.QueryVcVariables( + interesting_keys, VC_HOST_ARCH_TRANSLATOR[HostType], vs_version="VS2026") + for (k, v) in vs_vars.items(): + shell_env.set_shell_var(k, v) + + # now confirm it exists + if not os.path.exists(shell_environment.GetEnvironment().get_shell_var("VS2026_PREFIX")): + self.Logger.error("Path for VS2026 toolchain is invalid") + return -2 + # # CLANGPDB on Windows uses nmake from # the VS compiler toolchain. Find a version and set diff --git a/BaseTools/set_vsprefix_envs.bat b/BaseTools/set_vsprefix_envs.bat index 5565f615f1..acf2598312 100644 --- a/BaseTools/set_vsprefix_envs.bat +++ b/BaseTools/set_vsprefix_envs.bat @@ -18,6 +18,7 @@ set SCRIPT_ERROR=1 goto :EOF :main +if /I "%1"=="VS2026" goto SetVS2026 if /I "%1"=="VS2022" goto SetVS2022 if /I "%1"=="VS2019" goto SetVS2019 if /I "%1"=="VS2017" goto SetVS2017 @@ -250,4 +251,79 @@ if not defined IASL_PREFIX ( ) ) +:SetVS2026 +if not defined VS180COMNTOOLS ( + @REM clear two envs so that vcvars32.bat can run successfully. + set VSINSTALLDIR= + set VCToolsVersion= + if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" ( + if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2026\BuildTools" ( + call "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 18,19 > vswhereInfo + for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do ( + if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat" + ) + del vswhereInfo + ) else ( + call "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version 18,19 > vswhereInfo + for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do ( + if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat" + ) + del vswhereInfo + ) + ) else if exist "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" ( + if exist "%ProgramFiles%\Microsoft Visual Studio\2026\BuildTools" ( + call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 18,19 > vswhereInfo + for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do ( + if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat" + ) + del vswhereInfo + ) else ( + call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -version 18,19 > vswhereInfo + for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do ( + if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat" + ) + del vswhereInfo + ) + ) else ( + if /I "%1"=="VS2026" goto ToolNotInstall + goto SetWinDDK + ) +) + +if defined VCToolsInstallDir ( + if not defined VS2026_PREFIX ( + set "VS2026_PREFIX=%VCToolsInstallDir%" + ) + if not defined WINSDK10_PREFIX ( + if defined WindowsSdkVerBinPath ( + set "WINSDK10_PREFIX=%WindowsSdkVerBinPath%" + ) else if exist "%ProgramFiles(x86)%\Windows Kits\10\bin" ( + set "WINSDK10_PREFIX=%ProgramFiles(x86)%\Windows Kits\10\bin\" + ) else if exist "%ProgramFiles%\Windows Kits\10\bin" ( + set "WINSDK10_PREFIX=%ProgramFiles%\Windows Kits\10\bin\" + ) + ) +) +if not defined WINSDK_PATH_FOR_RC_EXE ( + if defined WINSDK10_PREFIX ( + set "WINSDK_PATH_FOR_RC_EXE=%WINSDK10_PREFIX%x86" + ) +) + +if /I "%1"=="VS2026" goto SetWinDDK + +:SetWinDDK +if not defined WINDDK3790_PREFIX ( + set WINDDK3790_PREFIX=C:\WINDDK\3790.1830\bin\ +) + +if not defined IASL_PREFIX ( + if exist "C:\ASL\" ( + set IASL_PREFIX=C:\ASL\ + ) else ( + @echo. + @echo !!! WARNING !!! IASL_PREFIX environment variable is not set + ) +) + popd diff --git a/BaseTools/toolsetup.bat b/BaseTools/toolsetup.bat index 92eb6823a1..b3a778f4f1 100755 --- a/BaseTools/toolsetup.bat +++ b/BaseTools/toolsetup.bat @@ -49,6 +49,12 @@ if /I "%1"=="/?" goto Usage set BASETOOLS_MINGW_BUILD=TRUE goto loop ) + if /I "%1"=="VS2026" ( + shift + set VS2026=TRUE + set VSTool=VS2026 + goto loop + ) if /I "%1"=="VS2022" ( shift set VS2022=TRUE @@ -320,7 +326,9 @@ IF NOT exist "%EDK_TOOLS_PATH%\set_vsprefix_envs.bat" ( @echo. goto end ) -if defined VS2022 ( +if defined VS2026 ( + call %EDK_TOOLS_PATH%\set_vsprefix_envs.bat VS2026 +) else if defined VS2022 ( call %EDK_TOOLS_PATH%\set_vsprefix_envs.bat VS2022 ) else if defined VS2019 ( call %EDK_TOOLS_PATH%\set_vsprefix_envs.bat VS2019 @@ -582,7 +590,7 @@ endlocal :Usage @echo. - @echo Usage: "%0 [-h | -help | --help | /h | /help | /?] [ Rebuild | ForceRebuild ] [Reconfig] [Mingw-w64] [base_tools_path [edk_tools_path]] [VS2022] [VS2019] [VS2017] [VS2015]" + @echo Usage: "%0 [-h | -help | --help | /h | /help | /?] [ Rebuild | ForceRebuild ] [Reconfig] [Mingw-w64] [base_tools_path [edk_tools_path]] [VS2026] [VS2022] [VS2019] [VS2017] [VS2015]" @echo. @echo base_tools_path BaseTools project path, BASE_TOOLS_PATH will be set to this path. @echo edk_tools_path EDK_TOOLS_PATH will be set to this path. @@ -596,12 +604,14 @@ endlocal @echo VS2017 Set the env for VS2017 build. @echo VS2019 Set the env for VS2019 build. @echo VS2022 Set the env for VS2022 build. + @echo VS2026 Set the env for VS2026 build. @echo. :end set REBUILD= set FORCE_REBUILD= set RECONFIG= +set VS2026= set VS2022= set VS2019= set VS2017= diff --git a/edksetup.bat b/edksetup.bat index 8ee17c112c..d0b06241e8 100755 --- a/edksetup.bat +++ b/edksetup.bat @@ -135,6 +135,7 @@ if defined CYGWIN_HOME ( if /I "%1"=="Rebuild" shift if /I "%1"=="ForceRebuild" shift if /I "%1"=="Mingw-w64" shift +if /I "%1"=="VS2026" shift if /I "%1"=="VS2022" shift if /I "%1"=="VS2019" shift if /I "%1"=="VS2017" shift @@ -143,7 +144,7 @@ if "%1"=="" goto end :Usage @echo. - @echo Usage: "%0 [-h | -help | --help | /h | /help | /?] [Reconfig] [Rebuild] [ForceRebuild] [Mingw-w64] [VS2022] [VS2019] [VS2017] [VS2015]" + @echo Usage: "%0 [-h | -help | --help | /h | /help | /?] [Reconfig] [Rebuild] [ForceRebuild] [Mingw-w64] [VS2026] [VS2022] [VS2019] [VS2017] [VS2015]" @echo. @echo Reconfig Reinstall target.txt, tools_def.txt and build_rule.txt. @echo Rebuild Perform incremental rebuild of BaseTools binaries. @@ -153,6 +154,7 @@ if "%1"=="" goto end @echo VS2017 Set the env for VS2017 build. @echo VS2019 Set the env for VS2019 build. @echo VS2022 Set the env for VS2022 build. + @echo VS2026 Set the env for VS2026 build. @echo. @echo Note that target.template, tools_def.template and build_rules.template @echo will only be copied to target.txt, tools_def.txt and build_rule.txt