-
Notifications
You must be signed in to change notification settings - Fork 297
148 lines (147 loc) · 7.16 KB
/
buildApple.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
name: Build macOS
on:
workflow_call:
inputs:
runner-label:
required: true
type: string
unreal-engine-version:
required: true
type: string
unreal-engine-zip:
required: true
type: string
unreal-program-name:
required: true
type: string
upload-package-base-name:
required: true
type: string
xcode-version:
required: true
type: string
jobs:
build:
runs-on: ${{ inputs.runner-label }}
steps:
- name: Customize BuildConfiguration.xml
run: |
mkdir -p ~/.config/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.
printf '<?xml version="1.0" encoding="utf-8" ?>\n<Configuration xmlns="https://www.unrealengine.com/BuildConfiguration">\n <BuildConfiguration>\n <MaxParallelActions>2</MaxParallelActions>\n </BuildConfiguration>\n <SourceFileWorkingSet><Provider>None</Provider></SourceFileWorkingSet>\n</Configuration>\n' > ~/.config/Unreal\ Engine/UnrealBuildTool/BuildConfiguration.xml
# In UE 5.5, UBT apparently loads from ~/Documents instead of ~/.config
mkdir -p ~/Documents/Unreal\ Engine/UnrealBuildTool
cp ~/.config/Unreal\ Engine/UnrealBuildTool/BuildConfiguration.xml ~/Documents/Unreal\ Engine/UnrealBuildTool/BuildConfiguration.xml
- name: Make some more disk space
run: |
df -h
ls /Applications
brew uninstall google-chrome
sudo rm -rf /Users/runner/Library/Android
sudo rm -rf /Applications/Xcode_14.3.app
sudo rm -rf /Applications/Xcode_14.3.1.app
sudo rm -rf /Applications/Xcode_15.0.1.app
sudo rm -rf /Applications/Xcode_15.0.app
sudo rm -rf /Applications/Xcode_15.1.0.app
sudo rm -rf /Applications/Xcode_15.1.app
sudo rm -rf /Applications/Xcode_15.2.0.app
sudo rm -rf /Applications/Xcode_15.2.app
sudo rm -rf /Applications/Xcode_15.3.0.app
sudo rm -rf /Applications/Xcode_15.3.app
sudo rm -rf /Applications/Xcode_16.0.0.app
sudo rm -rf /Applications/Xcode_16.0.app
sudo rm -rf /Applications/Xcode_16.1.0.app
sudo rm -rf /Applications/Xcode_16.1.app
sudo rm -rf /Applications/Xcode_16.1_beta.app
sudo rm -rf /Applications/Xcode_16_beta_6.app
ls /Applications
df -h
- name: Set XCode version
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: "${{ inputs.xcode-version }}"
- name: Check out repository code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Configure vcpkg caching
uses: ./.github/actions/vcpkg-cache
with:
id: ${{ inputs.upload-package-base-name }}
- name: Install Unreal Engine
uses: ./.github/actions/install-unreal-macos
with:
unreal-engine-zip: ${{ inputs.unreal-engine-zip }}
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
unreal-program-name: ${{ inputs.unreal-program-name }}
- name: Set environment variables
run: |
export CESIUM_UNREAL_VERSION=$GITHUB_REF_NAME
export BUILD_CESIUM_UNREAL_PACKAGE_NAME="${{ inputs.upload-package-base-name }}-${CESIUM_UNREAL_VERSION}"
# Make these available to subsequent steps
echo "CESIUM_UNREAL_VERSION=${CESIUM_UNREAL_VERSION}" >> $GITHUB_ENV
echo "BUILD_CESIUM_UNREAL_PACKAGE_NAME=${BUILD_CESIUM_UNREAL_PACKAGE_NAME}" >> $GITHUB_ENV
- name: Install nasm
uses: ilammy/[email protected]
- name: Build cesium-native for macOS ARM64
run: |
export UNREAL_ENGINE_ROOT=$HOME/${{ inputs.unreal-program-name }}
export CESIUM_VCPKG_RELEASE_ONLY=TRUE
mkdir -p extern/build-arm64
cd extern/build-arm64
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 -DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_SYSTEM_NAME=Darwin -DCMAKE_SYSTEM_PROCESSOR=arm64
cmake --build . -j4 --target install
- name: Build cesium-native for macOS x86_64
run: |
export UNREAL_ENGINE_ROOT=$HOME/${{ inputs.unreal-program-name }}
export CESIUM_VCPKG_RELEASE_ONLY=TRUE
mkdir -p extern/build-x64
cd extern/build-x64
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 -DCMAKE_OSX_ARCHITECTURES=x86_64 -DCMAKE_SYSTEM_NAME=Darwin -DCMAKE_SYSTEM_PROCESSOR=x86_64
cmake --build . -j4 --target install
- name: Create universal macOS libs for cesium-native
run: |
mkdir -p ${GITHUB_WORKSPACE}/Source/ThirdParty/lib/Darwin-universal-Release
for f in ${GITHUB_WORKSPACE}/Source/ThirdParty/lib/Darwin-x86_64-Release/*.a
do
arm64f=${GITHUB_WORKSPACE}/Source/ThirdParty/lib/Darwin-arm64-Release/$(basename -- $f)
x64f=${GITHUB_WORKSPACE}/Source/ThirdParty/lib/Darwin-x86_64-Release/$(basename -- $f)
universalf=${GITHUB_WORKSPACE}/Source/ThirdParty/lib/Darwin-universal-Release/$(basename -- $f)
if diff $arm64f $x64f; then
# arm64 and x64 files are identical, so just copy one to the universal directory.
cp $arm64f $universalf
else
lipo -create -output $universalf $arm64f $x64f
fi
done
rm -rf ${GITHUB_WORKSPACE}/Source/ThirdParty/lib/Darwin-x86_64-Release
rm -rf ${GITHUB_WORKSPACE}/Source/ThirdParty/lib/Darwin-arm64-Release
- name: Build cesium-native for iOS
run: |
mkdir -p extern/build-ios
cd extern
export UNREAL_ENGINE_ROOT=$HOME/${{ inputs.unreal-program-name }}
export CESIUM_VCPKG_RELEASE_ONLY=TRUE
cmake -B build-ios -S . -GXcode -DCMAKE_TOOLCHAIN_FILE="unreal-ios-toolchain.cmake" -DCMAKE_BUILD_TYPE=Release
cmake --build build-ios -j4 --target install --config Release
- name: Remove extern directory
run: |
rm -rf extern
- name: Build plugin for macOS and iOS
run: |
sed -i '' 's/\"EngineVersion\": \"5.3.0\"/\"EngineVersion\": \"${{ inputs.unreal-engine-version }}\"/g' CesiumForUnreal.uplugin
export UNREAL_ENGINE_DIR=$HOME/${{ inputs.unreal-program-name }}
cd $UNREAL_ENGINE_DIR/Engine/Build/BatchFiles
./RunUAT.sh BuildPlugin -Plugin="$GITHUB_WORKSPACE/CesiumForUnreal.uplugin" -Package="$GITHUB_WORKSPACE/packages/CesiumForUnreal" -CreateSubFolder -TargetPlatforms=Mac+iOS -Architecture_Mac=arm64+x64
- name: Print log
if: ${{ failure() }}
run: |
cat "/Users/runner/Library/Logs/Unreal Engine/LocalBuildLogs/UBT-UnrealEditor-Mac-Development.txt"
- name: Publish plugin package artifact
if: ${{ success() }}
uses: actions/upload-artifact@v4
with:
name: ${{ env.BUILD_CESIUM_UNREAL_PACKAGE_NAME}}
path: packages