Skip to content

Commit

Permalink
Merge pull request H-uru#1588 from dpogue/metal-version
Browse files Browse the repository at this point in the history
Don't try to enable Metal on older Macs
  • Loading branch information
dpogue authored Jun 2, 2024
2 parents c6895a6 + 1826acf commit a89e627
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Sources/Plasma/FeatureLib/pfMetalPipeline/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ target_link_libraries(pfMetalPipeline
CoreLib
pnNucleusInc
plPipeline
"-framework Metal"
Metal::Metal
"-framework MetalPerformanceShaders"
PRIVATE
plStatusLog
Expand Down
17 changes: 17 additions & 0 deletions cmake/FindMetal.cmake
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit a89e627

Please sign in to comment.