2007-05-07 12:01:51 +01:00
|
|
|
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
|
|
|
|
|
import sys
|
|
|
|
|
|
|
|
|
|
import Params
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def set_options(opt):
|
|
|
|
|
opt.add_option('--high-precision-as-double',
|
|
|
|
|
help=('Whether to use a double floating point'
|
2007-06-21 12:33:50 +01:00
|
|
|
' type for high precision time values'
|
|
|
|
|
' WARNING: this option only has effect '
|
|
|
|
|
'with the configure command.'),
|
2007-05-07 12:01:51 +01:00
|
|
|
action="store_true", default=False,
|
|
|
|
|
dest='high_precision_as_double')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def configure(conf):
|
|
|
|
|
if Params.g_options.high_precision_as_double:
|
|
|
|
|
conf.add_define('USE_HIGH_PRECISION_DOUBLE', 1)
|
|
|
|
|
conf.env['USE_HIGH_PRECISION_DOUBLE'] = 1
|
|
|
|
|
highprec = 'long double'
|
|
|
|
|
else:
|
|
|
|
|
conf.env['USE_HIGH_PRECISION_DOUBLE'] = 0
|
|
|
|
|
highprec = '128-bit integer'
|
|
|
|
|
conf.check_message_custom('high precision time', 'implementation', highprec)
|
|
|
|
|
|
|
|
|
|
e = conf.create_header_configurator()
|
|
|
|
|
e.mandatory = False
|
|
|
|
|
e.name = 'stdint.h'
|
|
|
|
|
e.define = 'HAVE_STDINT_H'
|
|
|
|
|
e.run()
|
|
|
|
|
|
|
|
|
|
e = conf.create_header_configurator()
|
|
|
|
|
e.mandatory = False
|
|
|
|
|
e.name = 'inttypes.h'
|
|
|
|
|
e.define = 'HAVE_INTTYPES_H'
|
|
|
|
|
e.run()
|
|
|
|
|
|
|
|
|
|
e = conf.create_header_configurator()
|
|
|
|
|
e.mandatory = False
|
|
|
|
|
e.name = 'sys/inttypes.h'
|
|
|
|
|
e.define = 'HAVE_SYS_INT_TYPES_H'
|
|
|
|
|
e.run()
|
|
|
|
|
|
|
|
|
|
conf.write_config_header('ns3/simulator-config.h')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def build(bld):
|
2007-08-08 15:10:36 +01:00
|
|
|
sim = bld.create_ns3_module('simulator', ['core'])
|
2007-05-07 12:01:51 +01:00
|
|
|
sim.source = [
|
|
|
|
|
'high-precision.cc',
|
|
|
|
|
'time.cc',
|
|
|
|
|
'event-id.cc',
|
|
|
|
|
'scheduler.cc',
|
|
|
|
|
'scheduler-factory.cc',
|
|
|
|
|
'scheduler-list.cc',
|
|
|
|
|
'scheduler-heap.cc',
|
|
|
|
|
'scheduler-map.cc',
|
|
|
|
|
'event-impl.cc',
|
|
|
|
|
'simulator.cc',
|
2007-07-23 14:41:53 +02:00
|
|
|
'time-default-value.cc',
|
2007-09-27 12:51:17 +02:00
|
|
|
'timer.cc',
|
|
|
|
|
'event-garbage-collector.cc',
|
2007-05-07 12:01:51 +01:00
|
|
|
]
|
2007-07-20 11:12:43 +01:00
|
|
|
|
2007-05-07 12:01:51 +01:00
|
|
|
headers = bld.create_obj('ns3header')
|
|
|
|
|
headers.source = [
|
|
|
|
|
'high-precision.h',
|
|
|
|
|
'nstime.h',
|
|
|
|
|
'event-id.h',
|
|
|
|
|
'event-impl.h',
|
|
|
|
|
'simulator.h',
|
|
|
|
|
'scheduler.h',
|
|
|
|
|
'scheduler-factory.h',
|
|
|
|
|
'simulation-singleton.h',
|
2007-07-23 14:41:53 +02:00
|
|
|
'time-default-value.h',
|
2007-09-27 12:51:17 +02:00
|
|
|
'timer.h'
|
2007-05-07 12:01:51 +01:00
|
|
|
]
|
|
|
|
|
|
|
|
|
|
env = bld.env_of_name('default')
|
|
|
|
|
if env['USE_HIGH_PRECISION_DOUBLE']:
|
|
|
|
|
sim.source.extend([
|
|
|
|
|
'high-precision-double.cc',
|
|
|
|
|
])
|
|
|
|
|
headers.source.extend([
|
|
|
|
|
'high-precision-double.h',
|
|
|
|
|
])
|
|
|
|
|
else:
|
|
|
|
|
sim.source.extend([
|
|
|
|
|
'high-precision-128.cc',
|
|
|
|
|
'cairo-wideint.c',
|
|
|
|
|
])
|
|
|
|
|
headers.source.extend([
|
|
|
|
|
'high-precision-128.h',
|
|
|
|
|
'cairo-wideint-private.h',
|
|
|
|
|
])
|
|
|
|
|
|