2010-12-06 17:26:06 +00:00
|
|
|
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
|
2011-06-01 17:01:55 -07:00
|
|
|
import Options
|
|
|
|
|
|
2012-02-14 18:44:16 +00:00
|
|
|
required_python_modules = [
|
|
|
|
|
'gtk',
|
|
|
|
|
'goocanvas',
|
|
|
|
|
'pygraphviz',
|
|
|
|
|
]
|
|
|
|
|
|
2011-06-01 17:01:55 -07:00
|
|
|
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.
|
2012-02-14 18:44:16 +00:00
|
|
|
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")
|
2011-06-01 17:01:55 -07:00
|
|
|
conf.env['MODULES_NOT_BUILT'].append('visualizer')
|
2012-02-14 18:44:16 +00:00
|
|
|
return
|
2010-12-06 17:26:06 +00:00
|
|
|
|
2012-02-14 18:44:16 +00:00
|
|
|
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')
|
2011-06-01 17:01:55 -07:00
|
|
|
return
|
|
|
|
|
|
2012-02-14 18:44:16 +00:00
|
|
|
conf.report_optional_feature("PyViz", "PyViz visualizer", True, None)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def build(bld):
|
|
|
|
|
|
|
|
|
|
module = bld.create_ns3_module('visualizer', ['internet', 'wifi', 'point-to-point'])
|
2011-09-08 16:13:40 +01:00
|
|
|
headers = bld.new_task_gen(features=['ns3header'])
|
2010-12-06 17:26:06 +00:00
|
|
|
headers.module = 'visualizer'
|
|
|
|
|
|
2012-02-14 18:44:16 +00:00
|
|
|
# Don't do anything more for this module if Python was explicitly
|
|
|
|
|
# disabled.
|
|
|
|
|
if not bld.env['ENABLE_PYVIZ']:
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
headers.source = []
|
2011-06-01 17:01:55 -07:00
|
|
|
|
|
|
|
|
# XXX This file was added so that static builds would work on
|
|
|
|
|
# Darwin, which doesn't like modules with no source files. It
|
|
|
|
|
# would have been better to add this module to the list
|
|
|
|
|
# conf.env['MODULES_NOT_BUILT'] if Python bindings were not
|
|
|
|
|
# enabled, but it's not possible for this module to determine in
|
|
|
|
|
# its configure() function if Python bindings will be enabled
|
|
|
|
|
# because that is done by the wscript file in bindings/python that
|
|
|
|
|
# is parsed after this module's wscript file is parsed.
|
|
|
|
|
module.source = [
|
|
|
|
|
'model/dummy-file-for-static-builds.cc',
|
|
|
|
|
]
|
|
|
|
|
|
2010-12-06 17:26:06 +00:00
|
|
|
module.features.append('pyembed')
|
2011-09-13 13:47:17 +01:00
|
|
|
#module.env.append_value('CXXFLAGS', module.env['shlib_CXXFLAGS'])
|
|
|
|
|
#module.includes = '.'
|
2010-12-06 17:26:06 +00:00
|
|
|
|
2011-06-01 17:01:55 -07:00
|
|
|
module.source.extend([
|
|
|
|
|
'model/pyviz.cc',
|
|
|
|
|
'model/visual-simulator-impl.cc',
|
|
|
|
|
])
|
|
|
|
|
headers.source.append('model/pyviz.h')
|
2011-03-30 11:12:13 +01:00
|
|
|
|
|
|
|
|
bld.ns3_python_bindings()
|