Clone vulkan headers if needed

This commit is contained in:
jackun 2020-02-13 23:33:04 +02:00
parent 18edd4eb50
commit 70d0e81c36
No known key found for this signature in database
GPG Key ID: 119DB3F1D05A9ED3
6 changed files with 27 additions and 13 deletions

3
.gitmodules vendored
View File

@ -1,6 +1,3 @@
[submodule "modules/ImGui/src"]
path = modules/ImGui/src
url = https://github.com/flightlessmango/ImGui.git
[submodule "modules/Vulkan-Headers"]
path = modules/Vulkan-Headers
url = https://github.com/KhronosGroup/Vulkan-Headers.git

View File

@ -111,11 +111,6 @@ inc_common = [
]
dep_vulkan = dependency('vulkan', required: get_option('use_system_vulkan'))
if not dep_vulkan.found()
inc_common += [
include_directories('modules/Vulkan-Headers/include')
]
endif
# Check for generic C arguments
c_args = []
@ -191,17 +186,17 @@ endif
dep_pthread = cc.find_library('pthread')
if dep_vulkan.found()
vulkan_headers = []
datadir = get_option('datadir')
if not datadir.startswith('/')
datadir = get_option('prefix') / datadir
endif
vk_api_xml = files(datadir / 'vulkan/registry/vk.xml')
else
vk_api_xml = files('modules/Vulkan-Headers/registry/vk.xml')
subdir('modules/Vulkan-Headers')
vulkan_headers = vk_api_xml
endif
vk_layer_table_helpers = []
vk_enum_to_str = custom_target(
'vk_enum_to_str',
input : ['bin/gen_enum_to_str.py', vk_api_xml],

@ -1 +0,0 @@
Subproject commit 7264358702061d3ed819d62d3d6fd66ab1da33c3

View File

@ -0,0 +1,11 @@
#!/bin/sh
GIT="$1"
BUILD_DIR="$2"
if [ ! -f "$BUILD_DIR/registry/vk.xml" ]; then
"$GIT" clone --depth 1 https://github.com/KhronosGroup/Vulkan-Headers.git "$BUILD_DIR"
fi
ln -sf "registry/vk.xml" modules/Vulkan-Headers/
ln -sf "include/vulkan" modules/Vulkan-Headers/

View File

@ -0,0 +1,12 @@
prog_git = find_program('git')
prog_sh = find_program('sh')
script_clone_hdrs = files('clone_headers.sh')
vk_api_xml = custom_target(
'vk_api_xml',
input : [],
output : ['vk.xml'], # because output can't have segments, link vk.xml to this subdir dir in build prefix
command : [
prog_sh, script_clone_hdrs, prog_git, meson.current_build_dir()
],
)

View File

@ -50,7 +50,7 @@ vklayer_mesa_overlay = shared_library(
vk_enum_to_str,
vklayer_files,
overlay_spv,
vk_layer_table_helpers,
vulkan_headers,
c_args : [
pre_args,
c_vis_args,