mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-19 18:36:53 +02:00
build: add macOS (Apple Silicon) build support
macOS compiles the existing POSIX/Linux code paths (KYTY_PLATFORM_LINUX) targeting x86_64 under Rosetta 2. Adds an APPLE branch to the build: selects Apple's ld64 linker, unsets the Ninja response-file forcing (Apple ar has no @file support), derives the target arch from CMAKE_OSX_ARCHITECTURES for cpuinfo/ffmpeg, and re-signs the binary post-build with JIT entitlements (required to execute written trampolines and Rosetta-translated guest code). All changes are guarded by if(APPLE); Windows and Linux configuration is unchanged. (cherry picked from commit 13be13b7573b9a687cf87531a81e4497ed3de1d5)
This commit is contained in:
Vendored
+11
-1
@@ -44,7 +44,17 @@ set(SPDLOG_NO_EXCEPTIONS ON CACHE BOOL "" FORCE)
|
||||
add_subdirectory(spdlog EXCLUDE_FROM_ALL)
|
||||
|
||||
if (NOT TARGET FFmpeg::ffmpeg)
|
||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64|arm64|ARM64)$")
|
||||
# On macOS the target arch is driven by CMAKE_OSX_ARCHITECTURES, not the host
|
||||
# CMAKE_SYSTEM_PROCESSOR (which reports arm64 even for an x86_64/Rosetta build).
|
||||
if(APPLE AND CMAKE_OSX_ARCHITECTURES)
|
||||
if(CMAKE_OSX_ARCHITECTURES MATCHES "^(x86_64)$")
|
||||
set(ARCHITECTURE x86_64)
|
||||
elseif(CMAKE_OSX_ARCHITECTURES MATCHES "^(arm64)$")
|
||||
set(ARCHITECTURE arm64)
|
||||
else()
|
||||
set(ARCHITECTURE x86_64 arm64) # universal
|
||||
endif()
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64|arm64|ARM64)$")
|
||||
set(ARCHITECTURE arm64)
|
||||
else()
|
||||
set(ARCHITECTURE x86_64)
|
||||
|
||||
Vendored
+12
-3
@@ -5,7 +5,14 @@ set(cpuinfo_src
|
||||
deps/clog/src/clog.c
|
||||
)
|
||||
|
||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(i[3-6]86|AMD64|x86(_64)?)$")
|
||||
# On Apple the target arch is driven by CMAKE_OSX_ARCHITECTURES, not the host
|
||||
# CMAKE_SYSTEM_PROCESSOR (which is arm64 even for an x86_64/Rosetta build).
|
||||
set(CPUINFO_TARGET_PROC "${CMAKE_SYSTEM_PROCESSOR}")
|
||||
if(APPLE AND CMAKE_OSX_ARCHITECTURES)
|
||||
list(GET CMAKE_OSX_ARCHITECTURES 0 CPUINFO_TARGET_PROC)
|
||||
endif()
|
||||
|
||||
if(CPUINFO_TARGET_PROC MATCHES "^(i[3-6]86|AMD64|x86(_64)?)$")
|
||||
list(APPEND cpuinfo_src
|
||||
src/x86/init.c
|
||||
src/x86/info.c
|
||||
@@ -19,11 +26,13 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(i[3-6]86|AMD64|x86(_64)?)$")
|
||||
src/x86/cache/deterministic.c)
|
||||
if(LINUX OR ANDROID)
|
||||
list(APPEND cpuinfo_src src/x86/linux/init.c src/x86/linux/cpuinfo.c)
|
||||
elseif(APPLE)
|
||||
list(APPEND cpuinfo_src src/x86/mach/init.c src/mach/topology.c)
|
||||
else()
|
||||
list(APPEND cpuinfo_src src/x86/windows/init.c)
|
||||
endif()
|
||||
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(armv[5-8].*|aarch64|arm64)$")
|
||||
|
||||
elseif(CPUINFO_TARGET_PROC MATCHES "^(armv[5-8].*|aarch64|arm64)$")
|
||||
list(APPEND cpuinfo_src src/arm/uarch.c src/arm/cache.c)
|
||||
|
||||
if(LINUX OR ANDROID)
|
||||
|
||||
Reference in New Issue
Block a user