src/visualizer/wscript
author Tom Henderson <tomh@tomh.org>
Mon, 28 Sep 2015 20:27:25 -0700
changeset 11676 05ea1489e509
parent 9287 cab2faac6f45
permissions -rw-r--r--
bug 2184: Integer overflow in MacLow
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6676
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
     1
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
9277
0f87d1cb030c Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents: 7712
diff changeset
     2
from waflib import Options
7297
e552e9840a14 Make ns3tcp, ns3wifi, and visualizer modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 6977
diff changeset
     3
7712
e22640804bf7 Bug 1355 - visualizer dependencies not detected at buildtime
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7494
diff changeset
     4
required_python_modules = [
e22640804bf7 Bug 1355 - visualizer dependencies not detected at buildtime
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7494
diff changeset
     5
    'gtk',
e22640804bf7 Bug 1355 - visualizer dependencies not detected at buildtime
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7494
diff changeset
     6
    'goocanvas',
e22640804bf7 Bug 1355 - visualizer dependencies not detected at buildtime
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7494
diff changeset
     7
    'pygraphviz',
e22640804bf7 Bug 1355 - visualizer dependencies not detected at buildtime
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7494
diff changeset
     8
    ]
e22640804bf7 Bug 1355 - visualizer dependencies not detected at buildtime
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7494
diff changeset
     9
7297
e552e9840a14 Make ns3tcp, ns3wifi, and visualizer modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 6977
diff changeset
    10
def configure(conf):
e552e9840a14 Make ns3tcp, ns3wifi, and visualizer modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 6977
diff changeset
    11
    # If Python was explicitly disabled, then add this module to the
e552e9840a14 Make ns3tcp, ns3wifi, and visualizer modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 6977
diff changeset
    12
    # list of modules that won't be built if they are enabled.
7712
e22640804bf7 Bug 1355 - visualizer dependencies not detected at buildtime
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7494
diff changeset
    13
    conf.env['ENABLE_PYVIZ'] = True
e22640804bf7 Bug 1355 - visualizer dependencies not detected at buildtime
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7494
diff changeset
    14
    if not conf.check_optional_feature("python"):
e22640804bf7 Bug 1355 - visualizer dependencies not detected at buildtime
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7494
diff changeset
    15
        conf.env['ENABLE_PYVIZ'] = False
e22640804bf7 Bug 1355 - visualizer dependencies not detected at buildtime
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7494
diff changeset
    16
        conf.report_optional_feature("PyViz", "PyViz visualizer",
e22640804bf7 Bug 1355 - visualizer dependencies not detected at buildtime
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7494
diff changeset
    17
                                     False,
e22640804bf7 Bug 1355 - visualizer dependencies not detected at buildtime
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7494
diff changeset
    18
                                     "Python Bindings are needed but not enabled")
7297
e552e9840a14 Make ns3tcp, ns3wifi, and visualizer modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 6977
diff changeset
    19
        conf.env['MODULES_NOT_BUILT'].append('visualizer')
7712
e22640804bf7 Bug 1355 - visualizer dependencies not detected at buildtime
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7494
diff changeset
    20
        return
e22640804bf7 Bug 1355 - visualizer dependencies not detected at buildtime
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7494
diff changeset
    21
e22640804bf7 Bug 1355 - visualizer dependencies not detected at buildtime
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7494
diff changeset
    22
    modules_missing = []
e22640804bf7 Bug 1355 - visualizer dependencies not detected at buildtime
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7494
diff changeset
    23
    for pymod in required_python_modules:
e22640804bf7 Bug 1355 - visualizer dependencies not detected at buildtime
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7494
diff changeset
    24
        try:
e22640804bf7 Bug 1355 - visualizer dependencies not detected at buildtime
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7494
diff changeset
    25
            conf.check_python_module(pymod)
e22640804bf7 Bug 1355 - visualizer dependencies not detected at buildtime
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7494
diff changeset
    26
        except conf.errors.ConfigurationError:
