One more stop to fixing --enable-modules

This commit is contained in:
Gustavo J. A. M. Carneiro
2010-10-25 22:21:50 +01:00
parent 72689da5c2
commit f99cbd7ebc

26
wscript
View File

@@ -549,24 +549,44 @@ def build(bld):
env['NS3_ENABLED_MODULES'] = modules
print "Modules to build:", modules
def exclude_task(bld, task):
# ok, so WAF does not provide an API to prevent an
# arbitrary task from running; we have to muck around with
# WAF internal state, something that might stop working if
# WAF is upgraded...
bld.all_task_gen.remove(task)
for group in bld.task_manager.groups:
try:
group.tasks_gen.remove(task)
except ValueError:
pass
else:
break
# Exclude the programs other misc task gens that depend on disabled modules
for obj in list(bld.all_task_gen):
# check for ns3moduleheader_taskgen
if type(obj).__name__ == 'ns3moduleheader_taskgen':
if ("ns3-%s" % obj.module) not in modules:
bld.all_task_gen.remove(obj)
exclude_task(bld, obj)
# check for programs
if hasattr(obj, 'ns3_module_dependencies'):
# this is an NS-3 program (bld.create_ns3_program)
for dep in obj.ns3_module_dependencies:
if dep not in modules: # prog. depends on a module that isn't enabled?
bld.all_task_gen.remove(obj)
exclude_task(bld, obj)
break
# disable the modules themselves
if hasattr(obj, "is_ns3_module") and obj.name not in modules:
bld.all_task_gen.remove(obj)
exclude_task(bld, obj)
# disable the ns3header_taskgen
if type(obj).__name__ == 'ns3header_taskgen':
if ("ns3-%s" % obj.module) not in modules:
exclude_task(bld, obj)
## Create a single ns3 library containing all enabled modules
if env['ENABLE_STATIC_NS3']: