2019-06-07 16:07:57 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
Import('env')
|
|
|
|
|
2019-08-05 09:48:54 +00:00
|
|
|
env.add_source_files(env.drivers_sources, "*.cpp")
|
2019-06-07 16:07:57 +00:00
|
|
|
|
2019-08-05 09:48:54 +00:00
|
|
|
if env['builtin_vulkan']:
|
|
|
|
# Use bundled Vulkan headers
|
|
|
|
thirdparty_dir = "#thirdparty/vulkan"
|
2020-02-11 13:01:43 +00:00
|
|
|
env.Prepend(CPPPATH=[thirdparty_dir, thirdparty_dir + "/include", thirdparty_dir + "/loader"])
|
2019-06-07 16:07:57 +00:00
|
|
|
|
2019-08-05 09:48:54 +00:00
|
|
|
# Build Vulkan loader library
|
|
|
|
env_thirdparty = env.Clone()
|
|
|
|
env_thirdparty.disable_warnings()
|
|
|
|
|
|
|
|
loader_sources = [
|
|
|
|
"cJSON.c",
|
|
|
|
"debug_utils.c",
|
|
|
|
"dev_ext_trampoline.c",
|
|
|
|
"loader.c",
|
|
|
|
"murmurhash.c",
|
|
|
|
"phys_dev_ext.c",
|
|
|
|
"trampoline.c",
|
|
|
|
"unknown_ext_chain.c",
|
|
|
|
"wsi.c",
|
|
|
|
"extension_manual.c",
|
|
|
|
]
|
2020-02-11 13:01:43 +00:00
|
|
|
vma_sources = [thirdparty_dir + "/vk_mem_alloc.cpp"]
|
2019-08-05 09:48:54 +00:00
|
|
|
|
|
|
|
if env['platform'] == "windows":
|
|
|
|
loader_sources.append("dirent_on_windows.c")
|
2019-11-06 09:38:30 +00:00
|
|
|
loader_sources.append("dxgi_loader.c")
|
2019-08-05 09:48:54 +00:00
|
|
|
env_thirdparty.AppendUnique(CPPDEFINES=[
|
|
|
|
'VK_USE_PLATFORM_WIN32_KHR',
|
|
|
|
'VULKAN_NON_CMAKE_BUILD',
|
|
|
|
'WIN32_LEAN_AND_MEAN',
|
|
|
|
'API_NAME=\\"%s\\"' % 'Vulkan'
|
|
|
|
])
|
|
|
|
if not env.msvc: # Windows 7+, missing in mingw headers
|
|
|
|
env_thirdparty.AppendUnique(CPPDEFINES=[
|
|
|
|
"CM_GETIDLIST_FILTER_CLASS=0x00000200",
|
|
|
|
"CM_GETIDLIST_FILTER_PRESENT=0x00000100"
|
|
|
|
])
|
|
|
|
elif env['platform'] == "osx":
|
|
|
|
env_thirdparty.AppendUnique(CPPDEFINES=[
|
|
|
|
'VK_USE_PLATFORM_MACOS_MVK',
|
|
|
|
'VULKAN_NON_CMAKE_BUILD',
|
2020-02-22 06:00:48 +00:00
|
|
|
'SYSCONFDIR=\\"%s\\"' % '/etc',
|
|
|
|
'FALLBACK_DATA_DIRS=\\"%s\\"' % '/usr/local/share:/usr/share',
|
|
|
|
'FALLBACK_CONFIG_DIRS=\\"%s\\"' % '/etc/xdg'
|
|
|
|
])
|
|
|
|
elif env['platform'] == "iphone":
|
|
|
|
env_thirdparty.AppendUnique(CPPDEFINES=[
|
|
|
|
'VK_USE_PLATFORM_IOS_MVK',
|
|
|
|
'VULKAN_NON_CMAKE_BUILD',
|
2019-08-05 09:48:54 +00:00
|
|
|
'SYSCONFDIR=\\"%s\\"' % '/etc',
|
|
|
|
'FALLBACK_DATA_DIRS=\\"%s\\"' % '/usr/local/share:/usr/share',
|
|
|
|
'FALLBACK_CONFIG_DIRS=\\"%s\\"' % '/etc/xdg'
|
|
|
|
])
|
2020-03-03 13:36:29 +00:00
|
|
|
elif env['platform'] == "linuxbsd":
|
2019-08-05 09:48:54 +00:00
|
|
|
env_thirdparty.AppendUnique(CPPDEFINES=[
|
|
|
|
'VK_USE_PLATFORM_XLIB_KHR',
|
|
|
|
'VULKAN_NON_CMAKE_BUILD',
|
|
|
|
'SYSCONFDIR=\\"%s\\"' % '/etc',
|
|
|
|
'FALLBACK_DATA_DIRS=\\"%s\\"' % '/usr/local/share:/usr/share',
|
|
|
|
'FALLBACK_CONFIG_DIRS=\\"%s\\"' % '/etc/xdg'
|
|
|
|
])
|
2020-02-14 14:32:03 +00:00
|
|
|
import platform
|
|
|
|
if (platform.system() == "Linux"):
|
|
|
|
# In glibc since 2.17 and musl libc since 1.1.24. Used by loader.c.
|
|
|
|
env_thirdparty.AppendUnique(CPPDEFINES=['HAVE_SECURE_GETENV'])
|
2019-08-05 09:48:54 +00:00
|
|
|
|
|
|
|
loader_sources = [thirdparty_dir + "/loader/" + file for file in loader_sources]
|
|
|
|
env_thirdparty.add_source_files(env.drivers_sources, loader_sources)
|
2020-02-11 13:01:43 +00:00
|
|
|
env_thirdparty.add_source_files(env.drivers_sources, vma_sources)
|