only enable metal on apple platforms by default

This commit is contained in:
Samuliak 2024-09-28 11:51:50 +02:00
parent 3cf831d46a
commit 3de2b0325b
2 changed files with 51 additions and 46 deletions

View File

@ -103,11 +103,20 @@ if (UNIX AND NOT APPLE)
option(ENABLE_FERAL_GAMEMODE "Enables Feral Interactive GameMode 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" 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)

View File

@ -534,52 +534,48 @@ if(APPLE)
endif()
if(ENABLE_METAL)
if(APPLE)
target_sources(CemuCafe PRIVATE
HW/Latte/Renderer/Metal/MetalRenderer.cpp
HW/Latte/Renderer/Metal/MetalRenderer.h
HW/Latte/Renderer/Metal/MetalCommon.h
HW/Latte/Renderer/Metal/MetalCppImpl.cpp
HW/Latte/Renderer/Metal/MetalLayer.mm
HW/Latte/Renderer/Metal/MetalLayer.h
HW/Latte/Renderer/Metal/MetalLayerHandle.cpp
HW/Latte/Renderer/Metal/MetalLayerHandle.h
HW/Latte/Renderer/Metal/LatteToMtl.cpp
HW/Latte/Renderer/Metal/LatteToMtl.h
HW/Latte/Renderer/Metal/LatteTextureMtl.cpp
HW/Latte/Renderer/Metal/LatteTextureMtl.h
HW/Latte/Renderer/Metal/LatteTextureViewMtl.cpp
HW/Latte/Renderer/Metal/LatteTextureViewMtl.h
HW/Latte/Renderer/Metal/LatteTextureReadbackMtl.cpp
HW/Latte/Renderer/Metal/LatteTextureReadbackMtl.h
HW/Latte/Renderer/Metal/RendererShaderMtl.cpp
HW/Latte/Renderer/Metal/RendererShaderMtl.h
HW/Latte/Renderer/Metal/CachedFBOMtl.cpp
HW/Latte/Renderer/Metal/CachedFBOMtl.h
HW/Latte/Renderer/Metal/MetalBufferAllocator.h
HW/Latte/Renderer/Metal/MetalMemoryManager.cpp
HW/Latte/Renderer/Metal/MetalMemoryManager.h
HW/Latte/Renderer/Metal/MetalPipelineCache.cpp
HW/Latte/Renderer/Metal/MetalPipelineCache.h
HW/Latte/Renderer/Metal/MetalDepthStencilCache.cpp
HW/Latte/Renderer/Metal/MetalDepthStencilCache.h
HW/Latte/Renderer/Metal/MetalSamplerCache.cpp
HW/Latte/Renderer/Metal/MetalSamplerCache.h
HW/Latte/Renderer/Metal/MetalHybridComputePipeline.cpp
HW/Latte/Renderer/Metal/MetalHybridComputePipeline.h
HW/Latte/Renderer/Metal/MetalQuery.cpp
HW/Latte/Renderer/Metal/MetalQuery.h
HW/Latte/Renderer/Metal/MetalPerformanceMonitor.h
HW/Latte/Renderer/Metal/UtilityShaderSource.h
)
target_sources(CemuCafe PRIVATE
HW/Latte/Renderer/Metal/MetalRenderer.cpp
HW/Latte/Renderer/Metal/MetalRenderer.h
HW/Latte/Renderer/Metal/MetalCommon.h
HW/Latte/Renderer/Metal/MetalCppImpl.cpp
HW/Latte/Renderer/Metal/MetalLayer.mm
HW/Latte/Renderer/Metal/MetalLayer.h
HW/Latte/Renderer/Metal/MetalLayerHandle.cpp
HW/Latte/Renderer/Metal/MetalLayerHandle.h
HW/Latte/Renderer/Metal/LatteToMtl.cpp
HW/Latte/Renderer/Metal/LatteToMtl.h
HW/Latte/Renderer/Metal/LatteTextureMtl.cpp
HW/Latte/Renderer/Metal/LatteTextureMtl.h
HW/Latte/Renderer/Metal/LatteTextureViewMtl.cpp
HW/Latte/Renderer/Metal/LatteTextureViewMtl.h
HW/Latte/Renderer/Metal/LatteTextureReadbackMtl.cpp
HW/Latte/Renderer/Metal/LatteTextureReadbackMtl.h
HW/Latte/Renderer/Metal/RendererShaderMtl.cpp
HW/Latte/Renderer/Metal/RendererShaderMtl.h
HW/Latte/Renderer/Metal/CachedFBOMtl.cpp
HW/Latte/Renderer/Metal/CachedFBOMtl.h
HW/Latte/Renderer/Metal/MetalBufferAllocator.h
HW/Latte/Renderer/Metal/MetalMemoryManager.cpp
HW/Latte/Renderer/Metal/MetalMemoryManager.h
HW/Latte/Renderer/Metal/MetalPipelineCache.cpp
HW/Latte/Renderer/Metal/MetalPipelineCache.h
HW/Latte/Renderer/Metal/MetalDepthStencilCache.cpp
HW/Latte/Renderer/Metal/MetalDepthStencilCache.h
HW/Latte/Renderer/Metal/MetalSamplerCache.cpp
HW/Latte/Renderer/Metal/MetalSamplerCache.h
HW/Latte/Renderer/Metal/MetalHybridComputePipeline.cpp
HW/Latte/Renderer/Metal/MetalHybridComputePipeline.h
HW/Latte/Renderer/Metal/MetalQuery.cpp
HW/Latte/Renderer/Metal/MetalQuery.h
HW/Latte/Renderer/Metal/MetalPerformanceMonitor.h
HW/Latte/Renderer/Metal/UtilityShaderSource.h
)
#target_link_libraries(CemuCafe PRIVATE
# "-framework Metal"
# "-framework QuartzCore"
#)
else()
message(FATAL_ERROR "Metal is only supported on macOS")
endif()
#target_link_libraries(CemuCafe PRIVATE
# "-framework Metal"
# "-framework QuartzCore"
#)
endif()
set_property(TARGET CemuCafe PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")