diff --git a/demos/vala/shlib/wscript_build b/demos/vala/shlib/wscript_build index 3d6f7395..fa1a61e6 100644 --- a/demos/vala/shlib/wscript_build +++ b/demos/vala/shlib/wscript_build @@ -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)