--- a/examples/tcp/wscript Tue Feb 14 17:57:15 2012 +0000
+++ b/examples/tcp/wscript Tue Feb 14 18:44:16 2012 +0000
@@ -2,7 +2,7 @@
def build(bld):
obj = bld.create_ns3_program('tcp-large-transfer',
- ['point-to-point', 'applications', 'internet'])
+ ['visualizer', 'point-to-point', 'applications', 'internet'])
obj.source = 'tcp-large-transfer.cc'
obj = bld.create_ns3_program('tcp-nsc-lfn',
--- a/src/visualizer/wscript Tue Feb 14 17:57:15 2012 +0000
+++ b/src/visualizer/wscript Tue Feb 14 18:44:16 2012 +0000
@@ -1,24 +1,53 @@
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
import Options
+required_python_modules = [
+ 'gtk',
+ 'goocanvas',
+ 'pygraphviz',
+ ]
+
def configure(conf):
# If Python was explicitly disabled, then add this module to the
# list of modules that won't be built if they are enabled.
- if Options.options.python_disable:
+ conf.env['ENABLE_PYVIZ'] = True
+ if not conf.check_optional_feature("python"):
+ conf.env['ENABLE_PYVIZ'] = False
+ conf.report_optional_feature("PyViz", "PyViz visualizer",
+ False,
+ "Python Bindings are needed but not enabled")
conf.env['MODULES_NOT_BUILT'].append('visualizer')
+ return
+
+ modules_missing = []
+ for pymod in required_python_modules:
+ try:
+ conf.check_python_module(pymod)
+ except conf.errors.ConfigurationError:
+ modules_missing.append(pymod)
+ if modules_missing:
+ conf.report_optional_feature("PyViz", "PyViz visualizer",
+ False, "Missing python modules: %s" % (', '.join(modules_missing),))
+ conf.env['ENABLE_PYVIZ'] = False
+ conf.env['MODULES_NOT_BUILT'].append('visualizer')
+ return
+
+ conf.report_optional_feature("PyViz", "PyViz visualizer", True, None)
+
def build(bld):
- # Don't do anything for this module if Python was explicitly
+
+ module = bld.create_ns3_module('visualizer', ['internet', 'wifi', 'point-to-point'])
+ headers = bld.new_task_gen(features=['ns3header'])
+ headers.module = 'visualizer'
+
+ # Don't do anything more for this module if Python was explicitly
# disabled.
- if 'visualizer' in bld.env['MODULES_NOT_BUILT']:
+ if not bld.env['ENABLE_PYVIZ']:
return
- headers = bld.new_task_gen(features=['ns3header'])
- headers.module = 'visualizer'
- headers.source = [
- ]
- module = bld.create_ns3_module('visualizer', ['internet', 'wifi', 'point-to-point'])
+ headers.source = []
# XXX This file was added so that static builds would work on
# Darwin, which doesn't like modules with no source files. It
@@ -32,9 +61,6 @@
'model/dummy-file-for-static-builds.cc',
]
- if not bld.env['ENABLE_PYTHON_BINDINGS']:
- return
-
module.features.append('pyembed')
#module.env.append_value('CXXFLAGS', module.env['shlib_CXXFLAGS'])
#module.includes = '.'
--- a/wscript Tue Feb 14 17:57:15 2012 +0000
+++ b/wscript Tue Feb 14 18:44:16 2012 +0000
@@ -270,6 +270,11 @@
def report_optional_feature(conf, name, caption, was_enabled, reason_not_enabled):
conf.env.append_value('NS3_OPTIONAL_FEATURES', [(name, caption, was_enabled, reason_not_enabled)])
+def check_optional_feature(conf, name):
+ for (name1, caption, was_enabled, reason_not_enabled) in conf.env.NS3_OPTIONAL_FEATURES:
+ if name1 == name:
+ return was_enabled
+ raise KeyError("Feature %r not declared yet" % (name,))
# starting with waf 1.6, conf.check() becomes fatal by default if the
# test fails, this alternative method makes the test non-fatal, as it
@@ -287,6 +292,7 @@
conf.check_nonfatal = types.MethodType(_check_nonfatal, conf)
conf.check_compilation_flag = types.MethodType(_check_compilation_flag, conf)
conf.report_optional_feature = types.MethodType(report_optional_feature, conf)
+ conf.check_optional_feature = types.MethodType(check_optional_feature, conf)
conf.env['NS3_OPTIONAL_FEATURES'] = []
conf.check_tool('compiler_c')
@@ -364,6 +370,8 @@
conf.env['MODULES_NOT_BUILT'] = []
+ conf.sub_config('bindings/python')
+
conf.sub_config('src')
# Set the list of enabled modules.
@@ -396,8 +404,6 @@
if not conf.env['NS3_ENABLED_MODULES']:
raise WafError('Exiting because the ' + not_built + ' module can not be built and it was the only one enabled.')
- conf.sub_config('bindings/python')
-
conf.sub_config('src/mpi')
# for suid bits