Dov Grobgeld
Dov Grobgeld

Reputation: 4983

How to chain two custom_targets in meson?

Two properly build my target, I need to chain two custom commands in meson:

But I can't figure out how to give the patch_src command the output of the gob2 program as input. If I do the following:

gob2 = find_program('gob2')
patch_src = find_program('patch_src')

gen_src = custom_target('gen-output',
  output : ['gtk-image-viewer.h','gtk-image-viewer-private.h','gtk-image-viewer.c'],
  input : 'gtk-image-viewer.gob',
  command : [gob2, '-o', '@OUTDIR@', '@INPUT@'],
  )

fixed_src = custom_target('patch-output',
  output : ['gtk-image-viewer-fixed.c'],
  input : 'gtk-image-viewer.c',
  command : [patch_src, 'gtk-image-viewer.c','@OUTPUT@'],
  )

I obviously get the error that gtk-image-viewer.c is not found, which makes sense as it is written to @OUTPUTDIR@. But how do I specify to meson to look for gtk-image-viewer.c in @OUTPUTDIR@?

Upvotes: 1

Views: 1304

Answers (1)

TingPing
TingPing

Reputation: 2292

You can pass gen_src[3] for example as the input directly and meson will set up the dependencies and use the correct path to it.

fixed_src = custom_target('patch-output',
  output : ['gtk-image-viewer-fixed.c'],
  input  : gen_src[3],
  command : [patch_src, '@INPUT@','@OUTPUT@'],
)

Upvotes: 2

Related Questions