yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

Ellie Hermaszewskaformat cmake files (#5406)657287e77

master
1.5 KiB58 linesraw
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)
8    file(GLOB files CONFIGURE_DEPENDS ${ARGN})
9    list(APPEND ${dest} ${files})
10    set(${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)
18    set(patterns
19        "*.cpp"
20        "*.h"
21        "*.natvis"
22        "*.natstepfilter"
23        "*.natjmc"
24    )
25    if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
26        list(APPEND patterns "*.mm")
27    endif()
28    list(TRANSFORM patterns PREPEND "${dir}/")
29
30    file(GLOB_RECURSE files CONFIGURE_DEPENDS ${patterns})
31
32    if(NOT WIN32)
33        list(FILTER files EXCLUDE REGEX "(^|/)windows/.*")
34    endif()
35
36    if(NOT UNIX)
37        list(FILTER files EXCLUDE REGEX "(^|/)unix/.*")
38    endif()
39
40    if(NOT CMAKE_SYSTEM_NAME MATCHES "Windows" AND NOT SLANG_ENABLE_DX_ON_VK)
41        list(FILTER files EXCLUDE REGEX "(^|/)d3d.*/.*")
42    endif()
43
44    if(NOT CMAKE_SYSTEM_NAME MATCHES "Windows|Linux|Darwin")
45        list(FILTER files EXCLUDE REGEX "(^|/)vulkan/.*")
46    endif()
47
48    if(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")
49        list(FILTER files EXCLUDE REGEX "(^|/)metal/.*")
50    endif()
51
52    if(NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
53        list(FILTER files EXCLUDE REGEX "(^|/)open-gl/.*")
54    endif()
55
56    list(APPEND ${var} ${files})
57    set(${var} ${${var}} PARENT_SCOPE)
58endfunction()