Browse Source

waf: use git_submodule tool through GIT_SUBMODULES variable

With this change, there's no need to verify if the submodule is initialized,
because the submodules in GIT_SUBMODULES are automatically initialized and
updated if necessary before the build tasks are performed.

One downside of this change is that Google Benchmark configuration is now done
only during build. However that is minor, since now there are easy ways to
separately build different targets and program groups, so that a fail in
benchmark build doesn't really affect the other targets.
master
Gustavo Jose de Sousa 9 years ago committed by Lucas De Marchi
parent
commit
8655fdfd7f
  1. 22
      Tools/ardupilotwaf/gbenchmark.py
  2. 8
      Tools/ardupilotwaf/gtest.py
  3. 8
      Tools/ardupilotwaf/mavgen.py
  4. 2
      wscript

22
Tools/ardupilotwaf/gbenchmark.py

@ -49,13 +49,6 @@ def configure(cfg):
) )
return return
cfg.start_msg('Checking for gbenchmark submodule')
cmake_lists = cfg.srcnode.find_resource('modules/gbenchmark/CMakeLists.txt')
if not cmake_lists:
cfg.end_msg('not initialized', color='YELLOW')
return
cfg.end_msg('yes')
cfg.find_program('cmake', mandatory=False) cfg.find_program('cmake', mandatory=False)
if not env.CMAKE: if not env.CMAKE:
@ -74,25 +67,18 @@ def configure(cfg):
bldnode = cfg.bldnode.make_node(cfg.variant) bldnode = cfg.bldnode.make_node(cfg.variant)
prefix_node = bldnode.make_node('gbenchmark') prefix_node = bldnode.make_node('gbenchmark')
my_build_node = bldnode.make_node('gbenchmark_build') my_build_node = bldnode.make_node('gbenchmark_build')
my_src_node = cfg.srcnode.find_dir('modules/gbenchmark') my_src_node = cfg.srcnode.make_node('modules/gbenchmark')
env.GBENCHMARK_PREFIX_REL = prefix_node.path_from(bldnode) env.GBENCHMARK_PREFIX_REL = prefix_node.path_from(bldnode)
env.GBENCHMARK_BUILD = my_build_node.abspath() env.GBENCHMARK_BUILD = my_build_node.abspath()
env.GBENCHMARK_BUILD_REL = my_build_node.path_from(bldnode) env.GBENCHMARK_BUILD_REL = my_build_node.path_from(bldnode)
env.GBENCHMARK_SRC = my_src_node.abspath() env.GBENCHMARK_SRC = my_src_node.abspath()
cfg.start_msg('Configuring gbenchmark')
try:
_configure_cmake(cfg, bldnode)
cfg.end_msg('done')
except:
cfg.end_msg('failed', color='YELLOW')
return
env.INCLUDES_GBENCHMARK = [prefix_node.make_node('include').abspath()] env.INCLUDES_GBENCHMARK = [prefix_node.make_node('include').abspath()]
env.LIBPATH_GBENCHMARK = [prefix_node.make_node('lib').abspath()] env.LIBPATH_GBENCHMARK = [prefix_node.make_node('lib').abspath()]
env.LIB_GBENCHMARK = ['benchmark'] env.LIB_GBENCHMARK = ['benchmark']
env.append_value('GIT_SUBMODULES', 'gbenchmark')
env.HAS_GBENCHMARK = True env.HAS_GBENCHMARK = True
class gbenchmark_build(Task.Task): class gbenchmark_build(Task.Task):
@ -116,10 +102,6 @@ class gbenchmark_build(Task.Task):
bld = self.generator.bld bld = self.generator.bld
cmds = [] cmds = []
cmake_lists = bld.srcnode.find_resource('modules/gbenchmark/CMakeLists.txt')
if not cmake_lists:
bld.fatal('Submodule gbenchmark not initialized, please run configure again')
try: try:
# Generate build system first, if necessary # Generate build system first, if necessary
my_build_node = bld.bldnode.find_dir(self.env.GBENCHMARK_BUILD_REL) my_build_node = bld.bldnode.find_dir(self.env.GBENCHMARK_BUILD_REL)

8
Tools/ardupilotwaf/gtest.py

@ -20,13 +20,7 @@ def configure(cfg):
) )
return return
cfg.start_msg('Checking for gtest submodule') cfg.env.append_value('GIT_SUBMODULES', 'gtest')
readme = cfg.srcnode.find_resource('modules/gtest/README')
if not readme:
cfg.end_msg('not initialized', color='YELLOW')
return
cfg.end_msg('yes')
cfg.env.HAS_GTEST = True cfg.env.HAS_GTEST = True
@conf @conf

8
Tools/ardupilotwaf/mavgen.py

@ -53,11 +53,5 @@ def configure(cfg):
env = cfg.env env = cfg.env
cfg.start_msg('Checking for mavgen') env.MAVLINK_DIR = cfg.srcnode.make_node('modules/mavlink/').abspath()
if not cfg.srcnode.find_resource('modules/mavlink/pymavlink/tools/mavgen.py'):
cfg.fatal('not found, please run: git submodule init && git submodule update')
return
cfg.end_msg('yes')
env.MAVLINK_DIR = cfg.srcnode.find_dir('modules/mavlink/').abspath()
env.MAVGEN = env.MAVLINK_DIR + '/pymavlink/tools/mavgen.py' env.MAVGEN = env.MAVLINK_DIR + '/pymavlink/tools/mavgen.py'

2
wscript

@ -97,6 +97,8 @@ def configure(cfg):
else: else:
cfg.end_msg('disabled', color='YELLOW') cfg.end_msg('disabled', color='YELLOW')
cfg.env.append_value('GIT_SUBMODULES', 'mavlink')
cfg.env.prepend_value('INCLUDES', [ cfg.env.prepend_value('INCLUDES', [
cfg.srcnode.abspath() + '/libraries/', cfg.srcnode.abspath() + '/libraries/',
]) ])

Loading…
Cancel
Save