Debian Codegraph @

drivers/metal/SCsub

raw symbols SCIP
1 #!/usr/bin/env python
2 from misc.utility.scons_hints import *
3
4 Import("env")
5
6 env_metal = env.Clone()
7
8 # Thirdparty source files
9
10 thirdparty_obj = []
11
12 thirdparty_spirv_headers_dir = "#thirdparty/spirv-headers/"
13 thirdparty_dir = "#thirdparty/spirv-cross/"
14 thirdparty_sources = [
15 "spirv_cfg.cpp",
16 "spirv_cross.cpp",
17 "spirv_parser.cpp",
18 "spirv_msl.cpp",
19 "spirv_reflect.cpp",
20 "spirv_glsl.cpp",
21 "spirv_cross_parsed_ir.cpp",
22 ]
23 thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
24
25 env_metal.Prepend(CPPPATH=[thirdparty_dir, thirdparty_dir + "/include"])
26 env_metal.Prepend(CPPPATH=[thirdparty_spirv_headers_dir + "include/spirv/unified1"])
27
28 # Must enable exceptions for SPIRV-Cross; otherwise, it will abort the process on errors.
29 if "-fno-exceptions" in env_metal["CXXFLAGS"]:
30 env_metal["CXXFLAGS"].remove("-fno-exceptions")
31 env_metal.Append(CXXFLAGS=["-fexceptions"])
32
33 env_thirdparty = env_metal.Clone()
34 env_thirdparty.disable_warnings()
35 env_thirdparty.add_source_files(thirdparty_obj, thirdparty_sources)
36 env_metal.drivers_sources += thirdparty_obj
37
38 # Enable C++20 for the Objective-C++ Metal code, which uses C++20 concepts.
39 if "-std=gnu++17" in env_metal["CXXFLAGS"]:
40 env_metal["CXXFLAGS"].remove("-std=gnu++17")
41 env_metal.Append(CXXFLAGS=["-std=gnu++20"])
42
43 # Enable module support
44 env_metal.Append(CCFLAGS=["-fmodules", "-fcxx-modules"])
45
46 # Driver source files
47
48 driver_obj = []
49
50 env_metal.add_source_files(driver_obj, "*.mm")
51 env_metal.add_source_files(driver_obj, "*.cpp")
52 env.drivers_sources += driver_obj
53
54 # Needed to force rebuilding the driver files when the thirdparty library is updated.
55 env.Depends(driver_obj, thirdparty_obj)