mirror of
https://gitlab.com/ita1024/waf.git
synced 2024-11-22 01:46:15 +01:00
Show how to re-use the outputs from a task generator into another - vala
This commit is contained in:
parent
8f4df2085c
commit
9d37801661
@ -12,3 +12,29 @@ bld.shlib(
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user