Skip to content

Update Windows build environment to use Visual Studio 2022 #41

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 26 additions & 19 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ jobs:
fail-fast: false
matrix:
include: [
{ NAME: 'AppPkg', PACKAGE: 'AppPkg/AppPkg.dsc', TARGET: 'RELEASE', ARCH: 'X64', TOOLCHAIN: 'VS2019', ADDITIONAL_DEFINITION: '-D BUILD_PYTHON368' },
{ NAME: 'AppPkg', PACKAGE: 'AppPkg/AppPkg.dsc', TARGET: 'DEBUG', ARCH: 'X64', TOOLCHAIN: 'VS2019', ADDITIONAL_DEFINITION: '-D BUILD_PYTHON368' },
{ NAME: 'ShellPkg', PACKAGE: 'ShellPkg/ShellPkg.dsc', TARGET: 'RELEASE', ARCH: 'X64', TOOLCHAIN: 'VS2019', ADDITIONAL_DEFINITION: '' },
{ NAME: 'AppPkg', PACKAGE: 'AppPkg/AppPkg.dsc', TARGET: 'RELEASE', ARCH: 'X64', TOOLCHAIN: 'VS2022', ADDITIONAL_DEFINITION: '-D BUILD_PYTHON368' },
{ NAME: 'AppPkg', PACKAGE: 'AppPkg/AppPkg.dsc', TARGET: 'DEBUG', ARCH: 'X64', TOOLCHAIN: 'VS2022', ADDITIONAL_DEFINITION: '-D BUILD_PYTHON368' },
{ NAME: 'ShellPkg', PACKAGE: 'ShellPkg/ShellPkg.dsc', TARGET: 'RELEASE', ARCH: 'X64', TOOLCHAIN: 'VS2022', ADDITIONAL_DEFINITION: '' },
{ NAME: 'ShellPkg', PACKAGE: 'ShellPkg/ShellPkg.dsc', TARGET: 'DEBUG', ARCH: 'X64', TOOLCHAIN: 'CLANGPDB', ADDITIONAL_DEFINITION: '' },
{ NAME: 'FatPkg', PACKAGE: 'FatPkg/FatPkg.dsc', TARGET: 'RELEASE', ARCH: 'X64', TOOLCHAIN: 'VS2019', ADDITIONAL_DEFINITION: '' },
{ NAME: 'AsixPkg', PACKAGE: 'Drivers/ASIX/Asix.dsc', TARGET: 'RELEASE', ARCH: 'X64', TOOLCHAIN: 'VS2019', ADDITIONAL_DEFINITION: '' },
{ NAME: 'DisplayLinkPkg', PACKAGE: 'Drivers/DisplayLink/DisplayLinkPkg/DisplayLinkPkg.dsc', TARGET: 'RELEASE', ARCH: 'X64', TOOLCHAIN: 'VS2019', ADDITIONAL_DEFINITION: '' },
{ NAME: 'OvmfPkg', PACKAGE: 'OvmfPkg/OvmfPkgX64.dsc', TARGET: 'RELEASE', ARCH: 'X64', TOOLCHAIN: 'VS2019', ADDITIONAL_DEFINITION: '' },
{ NAME: 'FatPkg', PACKAGE: 'FatPkg/FatPkg.dsc', TARGET: 'RELEASE', ARCH: 'X64', TOOLCHAIN: 'VS2022', ADDITIONAL_DEFINITION: '' },
{ NAME: 'AsixPkg', PACKAGE: 'Drivers/ASIX/Asix.dsc', TARGET: 'RELEASE', ARCH: 'X64', TOOLCHAIN: 'VS2022', ADDITIONAL_DEFINITION: '' },
{ NAME: 'DisplayLinkPkg', PACKAGE: 'Drivers/DisplayLink/DisplayLinkPkg/DisplayLinkPkg.dsc', TARGET: 'RELEASE', ARCH: 'X64', TOOLCHAIN: 'VS2022', ADDITIONAL_DEFINITION: '' },
{ NAME: 'OvmfPkg', PACKAGE: 'OvmfPkg/OvmfPkgX64.dsc', TARGET: 'RELEASE', ARCH: 'X64', TOOLCHAIN: 'VS2022', ADDITIONAL_DEFINITION: '' },
{ NAME: 'OvmfPkg', PACKAGE: 'OvmfPkg/OvmfPkgX64.dsc', TARGET: 'DEBUG', ARCH: 'X64', TOOLCHAIN: 'CLANGPDB', ADDITIONAL_DEFINITION: '' },
{ NAME: 'UefiSct', PACKAGE: 'SctPkg/UEFI/UEFI_SCT.dsc', TARGET: 'RELEASE', ARCH: 'X64', TOOLCHAIN: 'VS2019', ADDITIONAL_DEFINITION: '' },
{ NAME: 'IhvSct', PACKAGE: 'SctPkg/UEFI/IHV_SCT.dsc', TARGET: 'RELEASE', ARCH: 'X64', TOOLCHAIN: 'VS2019', ADDITIONAL_DEFINITION: '' },
{ NAME: 'UefiSct', PACKAGE: 'SctPkg/UEFI/UEFI_SCT.dsc', TARGET: 'RELEASE', ARCH: 'X64', TOOLCHAIN: 'VS2022', ADDITIONAL_DEFINITION: '' },
{ NAME: 'IhvSct', PACKAGE: 'SctPkg/UEFI/IHV_SCT.dsc', TARGET: 'RELEASE', ARCH: 'X64', TOOLCHAIN: 'VS2022', ADDITIONAL_DEFINITION: '' },
]
steps:
- name: Checkout repositories
Expand All @@ -31,7 +31,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: '3.12'

