build: Improve vulkan resource handling

This fixes the proper dependencies getting set up for generating
the shaders and only the necessary things getting rebuilt on
resources changing in gsk.
This commit is contained in:
Patrick Griffis 2017-09-05 12:47:10 -04:00 committed by Matthias Clasen
parent f0f394bfdd
commit a55b57caff
2 changed files with 9 additions and 7 deletions

View File

@ -45,7 +45,12 @@ gsk_public_headers = files([
install_headers(gsk_public_headers, 'gsk.h', subdir: 'gtk-4.0/gsk')
gsk_private_vulkan_shaders = []
# This is an odd split because we use configure_file() below to workaround
# a limitation in meson preventing using custom_target() with gnome.compile_resources()
# and that requires file paths, but we also need to have dependencies during development
# on constantly regenerated files.
gsk_private_vulkan_compiled_shaders = []
gsk_private_vulkan_compiled_shaders_deps = []
if have_vulkan
gsk_private_sources += files([
@ -96,6 +101,7 @@ gskenum_h = gsk_enums[1]
gskresources = gnome.compile_resources('gskresources',
gsk_resources_xml,
dependencies: gsk_private_vulkan_compiled_shaders_deps,
source_dir: '.',
c_name: '_gsk',
extra_args: [ '--manual-register', ])
@ -126,5 +132,5 @@ libgsk = static_library('gsk',
# list the dependencies and generated headers and such, for use in the
# "public" libgtk_dep used by internal executables.
libgsk_dep = declare_dependency(include_directories: [ confinc, ],
sources: [ gskenum_h, gskresources, ],
sources: [ gskenum_h, ],
dependencies: libgdk_dep)

View File

@ -45,7 +45,6 @@ foreach shader: gsk_private_vulkan_shaders
compiled_shader = custom_target(spv_shader,
input: shader,
output: spv_shader,
build_by_default: true,
command: [
glslc,
stage_arg,
@ -56,7 +55,6 @@ foreach shader: gsk_private_vulkan_shaders
compiled_clip_shader = custom_target(clip_spv_shader,
input: shader,
output: clip_spv_shader,
build_by_default: true,
command: [
glslc,
stage_arg,
@ -67,7 +65,6 @@ foreach shader: gsk_private_vulkan_shaders
compiled_clip_rounded_shader = custom_target(clip_rounded_spv_shader,
input: shader,
output: clip_rounded_spv_shader,
build_by_default: true,
command: [
glslc,
stage_arg,
@ -75,8 +72,7 @@ foreach shader: gsk_private_vulkan_shaders
'@INPUT@',
'-o', '@OUTPUT@'
])
gsk_private_vulkan_compiled_shaders_deps += [compiled_shader, compiled_clip_shader, compiled_clip_rounded_shader]
endif
gsk_private_vulkan_compiled_shaders += files(spv_shader)
gsk_private_vulkan_compiled_shaders += files(clip_spv_shader)
gsk_private_vulkan_compiled_shaders += files(clip_rounded_spv_shader)
gsk_private_vulkan_compiled_shaders += files(spv_shader, clip_spv_shader, clip_rounded_spv_shader)
endforeach