mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-08-03 11:23:49 +00:00
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 13be13b757)
96 lines
3.0 KiB
CMake
96 lines
3.0 KiB
CMake
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
|
|
|
|
add_subdirectory(cpuinfo)
|
|
|
|
set(SDL_SHARED OFF CACHE BOOL "" FORCE)
|
|
add_subdirectory(SDL2)
|
|
|
|
add_library(Vulkan-Headers INTERFACE)
|
|
add_library(Vulkan::Headers ALIAS Vulkan-Headers)
|
|
target_include_directories(Vulkan-Headers INTERFACE
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/Vulkan-Headers/include"
|
|
)
|
|
|
|
set(SPIRV_SKIP_TESTS ON CACHE BOOL "" FORCE)
|
|
set(SPIRV_SKIP_EXECUTABLES ON CACHE BOOL "" FORCE)
|
|
set(SKIP_SPIRV_TOOLS_INSTALL ON CACHE BOOL "" FORCE)
|
|
set(SPIRV_WERROR OFF CACHE BOOL "" FORCE)
|
|
set(SPIRV-Headers_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/SPIRV-Headers" CACHE PATH "" FORCE)
|
|
add_subdirectory(SPIRV-Tools)
|
|
|
|
add_library(spirv-tools ALIAS SPIRV-Tools-static)
|
|
add_library(spirv-tools-opt ALIAS SPIRV-Tools-opt)
|
|
|
|
add_subdirectory(xxHash/build/cmake)
|
|
|
|
set(FMT_DOC OFF CACHE BOOL "" FORCE)
|
|
set(FMT_INSTALL OFF CACHE BOOL "" FORCE)
|
|
set(FMT_MODULE OFF CACHE BOOL "" FORCE)
|
|
set(FMT_TEST OFF CACHE BOOL "" FORCE)
|
|
add_subdirectory(fmt EXCLUDE_FROM_ALL)
|
|
|
|
set(JSON_BuildTests OFF CACHE BOOL "" FORCE)
|
|
set(JSON_Install OFF CACHE BOOL "" FORCE)
|
|
add_subdirectory(nlohmann_json EXCLUDE_FROM_ALL)
|
|
|
|
set(SPDLOG_BUILD_ALL OFF CACHE BOOL "" FORCE)
|
|
set(SPDLOG_BUILD_EXAMPLE OFF CACHE BOOL "" FORCE)
|
|
set(SPDLOG_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
|
set(SPDLOG_BUILD_BENCH OFF CACHE BOOL "" FORCE)
|
|
set(SPDLOG_BUILD_WARNINGS OFF CACHE BOOL "" FORCE)
|
|
set(SPDLOG_INSTALL OFF CACHE BOOL "" FORCE)
|
|
set(SPDLOG_FMT_EXTERNAL ON CACHE BOOL "" FORCE)
|
|
set(SPDLOG_NO_EXCEPTIONS ON CACHE BOOL "" FORCE)
|
|
add_subdirectory(spdlog EXCLUDE_FROM_ALL)
|
|
|
|
if (NOT TARGET FFmpeg::ffmpeg)
|
|
# 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)
|
|
endif()
|
|
add_subdirectory(ffmpeg-core)
|
|
add_library(FFmpeg::ffmpeg ALIAS ffmpeg)
|
|
endif()
|
|
|
|
file(GLOB LIBATRAC9_SOURCES LibAtrac9/C/src/*.c)
|
|
add_library(LibAtrac9 STATIC ${LIBATRAC9_SOURCES})
|
|
target_include_directories(LibAtrac9 PUBLIC LibAtrac9/C/src)
|
|
if(MSVC)
|
|
target_compile_options(LibAtrac9 PRIVATE /W0)
|
|
endif()
|
|
|
|
set(TRACY_STATIC ON CACHE BOOL "" FORCE)
|
|
set(TRACY_ENABLE ON CACHE BOOL "" FORCE)
|
|
set(TRACY_ON_DEMAND ON CACHE BOOL "" FORCE)
|
|
set(TRACY_DELAYED_INIT ON CACHE BOOL "" FORCE)
|
|
set(TRACY_MANUAL_LIFETIME ON CACHE BOOL "" FORCE)
|
|
add_subdirectory(tracy EXCLUDE_FROM_ALL)
|
|
if (TARGET TracyClient)
|
|
if (MSVC)
|
|
target_compile_options(TracyClient PRIVATE /WX-)
|
|
endif()
|
|
if (CLANG)
|
|
target_compile_options(TracyClient PRIVATE
|
|
-Wno-error
|
|
-Wno-braced-scalar-init
|
|
-Wno-format
|
|
-Wno-unused-variable
|
|
)
|
|
endif()
|
|
endif()
|
|
|
|
if (CLANG AND MSVC)
|
|
add_subdirectory(winpthread)
|
|
endif()
|