From a49e7f1eb4b94c4b35312b8ec56757307e5ab4b1 Mon Sep 17 00:00:00 2001 From: Colin Cornaby Date: Thu, 9 Nov 2023 21:42:56 -0800 Subject: [PATCH] Shader CMake cleanup --- Sources/Plasma/Apps/plClient/CMakeLists.txt | 21 +----------------- .../FeatureLib/pfMetalPipeline/CMakeLists.txt | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/Sources/Plasma/Apps/plClient/CMakeLists.txt b/Sources/Plasma/Apps/plClient/CMakeLists.txt index 7dd46ce989..865b425851 100644 --- a/Sources/Plasma/Apps/plClient/CMakeLists.txt +++ b/Sources/Plasma/Apps/plClient/CMakeLists.txt @@ -117,26 +117,6 @@ elseif(APPLE) Mac-Cocoa/banner@2x.png win32/res/Dirt.ICO ) - #shaders need to be compiled as part of the app - #this could change in the future, but for now the Metal code expects the library to be compiled in the app - set(plClient_SHADERS - ../../FeatureLib/pfMetalPipeline/ShaderSrc/FixedPipelineShaders.metal - ../../FeatureLib/pfMetalPipeline/ShaderSrc/PlateShaders.metal - ../../FeatureLib/pfMetalPipeline/ShaderSrc/BiasNormals.metal - ../../FeatureLib/pfMetalPipeline/ShaderSrc/CompCosines.metal - ../../FeatureLib/pfMetalPipeline/ShaderSrc/WaveSet7.metal - ../../FeatureLib/pfMetalPipeline/ShaderSrc/Grass.metal - ../../FeatureLib/pfMetalPipeline/ShaderSrc/WaveDecEnv.metal - ../../FeatureLib/pfMetalPipeline/ShaderSrc/Avatar.metal - ../../FeatureLib/pfMetalPipeline/ShaderSrc/WaveDec1Lay_7.metal - ../../FeatureLib/pfMetalPipeline/ShaderSrc/WaveRip.metal - ../../FeatureLib/pfMetalPipeline/ShaderSrc/Clear.metal - ../../FeatureLib/pfMetalPipeline/ShaderSrc/GammaCorrection.metal - ../../FeatureLib/pfMetalPipeline/ShaderSrc/TextFontShader.metal - ) - set_source_files_properties(${plClient_SHADERS} PROPERTIES LANGUAGE METAL) - source_group("Metal Shaders" FILES ${plClient_SHADERS}) - set(plClient_SOURCES ${plClient_SOURCES} ${plClient_SHADERS}) list(APPEND plClient_RESOURCES win32/res/Dirt.ICO ) @@ -260,6 +240,7 @@ target_link_libraries( $<$:pfDXPipeline> $<$:pfGLPipeline> $<$:pfMetalPipeline> + $<$:pfMetalPipelineShaders> CURL::libcurl ) target_include_directories(plClient PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}") diff --git a/Sources/Plasma/FeatureLib/pfMetalPipeline/CMakeLists.txt b/Sources/Plasma/FeatureLib/pfMetalPipeline/CMakeLists.txt index 9d286f3218..194097c557 100644 --- a/Sources/Plasma/FeatureLib/pfMetalPipeline/CMakeLists.txt +++ b/Sources/Plasma/FeatureLib/pfMetalPipeline/CMakeLists.txt @@ -58,3 +58,25 @@ target_include_directories(pfMetalPipeline PUBLIC "ShaderSrc") source_group("Source Files" FILES ${pfMetalPipeline_SOURCES}) source_group("Header Files" FILES ${pfMetalPipeline_HEADERS}) + +add_library( pfMetalPipelineShaders INTERFACE ) +set(pfMetalPipeline_SHADERS + ShaderSrc/FixedPipelineShaders.metal + ShaderSrc/PlateShaders.metal + ShaderSrc/BiasNormals.metal + ShaderSrc/CompCosines.metal + ShaderSrc/WaveSet7.metal + ShaderSrc/Grass.metal + ShaderSrc/WaveDecEnv.metal + ShaderSrc/Avatar.metal + ShaderSrc/WaveDec1Lay_7.metal + ShaderSrc/WaveRip.metal + ShaderSrc/Clear.metal + ShaderSrc/GammaCorrection.metal + ShaderSrc/TextFontShader.metal +) +set_source_files_properties(${pfMetalPipeline_SHADERS} TARGET_DIRECTORY plClient PROPERTIES LANGUAGE METAL) +# source group does not work with an interface library in Xcode, but maybe someday... +source_group("Metal Shaders" FILES ${pfMetalPipeline_SHADERS}) + +target_sources(pfMetalPipelineShaders INTERFACE ${pfMetalPipeline_SHADERS})