waf: prepare for using git_submodule tool

We define three build groups and set post_mode as POST_LAZY, which makes one
group be posted only after the previous one. That enables us to correctly
define dynamic sources with submodules and generators that may or may not
depend on submodules (e.g. mavgen - this one depends on mavlink submodule).

The groups are defined below, in that order:
 1. git_submodules: contains taskgens that initialize and update submodules.
 2. dynamic_sources: contains taskgens that generate sources used by the build.
 3. build: contains the normal taskgens.
This commit is contained in:
Gustavo Jose de Sousa 2016-02-05 12:28:11 +00:00 committed by Lucas De Marchi
parent 1a17d63114
commit 264c3e2d28
1 changed files with 16 additions and 2 deletions

18
wscript
View File

@ -80,6 +80,7 @@ def configure(cfg):
cfg.load('clang_compilation_database')
cfg.load('waf_unit_test')
cfg.load('mavgen')
cfg.load('git_submodule')
cfg.load('gbenchmark')
cfg.load('gtest')
cfg.load('static_linking')
@ -128,7 +129,7 @@ def _build_cmd_tweaks(bld):
bld.fatal('check: gtest library is required')
bld.add_post_fun(ardupilotwaf.test_summary)
def _create_common_taskgens(bld):
def _build_dynamic_sources(bld):
bld(
features='mavgen',
source='modules/mavlink/message_definitions/v1.0/ardupilotmega.xml',
@ -142,6 +143,7 @@ def _create_common_taskgens(bld):
],
)
def _build_common_taskgens(bld):
# NOTE: Static library with vehicle set to UNKNOWN, shared by all
# the tools and examples. This is the first step until the
# dependency on the vehicles is reduced. Later we may consider
@ -198,11 +200,23 @@ def _build_recursion(bld):
bld.recurse(d)
def build(bld):
bld.post_mode = Build.POST_LAZY
bld.load('ardupilotwaf')
bld.load('gtest')
_build_cmd_tweaks(bld)
_create_common_taskgens(bld)
bld.add_group('git_submodules')
for name in bld.env.GIT_SUBMODULES:
bld.git_submodule(name)
bld.add_group('dynamic_sources')
_build_dynamic_sources(bld)
bld.add_group('build')
_build_common_taskgens(bld)
_build_recursion(bld)
ardupilotwaf.build_command('check',