2
0
mirror of https://gitlab.com/ita1024/waf.git synced 2024-11-22 09:57:15 +01:00

Show how to re-use the outputs from a task generator into another - vala

This commit is contained in:
Thomas Nagy 2015-02-17 16:50:19 +01:00
parent 8f4df2085c
commit 9d37801661
No known key found for this signature in database
GPG Key ID: 67A565EDFDF90E64

View File

@ -12,3 +12,29 @@ bld.shlib(
pkg_name = 'hello' pkg_name = 'hello'
) )
bld(features = 'c cstlib foreign_generator', # be specific
source = '', # no source files
target = 'hello-world', # this is for the file name
name = 'hello-world-static', # and this is when you want to reuse from wscript files
srcgen = 'hello-world',
use = 'GTK GLIB', # mandatory here
)
# --- support code for 'foreign_generator' above ---
from waflib import TaskGen
@TaskGen.feature('foreign_generator')
@TaskGen.before('apply_link')
def call_me_static(self):
for x in self.to_list(getattr(self, 'srcgen')):
tg = self.bld.get_tgen_by_name(x)
if not tg:
self.bld.fatal('No task generator by the name %r' % x)
tg.post() # required by "waf clean build --target=hello-world-static"
for tsk in tg.tasks:
for out in tsk.outputs:
if out.name.endswith('.c'):
self.create_compiled_task('c', out)
if not self.compiled_tasks:
self.fatal('No source file for %r? this is unexpected' % self.name)