yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
657287e77
master
1# 2# glob_append(MY_VAR my_glob) will append the results of file(GLOB 3# CONFIGURE_DEPENDS my_glob) to MY_VAR 4# 5# Any number of globs may be specified 6# 7function ( glob_append dest ) 8file ( GLOB files CONFIGURE_DEPENDS ${ ARGN }) 9list ( APPEND ${ dest } ${ files }) 10set ( $ { dest } ${ $ { dest }} PARENT_SCOPE ) 11endfunction () 12 13# 14# Perform a recursive glob, and exclude any files appropriately according to 15# the host system and build options 16# 17function ( slang_glob_sources var dir ) 18set ( patterns 19"*.cpp" 20"*.h" 21"*.natvis" 22"*.natstepfilter" 23"*.natjmc" 24) 25if ( CMAKE_SYSTEM_NAMEMATCHES "Darwin" ) 26list ( APPEND patterns "*.mm" ) 27endif () 28list ( TRANSFORM patterns PREPEND " ${ dir } /" ) 29 30file ( GLOB_RECURSE files CONFIGURE_DEPENDS ${ patterns }) 31 32if ( NOT WIN32) 33list ( FILTER files EXCLUDE REGEX "(^|/)windows/.*" ) 34endif () 35 36if ( NOT UNIX) 37list ( FILTER files EXCLUDE REGEX "(^|/)unix/.*" ) 38endif () 39 40if ( NOT CMAKE_SYSTEM_NAMEMATCHES "Windows" AND NOT SLANG_ENABLE_DX_ON_VK) 41list ( FILTER files EXCLUDE REGEX "(^|/)d3d.*/.*" ) 42endif () 43 44if ( NOT CMAKE_SYSTEM_NAMEMATCHES "Windows|Linux|Darwin" ) 45list ( FILTER files EXCLUDE REGEX "(^|/)vulkan/.*" ) 46endif () 47 48if ( NOT CMAKE_SYSTEM_NAMEMATCHES "Darwin" ) 49list ( FILTER files EXCLUDE REGEX "(^|/)metal/.*" ) 50endif () 51 52if ( NOT CMAKE_SYSTEM_NAMEMATCHES "Windows" ) 53list ( FILTER files EXCLUDE REGEX "(^|/)open-gl/.*" ) 54endif () 55 56list ( APPEND ${ var } ${ files }) 57set ( $ { var } ${ $ { var }} PARENT_SCOPE ) 58endfunction ()