blob: 7859de3fd41e1dc1afcad50d941508baa5de04ca [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
Davide Pesavento28ae2cb2016-01-14 22:30:39 +01004from waflib import Options, Errors
Shock Jiang0f0bc4b2015-06-22 15:11:30 -07005
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,
Davide Pesavento28ae2cb2016-01-14 22:30:39 +010010 action='store_true',
Shock Jiang0f0bc4b2015-06-22 15:11:30 -070011 dest='enable_%s' % subdir)
12
13 opt.add_option('--disable-%s' % subdir,
Davide Pesavento28ae2cb2016-01-14 22:30:39 +010014 help='Do not build tool %s' % subdir,
15 action='store_true',
Shock Jiang0f0bc4b2015-06-22 15:11:30 -070016 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
Alexander Afanasyev1b05b0a2017-01-08 11:42:45 -080026 Options.options.disable_pib = True
27
Junxiao Shif7191242015-03-19 05:53:41 -070028 for subdir in conf.path.ant_glob(['*'], dir=True, src=False):
Shock Jiang0f0bc4b2015-06-22 15:11:30 -070029 tool = str(subdir)
30 all_tools.add(tool)
31
32 is_enabled = getattr(Options.options, 'enable_%s' % tool)
33 is_disabled = getattr(Options.options, 'disable_%s' % tool)
34
35 if is_enabled and is_disabled:
36 raise Errors.WafError("--enable-%s and --disable-%s cannot be both specified" % (tool, tool))
37
38 if is_enabled:
39 enabled_tools.add(tool)
40
41 if is_disabled:
42 disabled_tools.add(tool)
43
44 if len(enabled_tools) == 0:
45 conf.env['BUILD_TOOLS'] = list(all_tools - disabled_tools)
46 else:
47 conf.env['BUILD_TOOLS'] = list(enabled_tools)
48
49 for tool in conf.env['BUILD_TOOLS']:
50 conf.recurse(tool, mandatory=False)
51
52 conf.msg("Tools to build", ", ".join(conf.env['BUILD_TOOLS']))
Junxiao Shif7191242015-03-19 05:53:41 -070053
54def build(bld):
Shock Jiang0f0bc4b2015-06-22 15:11:30 -070055 for tool in bld.env['BUILD_TOOLS']:
56 bld.recurse(tool)