On Tue, Aug 18, 2015 at 3:33 AM, Rob
<rdool...@gmail.com> wrote:
Ok, thanks.
Do you think meson run_target will ever be as capable as cmake's 'add custom target'?
It supports everything one might expect from a custom target - multiple commands, dependencies, etc.
It seems like 'custom_target' is close, but it requires the output be specified and it runs automatically.
There are many issues at work here.
First, dependencies should already work. If you specify files in the command line (as declared with the files() command), then dependency info is generated automatically.
Second, multiple commands is not supported by design. If you have a build step that is more complicated than just one command, you are better off writing it into a script. It has many benefits. For example, this makes your standalone step testable in isolation, you can just run it on its own to debug any issue. Secondly that makes your custom step easy to find. Hunting for embedded build steps in multi-hundred lines of build definition is extremely unpleasant (speaking from experience). You also improve portability because if you write shell commands in your build definition it might fail mysteriously on Windows where the shell is different. You can even write your custom steps in Python, Lua, or anything you like.
Thirdly, if you do not want the target to be built automatically but instead only when you explicitly call it, you might want to look into a run_target instead. As an example see what the gtk-doc test case in unit tests does (test cases/frameworks/10 gtk-doc). In this case you probably don't care about dependencies either, just regenerate all docs on invocation.
Finally, when you have your commands in a script file rather than embedded, your editor's syntax highlighter will display correct output.