unfuck broken ninja dep tracking that always rebuilds the entire ui and also write a 200 word essay for twitch chat

This commit is contained in:
psykose 2024-10-16 06:41:45 +02:00
parent 8c42d99c18
commit fdbbfcd730
2 changed files with 35 additions and 12 deletions

View file

@ -22,24 +22,35 @@ audrey_deps = [
dependency('libsoup-3.0', version: '>= 3.6'),
]
blueprints = custom_target(
'blueprints',
input: files('ui/play_queue.blp', 'ui/setup.blp', 'ui/window.blp'),
output: ['play_queue.ui', 'setup.ui', 'window.ui'],
command: [
find_program('blueprint-compiler'),
'batch-compile',
'@OUTDIR@',
'@CURRENT_SOURCE_DIR@',
'@INPUT@',
],
)
subdir('ui')
audrey_sources += gnome.compile_resources(
'audrey-resources',
'audrey.gresource.xml',
c_name: 'audrey',
dependencies: blueprints,
# this is a huge hack, as by default only src/ui to the 'blueprints' dep
# and ../src is passed, which means the ui/xyz.ui prefix will not be found
# anywhere, as src/ui already has the ui in the path.
# the reason we have to put blp in its own ui folder, is because:
# - blueprint-compiler batch-compile outputs in the same directory structure,
# i.e. if you pass ui/x.blp outdir foo, it will create foo/ui/x.ui,
# - meson doesn't support output:[] with dir/ prefix
# .. which means, all the files are always dirty; meson will try find 'src/x.ui'
# as an output for dirty tracking, but blp is outputting src/ui/x.ui
# because of the directory structure.
# using manual blueprint-compiler invocations to put the output in the
# 'correct' tracked place doesn't work either,
# since then it will be in this dir and not in ui/ and so all the ui/ prefixes
# in gresources won't find it, and we can't put it in a ui/ output from the
# current dir due to the above and meson not letting you.
#so since we use ui/ prefix, we need a meson.build in ui/ and then this hack
# to ensure compile sees the ui/ prefix starting from this src/ dir still,
# despite the dependency normally doing this for you
# note that the 'documented' way to use blp is with outdir:[.] which is
# fundamentally broken as then nothing is tracked except the dirs existence, which
# is racy as the dependency is satistfied before anything is compiled
extra_args: ['--sourcedir', 'src'],
)
executable(

12
src/ui/meson.build Normal file
View file

@ -0,0 +1,12 @@
blueprints = custom_target(
'blueprints',
input: files('play_queue.blp', 'setup.blp', 'window.blp'),
output: ['play_queue.ui', 'setup.ui', 'window.ui'],
command: [
find_program('blueprint-compiler'),
'batch-compile',
'@OUTDIR@',
'@CURRENT_SOURCE_DIR@',
'@INPUT@',
],
)