- name: Setup build environment
shell: cmd
Expand All @@ -42,25 +42,32 @@ jobs:
curl -SL --output ${{ github.workspace }}\iasl-win-20240321.zip https://downloadmirror.intel.com/819464/iasl-win-20240321.zip
powershell -Command "expand-archive -Path '${{ github.workspace }}\iasl-win-20240321.zip' -DestinationPath 'c:\ASL'"

- name: Setup VS2019 build environment
if: ${{ matrix.TOOLCHAIN == 'VS2019' }}
shell: cmd
run: |-
curl -SL --output ${{ github.workspace }}\vs_buildtools.exe https://aka.ms/vs/16/release/vs_buildtools.exe
${{ github.workspace }}\vs_buildtools.exe --quiet --wait --norestart --add Microsoft.VisualStudio.Component.VC.CoreBuildTools --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows11SDK.22000
# - name: Setup VS2019 build environment
# if: ${{ matrix.TOOLCHAIN == 'VS2019' }}
# shell: cmd
# run: |-
# curl -SL --output ${{ github.workspace }}\vs_buildtools.exe https://aka.ms/vs/16/release/vs_buildtools.exe
# ${{ github.workspace }}\vs_buildtools.exe --quiet --wait --norestart --add Microsoft.VisualStudio.Component.VC.CoreBuildTools --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows11SDK.22000

# - name: Setup VS2022 build environment
# if: ${{ matrix.TOOLCHAIN == 'VS2022' }}
# shell: cmd
# run: |-
# curl -SL --output ${{ github.workspace }}\vs_buildtools.exe https://aka.ms/vs/17/release/vs_buildtools.exe
# ${{ github.workspace }}\vs_buildtools.exe --quiet --wait --norestart --add Microsoft.VisualStudio.Component.VC.CoreBuildTools --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows11SDK.22000

- name: Setup CLANG build environment
if: ${{ matrix.TOOLCHAIN == 'CLANGPDB' }}
run: |-
choco install mingw llvm

- name: Build BaseTools with VS2019
- name: Build BaseTools with VS2022
if: ${{ matrix.TOOLCHAIN != 'CLANGPDB' }}
shell: cmd
run: |-
set WORKSPACE=${{ github.workspace }}
set PACKAGES_PATH=%WORKSPACE%\edk2
%WORKSPACE%\edk2\edksetup.bat ForceRebuild
%WORKSPACE%\edk2\edksetup.bat VS2022 ForceRebuild

