diff --git a/CMakeLists.txt b/CMakeLists.txt index cffa6c7e76..e7f806e3bf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -124,6 +124,7 @@ find_package(ZLIB REQUIRED) if(APPLE) find_package(Security) + find_package(Metal) elseif(UNIX) find_package(LIBSECRET) find_package(Uuid REQUIRED) @@ -147,7 +148,7 @@ endif(PLASMA_EXTERNAL_RELEASE) # Pipeline Renderers cmake_dependent_option(PLASMA_PIPELINE_DX "Enable DirectX rendering pipeline?" ON "DirectX_FOUND" OFF) cmake_dependent_option(PLASMA_PIPELINE_GL "Enable OpenGL rendering pipeline?" ON "TARGET epoxy::epoxy" OFF) -cmake_dependent_option(PLASMA_PIPELINE_METAL "Enable Metal rendering pipeline?" ON "APPLE" OFF) +cmake_dependent_option(PLASMA_PIPELINE_METAL "Enable Metal rendering pipeline?" ON "TARGET Metal::Metal" OFF) if(PLASMA_PIPELINE_DX) add_definitions(-DPLASMA_PIPELINE_DX) diff --git a/Sources/Plasma/FeatureLib/pfMetalPipeline/CMakeLists.txt b/Sources/Plasma/FeatureLib/pfMetalPipeline/CMakeLists.txt index 2129c8b8d2..7a583ee2ef 100644 --- a/Sources/Plasma/FeatureLib/pfMetalPipeline/CMakeLists.txt +++ b/Sources/Plasma/FeatureLib/pfMetalPipeline/CMakeLists.txt @@ -50,7 +50,7 @@ target_link_libraries(pfMetalPipeline CoreLib pnNucleusInc plPipeline - "-framework Metal" + Metal::Metal "-framework MetalPerformanceShaders" PRIVATE plStatusLog diff --git a/cmake/FindMetal.cmake b/cmake/FindMetal.cmake new file mode 100644 index 0000000000..2789a7395b --- /dev/null +++ b/cmake/FindMetal.cmake @@ -0,0 +1,17 @@ +include(FindPackageHandleStandardArgs) + +find_library( + Metal_LIBRARY + NAMES Metal +) + +find_package_handle_standard_args(Metal REQUIRED_VARS Metal_LIBRARY) + +if(Metal_FOUND AND NOT TARGET Metal::Metal) + add_library(Metal::Metal INTERFACE IMPORTED) + set_target_properties( + Metal::Metal PROPERTIES + INTERFACE_LINK_LIBRARIES ${Metal_LIBRARY} + ) +endif() +