Skip to content

Commit 832d333

Browse files
committed
Install Windows SDK >= 18362 when using VS2019 to fix compilation of UE-4.27.0
resolves #192
1 parent 9bd34d9 commit 832d333

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

ue4docker/dockerfiles/ue4-build-prerequisites/windows/install-prerequisites.bat

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,29 @@ curl --progress-bar -L "https://sdk.lunarg.com/sdk/download/latest/windows/vulka
3131
powershell -Command "Expand-Archive -Path \"$env:TEMP\vulkan-runtime-components.zip\" -DestinationPath $env:TEMP" && ^
3232
powershell -Command "Copy-Item -Path \"*\x64\vulkan-1.dll\" -Destination C:\Windows\System32" || goto :error
3333

34+
@rem Use the latest available Windows SDK. The motivation behind this is:
35+
@rem 1. Newer SDKs allow developers to use newer APIs. Developers can guard that API usage with runtime version checks if they want to continue to support older Windows releases.
36+
@rem 2. Unreal Engine slowly moves to newer Windows SDK. 4.27.0 no longer compiles with SDKs older than 18362 and even if it will be fixed in 4.27.x,
37+
@rem this is just a question of a time when older SDKs support will be dropped completely
38+
@rem 3. UE5 doesn't support VS2017 at all, so in the future that argument for continuing to use Windows SDK 17763 from VS2017 era will be weaker and weaker.
39+
@rem
40+
@rem We can't use newer SDK for VS2017 that is used to compile older engines because 18362 SDK support was only added in UE-4.23.
41+
@rem
42+
@rem See https://github.com/adamrehn/ue4-docker/issues/192
43+
@rem See https://forums.unrealengine.com/t/ndis_miniport_major_version-is-not-defined-error/135058
44+
@rem See https://github.com/EpicGames/UnrealEngine/blame/4.23.0-release/Engine/Source/Programs/UnrealBuildTool/Platform/Windows/UEBuildWindows.cs#L1822-L1823
45+
@rem See https://github.com/EpicGames/UnrealEngine/commit/ecc4872c3269e75a24adc40734cc8bcc9bbed1ca
46+
@rem See https://udn.unrealengine.com/s/question/0D54z000079HcjJCAS/d3d12h427-error-c4668-winapipartitiongames-is-not-defined-as-a-preprocessor-macro-replacing-with-0-for-ifelif
47+
@rem
48+
@rem Keywords for Google:
49+
@rem error C4668: 'NDIS_MINIPORT_MAJOR_VERSION' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif
50+
@rem d3d12.h(427): error C4668: 'WINAPI_PARTITION_GAMES' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
3451
set VISUAL_STUDIO_BUILD_NUMBER=%~1
52+
if "%VISUAL_STUDIO_BUILD_NUMBER%" == "15" (
53+
set WINDOWS_SDK_VERSION=17763
54+
) else (
55+
set WINDOWS_SDK_VERSION=20348
56+
)
3557

3658
@rem Install the Visual Studio Build Tools workloads and components we need
3759
@rem NOTE: We use the Visual Studio 2019 installer even for Visual Studio 2017 here because the old installer now breaks
@@ -49,7 +71,7 @@ curl --progress-bar -L "https://aka.ms/vs/16/release/vs_buildtools.exe" --output
4971
--add Microsoft.VisualStudio.Workload.MSBuildTools ^
5072
--add Microsoft.VisualStudio.Component.NuGet ^
5173
--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 ^
52-
--add Microsoft.VisualStudio.Component.Windows10SDK.17763 ^
74+
--add Microsoft.VisualStudio.Component.Windows10SDK.%WINDOWS_SDK_VERSION% ^
5375
--add Microsoft.Net.Component.4.5.TargetingPack ^
5476
--add Microsoft.Net.ComponentGroup.4.6.2.DeveloperTools ^
5577
--add Microsoft.NetCore.Component.SDK

0 commit comments

Comments
 (0)