diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b028d84..898f0086 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/src/Cafe/CMakeLists.txt b/src/Cafe/CMakeLists.txt index 10c85270..8dd401b7 100644 --- a/src/Cafe/CMakeLists.txt +++ b/src/Cafe/CMakeLists.txt @@ -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$<$:Debug>")