e22640804bf7 Bug 1355 - visualizer dependencies not detected at buildtime
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7494
diff changeset
    27
            modules_missing.append(pymod)
e22640804bf7 Bug 1355 - visualizer dependencies not detected at buildtime
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7494
diff changeset
    28
    if modules_missing:
e22640804bf7 Bug 1355 - visualizer dependencies not detected at buildtime
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7494
diff changeset
    29
        conf.report_optional_feature("PyViz", "PyViz visualizer",
e22640804bf7 Bug 1355 - visualizer dependencies not detected at buildtime
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7494
diff changeset
    30
                                     False, "Missing python modules: %s" % (', '.join(modules_missing),))
e22640804bf7 Bug 1355 - visualizer dependencies not detected at buildtime
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7494
diff changeset
    31
        conf.env['ENABLE_PYVIZ'] = False
e22640804bf7 Bug 1355 - visualizer dependencies not detected at buildtime
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7494
diff changeset
    32
        conf.env['MODULES_NOT_BUILT'].append('visualizer')
e22640804bf7 Bug 1355 - visualizer dependencies not detected at buildtime
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7494
diff changeset
    33
        return
e22640804bf7 Bug 1355 - visualizer dependencies not detected at buildtime
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7494
diff changeset
    34
e22640804bf7 Bug 1355 - visualizer dependencies not detected at buildtime
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7494
diff changeset
    35
    conf.report_optional_feature("PyViz", "PyViz visualizer", True, None)
e22640804bf7 Bug 1355 - visualizer dependencies not detected at buildtime
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7494
diff changeset
    36
6676
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    37
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    38
def build(bld):
7712
e22640804bf7 Bug 1355 - visualizer dependencies not detected at buildtime
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7494
diff changeset
    39
e22640804bf7 Bug 1355 - visualizer dependencies not detected at buildtime
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7494
diff changeset
    40
    module = bld.create_ns3_module('visualizer', ['internet', 'wifi', 'point-to-point'])
9277
0f87d1cb030c Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents: 7712
diff changeset
    41
    headers = bld(features='ns3header')
7712
e22640804bf7 Bug 1355 - visualizer dependencies not detected at buildtime
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7494
diff changeset
    42
    headers.module = 'visualizer'
e22640804bf7 Bug 1355 - visualizer dependencies not detected at buildtime
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7494
diff changeset
    43
e22640804bf7 Bug 1355 - visualizer dependencies not detected at buildtime
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7494
diff changeset
    44
    # Don't do anything more for this module if Python was explicitly
7297
e552e9840a14 Make ns3tcp, ns3wifi, and visualizer modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 6977
diff changeset
    45
    # disabled.
7712
e22640804bf7 Bug 1355 - visualizer dependencies not detected at buildtime
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7494
diff changeset
    46
    if not bld.env['ENABLE_PYVIZ']:
7297
e552e9840a14 Make ns3tcp, ns3wifi, and visualizer modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 6977
diff changeset
    47
        return
e552e9840a14 Make ns3tcp, ns3wifi, and visualizer modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 6977
diff changeset
    48
6676
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    49
7712
e22640804bf7 Bug 1355 - visualizer dependencies not detected at buildtime
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7494
diff changeset
    50
    headers.source = []
7297
e552e9840a14 Make ns3tcp, ns3wifi, and visualizer modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 6977
diff changeset
    51
e552e9840a14 Make ns3tcp, ns3wifi, and visualizer modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 6977
diff changeset
    52
    # XXX This file was added so that static builds would work on
e552e9840a14 Make ns3tcp, ns3wifi, and visualizer modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 6977
diff changeset
    53
    # Darwin, which doesn't like modules with no source files.  It
e552e9840a14 Make ns3tcp, ns3wifi, and visualizer modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 6977
diff changeset
    54
    # would have been better to add this module to the list
