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

playground/c: update bld methods. Use write_config_header for variants so

cleanall doesn't delete them.
This commit is contained in:
Shawn Hoover 2015-09-30 23:34:08 -04:00
parent c6f98f80db
commit b0b773335c

View File

@ -26,13 +26,9 @@ def configure(conf):
conf.check_cc(fragment="""#include<stdio.h>\nint main(){fprintf(stderr, "mu"); printf("%d", 22);return 0;}\n""", execute=True, define_name='HAVE_MU') conf.check_cc(fragment="""#include<stdio.h>\nint main(){fprintf(stderr, "mu"); printf("%d", 22);return 0;}\n""", execute=True, define_name='HAVE_MU')
conf.write_config_header('config.h') conf.write_config_header('config.h')
# gotcha - the config.h must be written for each variant # gotcha - the config.h must be written for each variant
txt = conf.bldnode.search_node('config.h').read()
for x in lst: for x in lst:
node = conf.bldnode.make_node(x + '/config.h') conf.write_config_header(x + '/config.h')
node.parent.mkdir()
node.write(txt)
from waflib import Utils, Build from waflib import Utils, Build
class buildall_ctx(Build.BuildContext): class buildall_ctx(Build.BuildContext):
@ -50,7 +46,7 @@ def buildall(ctx):
class sub_build(Utils.threading.Thread): class sub_build(Utils.threading.Thread):
def run(self): def run(self):
bld = self.bld = self.cls(top_dir=ctx.top_dir, out_dir=ctx.out_dir) bld = self.bld = self.cls(top_dir=ctx.top_dir, out_dir=ctx.out_dir)
bld.load() bld.restore()
bld.siblings = threads bld.siblings = threads
bld.count = count bld.count = count
bld.line_lock = line_lock bld.line_lock = line_lock
@ -96,13 +92,13 @@ def cleanall(ctx):
for x in lst: for x in lst:
cls = type(Build.CleanContext)(x, (Build.CleanContext,), {'cmd': x, 'variant': x}) cls = type(Build.CleanContext)(x, (Build.CleanContext,), {'cmd': x, 'variant': x})
bld = cls(top_dir=ctx.top_dir, out_dir=ctx.out_dir) bld = cls(top_dir=ctx.top_dir, out_dir=ctx.out_dir)
bld.load() bld.restore()
bld.load_envs() bld.load_envs()
bld.recurse([bld.run_dir]) bld.recurse([bld.run_dir])
try: try:
bld.clean() bld.clean()
finally: finally:
bld.save() bld.store()
# produces dict/json compatible output # produces dict/json compatible output