Junxiao Shi | f719124 | 2015-03-19 05:53:41 -0700 | [diff] [blame] | 1 | # -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- |
| 2 | top = '..' |
| 3 | |
Alexander Afanasyev | 20c85cb | 2018-03-09 17:50:14 -0500 | [diff] [blame^] | 4 | from waflib import Options |
Shock Jiang | 0f0bc4b | 2015-06-22 15:11:30 -0700 | [diff] [blame] | 5 | |
| 6 | def options(opt): |
| 7 | for subdir in opt.path.ant_glob(['*'], dir=True, src=False): |
Davide Pesavento | 1aa9143 | 2018-02-19 22:43:31 -0500 | [diff] [blame] | 8 | tool = subdir.path_from(opt.path) |
| 9 | opt.add_option('--enable-%s' % tool, |
| 10 | help='Build tool %s, enabled by default' % tool, |
| 11 | action='store_true', dest='enable_%s' % tool) |
| 12 | opt.add_option('--disable-%s' % tool, |
| 13 | help='Do not build tool %s' % tool, |
| 14 | action='store_true', dest='disable_%s' % tool) |
| 15 | opt.recurse(str(tool), mandatory=False) |
Shock Jiang | 0f0bc4b | 2015-06-22 15:11:30 -0700 | [diff] [blame] | 16 | |
Junxiao Shi | f719124 | 2015-03-19 05:53:41 -0700 | [diff] [blame] | 17 | def configure(conf): |
Shock Jiang | 0f0bc4b | 2015-06-22 15:11:30 -0700 | [diff] [blame] | 18 | all_tools = set() # all available tools |
| 19 | enabled_tools = set() # --enable-X |
| 20 | disabled_tools = set() # --disable-X |
| 21 | |
Alexander Afanasyev | 1b05b0a | 2017-01-08 11:42:45 -0800 | [diff] [blame] | 22 | Options.options.disable_pib = True |
| 23 | |
Alexander Afanasyev | 20c85cb | 2018-03-09 17:50:14 -0500 | [diff] [blame^] | 24 | for subdir in conf.path.ant_glob('*', dir=True, src=False): |
| 25 | tool = subdir.path_from(conf.path) |
Shock Jiang | 0f0bc4b | 2015-06-22 15:11:30 -0700 | [diff] [blame] | 26 | all_tools.add(tool) |
| 27 | |
| 28 | is_enabled = getattr(Options.options, 'enable_%s' % tool) |
| 29 | is_disabled = getattr(Options.options, 'disable_%s' % tool) |
| 30 | |
| 31 | if is_enabled and is_disabled: |
Alexander Afanasyev | 20c85cb | 2018-03-09 17:50:14 -0500 | [diff] [blame^] | 32 | conf.fatal("--enable-%s and --disable-%s cannot be both specified" % (tool, tool)) |
Shock Jiang | 0f0bc4b | 2015-06-22 15:11:30 -0700 | [diff] [blame] | 33 | |
| 34 | if is_enabled: |
| 35 | enabled_tools.add(tool) |
| 36 | |
| 37 | if is_disabled: |
| 38 | disabled_tools.add(tool) |
| 39 | |
| 40 | if len(enabled_tools) == 0: |
| 41 | conf.env['BUILD_TOOLS'] = list(all_tools - disabled_tools) |
| 42 | else: |
| 43 | conf.env['BUILD_TOOLS'] = list(enabled_tools) |
| 44 | |
| 45 | for tool in conf.env['BUILD_TOOLS']: |
| 46 | conf.recurse(tool, mandatory=False) |
| 47 | |
Junxiao Shi | f719124 | 2015-03-19 05:53:41 -0700 | [diff] [blame] | 48 | def build(bld): |
Shock Jiang | 0f0bc4b | 2015-06-22 15:11:30 -0700 | [diff] [blame] | 49 | for tool in bld.env['BUILD_TOOLS']: |
| 50 | bld.recurse(tool) |