e552e9840a14 Make ns3tcp, ns3wifi, and visualizer modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 6977
diff changeset
    55
    # conf.env['MODULES_NOT_BUILT'] if Python bindings were not
e552e9840a14 Make ns3tcp, ns3wifi, and visualizer modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 6977
diff changeset
    56
    # enabled, but it's not possible for this module to determine in
e552e9840a14 Make ns3tcp, ns3wifi, and visualizer modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 6977
diff changeset
    57
    # its configure() function if Python bindings will be enabled
e552e9840a14 Make ns3tcp, ns3wifi, and visualizer modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 6977
diff changeset
    58
    # because that is done by the wscript file in bindings/python that
e552e9840a14 Make ns3tcp, ns3wifi, and visualizer modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 6977
diff changeset
    59
    # is parsed after this module's wscript file is parsed.
e552e9840a14 Make ns3tcp, ns3wifi, and visualizer modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 6977
diff changeset
    60
    module.source = [
e552e9840a14 Make ns3tcp, ns3wifi, and visualizer modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 6977
diff changeset
    61
        'model/dummy-file-for-static-builds.cc',
e552e9840a14 Make ns3tcp, ns3wifi, and visualizer modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 6977
diff changeset
    62
        ]
e552e9840a14 Make ns3tcp, ns3wifi, and visualizer modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 6977
diff changeset
    63
9277
0f87d1cb030c Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents: 7712
diff changeset
    64
    module.features += ' pyembed'
7494
d93f5e8e0a59 waf-1.6: Mac OSX and other fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7487
diff changeset
    65
    #module.env.append_value('CXXFLAGS', module.env['shlib_CXXFLAGS'])
d93f5e8e0a59 waf-1.6: Mac OSX and other fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7487
diff changeset
    66
    #module.includes = '.'
6676
8a57344a8d09 Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    67
7297
e552e9840a14 Make ns3tcp, ns3wifi, and visualizer modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 6977
diff changeset
    68
    module.source.extend([
e552e9840a14 Make ns3tcp, ns3wifi, and visualizer modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 6977
diff changeset
    69
        'model/pyviz.cc',
e552e9840a14 Make ns3tcp, ns3wifi, and visualizer modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 6977
diff changeset
    70
        'model/visual-simulator-impl.cc',
e552e9840a14 Make ns3tcp, ns3wifi, and visualizer modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 6977
diff changeset
    71
        ])
e552e9840a14 Make ns3tcp, ns3wifi, and visualizer modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents: 6977
diff changeset
    72
    headers.source.append('model/pyviz.h')
6977
0ae77a662277 Add visualizer modular python bindings
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6950
diff changeset
    73
9287
cab2faac6f45 Bug 1612 - pyviz (visualizer) will not be installed
Hajime Tazaki <tazaki@nict.go.jp>
parents: 9277
diff changeset
    74
    vissrc = [
cab2faac6f45 Bug 1612 - pyviz (visualizer) will not be installed
Hajime Tazaki <tazaki@nict.go.jp>
parents: 9277
diff changeset
    75
        'visualizer/base.py',
cab2faac6f45 Bug 1612 - pyviz (visualizer) will not be installed
Hajime Tazaki <tazaki@nict.go.jp>
parents: 9277
diff changeset
    76
        'visualizer/core.py',
cab2faac6f45 Bug 1612 - pyviz (visualizer) will not be installed
Hajime Tazaki <tazaki@nict.go.jp>
parents: 9277
diff changeset
    77
        'visualizer/higcontainer.py',
cab2faac6f45 Bug 1612 - pyviz (visualizer) will not be installed
Hajime Tazaki <tazaki@nict.go.jp>
parents: 9277
diff changeset
    78
        'visualizer/hud.py',
cab2faac6f45 Bug 1612 - pyviz (visualizer) will not be installed
Hajime Tazaki <tazaki@nict.go.jp>
parents: 9277
diff changeset
    79
        'visualizer/__init__.py',
cab2faac6f45 Bug 1612 - pyviz (visualizer) will not be installed
Hajime Tazaki <tazaki@nict.go.jp>
parents: 9277
diff changeset
    80
        'visualizer/svgitem.py',
cab2faac6f45 Bug 1612 - pyviz (visualizer) will not be installed
Hajime Tazaki <tazaki@nict.go.jp>
parents: 9277
diff changeset
    81
        ]
