Skip to content

Commit 85dd6d2

Browse files
committed
Add support for macOS.
1 parent e4c43ae commit 85dd6d2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+889
-141
lines changed

.github/workflows/validate.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,3 +210,80 @@ jobs:
210210
with:
211211
name: UnleashedRecomp-Flatpak
212212
path: ./${{ env.FLATPAK_ID }}.flatpak
213+
build-macos:
214+
name: Build macOS
215+
runs-on: macos-15
216+
strategy:
217+
matrix:
218+
arch: [ "arm64" ]
219+
preset: ["macos-debug", "macos-release", "macos-relwithdebinfo"]
220+
env:
221+
CMAKE_PRESET: ${{ matrix.preset }}
222+
223+
steps:
224+
- name: Checkout Repository
225+
uses: actions/checkout@v4
226+
with:
227+
submodules: recursive
228+
229+
- name: Checkout Private Repository
230+
uses: actions/checkout@v4
231+
with:
232+
repository: ${{ secrets.ASSET_REPO }}
233+
token: ${{ secrets.ASSET_REPO_TOKEN }}
234+
path: ./private
235+
236+
- name: Setup latest Xcode
237+
uses: maxim-lobanov/setup-xcode@v1
238+
with:
239+
xcode-version: latest-stable
240+
241+
- name: Setup ccache
242+
uses: hendrikmuhs/[email protected]
243+
with:
244+
key: ccache-${{ runner.os }}-${{ matrix.arch }}-${{ matrix.preset }}
245+
246+
- name: Cache vcpkg
247+
uses: actions/cache@v4
248+
with:
249+
path: |
250+
./thirdparty/vcpkg/downloads
251+
./thirdparty/vcpkg/packages
252+
key: vcpkg-${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('vcpkg.json') }}
253+
restore-keys: |
254+
vcpkg-${{ runner.os }}-${{ matrix.arch }}-
255+
256+
- name: Install Dependencies (macOS)
257+
run: |
258+
brew install ninja
259+
260+
- name: Cache ccache Directory
261+
uses: actions/cache@v4
262+
with:
263+
path: /tmp/ccache
264+
key: ccache-${{ runner.os }}-${{ matrix.arch }}-${{ matrix.preset }}
265+
266+
- name: Prepare Project
267+
run: |
268+
cp ./private/* ./UnleashedRecompLib/private
269+
270+
- name: Configure Project
271+
env:
272+
CCACHE_DIR: /tmp/ccache
273+
run: cmake . --preset ${{ env.CMAKE_PRESET }} -DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} -DSDL2MIXER_VORBIS=VORBISFILE -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache
274+
275+
- name: Build Project
276+
env:
277+
CCACHE_DIR: /tmp/ccache
278+
run: cmake --build ./out/build/${{ env.CMAKE_PRESET }} --target UnleashedRecomp
279+
280+
- name: Pack Release
281+
run: |
282+
codesign --deep -fs - "./out/build/${{ env.CMAKE_PRESET }}/UnleashedRecomp/Unleashed Recompiled.app"
283+
tar -czf UnleashedRecomp-macOS-${{ matrix.arch }}-${{ env.CMAKE_PRESET }}.tar.gz -C ./out/build/${{ env.CMAKE_PRESET }}/UnleashedRecomp "Unleashed Recompiled.app"
284+
285+
- name: Upload Artifact
286+
uses: actions/upload-artifact@v4
287+
with:
288+
name: UnleashedRecomp-macOS-${{ matrix.arch }}-${{ env.CMAKE_PRESET }}
289+
path: UnleashedRecomp-macOS-${{ matrix.arch }}-${{ env.CMAKE_PRESET }}.tar.gz

.gitmodules

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[submodule "tools/XenonRecomp"]
22
path = tools/XenonRecomp
3-
url = https://github.com/hedge-dev/XenonRecomp.git
3+
url = https://github.com/squidbus/XenonRecomp.git
44
[submodule "thirdparty/ddspp"]
55
path = thirdparty/ddspp
66
url = https://github.com/redorav/ddspp.git
77
[submodule "tools/XenosRecomp"]
88
path = tools/XenosRecomp
9-
url = https://github.com/hedge-dev/XenosRecomp.git
9+
url = https://github.com/squidbus/XenosRecomp.git
1010
[submodule "UnleashedRecompResources"]
1111
path = UnleashedRecompResources
1212
url = https://github.com/hedge-dev/UnleashedRecompResources.git
@@ -61,3 +61,9 @@
6161
[submodule "UnleashedRecomp/api"]
6262
path = UnleashedRecomp/api
6363
url = https://github.com/hedge-dev/SWA.git
64+
[submodule "thirdparty/MoltenVK/MoltenVK"]
65+
path = thirdparty/MoltenVK/MoltenVK
66+
url = https://github.com/KhronosGroup/MoltenVK.git
67+
[submodule "thirdparty/MoltenVK/SPIRV-Cross"]
68+
path = thirdparty/MoltenVK/SPIRV-Cross
69+
url = https://github.com/KhronosGroup/SPIRV-Cross.git

CMakeLists.txt

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ if(NOT DEFINED ENV{VCPKG_ROOT})
44
message(FATAL_ERROR "VCPKG_ROOT is not defined!")
55
endif()
66

7-
include($ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake)
87
set(UNLEASHED_RECOMP_THIRDPARTY_ROOT ${CMAKE_SOURCE_DIR}/thirdparty)
98
set(UNLEASHED_RECOMP_TOOLS_ROOT ${CMAKE_SOURCE_DIR}/tools)
109
set(CMAKE_CXX_STANDARD 20)
@@ -18,16 +17,28 @@ endif()
1817

1918
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
2019

21-
# Target Sandy Bridge for all projects
22-
add_compile_options(
23-
-march=sandybridge
24-
)
20+
project("UnleashedRecomp-ALL")
21+
22+
if (CMAKE_OSX_ARCHITECTURES)
23+
set(UNLEASHED_RECOMP_ARCHITECTURE ${CMAKE_OSX_ARCHITECTURES})
24+
elseif(CMAKE_SYSTEM_PROCESSOR)
25+
set(UNLEASHED_RECOMP_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR})
26+
else()
27+
set(UNLEASHED_RECOMP_ARCHITECTURE ${CMAKE_HOST_SYSTEM_PROCESSOR})
28+
endif()
29+
string(TOLOWER "${UNLEASHED_RECOMP_ARCHITECTURE}" UNLEASHED_RECOMP_ARCHITECTURE)
30+
message(STATUS "Detected architecture: ${UNLEASHED_RECOMP_ARCHITECTURE}")
31+
32+
if (UNLEASHED_RECOMP_ARCHITECTURE STREQUAL "x86_64" OR UNLEASHED_RECOMP_ARCHITECTURE STREQUAL "amd64")
33+
# Target Sandy Bridge for all projects
34+
add_compile_options(
35+
-march=sandybridge
36+
)
37+
endif()
2538

2639
add_subdirectory(${UNLEASHED_RECOMP_THIRDPARTY_ROOT})
2740
add_subdirectory(${UNLEASHED_RECOMP_TOOLS_ROOT})
2841

29-
project("UnleashedRecomp-ALL")
30-
3142
# Include sub-projects.
3243
add_subdirectory("UnleashedRecompLib")
3344
add_subdirectory("UnleashedRecomp")

CMakePresets.json

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,58 @@
113113
"CMAKE_BUILD_TYPE": "Release",
114114
"CMAKE_INTERPROCEDURAL_OPTIMIZATION": true
115115
}
116+
},
117+
{
118+
"name": "macos-base",
119+
"hidden": true,
120+
"generator": "Ninja",
121+
"binaryDir": "${sourceDir}/out/build/${presetName}",
122+
"installDir": "${sourceDir}/out/install/${presetName}",
123+
"cacheVariables": {
124+
"CMAKE_TOOLCHAIN_FILE": {
125+
"value": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
126+
"type": "FILEPATH"
127+
},
128+
"CMAKE_OSX_DEPLOYMENT_TARGET": "13.0"
129+
},
130+
"environment": {
131+
"VCPKG_ROOT": "${sourceDir}/thirdparty/vcpkg"
132+
},
133+
"condition": {
134+
"type": "equals",
135+
"lhs": "${hostSystemName}",
136+
"rhs": "Darwin"
137+
},
138+
"vendor": {
139+
"microsoft.com/VisualStudioRemoteSettings/CMake/2.0": {
140+
"remoteSourceRootDir": "$env{HOME}/.vs/$ms{projectDirName}"
141+
}
142+
}
143+
},
144+
{
145+
"name": "macos-debug",
146+
"displayName": "macOS-Debug",
147+
"inherits": "macos-base",
148+
"cacheVariables": {
149+
"CMAKE_BUILD_TYPE": "Debug"
150+
}
151+
},
152+
{
153+
"name": "macos-relwithdebinfo",
154+
"displayName": "macOS-RelWithDebInfo",
155+
"inherits": "macos-base",
156+
"cacheVariables": {
157+
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
158+
}
159+
},
160+
{
161+
"name": "macos-release",
162+
"displayName": "macOS-Release",
163+
"inherits": "macos-base",
164+
"cacheVariables": {
165+
"CMAKE_BUILD_TYPE": "Release",
166+
"CMAKE_INTERPROCEDURAL_OPTIMIZATION": true
167+
}
116168
}
117169
]
118170
}

0 commit comments

Comments
 (0)