-
Notifications
You must be signed in to change notification settings - Fork 296
149 lines (146 loc) · 6.28 KB
/
buildWindows.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: Build Windows
on:
workflow_call:
inputs:
runner-label:
required: true
type: string
visual-studio-version:
required: false
type: string
default: ''
visual-studio-components:
required: false
type: string
default: ''
unreal-engine-version:
required: true
type: string
unreal-engine-zip:
required: true
type: string
# unreal-linux-toolchain:
# required: false
# type: string
# default: ""
unreal-program-name:
required: true
type: string
upload-package-base-name:
required: true
type: string
extra-choco-packages:
required: false
type: string
default: ''
cmake-generator:
required: true
type: string
cmake-toolchain:
required: false
type: string
default: ""
cmake-platform:
required: false
type: string
default: "x64"
jobs:
build:
runs-on: ${{ inputs.runner-label }}
steps:
- name: Check disk space
run: |
get-psdrive
- name: Install Visual Studio components
if: ${{ inputs.visual-studio-version && inputs.visual-studio-components }}
run: |
$components = "${{ inputs.visual-studio-components }}" -split "," | foreach {"--add $_"}
if ($components.Length -gt 0)
{
$componentcmd = $components -join " "
Start-Process "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" -ArgumentList "modify --installPath ""C:\Program Files\Microsoft Visual Studio\${{ inputs.visual-studio-version }}\Enterprise"" --quiet $componentcmd" -Wait -PassThru
}
- name: Check out repository code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Extra Dependencies
if: ${{ inputs.extra-choco-packages }}
run: |
choco install -y ${{ inputs.extra-choco-packages }}
- name: Configure vcpkg caching
uses: ./.github/actions/vcpkg-cache
with:
id: ${{ inputs.upload-package-base-name }}
- name: Set environment variables
run: |
$env:CESIUM_UNREAL_VERSION=$env:GITHUB_REF_NAME
$env:BUILD_CESIUM_UNREAL_PACKAGE_NAME="${{ inputs.upload-package-base-name }}-${env:CESIUM_UNREAL_VERSION}"
$env:BUILD_CESIUM_UNREAL_PACKAGE_PATH="$env:GITHUB_WORKSPACE/packages/CesiumForUnreal"
$env:UNREAL_BATCH_FILES_PATH="D:/Program Files/Epic Games/${{ inputs.unreal-program-name }}/Engine/Build/BatchFiles"
$env:AWS_REGION="us-east-1"
# Make these available to subsequent steps
echo "BUILD_CESIUM_UNREAL_PACKAGE_NAME=${env:BUILD_CESIUM_UNREAL_PACKAGE_NAME}" >> $env:GITHUB_ENV
echo "BUILD_CESIUM_UNREAL_PACKAGE_PATH=${env:BUILD_CESIUM_UNREAL_PACKAGE_PATH}" >> $env:GITHUB_ENV
echo "UNREAL_BATCH_FILES_PATH=${env:UNREAL_BATCH_FILES_PATH}" >> $env:GITHUB_ENV
echo "AWS_REGION=${env:AWS_REGION}" >> $env:GITHUB_ENV
# Confirm vars to the console
echo BUILD_CESIUM_UNREAL_PACKAGE_NAME=$env:BUILD_CESIUM_UNREAL_PACKAGE_NAME
echo BUILD_CESIUM_UNREAL_PACKAGE_PATH=$env:BUILD_CESIUM_UNREAL_PACKAGE_PATH
echo UNREAL_BATCH_FILES_PATH=$env:UNREAL_BATCH_FILES_PATH
- name: Install Unreal Engine
uses: ./.github/actions/install-unreal-windows
with:
unreal-engine-zip: ${{ inputs.unreal-engine-zip }}
unreal-program-name: ${{ inputs.unreal-program-name }}
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Install nasm
uses: ilammy/setup-nasm@v1.5.1
- name: Build cesium-native
run: |
cd extern
$env:UNREAL_ENGINE_ROOT="D:/Program Files/Epic Games/${{ inputs.unreal-program-name }}"
$env:CESIUM_VCPKG_RELEASE_ONLY="TRUE"
$toolchainOption=If ("${{ inputs.cmake-toolchain }}") {"-T ${{ inputs.cmake-toolchain }}"} Else {""}
cmake -B build -S . -A "${{ inputs.cmake-platform }}" -G "${{ inputs.cmake-generator }}" $toolchainOption
cmake --build build --config Release --target install -j8
cd ..
rm -r -fo extern
- name: Overwrite plugin engine version
run: |
((Get-Content -path CesiumForUnreal.uplugin -Raw) -replace '"EngineVersion": "5.2.0"','"EngineVersion": "${{ inputs.unreal-engine-version }}"') | Set-Content -Path CesiumForUnreal.uplugin
- name: Customize BuildConfiguration.xml
run: |
mkdir -p "$env:USERPROFILE\AppData\Roaming\Unreal Engine\UnrealBuildTool"
# - We limit parallel actions because our builds use a lot more memory than UBT thinks they will.
# - We set the source code control Provider to None so UBT includes all files in the unity build.
Set-Content -Path "$env:USERPROFILE\AppData\Roaming\Unreal Engine\UnrealBuildTool\BuildConfiguration.xml" -Value '<?xml version="1.0" encoding="utf-8" ?>
<Configuration xmlns="https://www.unrealengine.com/BuildConfiguration">
<BuildConfiguration>
<MaxParallelActions>2</MaxParallelActions>
</BuildConfiguration>
<SourceFileWorkingSet><Provider>None</Provider></SourceFileWorkingSet>
</Configuration>'
- name: Build CesiumForUnreal plugin
timeout-minutes: 180
run: |
cd "$env:UNREAL_BATCH_FILES_PATH"
./RunUAT.bat BuildPlugin -Plugin="$env:GITHUB_WORKSPACE/CesiumForUnreal.uplugin" -Package="$env:BUILD_CESIUM_UNREAL_PACKAGE_PATH" -CreateSubFolder -TargetPlatforms=Win64
echo LastExitCode=$LASTEXITCODE
if ($LASTEXITCODE -eq 0) {
exit 0
}
else {
exit -1
}
- name: Print log
if: ${{ failure() }}
run: |
cat "C:\Users\runneradmin\AppData\Roaming\Unreal Engine\AutomationTool\Logs\C+Program+Files+Epic+Games+UE_5.3\UBT-UnrealEditor-Win64-Development.txt"
- name: Upload plugin artifact
if: ${{ success() }}
uses: actions/upload-artifact@v4
with:
name: ${{ env.BUILD_CESIUM_UNREAL_PACKAGE_NAME}}
path: packages