Skip to content

Commit e3bc03b

Browse files
committed
Merge build scripts
1 parent d140413 commit e3bc03b

File tree

2 files changed

+160
-168
lines changed

2 files changed

+160
-168
lines changed
Lines changed: 160 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,166 @@
1-
name: Dolphin-AppImage
1+
name: Project+ Dolphin Builder
22

3-
on:
4-
push:
5-
workflow_dispatch:
6-
schedule:
7-
- cron: "15 0 * * 3"
3+
on: [push, pull_request]
84

95
jobs:
10-
dolphin-appimage:
6+
build_macos:
7+
name: macOS Build
8+
runs-on: macos-14
9+
env:
10+
CCACHE_BASEDIR: ${{ github.workspace }}
11+
CCACHE_DIR: ${{ github.workspace }}/.ccache
12+
CCACHE_COMPRESS: true
13+
CCACHE_COMPRESSLEVEL: 9
14+
CCACHE_MAXSIZE: 200M
15+
16+
steps:
17+
- name: Checkout Repository
18+
uses: actions/checkout@v4
19+
with:
20+
submodules: recursive
21+
22+
- name: Install Packages
23+
env:
24+
HOMEBREW_NO_INSTALL_CLEANUP: 1
25+
HOMEBREW_NO_ANALYTICS: 1
26+
run: |
27+
if ! brew install ccache ninja; then
28+
brew update
29+
brew install ccache ninja
30+
fi
31+
32+
- name: Cache Dependencies
33+
id: cache-deps
34+
uses: actions/cache@v4
35+
with:
36+
path: ~/deps
37+
key: macOS deps ${{ hashFiles('.github/workflows/scripts/macos/build-dependencies.sh') }}
38+
39+
- name: Build Dependencies
40+
if: steps.cache-deps.outputs.cache-hit != 'true'
41+
run: .github/workflows/scripts/macos/build-dependencies.sh
42+
43+
- name: Cache MoltenVK
44+
id: cache-moltenvk
45+
uses: actions/cache@v4
46+
with:
47+
path: ~/moltenvk
48+
key: macOS MoltenVK ${{ hashFiles('Externals/MoltenVK') }}
49+
50+
- name: Build MoltenVK
51+
if: steps.cache-moltenvk.outputs.cache-hit != 'true'
52+
run: |
53+
MVK_VER="$(sed -nr 's/^.*set\(MOLTENVK_VERSION "([^"]+)".*$/\1/p' Externals/MoltenVK/CMakeLists.txt)"
54+
if [ -z "$MVK_VER" ]; then
55+
echo "::error::Failed to parse MoltenVK version from CMakeLists"
56+
exit 1
57+
fi
58+
git clone --depth 1 --branch "$MVK_VER" https://github.com/KhronosGroup/MoltenVK.git mvk-build
59+
pushd mvk-build
60+
git apply ../Externals/MoltenVK/patches/*.patch
61+
./fetchDependencies --macos
62+
make macos
63+
ls -l Package/Release/MoltenVK/dynamic/*
64+
chmod 755 Package/Release/MoltenVK/dynamic/dylib/macOS/libMoltenVK.dylib
65+
mkdir -p "$HOME/moltenvk/lib/"
66+
mv Package/Release/MoltenVK/dynamic/dylib/macOS/libMoltenVK.dylib "$HOME/moltenvk/lib/"
67+
popd
68+
rm -rf mvk-build
69+
70+
# -- SETUP CCACHE - https://cristianadam.eu/20200113/speeding-up-c-plus-plus-github-actions-using-ccache/
71+
- name: Prepare ccache timestamp
72+
id: ccache_cache_timestamp
73+
run: echo "timestamp=$(date -u "+%Y-%m-%d-%H;%M;%S")" >> $GITHUB_OUTPUT
74+
75+
- name: Cache ccache cache
76+
uses: actions/cache@v4
77+
with:
78+
path: .ccache
79+
key: macOS ccache ${{ steps.ccache_cache_timestamp.outputs.timestamp }}
80+
restore-keys: macOS ccache
81+
82+
- name: Generate CMake Files
83+
run: |
84+
COMMON_ARGS=(
85+
-DCMAKE_PREFIX_PATH="$HOME/deps;$HOME/moltenvk"
86+
-DCMAKE_BUILD_TYPE=Release
87+
-DUSE_BUNDLED_MOLTENVK=OFF
88+
-DMACOS_CODE_SIGNING=OFF
89+
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON
90+
-DCMAKE_C_COMPILER_LAUNCHER=ccache
91+
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
92+
-DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON
93+
-DUSE_SYSTEM_LIBS=OFF
94+
-DUSE_SYSTEM_BZIP2=ON
95+
-DUSE_SYSTEM_CURL=ON
96+
-DUSE_SYSTEM_ICONV=ON
97+
-DUSE_SYSTEM_SDL2=ON
98+
-GNinja
99+
)
100+
101+
cmake -DCMAKE_OSX_ARCHITECTURES=x86_64 \
102+
-DCMAKE_SYSTEM_PROCESSOR=x86_64 \
103+
-DCMAKE_SYSTEM_NAME=Darwin \
104+
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.00 \
105+
"${COMMON_ARGS[@]}" \
106+
-B build .
107+
cmake -DCMAKE_OSX_ARCHITECTURES=arm64 \
108+
-DCMAKE_SYSTEM_PROCESSOR=arm64 \
109+
-DCMAKE_SYSTEM_NAME=Darwin \
110+
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
111+
"${COMMON_ARGS[@]}" \
112+
-B build-arm .
113+
114+
- name: Build Dolphin (x86_64)
115+
working-directory: build
116+
run: |
117+
ccache -p
118+
ccache -s
119+
ccache -z
120+
ninja dolphin-emu
121+
ccache -s
122+
123+
- name: Build Dolphin (arm64)
124+
working-directory: build-arm
125+
run: |
126+
ccache -p
127+
ccache -s
128+
ccache -z
129+
ninja dolphin-emu
130+
ccache -s
131+
132+
- name: Prepare Build Artifacts
133+
id: create-artifact
134+
env:
135+
EVENT_NAME: ${{ github.event_name }}
136+
PR_TITLE: ${{ github.event.pull_request.title }}
137+
PR_NUM: ${{ github.event.pull_request.number }}
138+
PR_SHA: ${{ github.event.pull_request.head.sha }}
139+
run: |
140+
lipo -create build/Binaries/DolphinQt.app/Contents/MacOS/DolphinQt build-arm/Binaries/DolphinQt.app/Contents/MacOS/DolphinQt -o dolphin
141+
mv dolphin build/Binaries/DolphinQt.app/Contents/MacOS/DolphinQt
142+
TAG="$(git tag --points-at HEAD)"
143+
if [ ! -z "$TAG" ]; then
144+
SUFFIX="$TAG"
145+
elif [ "$EVENT_NAME" == "pull_request" ]; then
146+
PR_TITLE=$(echo "${PR_TITLE}" | tr -cd '[a-zA-Z0-9[:space:]]_-')
147+
SUFFIX="pr[$PR_NUM]-sha[$PR_SHA]-title[$PR_TITLE"
148+
SUFFIX=$(printf "%.99s]" "$SUFFIX")
149+
else
150+
SUFFIX="sha[$(git rev-parse --short HEAD)]"
151+
fi
152+
APPNAME="ProjectPlus-$SUFFIX"
153+
mv build/Binaries/DolphinQt.app "$APPNAME.app"
154+
tar --options xz:compression-level=9 -cvJf "$APPNAME.tar.xz" "$APPNAME.app"
155+
echo "name=$APPNAME" >> "$GITHUB_OUTPUT"
156+
157+
- name: Upload Artifact
158+
uses: actions/upload-artifact@v4
159+
with:
160+
name: ${{ steps.create-artifact.outputs.name }}
161+
path: "*.tar.xz"
162+
163+
build_appimage:
11164
name: Project Plus Dolphin bundled as appimage
12165
runs-on: ubuntu-24.04
13166
env:

.github/workflows/macos_build.yml

Lines changed: 0 additions & 161 deletions
This file was deleted.

0 commit comments

Comments
 (0)