From 264c3e2d282b98fb128e5c81317cf2488f12b194 Mon Sep 17 00:00:00 2001 From: Gustavo Jose de Sousa Date: Fri, 5 Feb 2016 12:28:11 +0000 Subject: [PATCH] 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. --- wscript | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/wscript b/wscript index e252ab03fc..c78a0c854e 100644 --- a/wscript +++ b/wscript @@ -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',