- name: Build BaseTools with GCC
if: ${{ matrix.TOOLCHAIN == 'CLANGPDB' }}
Expand Down Expand Up @@ -123,7 +130,7 @@ jobs:
sed -i "1734s/KeyboardWaitForValue/\/\/KeyboardWaitForValue/" edk2/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c
sed -i "1736s/mWaitForValueTimeOut/\/\/mWaitForValueTimeOut/" edk2/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c

- name: Build with VS2019
- name: Build with VS2022
if: ${{ matrix.TOOLCHAIN != 'CLANGPDB' }}
shell: cmd
run: |-
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ source edk2/edksetup.sh
build -a X64 -t GCC -p ShellPkg/ShellPkg.dsc -b RELEASE
```

## Windows + Visual Studio Community 2019
## Windows + Visual Studio Community 2022

### Setup Windows build environment

- Install Python 3.x
- Install [Microsoft Visual Studio community 2019](https://aka.ms/vs/16/release/vs_community.exe)
- Install [Microsoft Visual Studio community 2022](https://aka.ms/vs/17/release/vs_community.exe)
- Install [NASM 2.16.03](https://www.nasm.us/pub/nasm/releasebuilds/2.16.03/win64/nasm-2.16.03-win64.zip) (edk2_stable202205 or above)
- [PR#2354 - Replace Opcode with the corresponding instructions](https://github.com/tianocore/edk2/pull/2354)
- [BaseTools: Upgrade the version of NASM tool](https://github.com/tianocore/edk2/commit/6a890db161cd6d378bec3499a1e774db3f5a27a7)
Expand All @@ -87,7 +87,7 @@ build -a X64 -t GCC -p ShellPkg/ShellPkg.dsc -b RELEASE
git clone --recursive -j4 -v https://github.com/saqwed/myedk2.git myedk2
```

### Setup edk2 build environment with VS2019
### Setup edk2 build environment with VS2022

```batch
REM open a new command prompt
Expand All @@ -106,13 +106,13 @@ set BASETOOLS_MINGW_PATH=c:\ProgramData\mingw64\mingw64\
set EDK_TOOLS_PATH=%WORKSPACE%\edk2\BaseTools
set EDK_TOOLS_BIN=%WORKSPACE%\edk2\BaseTools\Source\C\bin\
REM Need to use sed and awk, you can download them in utilities directory
sed -i "s/register//g" %WORKSPACE%\BaseTools\Source\C\VfrCompile\Pccts\h\AParser.cpp
sed -i "s/register//g" %WORKSPACE%\BaseTools\Source\C\VfrCompile\Pccts\h\DLexer.h
sed -i "s/$(CC)/gcc/g" %WORKSPACE%\BaseTools\Source\C\VfrCompile\Pccts\antlr\makefile
sed -i "s/register//g" %WORKSPACE%\edk2\BaseTools\Source\C\VfrCompile\Pccts\h\AParser.cpp
sed -i "s/register//g" %WORKSPACE%\edk2\BaseTools\Source\C\VfrCompile\Pccts\h\DLexer.h
sed -i "s/$(CC)/gcc/g" %WORKSPACE%\edk2\BaseTools\Source\C\VfrCompile\Pccts\antlr\makefile
edksetup.bat Mingw-w64 Rebuild
```

### Build with VS2019
### Build with VS2022

```batch
REM open a new command prompt
Expand All @@ -130,8 +130,8 @@ set PACKAGES_PATH=%PACKAGES_PATH%;%WORKSPACE%/edk2-libc
set PACKAGES_PATH=%PACKAGES_PATH%;%WORKSPACE%/edk2-test
set PACKAGES_PATH=%PACKAGES_PATH%;%WORKSPACE%/SctPkg
REM
edk2\edksetup.bat VS2019
build -a X64 -t VS2019 -p ShellPkg/ShellPkg.dsc -b RELEASE
edk2\edksetup.bat VS2022
build -a X64 -t VS2022 -p ShellPkg/ShellPkg.dsc -b RELEASE
```

### Build with CLANG
Expand Down
Loading