## -*- 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. 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): 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 not bld.env['ENABLE_PYVIZ']: return 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 # 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', ] module.features.append('pyembed') #module.env.append_value('CXXFLAGS', module.env['shlib_CXXFLAGS']) #module.includes = '.' module.source.extend([ 'model/pyviz.cc', 'model/visual-simulator-impl.cc', ]) headers.source.append('model/pyviz.h') bld.ns3_python_bindings()