[Feature Request] allow batch-compile for files from multiple source directories
I tried to do something like this in my meson project
main_window_blp = configure_file(
input: 'main-window.blp.in',
output: 'main-window.blp',
configuration: conf,
install: false,
)
blueprints = [main_window_blp] + files(
'appearance-page.blp',
'fonts-page.blp',
'night-light-page.blp',
'sound-page.blp',
'top-bar-page.blp',
'touchpad-page.blp',
'misc-page.blp',
)
custom_target('interface_definitions',
input: blueprints,
output: 'ui',
command: [find_program("blueprint-compiler"), 'batch-compile', '@OUTPUT@', '@CURRENT_SOURCE_DIR@', '@INPUT@'],
install: true,
install_dir: pkgdatadir,
)
It does not work because result of configure_file()
is a file that lives in build directory not in @CURRENT_SOURCE_DIR@
and blueprint-compiler batch-compile
command does not allow source files from different directories.
Solution
I propose to change usage of batch-compile
sub-command to something like this
usage: blueprint-compiler batch-compile [{-i|--input-dir}=INPUT_DIR] OUTPUT_DIR SOURCE_FILES
INPUT_DIR: directory under which SOURCE_FILES exist
OUTPUT_DIR: directory where compiled files will be saved
SOURCE_FILES: source blueprint files
Note: If INPUT_DIR is provided, input directory structure will be preserved and all SOURCE_FIELS **MUST** exist under it.
Advantages
- It would be easier to use inside meson and other build systems
- Preserving directory structure of input files would be a choice and not mandatory
My workaround
Since the desired meson.build does not work, I am using following meson.build
blueprint_compiler = generator(
find_program('blueprint-compiler'),
output: '@BASENAME@.ui',
arguments: ['compile', '@INPUT@', '--output', '@OUTPUT@'],
)
main_window_blp = configure_file(
input: 'main-window.blp.in',
output: 'main-window.blp',
configuration: conf,
install: false,
)
blueprints = [main_window_blp] + files(
'appearance-page.blp',
'fonts-page.blp',
'night-light-page.blp',
'sound-page.blp',
'top-bar-page.blp',
'touchpad-page.blp',
'misc-page.blp',
)
ui_files = blueprint_compiler.process(blueprints)
custom_target('ui_files',
input: ui_files,
output: 'ui',
command: [find_program('install'), '-Dm644', '-t', '@OUTPUT@', '@INPUT@'],
install: true,
install_dir: pkgdatadir,
)
which compiles each blueprint file separately and uses install
shell command. This is not ideal (and seems to be a bit slower than batch-compile).
Edited by Mazhar Hussain