src/simulator/wscript
author Craig Dowell <craigdo@ee.washington.edu>
Tue, 26 Aug 2008 15:34:57 -0700
changeset 3560 5aa65b1ea001
parent 3470 21022872009d
child 3646 2b2f692044d8
child 3648 f912b24ddf2d
permissions -rw-r--r--
add realtime simulator and associated tests
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
537
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
     1
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
     2
import sys
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
     3
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
     4
import Params
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
     5
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
     6
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
     7
def set_options(opt):
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
     8
    opt.add_option('--high-precision-as-double',
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
     9
                   help=('Whether to use a double floating point'
788
72ea95517a13 WAF: add a warning to the --high-precision-as-double option help text saying they it works in configure.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 770
diff changeset
    10
                         ' type for high precision time values'
72ea95517a13 WAF: add a warning to the --high-precision-as-double option help text saying they it works in configure.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 770
diff changeset
    11
                         ' WARNING: this option only has effect '
72ea95517a13 WAF: add a warning to the --high-precision-as-double option help text saying they it works in configure.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 770
diff changeset
    12
                         'with the configure command.'),
537
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    13
                   action="store_true", default=False,
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    14
                   dest='high_precision_as_double')
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    15
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    16
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    17
def configure(conf):
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    18
    if Params.g_options.high_precision_as_double:
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    19
        conf.add_define('USE_HIGH_PRECISION_DOUBLE', 1)
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    20
        conf.env['USE_HIGH_PRECISION_DOUBLE'] = 1
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    21
        highprec = 'long double'
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    22
    else:
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    23
        conf.env['USE_HIGH_PRECISION_DOUBLE'] = 0
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    24
        highprec = '128-bit integer'
3560
5aa65b1ea001 add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents: 3470
diff changeset
    25
    conf.check_message_custom('high precision time','implementation',highprec)
537
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    26
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    27
    e = conf.create_header_configurator()
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    28
    e.mandatory = False
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    29
    e.name = 'stdint.h'
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    30
    e.define = 'HAVE_STDINT_H'
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    31
    e.run()
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    32
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    33
    e = conf.create_header_configurator()
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    34
    e.mandatory = False
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    35
    e.name = 'inttypes.h'
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    36
    e.define = 'HAVE_INTTYPES_H'
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    37
    e.run()
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    38
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    39
    e = conf.create_header_configurator()
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    40
    e.mandatory = False
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    41
    e.name = 'sys/inttypes.h'
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    42
    e.define = 'HAVE_SYS_INT_TYPES_H'
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    43
    e.run()
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    44
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    45
    conf.write_config_header('ns3/simulator-config.h')
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    46
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    47
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    48
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    49
def build(bld):
1217
2f7791ae388d WAF: add new bld.create_ns3_module() and bld.create_ns3_program() methods to make declaration of modules and programs simpler, and allowing us to change how ns-3 is built in a centralized way, without needing to change every module wscript file.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1000
diff changeset
    50
    sim = bld.create_ns3_module('simulator', ['core'])
537
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    51
    sim.source = [
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    52
        'high-precision.cc',
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    53
        'time.cc',
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    54
        'event-id.cc',
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    55
        'scheduler.cc',
2913
66dd24c80d75 bug 143: rename scheduler files
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2609
diff changeset
    56
        'list-scheduler.cc',
66dd24c80d75 bug 143: rename scheduler files
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2609
diff changeset
    57
        'map-scheduler.cc',
66dd24c80d75 bug 143: rename scheduler files
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2609
diff changeset
    58
        'heap-scheduler.cc',
537
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    59
        'event-impl.cc',
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    60
        'simulator.cc',
3470
21022872009d make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents: 3469
diff changeset
    61
        'default-simulator-impl.cc',
3560
5aa65b1ea001 add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents: 3470
diff changeset
    62
        'realtime-simulator-impl.cc',
1673
9886637756a1 Implement a Timer API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1217
diff changeset
    63
        'timer.cc',
1944
7044c1ad1d79 a Watchdog class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1941
diff changeset
    64
        'watchdog.cc',
3560
5aa65b1ea001 add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents: 3470
diff changeset
    65
        'synchronizer.cc',
5aa65b1ea001 add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents: 3470
diff changeset
    66
        'wall-clock-synchronizer.cc',
537
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    67
        ]
953
e3b9f87fb76c WAF: add obj.includes = '.' to command waf to do dependency tracking on private header files.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 928
diff changeset
    68
537
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    69
    headers = bld.create_obj('ns3header')
2609
931d59bb1303 Add a 'module' attribute to the ns3header object specifying which module each set of headers belongs to.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 2577
diff changeset
    70
    headers.module = 'simulator'
537
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    71
    headers.source = [
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    72
        'high-precision.h',
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    73
        'nstime.h',
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    74
        'event-id.h',
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    75
        'event-impl.h',
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    76
        'simulator.h',
3469
9e763021e045 factor simulator into interface and (multiple) implementation pieces
Craig Dowell <craigdo@ee.washington.edu>
parents: 2913
diff changeset
    77
        'simulator-impl.h',
3470
21022872009d make simulator implementation replaceable via global default value
Craig Dowell <craigdo@ee.washington.edu>
parents: 3469
diff changeset
    78
        'default-simulator-impl.h',
3560
5aa65b1ea001 add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents: 3470
diff changeset
    79
        'realtime-simulator-impl.h',
537
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    80
        'scheduler.h',
2913
66dd24c80d75 bug 143: rename scheduler files
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2609
diff changeset
    81
        'list-scheduler.h',
66dd24c80d75 bug 143: rename scheduler files
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2609
diff changeset
    82
        'map-scheduler.h',
66dd24c80d75 bug 143: rename scheduler files
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2609
diff changeset
    83
        'heap-scheduler.h',
537
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    84
        'simulation-singleton.h',
1941
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1673
diff changeset
    85
        'timer.h',
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1673
diff changeset
    86
        'timer-impl.h',
1949
e42c28778ef8 install watchdog.h
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1944
diff changeset
    87
        'watchdog.h',
3560
5aa65b1ea001 add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents: 3470
diff changeset
    88
        'synchronizer.h',
5aa65b1ea001 add realtime simulator and associated tests
Craig Dowell <craigdo@ee.washington.edu>
parents: 3470
diff changeset
    89
        'wall-clock-synchronizer.h',
537
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    90
        ]
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    91
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    92
    env = bld.env_of_name('default')
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    93
    if env['USE_HIGH_PRECISION_DOUBLE']:
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    94
        sim.source.extend([
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    95
            'high-precision-double.cc',
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    96
            ])
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    97
        headers.source.extend([
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    98
            'high-precision-double.h',
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
    99
            ])
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
   100
    else:
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
   101
        sim.source.extend([
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
   102
            'high-precision-128.cc',
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
   103
            'cairo-wideint.c',
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
   104
            ])
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
   105
        headers.source.extend([
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
   106
            'high-precision-128.h',
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
   107
            'cairo-wideint-private.h',
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
   108
            ])
e8a4183dfe00 Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff changeset
   109