cab2faac6f45 Bug 1612 - pyviz (visualizer) will not be installed
Hajime Tazaki <tazaki@nict.go.jp>
parents: 9277
diff changeset
    82
    pyviz = bld(features='py')
cab2faac6f45 Bug 1612 - pyviz (visualizer) will not be installed
Hajime Tazaki <tazaki@nict.go.jp>
parents: 9277
diff changeset
    83
    pyviz.source = vissrc
cab2faac6f45 Bug 1612 - pyviz (visualizer) will not be installed
Hajime Tazaki <tazaki@nict.go.jp>
parents: 9277
diff changeset
    84
    pyviz.install_path = '${PYTHONARCHDIR}/visualizer'
cab2faac6f45 Bug 1612 - pyviz (visualizer) will not be installed
Hajime Tazaki <tazaki@nict.go.jp>
parents: 9277
diff changeset
    85
cab2faac6f45 Bug 1612 - pyviz (visualizer) will not be installed
Hajime Tazaki <tazaki@nict.go.jp>
parents: 9277
diff changeset
    86
    visplugin_src = [
cab2faac6f45 Bug 1612 - pyviz (visualizer) will not be installed
Hajime Tazaki <tazaki@nict.go.jp>
parents: 9277
diff changeset
    87
        'visualizer/plugins/interface_statistics.py',
cab2faac6f45 Bug 1612 - pyviz (visualizer) will not be installed
Hajime Tazaki <tazaki@nict.go.jp>
parents: 9277
diff changeset
    88
        'visualizer/plugins/ipv4_routing_table.py',
cab2faac6f45 Bug 1612 - pyviz (visualizer) will not be installed
Hajime Tazaki <tazaki@nict.go.jp>
parents: 9277
diff changeset
    89
        'visualizer/plugins/olsr.py',
cab2faac6f45 Bug 1612 - pyviz (visualizer) will not be installed
Hajime Tazaki <tazaki@nict.go.jp>
parents: 9277
diff changeset
    90
        'visualizer/plugins/show_last_packets.py',
cab2faac6f45 Bug 1612 - pyviz (visualizer) will not be installed
Hajime Tazaki <tazaki@nict.go.jp>
parents: 9277
diff changeset
    91
        'visualizer/plugins/wifi_intrastructure_link.py'
cab2faac6f45 Bug 1612 - pyviz (visualizer) will not be installed
Hajime Tazaki <tazaki@nict.go.jp>
parents: 9277
diff changeset
    92
        ]
cab2faac6f45 Bug 1612 - pyviz (visualizer) will not be installed
Hajime Tazaki <tazaki@nict.go.jp>
parents: 9277
diff changeset
    93
    pyvizplug = bld(features='py')
cab2faac6f45 Bug 1612 - pyviz (visualizer) will not be installed
Hajime Tazaki <tazaki@nict.go.jp>
parents: 9277
diff changeset
    94
    pyvizplug.source = visplugin_src
cab2faac6f45 Bug 1612 - pyviz (visualizer) will not be installed
Hajime Tazaki <tazaki@nict.go.jp>
parents: 9277
diff changeset
    95
    pyvizplug.install_path = '${PYTHONARCHDIR}/visualizer/plugins'
cab2faac6f45 Bug 1612 - pyviz (visualizer) will not be installed
Hajime Tazaki <tazaki@nict.go.jp>
parents: 9277
diff changeset
    96
6977
0ae77a662277 Add visualizer modular python bindings
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6950
diff changeset
    97
    bld.ns3_python_bindings()