Add Metal backend (#1287)

This commit is contained in:
SamoZ256 2025-12-06 17:14:25 +01:00 committed by GitHub
parent 5520613dc3
commit 26e40a4bce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
108 changed files with 14986 additions and 453 deletions

View file

@ -102,10 +102,20 @@ if (UNIX AND NOT APPLE)
option(ENABLE_BLUEZ "Build with Bluez support" ON)
endif()
if (APPLE)
set(ENABLE_METAL_DEFAULT ON)
else()
set(ENABLE_METAL_DEFAULT OFF)
endif()
option(ENABLE_OPENGL "Enables the OpenGL backend" ON)
option(ENABLE_VULKAN "Enables the Vulkan backend" ON)
option(ENABLE_METAL "Enables the Metal backend" ${ENABLE_METAL_DEFAULT})
option(ENABLE_DISCORD_RPC "Enables the Discord Rich Presence feature" ON)
if (ENABLE_METAL AND NOT APPLE)
message(FATAL_ERROR "Metal backend is only supported on Apple platforms")
endif()
# input backends
if (WIN32)
@ -180,6 +190,12 @@ if (ENABLE_OPENGL)
find_package(OpenGL REQUIRED)
endif()
if (ENABLE_METAL)
include_directories(${CMAKE_SOURCE_DIR}/dependencies/metal-cpp)
add_definitions(-DENABLE_METAL=1)
endif()
if (ENABLE_DISCORD_RPC)
add_compile_definitions(ENABLE_DISCORD_RPC)
endif()
@ -204,7 +220,7 @@ endif()
if (ENABLE_CUBEB)
if (NOT ENABLE_VCPKG)
find_package(cubeb)
find_package(cubeb)
endif()
if (NOT cubeb_FOUND)
option(BUILD_TESTS "" OFF)