Skip to content

Commit

Permalink
BaseTools: Add VS2022 support.
Browse files Browse the repository at this point in the history
Adding tools_def for VS2022.
Update WindowsVsToolChain to support VS2022.
Update set_vsPrefix_envs and toolsetup and edksetup to support VS2022.

Signed-off-by: Aaron Pop <aaronpop@microsoft.com>
  • Loading branch information
matthewfcarlson authored and apop5 committed Jun 26, 2024
1 parent 0333faf commit 36c019a
Show file tree
Hide file tree
Showing 5 changed files with 392 additions and 7 deletions.
165 changes: 160 additions & 5 deletions BaseTools/Conf/tools_def.template
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
# - Remove VS2008, VS2010, VS2012, VS2013, CLANG35, CLANG38, EBC
# - Add GCC and GCCNOLTO
# - Deprecate GCC48, GCC49 and GCC5.
# 3.01 - Add toolchain for VS2022
#
#!VERSION=3.00
#!VERSION=3.01

IDENTIFIER = Default TOOL_CHAIN_CONF

Expand Down Expand Up @@ -50,6 +51,13 @@ DEFINE VS2019_BIN_X64 = DEF(VS2019_BIN)\HostDEF(VS_HOST)\x64
DEFINE VS2019_BIN_ARM = DEF(VS2019_BIN)\HostDEF(VS_HOST)\arm
DEFINE VS2019_BIN_AARCH64 = DEF(VS2019_BIN)\HostDEF(VS_HOST)\arm64

DEFINE VS2022_BIN = ENV(VS2022_PREFIX)bin
DEFINE VS2022_BIN_HOST = DEF(VS2022_BIN)\HostDEF(VS_HOST)\DEF(VS_HOST)
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_ARM = DEF(VS2022_BIN)\HostDEF(VS_HOST)\arm
DEFINE VS2022_BIN_AARCH64 = DEF(VS2022_BIN)\HostDEF(VS_HOST)\arm64

#
# Resource compiler
#
Expand All @@ -62,7 +70,7 @@ DEFINE WINSDKx86_BIN = ENV(WINSDKx86_PREFIX)
DEFINE WINSDK81_BIN = ENV(WINSDK81_PREFIX)x86\
DEFINE WINSDK81x86_BIN = ENV(WINSDK81x86_PREFIX)x64

# Microsoft Visual Studio 2017/2019 Professional Edition
# Microsoft Visual Studio 2017/2019/2022 Professional Edition
DEFINE WINSDK10_BIN = ENV(WINSDK10_PREFIX)DEF(VS_HOST)

# These defines are needed for certain Microsoft Visual Studio tools that
Expand Down Expand Up @@ -158,9 +166,11 @@ DEFINE DTC_BIN = ENV(DTC_PREFIX)dtc
# Required to build platforms or ACPI tables:
# Intel(r) ACPI Compiler (iasl.exe) from
# https://acpica.org/downloads
# Note:
# Building of XIP firmware images for ARM/ARM64 is not currently supported (only applications).
# /FILEALIGN:4096 and other changes are needed for ARM firmware builds.
# VS2022 -win32,win64- Requires:
# Microsoft Visual Studio 2022 version 17.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, aarch64-linux-gnu, or arm-linux-gnueabi
# Optional:
Expand Down Expand Up @@ -723,6 +733,151 @@ NOOPT_VS2019_AARCH64_ASM_FLAGS = /nologo
RELEASE_VS2019_AARCH64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /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
NOOPT_VS2019_AARCH64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /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

####################################################################################
# VS2022 - Microsoft Visual Studio 2022 with Intel ASL
# ASL - Intel ACPI Source Language Compiler (iasl.exe)
####################################################################################
# VS2022 - Microsoft Visual Studio 2022 with Intel ASL
*_VS2022_*_*_FAMILY = MSFT
*_VS2022_*_*_DLL = DEF(VS2022_BIN_HOST)

*_VS2022_*_MAKE_PATH = DEF(VS2022_BIN_HOST)\nmake.exe
*_VS2022_*_MAKE_FLAG = /nologo
*_VS2022_*_RC_PATH = DEF(RC_PATH)

