Skip to content

Commit

Permalink
Shader CMake cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
colincornaby committed Nov 10, 2023
1 parent 0574698 commit a49e7f1
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 20 deletions.
21 changes: 1 addition & 20 deletions Sources/Plasma/Apps/plClient/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,26 +117,6 @@ elseif(APPLE)
Mac-Cocoa/[email protected]
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
)
Expand Down Expand Up @@ -260,6 +240,7 @@ target_link_libraries(
$<$<BOOL:${PLASMA_PIPELINE_DX}>:pfDXPipeline>
$<$<BOOL:${PLASMA_PIPELINE_GL}>:pfGLPipeline>
$<$<BOOL:${PLASMA_PIPELINE_METAL}>:pfMetalPipeline>
$<$<BOOL:${PLASMA_PIPELINE_METAL}>:pfMetalPipelineShaders>
CURL::libcurl
)
target_include_directories(plClient PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}")
Expand Down
22 changes: 22 additions & 0 deletions Sources/Plasma/FeatureLib/pfMetalPipeline/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})

0 comments on commit a49e7f1

Please sign in to comment.