Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow passing GeneratedList to generator.process #1141

Closed
nirbheek opened this issue Dec 5, 2016 · 7 comments · Fixed by #11654
Closed

Allow passing GeneratedList to generator.process #1141

nirbheek opened this issue Dec 5, 2016 · 7 comments · Fixed by #11654

Comments

@nirbheek
Copy link
Member

nirbheek commented Dec 5, 2016

Sometimes you want to chain two generators one after the other; for instance while building assembly with MSVC, you need to use ml.exe but it doesn't do pre-processing, so you need to call cl.exe /EP /P /Fi@OUTPUT@ @INPUT@ to do the pre-processing, and then pass it to ml.exe /Fo @OUTPUT@ /c @INPUT@ to get compiled object code which can be added as sources to an executable or library.

This is not trivial to do (I tried) but shouldn't be too difficult. Also implementing it on the Visual Studio backend has the same problem that is causing the 113 generatorcustom test to fail there.

This is needed for building libffi with Meson without resorting to a wrapper script.

@msink
Copy link
Contributor

msink commented Dec 7, 2016

File objects too - if generator is defined in submodule - paths are relative to that submodule.

bin2c.process('../../hello.zip') - works

bin2c.process(files('hello.zip')) - syntax error

@randy408
Copy link
Contributor

Any updates on this? Wrapper scripts are not trivial to write when e.g. subproject executables are involved in a compilation chain.

@germandiagogomez
Copy link
Contributor

I am finding the exact same use case as described by this issue.

@quackerd
Copy link

Same here. I needed to preprocess some ASM files which include C headers, then pass the generated ASM sources to the ASM generator. Now it doesn't work. Could be done with custom_targets but not clean.

@Volker-Weissmann
Copy link
Contributor

Volker-Weissmann commented Jan 8, 2021

Same here. I'm using gnu m4 and lemon. Unfortunately

lemongen.process(m4gen.process('myfile'))

fails with

ERROR: Generator arguments must be strings or files not <GeneratedListHolder: ['myfile']>.

@vinipsmaker
Copy link

I stumbled upon this issue while trying to consume the output of gperf as input for re2c before finally using the generated sources to build an executable.

@vinipsmaker
Copy link

vinipsmaker commented Mar 28, 2023

What I wanted to do:

gperf_gen.process(re2c_gen.process(re2c_src))

What I had to do thanks to Meson's limitation regarding non-chainable generators:

pp_state = custom_target(
    'bc2_state.cpp',
    output : 'bc2_state.cpp',
    input : re2c_gen.process('src/state.ypp'),
    command : [
        emilua_gperf,
        '--assign', 'GPERF_BIN=' + find_program('gperf').full_path(),
        '@INPUT@', '@OUTPUT@',
    ],
)

Full example: https://gitlab.com/emilua/emilua/-/blob/63683c851b1701ac3827f183624f13c341d03156/meson.build

Volker-Weissmann added a commit to Volker-Weissmann/meson that referenced this issue Apr 6, 2023
Volker-Weissmann added a commit to Volker-Weissmann/meson that referenced this issue Apr 7, 2023
Volker-Weissmann added a commit to Volker-Weissmann/meson that referenced this issue Apr 7, 2023
Volker-Weissmann added a commit to Volker-Weissmann/meson that referenced this issue Apr 7, 2023
Volker-Weissmann added a commit to Volker-Weissmann/meson that referenced this issue Apr 7, 2023
Volker-Weissmann added a commit to Volker-Weissmann/meson that referenced this issue Apr 8, 2023
Volker-Weissmann added a commit to Volker-Weissmann/meson that referenced this issue Apr 8, 2023
Volker-Weissmann added a commit to Volker-Weissmann/meson that referenced this issue Apr 11, 2023
Volker-Weissmann added a commit to Volker-Weissmann/meson that referenced this issue Apr 11, 2023
Volker-Weissmann added a commit to Volker-Weissmann/meson that referenced this issue Apr 15, 2023
Volker-Weissmann added a commit to Volker-Weissmann/meson that referenced this issue Apr 26, 2023
Volker-Weissmann added a commit to Volker-Weissmann/meson that referenced this issue Apr 28, 2023
Volker-Weissmann added a commit to Volker-Weissmann/meson that referenced this issue May 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants