blob: 12954aa0b8203cde57bdc9cb9a6950928615a32f [file] [log] [blame]
Junxiao Shif7191242015-03-19 05:53:41 -07001# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
2top = '..'
3
Shock Jiang0f0bc4b2015-06-22 15:11:30 -07004from waflib import Options, Logs, Errors
5
6def options(opt):
7 for subdir in opt.path.ant_glob(['*'], dir=True, src=False):
8 opt.add_option('--enable-%s' % subdir,
9 help='Build tool %s, enabled by default' % subdir,
10 action="store_true",
11 dest='enable_%s' % subdir)
12
13 opt.add_option('--disable-%s' % subdir,
14 help='Do not build tool %s',
15 action="store_true",
16 dest='disable_%s' % subdir)
17
18 opt.recurse(str(subdir), mandatory=False)
19
20
Junxiao Shif7191242015-03-19 05:53:41 -070021def configure(conf):
Shock Jiang0f0bc4b2015-06-22 15:11:30 -070022 all_tools = set() # all available tools
23 enabled_tools = set() # --enable-X
24 disabled_tools = set() # --disable-X
25
Junxiao Shif7191242015-03-19 05:53:41 -070026 for subdir in conf.path.ant_glob(['*'], dir=True, src=False):
Shock Jiang0f0bc4b2015-06-22 15:11:30 -070027 tool = str(subdir)
28 all_tools.add(tool)
29
30 is_enabled = getattr(Options.options, 'enable_%s' % tool)
31 is_disabled = getattr(Options.options, 'disable_%s' % tool)
32
33 if is_enabled and is_disabled:
34 raise Errors.WafError("--enable-%s and --disable-%s cannot be both specified" % (tool, tool))
35
36 if is_enabled:
37 enabled_tools.add(tool)
38
39 if is_disabled:
40 disabled_tools.add(tool)
41
42 if len(enabled_tools) == 0:
43 conf.env['BUILD_TOOLS'] = list(all_tools - disabled_tools)
44 else:
45 conf.env['BUILD_TOOLS'] = list(enabled_tools)
46
47 for tool in conf.env['BUILD_TOOLS']:
48 conf.recurse(tool, mandatory=False)
49
50 conf.msg("Tools to build", ", ".join(conf.env['BUILD_TOOLS']))
Junxiao Shif7191242015-03-19 05:53:41 -070051
52def build(bld):
Shock Jiang0f0bc4b2015-06-22 15:11:30 -070053 for tool in bld.env['BUILD_TOOLS']:
54 bld.recurse(tool)