*_VS2022_*_MAKE_FLAGS = /nologo
*_VS2022_*_SLINK_FLAGS = /NOLOGO /LTCG
*_VS2022_*_APP_FLAGS = /nologo /E /TC
*_VS2022_*_PP_FLAGS = /nologo /E /TC /FIAutoGen.h
*_VS2022_*_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
# *_VS2022_*_DLINK2_FLAGS = /WHOLEARCHIVE # MU_CHANGE
*_VS2022_*_ASM16_PATH = DEF(VS2022_BIN_IA32)\ml.exe
*_VS2022_*_DEPS_FLAGS = DEF(MSFT_DEPS_FLAGS)
##################
# ASL definitions
##################
*_VS2022_*_ASL_PATH = DEF(WIN_IASL_BIN)
*_VS2022_*_ASL_FLAGS = DEF(DEFAULT_WIN_ASL_FLAGS)
*_VS2022_*_ASL_OUTFLAGS = DEF(DEFAULT_WIN_ASL_OUTFLAGS)
*_VS2022_*_ASLCC_FLAGS = DEF(MSFT_ASLCC_FLAGS)
*_VS2022_*_ASLPP_FLAGS = DEF(MSFT_ASLPP_FLAGS)
*_VS2022_*_ASLDLINK_FLAGS = DEF(MSFT_ASLDLINK_FLAGS)

##################
# IA32 definitions
##################
*_VS2022_IA32_CC_PATH = DEF(VS2022_BIN_IA32)\cl.exe
*_VS2022_IA32_VFRPP_PATH = DEF(VS2022_BIN_IA32)\cl.exe
*_VS2022_IA32_ASLCC_PATH = DEF(VS2022_BIN_IA32)\cl.exe
*_VS2022_IA32_ASLPP_PATH = DEF(VS2022_BIN_IA32)\cl.exe
*_VS2022_IA32_SLINK_PATH = DEF(VS2022_BIN_IA32)\lib.exe
*_VS2022_IA32_DLINK_PATH = DEF(VS2022_BIN_IA32)\link.exe
*_VS2022_IA32_ASLDLINK_PATH= DEF(VS2022_BIN_IA32)\link.exe
*_VS2022_IA32_APP_PATH = DEF(VS2022_BIN_IA32)\cl.exe
*_VS2022_IA32_PP_PATH = DEF(VS2022_BIN_IA32)\cl.exe
*_VS2022_IA32_ASM_PATH = DEF(VS2022_BIN_IA32)\ml.exe

*_VS2022_IA32_MAKE_FLAGS = /nologo
DEBUG_VS2022_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_VS2022_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gw
NOOPT_VS2022_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768 /D UNICODE /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Z7 /Od

DEBUG_VS2022_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi
RELEASE_VS2022_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd
NOOPT_VS2022_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi

DEBUG_VS2022_IA32_NASM_FLAGS = -Ox -f win32 -g
RELEASE_VS2022_IA32_NASM_FLAGS = -Ox -f win32
NOOPT_VS2022_IA32_NASM_FLAGS = -O0 -f win32 -g

DEBUG_VS2022_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
RELEASE_VS2022_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
NOOPT_VS2022_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

##################
# X64 definitions
##################
*_VS2022_X64_CC_PATH = DEF(VS2022_BIN_X64)\cl.exe
*_VS2022_X64_PP_PATH = DEF(VS2022_BIN_X64)\cl.exe
*_VS2022_X64_APP_PATH = DEF(VS2022_BIN_X64)\cl.exe
*_VS2022_X64_VFRPP_PATH = DEF(VS2022_BIN_X64)\cl.exe
*_VS2022_X64_ASLCC_PATH = DEF(VS2022_BIN_X64)\cl.exe
*_VS2022_X64_ASLPP_PATH = DEF(VS2022_BIN_X64)\cl.exe
*_VS2022_X64_ASM_PATH = DEF(VS2022_BIN_X64)\ml64.exe
*_VS2022_X64_SLINK_PATH = DEF(VS2022_BIN_X64)\lib.exe
*_VS2022_X64_DLINK_PATH = DEF(VS2022_BIN_X64)\link.exe
*_VS2022_X64_ASLDLINK_PATH = DEF(VS2022_BIN_X64)\link.exe

DEBUG_VS2022_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Z7 /Gw
RELEASE_VS2022_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Gw
NOOPT_VS2022_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Z7 /Od

