Skip to content

Commit 1189ccb

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

File tree

3 files changed

+33
-3
lines changed

3 files changed

+33
-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: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,30 @@ 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]
5859

5960
if ($visual_studio_build -eq "15")
6061
{
6162
$windows_sdk_version = 18362
63+
$windows_os_version = "Windows10SDK"
6264
}
6365
else
6466
{
6567
$windows_sdk_version = 20348
68+
$windows_os_version = "Windows10SDK"
69+
70+
# NOTE: See suggested components https://github.com/EpicGames/UnrealEngine/blob/release/Engine/Config/Windows/Windows_SDK.json
71+
if ($unreal_engine_version.StartsWith("5.4"))
72+
{
73+
$windows_sdk_version = 22621
74+
$vs_tools_version = "14.38.17.8"
75+
}
76+
elseif ($unreal_engine_version.StartsWith("5.5"))
77+
{
78+
$windows_sdk_version = 22621
79+
$windows_os_version = "Windows11SDK"
80+
$vs_tools_version = "14.38.17.8"
81+
}
6682
}
6783

6884
# 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 +101,26 @@ $vs_args = @(
85101
"--add", "Microsoft.VisualStudio.Workload.VCTools",
86102
"--add", "Microsoft.VisualStudio.Workload.MSBuildTools",
87103
"--add", "Microsoft.VisualStudio.Component.NuGet",
88-
"--add", "Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
89-
"--add", "Microsoft.VisualStudio.Component.Windows10SDK.$windows_sdk_version",
104+
"--add", "Microsoft.VisualStudio.Component.$windows_os_version.$windows_sdk_version",
90105
"--add", "Microsoft.Net.Component.4.5.TargetingPack",
91106
"--add", "Microsoft.Net.Component.4.6.2.TargetingPack",
92107
"--add", "Microsoft.Net.ComponentGroup.DevelopmentPrerequisites",
93108
"--add", "Microsoft.NetCore.Component.SDK",
94109
"--add", "Microsoft.NetCore.Component.Runtime.3.1"
95110
)
96111

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

0 commit comments

Comments
 (0)