meson: Add files in manifest as respack.py input
This makes meson detect changes to files like default_config.json and rebuild libresrc.cpp when necessary.
This commit is contained in:
parent
5bde34ff3e
commit
142605cf41
2 changed files with 19 additions and 9 deletions
|
@ -1,6 +1,6 @@
|
||||||
project('Aegisub', ['c', 'cpp'],
|
project('Aegisub', ['c', 'cpp'],
|
||||||
license: 'BSD-3-Clause',
|
license: 'BSD-3-Clause',
|
||||||
meson_version: '>=0.56.1',
|
meson_version: '>=0.57.0',
|
||||||
default_options: ['cpp_std=c++14', 'buildtype=debugoptimized'],
|
default_options: ['cpp_std=c++14', 'buildtype=debugoptimized'],
|
||||||
version: '3.2.2')
|
version: '3.2.2')
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
fs = import('fs')
|
||||||
|
|
||||||
respack = find_program(meson.project_source_root() / 'tools/respack.py')
|
respack = find_program(meson.project_source_root() / 'tools/respack.py')
|
||||||
|
|
||||||
resrc = [
|
resrc = [
|
||||||
|
@ -12,16 +14,24 @@ conf_platform_json = configure_file(input: 'default_config_platform.json.in',
|
||||||
configuration: conf_platform)
|
configuration: conf_platform)
|
||||||
|
|
||||||
if host_machine.system() == 'darwin'
|
if host_machine.system() == 'darwin'
|
||||||
resrc += custom_target('default_config.{cpp,h}',
|
resmanifest = 'manifest_osx.respack'
|
||||||
command: [respack, '@INPUT0@', '@OUTPUT@'],
|
|
||||||
input: [files('manifest_osx.respack'), conf_platform_json],
|
|
||||||
output: ['default_config.cpp', 'default_config.h'])
|
|
||||||
else
|
else
|
||||||
|
resmanifest = 'manifest.respack'
|
||||||
|
endif
|
||||||
|
|
||||||
|
resmanifest_files = [conf_platform_json]
|
||||||
|
# Filter out the files we've generated ourselves
|
||||||
|
foreach rfile : fs.read(resmanifest).strip().split('\n')
|
||||||
|
rfile_s = rfile.strip()
|
||||||
|
if fs.is_file(rfile_s)
|
||||||
|
resmanifest_files += files(rfile_s)
|
||||||
|
endif
|
||||||
|
endforeach
|
||||||
|
|
||||||
resrc += custom_target('default_config.{cpp,h}',
|
resrc += custom_target('default_config.{cpp,h}',
|
||||||
command: [respack, '@INPUT0@', '@OUTPUT@'],
|
command: [respack, '@INPUT0@', '@OUTPUT@'],
|
||||||
input: [files('manifest.respack'), conf_platform_json],
|
input: [files(resmanifest), resmanifest_files],
|
||||||
output: ['default_config.cpp', 'default_config.h'])
|
output: ['default_config.cpp', 'default_config.h'])
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
libresrc_inc = include_directories('.')
|
libresrc_inc = include_directories('.')
|
||||||
|
|
Loading…
Reference in a new issue