Write a status file during waf build step
This commit is contained in:
@@ -32,3 +32,5 @@ def build(bld):
|
||||
obj = bld.create_ns3_program('simple-routing-ping6',
|
||||
['csma', 'internet'])
|
||||
obj.source = 'simple-routing-ping6.cc'
|
||||
|
||||
bld.register_ns3_script('simple-routing-ping.py', ['csma', 'internet'])
|
||||
|
||||
@@ -6,6 +6,8 @@ def build(bld):
|
||||
|
||||
obj = bld.create_ns3_program('first', ['core', 'point-to-point', 'internet', 'applications'])
|
||||
obj.source = 'first.cc'
|
||||
|
||||
bld.register_ns3_script('first.py', ['core', 'point-to-point', 'internet', 'applications'])
|
||||
|
||||
obj = bld.create_ns3_program('second', ['core', 'point-to-point', 'csma', 'internet', 'applications'])
|
||||
obj.source = 'second.cc'
|
||||
|
||||
@@ -5,6 +5,9 @@ def build(bld):
|
||||
'internet', 'csma', 'olsr'])
|
||||
obj.source = 'mixed-wireless.cc'
|
||||
|
||||
bld.register_ns3_script('mixed-wireless.py', ['core', 'mobility', 'wifi', 'applications', 'point-to-point',
|
||||
'internet', 'csma', 'olsr'])
|
||||
|
||||
obj = bld.create_ns3_program('wifi-adhoc', ['core', 'mobility', 'wifi', 'applications', 'tools'])
|
||||
obj.source = 'wifi-adhoc.cc'
|
||||
|
||||
@@ -14,6 +17,8 @@ def build(bld):
|
||||
obj = bld.create_ns3_program('wifi-ap', ['core', 'mobility', 'wifi', 'applications', 'config-store', 'tools'])
|
||||
obj.source = 'wifi-ap.cc'
|
||||
|
||||
bld.register_ns3_script('wifi-ap.py', ['core', 'mobility', 'wifi', 'applications', 'config-store', 'tools'])
|
||||
|
||||
obj = bld.create_ns3_program('wifi-wired-bridging', ['internet', 'mobility', 'wifi', 'csma', 'bridge', 'applications'])
|
||||
obj.source = 'wifi-wired-bridging.cc'
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@ def build(bld):
|
||||
obj = bld.create_ns3_program('csma-bridge', ['bridge', 'csma', 'internet'])
|
||||
obj.source = 'csma-bridge.cc'
|
||||
|
||||
bld.register_ns3_script('csma-bridge.py', ['bridge', 'csma', 'internet'])
|
||||
|
||||
obj = bld.create_ns3_program('csma-bridge-one-hop', ['bridge', 'csma', 'internet'])
|
||||
obj.source = 'csma-bridge-one-hop.cc'
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@ def build(bld):
|
||||
obj = bld.create_ns3_program('sample-simulator', ['core'])
|
||||
obj.source = 'sample-simulator.cc'
|
||||
|
||||
bld.register_ns3_script('sample-simulator.py', ['core'])
|
||||
|
||||
obj = bld.create_ns3_program('main-ptr', ['core'] )
|
||||
obj.source = 'main-ptr.cc'
|
||||
|
||||
|
||||
4
src/flow-monitor/examples/wscript
Normal file
4
src/flow-monitor/examples/wscript
Normal file
@@ -0,0 +1,4 @@
|
||||
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
|
||||
|
||||
def build(bld):
|
||||
bld.register_ns3_script('wifi-olsr-flowmon.py', ['flow-monitor', 'internet', 'tools', 'config-store', 'wifi', 'olsr', 'applications', 'mobility'])
|
||||
@@ -29,4 +29,7 @@ def build(bld):
|
||||
]]
|
||||
headers.source.append("helper/flow-monitor-helper.h")
|
||||
|
||||
if bld.env['ENABLE_EXAMPLES']:
|
||||
bld.add_subdirs('examples')
|
||||
|
||||
bld.ns3_python_bindings()
|
||||
|
||||
@@ -7,7 +7,9 @@ def build(bld):
|
||||
obj.source = 'tap-csma.cc'
|
||||
obj = bld.create_ns3_program('tap-csma-virtual-machine', ['csma', 'tap-bridge', 'internet'])
|
||||
obj.source = 'tap-csma-virtual-machine.cc'
|
||||
bld.register_ns3_script('tap-csma-virtual-machine.py', ['csma', 'tap-bridge', 'internet'])
|
||||
obj = bld.create_ns3_program('tap-wifi-virtual-machine', ['csma', 'tap-bridge', 'internet', 'wifi', 'mobility'])
|
||||
obj.source = 'tap-wifi-virtual-machine.cc'
|
||||
bld.register_ns3_script('tap-wifi-virtual-machine.py', ['csma', 'tap-bridge', 'internet', 'wifi', 'mobility'])
|
||||
obj = bld.create_ns3_program('tap-wifi-dumbbell', ['wifi', 'csma', 'point-to-point', 'tap-bridge', 'internet'])
|
||||
obj.source = 'tap-wifi-dumbbell.cc'
|
||||
|
||||
41
wscript
41
wscript
@@ -532,6 +532,10 @@ def create_ns3_program(bld, name, dependencies=('core',)):
|
||||
program.env.append_value('LINKFLAGS', '-Wl,-Bdynamic,--no-whole-archive')
|
||||
return program
|
||||
|
||||
def register_ns3_script(bld, name, dependencies=('core',)):
|
||||
ns3_module_dependencies = ['ns3-'+dep for dep in dependencies]
|
||||
bld.env.append_value('NS3_SCRIPT_DEPENDENCIES', (name, ns3_module_dependencies))
|
||||
|
||||
def add_examples_programs(bld):
|
||||
env = bld.env_of_name('default')
|
||||
if env['ENABLE_EXAMPLES']:
|
||||
@@ -565,6 +569,9 @@ def add_scratch_programs(bld):
|
||||
def build(bld):
|
||||
bld.env['NS3_MODULES_WITH_TEST_LIBRARIES'] = []
|
||||
bld.env['NS3_ENABLED_MODULE_TEST_LIBRARIES'] = []
|
||||
bld.env['NS3_SCRIPT_DEPENDENCIES'] = []
|
||||
bld.env['NS3_RUNNABLE_PROGRAMS'] = []
|
||||
bld.env['NS3_RUNNABLE_SCRIPTS'] = []
|
||||
|
||||
wutils.bld = bld
|
||||
if Options.options.no_task_lines:
|
||||
@@ -575,6 +582,7 @@ def build(bld):
|
||||
|
||||
Options.cwd_launch = bld.path.abspath()
|
||||
bld.create_ns3_program = types.MethodType(create_ns3_program, bld)
|
||||
bld.register_ns3_script = types.MethodType(register_ns3_script, bld)
|
||||
bld.create_suid_program = types.MethodType(create_suid_program, bld)
|
||||
|
||||
# switch default variant to the one matching our debug level
|
||||
@@ -663,11 +671,18 @@ def build(bld):
|
||||
# check for programs
|
||||
if hasattr(obj, 'ns3_module_dependencies'):
|
||||
# this is an NS-3 program (bld.create_ns3_program)
|
||||
program_built = True
|
||||
for dep in obj.ns3_module_dependencies:
|
||||
if dep not in modules: # prog. depends on a module that isn't enabled?
|
||||
exclude_taskgen(bld, obj)
|
||||
program_built = False
|
||||
break
|
||||
|
||||
# Add this program to the list if all of its
|
||||
# dependencies will be built.
|
||||
if program_built:
|
||||
bld.env.append_value('NS3_RUNNABLE_PROGRAMS', obj.name)
|
||||
|
||||
# disable the modules themselves
|
||||
if hasattr(obj, "is_ns3_module") and obj.name not in modules:
|
||||
exclude_taskgen(bld, obj) # kill the module
|
||||
@@ -685,6 +700,19 @@ def build(bld):
|
||||
if env['NS3_ENABLED_MODULES']:
|
||||
env['NS3_ENABLED_MODULES'] = list(modules)
|
||||
|
||||
# Determine which scripts will be runnable.
|
||||
for (script, dependencies) in bld.env['NS3_SCRIPT_DEPENDENCIES']:
|
||||
script_runnable = True
|
||||
for dep in dependencies:
|
||||
if dep not in modules:
|
||||
script_runnable = False
|
||||
break
|
||||
|
||||
# Add this script to the list if all of its dependencies will
|
||||
# be built.
|
||||
if script_runnable:
|
||||
bld.env.append_value('NS3_RUNNABLE_SCRIPTS', script)
|
||||
|
||||
bld.add_subdirs('bindings/python')
|
||||
|
||||
if Options.options.run:
|
||||
@@ -719,6 +747,19 @@ def shutdown(ctx):
|
||||
print textwrap.fill(', '.join(modules_without_prefix))
|
||||
print
|
||||
|
||||
# Write the build status file.
|
||||
build_status_file = os.path.join (env['NS3_BUILDDIR'], env['NS3_ACTIVE_VARIANT'], 'build-status.py')
|
||||
out = open(build_status_file, 'w')
|
||||
out.write('#! /usr/bin/env python\n')
|
||||
out.write('\n')
|
||||
out.write('# Programs that are runnable.\n')
|
||||
out.write('NS3_RUNNABLE_PROGRAMS = ' + str(env['NS3_RUNNABLE_PROGRAMS']) + '\n')
|
||||
out.write('\n')
|
||||
out.write('# Scripts that are runnable.\n')
|
||||
out.write('NS3_RUNNABLE_SCRIPTS = ' + str(env['NS3_RUNNABLE_SCRIPTS']) + '\n')
|
||||
out.write('\n')
|
||||
out.close()
|
||||
|
||||
if Options.options.lcov_report:
|
||||
lcov_report()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user