Description
If using a generator to build some files, one may want to test run it, similarly to compiler.compiles()
, to detect exactly which constructs are supported by the external tool.
The specific case I have in mind is when assembling .S
style assembly files with MS armasm, by invoking the gas-preprocessor
tool as a custom generator, like this: https://code.videolan.org/videolan/dav1d/-/blob/1.3.0/meson.build?ref_type=tags#L450-465 As the assembler evolves and gets support for newer instruction sets, one would want to try it out to see which of these instruction set extensions it actually does support.
It's probably possible manually run the same commands with run_command()
- although it probably would require specifying the command with all its arguments twice - once for the actual generator, and one for the run_command()
calls. This probably works (I haven't tested it), but is inflexible. It would require storing the test input snippets in loose files in the project directory, instead of generating them dynamically inline in the meson file (or can meson write a string to a temp file and return the path to it? I doubt it).
Thus, generators would need something like compiler.compiles()
in order to write a temporary file to disk (with a given suffix maybe) and invoke the generator at configure time (as opposed to at build time, as it normally otherwise is done with the generator.process()
method).
This is somewhat related to #12395.
CC @ePirat