Skip to content

Commit 106b923

Browse files
committed
Using suggested MSVC build tools version for latest UE versions
1 parent 9d0d2aa commit 106b923

File tree

3 files changed

+35
-3
lines changed

3 files changed

+35
-3
lines changed

src/ue4docker/build.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,8 @@ def build():
408408
"--build-arg",
409409
"VISUAL_STUDIO_BUILD_NUMBER="
410410
+ config.visualStudio.build_number,
411+
"--build-arg",
412+
"UE_VERSION=" + config.release,
411413
]
412414

413415
custom_prerequisites_dockerfile = config.args.prerequisites_dockerfile

src/ue4docker/dockerfiles/ue4-build-prerequisites/windows/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,5 @@ RUN powershell -NoProfile -ExecutionPolicy Bypass -Command "$env:chocolateyVersi
6161
# Install the rest of our build prerequisites and clean up afterwards to minimise image size
6262
COPY install-prerequisites.ps1 C:\
6363
ARG VISUAL_STUDIO_BUILD_NUMBER
64-
RUN powershell -ExecutionPolicy Bypass -File C:\install-prerequisites.ps1 %VISUAL_STUDIO_BUILD_NUMBER%
64+
ARG UE_VERSION
65+
RUN powershell -ExecutionPolicy Bypass -File C:\install-prerequisites.ps1 %VISUAL_STUDIO_BUILD_NUMBER% %UE_VERSION%

src/ue4docker/dockerfiles/ue4-build-prerequisites/windows/install-prerequisites.ps1

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,32 @@ Expand-Archive -Path "$env:TEMP\vulkan-runtime-components.zip" -DestinationPath
5555
Copy-Item -Path "*\x64\vulkan-1.dll" -Destination C:\Windows\System32\
5656

5757
$visual_studio_build = $args[0]
58+
$unreal_engine_version = $args[1]
59+
60+
Write-Host "Unreal Engine version: $unreal_engine_version"
5861

5962
if ($visual_studio_build -eq "15")
6063
{
6164
$windows_sdk_version = 18362
65+
$windows_os_version = "Windows10SDK"
6266
}
6367
else
6468
{
6569
$windows_sdk_version = 20348
70+
$windows_os_version = "Windows10SDK"
71+
72+
# NOTE: See suggested components https://github.com/EpicGames/UnrealEngine/blob/release/Engine/Config/Windows/Windows_SDK.json
73+
if ($unreal_engine_version.StartsWith("5.4"))
74+
{
75+
$windows_sdk_version = 22621
76+
$vs_tools_version = "14.38.17.8"
77+
}
78+
elseif ($unreal_engine_version.StartsWith("5.5"))
79+
{
80+
$windows_sdk_version = 22621
81+
$windows_os_version = "Windows11SDK"
82+
$vs_tools_version = "14.38.17.8"
83+
}
6684
}
6785

6886
# NOTE: We use the Visual Studio 2022 installer even for Visual Studio 2019 and 2017 here because the old (2017) installer now breaks
@@ -85,15 +103,26 @@ $vs_args = @(
85103
"--add", "Microsoft.VisualStudio.Workload.VCTools",
86104
"--add", "Microsoft.VisualStudio.Workload.MSBuildTools",
87105
"--add", "Microsoft.VisualStudio.Component.NuGet",
88-
"--add", "Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
89-
"--add", "Microsoft.VisualStudio.Component.Windows10SDK.$windows_sdk_version",
106+
"--add", "Microsoft.VisualStudio.Component.$windows_os_version.$windows_sdk_version",
90107
"--add", "Microsoft.Net.Component.4.5.TargetingPack",
91108
"--add", "Microsoft.Net.Component.4.6.2.TargetingPack",
92109
"--add", "Microsoft.Net.ComponentGroup.DevelopmentPrerequisites",
93110
"--add", "Microsoft.NetCore.Component.SDK",
94111
"--add", "Microsoft.NetCore.Component.Runtime.3.1"
95112
)
96113

114+
if (-not ([string]::IsNullOrEmpty($vs_tools_version))) {
115+
$vs_args = $vs_args,
116+
"--add", "Microsoft.VisualStudio.Component.VC.$vs_tools_version.x86.x64",
117+
"--remove", "Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
118+
"--remove", "Microsoft.VisualStudio.Component.Windows10SDK.20348"
119+
}
120+
else
121+
{
122+
$vs_args = $vs_args,
123+
"--add", "Microsoft.VisualStudio.Component.VC.Tools.x86.x64"
124+
}
125+
97126
# Install the Visual Studio Build Tools workloads and components we need
98127
RunProcessChecked "$env:TEMP\vs_buildtools.exe" $vs_args
99128

0 commit comments

Comments
 (0)