DEBUG_VS2022_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi
RELEASE_VS2022_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd
NOOPT_VS2022_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi

DEBUG_VS2022_X64_NASM_FLAGS = -Ox -f win64 -g
RELEASE_VS2022_X64_NASM_FLAGS = -Ox -f win64
NOOPT_VS2022_X64_NASM_FLAGS = -O0 -f win64 -g

DEBUG_VS2022_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
RELEASE_VS2022_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
NOOPT_VS2022_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

#################
# ARM definitions
#################
*_VS2022_ARM_CC_PATH = DEF(VS2022_BIN_ARM)\cl.exe
*_VS2022_ARM_VFRPP_PATH = DEF(VS2022_BIN_ARM)\cl.exe
*_VS2022_ARM_SLINK_PATH = DEF(VS2022_BIN_ARM)\lib.exe
*_VS2022_ARM_DLINK_PATH = DEF(VS2022_BIN_ARM)\link.exe
*_VS2022_ARM_APP_PATH = DEF(VS2022_BIN_ARM)\cl.exe
*_VS2022_ARM_PP_PATH = DEF(VS2022_BIN_ARM)\cl.exe
*_VS2022_ARM_ASM_PATH = DEF(VS2022_BIN_ARM)\armasm.exe
*_VS2022_ARM_ASLCC_PATH = DEF(VS2022_BIN_ARM)\cl.exe
*_VS2022_ARM_ASLPP_PATH = DEF(VS2022_BIN_ARM)\cl.exe
*_VS2022_ARM_ASLDLINK_PATH = DEF(VS2022_BIN_ARM)\link.exe

*_VS2022_ARM_MAKE_FLAGS = /nologo
DEBUG_VS2022_ARM_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Zi /Gw /Oi-
RELEASE_VS2022_ARM_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gw /Oi-
NOOPT_VS2022_ARM_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Zi /Od /Oi-

DEBUG_VS2022_ARM_ASM_FLAGS = /nologo /g
RELEASE_VS2022_ARM_ASM_FLAGS = /nologo
NOOPT_VS2022_ARM_ASM_FLAGS = /nologo

DEBUG_VS2022_ARM_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:ARM /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
RELEASE_VS2022_ARM_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:ARM /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
NOOPT_VS2022_ARM_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:ARM /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG

#####################
# AARCH64 definitions
#####################
*_VS2022_AARCH64_CC_PATH = DEF(VS2022_BIN_AARCH64)\cl.exe
*_VS2022_AARCH64_VFRPP_PATH = DEF(VS2022_BIN_AARCH64)\cl.exe
*_VS2022_AARCH64_SLINK_PATH = DEF(VS2022_BIN_AARCH64)\lib.exe
*_VS2022_AARCH64_DLINK_PATH = DEF(VS2022_BIN_AARCH64)\link.exe
*_VS2022_AARCH64_APP_PATH = DEF(VS2022_BIN_AARCH64)\cl.exe
*_VS2022_AARCH64_PP_PATH = DEF(VS2022_BIN_AARCH64)\cl.exe
*_VS2022_AARCH64_ASM_PATH = DEF(VS2022_BIN_AARCH64)\armasm64.exe
*_VS2022_AARCH64_ASLCC_PATH = DEF(VS2022_BIN_AARCH64)\cl.exe
*_VS2022_AARCH64_ASLPP_PATH = DEF(VS2022_BIN_AARCH64)\cl.exe
*_VS2022_AARCH64_ASLDLINK_PATH = DEF(VS2022_BIN_AARCH64)\link.exe

*_VS2022_AARCH64_MAKE_FLAGS = /nologo
DEBUG_VS2022_AARCH64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Zi /Gw /Oi-
RELEASE_VS2022_AARCH64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gw /Oi-
NOOPT_VS2022_AARCH64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Zi /Od /Oi-

DEBUG_VS2022_AARCH64_ASM_FLAGS = /nologo /g
RELEASE_VS2022_AARCH64_ASM_FLAGS = /nologo
NOOPT_VS2022_AARCH64_ASM_FLAGS = /nologo

DEBUG_VS2022_AARCH64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /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
RELEASE_VS2022_AARCH64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /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
NOOPT_VS2022_AARCH64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /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

####################################################################################
# GCC Common
####################################################################################
Expand Down
Loading

0 comments on commit 36c019a

Please sign in to comment.