Debian Codegraph @

drivers/vulkan/SCsub

raw symbols SCIP
1 #!/usr/bin/env python
2 from misc.utility.scons_hints import *
3
4 Import("env")
5
6 thirdparty_obj = []
7 thirdparty_dir = "#thirdparty/vulkan"
8 thirdparty_volk_dir = "#thirdparty/volk"
9 thirdparty_spirv_headers_dir = "#thirdparty/spirv-headers"
10 thirdparty_respirv_dir = "#thirdparty/re-spirv"
11
12 # Use bundled Vulkan headers
13 env.Prepend(CPPPATH=[thirdparty_dir, thirdparty_dir + "/include"])
14
15 if env["use_volk"]:
16 env.AppendUnique(CPPDEFINES=["USE_VOLK"])
17 env.Prepend(CPPPATH=[thirdparty_volk_dir])
18
19 if env["platform"] == "android":
20 env.AppendUnique(CPPDEFINES=["VK_USE_PLATFORM_ANDROID_KHR"])
21 elif env["platform"] == "ios":
22 env.AppendUnique(CPPDEFINES=["VK_USE_PLATFORM_IOS_MVK", "VK_USE_PLATFORM_METAL_EXT"])
23 elif env["platform"] == "linuxbsd":
24 if env["x11"]:
25 env.AppendUnique(CPPDEFINES=["VK_USE_PLATFORM_XLIB_KHR"])
26 if env["wayland"]:
27 env.AppendUnique(CPPDEFINES=["VK_USE_PLATFORM_WAYLAND_KHR"])
28 elif env["platform"] == "macos":
29 env.AppendUnique(CPPDEFINES=["VK_USE_PLATFORM_MACOS_MVK", "VK_USE_PLATFORM_METAL_EXT"])
30 elif env["platform"] == "windows":
31 env.AppendUnique(CPPDEFINES=["VK_USE_PLATFORM_WIN32_KHR"])
32
33 # Build Vulkan memory allocator and volk
34 env_thirdparty_vma = env.Clone()
35 env_thirdparty_vma.disable_warnings()
36 thirdparty_sources_vma = [thirdparty_dir + "/vk_mem_alloc.cpp"]
37
38 if env["use_volk"]:
39 env_thirdparty_vma.AppendUnique(CPPDEFINES=[("VMA_STATIC_VULKAN_FUNCTIONS", 1)])
40 env_thirdparty_volk = env.Clone()
41 env_thirdparty_volk.disable_warnings()
42
43 thirdparty_sources_volk = [thirdparty_volk_dir + "/volk.c"]
44 env_thirdparty_volk.add_source_files(thirdparty_obj, thirdparty_sources_volk)
45 elif env["platform"] == "android":
46 # Our current NDK version only provides old Vulkan headers,
47 # so we have to limit VMA.
48 env_thirdparty_vma.AppendUnique(CPPDEFINES=[("VMA_VULKAN_VERSION", 1000000)])
49 elif env["platform"] == "macos" or env["platform"] == "ios":
50 # MoltenVK supports only Vulkan 1.1 API, limit VMA to the same version.
51 env_thirdparty_vma.AppendUnique(CPPDEFINES=[("VMA_VULKAN_VERSION", 1001000)])
52
53 env_thirdparty_vma.add_source_files(thirdparty_obj, thirdparty_sources_vma)
54
55 # Build re-spirv
56 env_thirdparty_respirv = env.Clone()
57 env_thirdparty_respirv.Prepend(CPPPATH=[thirdparty_spirv_headers_dir + "/include"])
58 env_thirdparty_respirv.disable_warnings()
59 thirdparty_sources_respirv = [thirdparty_respirv_dir + "/re-spirv.cpp"]
60 env_thirdparty_respirv.add_source_files(thirdparty_obj, thirdparty_sources_respirv)
61
62 env.drivers_sources += thirdparty_obj
63
64
65 # Godot source files
66
67 driver_obj = []
68
69 env.add_source_files(driver_obj, "*.cpp")
70 env.drivers_sources += driver_obj
71
72 # Needed to force rebuilding the driver files when the thirdparty code is updated.
73 env.Depends(driver_obj, thirdparty_obj)