2007-05-07 12:01:51 +01:00
|
|
|
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
|
|
|
|
|
import sys
|
|
|
|
|
|
2008-12-29 13:28:54 +00:00
|
|
|
import Options
|
2007-05-07 12:01:51 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
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):
|
2008-12-29 13:28:54 +00:00
|
|
|
if Options.options.high_precision_as_double:
|
2008-09-09 17:09:37 -07:00
|
|
|
conf.define('USE_HIGH_PRECISION_DOUBLE', 1)
|
2007-05-07 12:01:51 +01:00
|
|
|
conf.env['USE_HIGH_PRECISION_DOUBLE'] = 1
|
|
|
|
|
highprec = 'long double'
|
|
|
|
|
else:
|
|
|
|
|
conf.env['USE_HIGH_PRECISION_DOUBLE'] = 0
|
|
|
|
|
highprec = '128-bit integer'
|
|
|
|
|
|
2008-12-29 13:28:54 +00:00
|
|
|
conf.check_message_custom('high precision time', 'implementation', highprec)
|
2007-05-07 12:01:51 +01:00
|
|
|
|
2008-12-29 13:28:54 +00:00
|
|
|
conf.check(header_name='stdint.h', define_name='HAVE_STDINT_H')
|
2007-05-07 12:01:51 +01:00
|
|
|
|
2008-12-29 13:28:54 +00:00
|
|
|
conf.check(header_name='inttypes.h', define_name='HAVE_INTTYPES_H')
|
|
|
|
|
|
|
|
|
|
conf.check(header_name='sys/inttypes.h', define_name='HAVE_SYS_INT_TYPES_H')
|
2007-05-07 12:01:51 +01:00
|
|
|
|
|
|
|
|
conf.write_config_header('ns3/simulator-config.h')
|
|
|
|
|
|
2009-01-24 18:47:47 +00:00
|
|
|
if not conf.check(lib='rt', uselib='RT', define_name='HAVE_RT'):
|
|
|
|
|
conf.report_optional_feature("RealTime", "Real Time Simulator",
|
|
|
|
|
False, "librt is not available")
|
|
|
|
|
else:
|
|
|
|
|
conf.report_optional_feature("RealTime", "Real Time Simulator",
|
|
|
|
|
conf.env['ENABLE_THREADING'],
|
|
|
|
|
"threading not enabled")
|
|
|
|
|
conf.env["ENABLE_REAL_TIME"] = conf.env['ENABLE_THREADING']
|
2007-05-07 12:01:51 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
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',
|
2008-04-15 10:09:42 -07:00
|
|
|
'list-scheduler.cc',
|
|
|
|
|
'map-scheduler.cc',
|
|
|
|
|
'heap-scheduler.cc',
|
2009-01-08 09:31:38 +01:00
|
|
|
'calendar-scheduler.cc',
|
2009-01-15 11:23:59 +01:00
|
|
|
'ns2-calendar-scheduler.cc',
|
2007-05-07 12:01:51 +01:00
|
|
|
'event-impl.cc',
|
|
|
|
|
'simulator.cc',
|
2008-07-18 21:51:31 -07:00
|
|
|
'default-simulator-impl.cc',
|
2007-09-27 12:51:17 +02:00
|
|
|
'timer.cc',
|
2007-10-10 15:04:46 +02:00
|
|
|
'watchdog.cc',
|
2008-08-26 15:34:57 -07:00
|
|
|
'synchronizer.cc',
|
2008-10-15 14:35:28 +02:00
|
|
|
'make-event.cc',
|
2007-05-07 12:01:51 +01:00
|
|
|
]
|
2007-07-20 11:12:43 +01:00
|
|
|
|
2008-12-29 13:28:54 +00:00
|
|
|
headers = bld.new_task_gen('ns3header')
|
2007-12-26 13:40:39 +00:00
|
|
|
headers.module = 'simulator'
|
2007-05-07 12:01:51 +01:00
|
|
|
headers.source = [
|
|
|
|
|
'high-precision.h',
|
|
|
|
|
'nstime.h',
|
|
|
|
|
'event-id.h',
|
|
|
|
|
'event-impl.h',
|
|
|
|
|
'simulator.h',
|
2008-07-17 23:52:59 -07:00
|
|
|
'simulator-impl.h',
|
2008-07-18 21:51:31 -07:00
|
|
|
'default-simulator-impl.h',
|
2007-05-07 12:01:51 +01:00
|
|
|
'scheduler.h',
|
2008-04-15 10:09:42 -07:00
|
|
|
'list-scheduler.h',
|
|
|
|
|
'map-scheduler.h',
|
|
|
|
|
'heap-scheduler.h',
|
2009-01-08 09:31:38 +01:00
|
|
|
'calendar-scheduler.h',
|
2009-01-15 11:23:59 +01:00
|
|
|
'ns2-calendar-scheduler.h',
|
2007-05-07 12:01:51 +01:00
|
|
|
'simulation-singleton.h',
|
2007-10-10 13:18:15 +02:00
|
|
|
'timer.h',
|
|
|
|
|
'timer-impl.h',
|
2007-10-10 15:59:34 +02:00
|
|
|
'watchdog.h',
|
2008-08-26 15:34:57 -07:00
|
|
|
'synchronizer.h',
|
2008-10-15 14:35:28 +02:00
|
|
|
'make-event.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',
|
|
|
|
|
])
|
|
|
|
|
|
2009-01-24 18:47:47 +00:00
|
|
|
if env['ENABLE_REAL_TIME']:
|
2008-09-08 12:19:46 +01:00
|
|
|
headers.source.extend([
|
|
|
|
|
'realtime-simulator-impl.h',
|
|
|
|
|
'wall-clock-synchronizer.h',
|
|
|
|
|
])
|
|
|
|
|
sim.source.extend([
|
|
|
|
|
'realtime-simulator-impl.cc',
|
|
|
|
|
'wall-clock-synchronizer.cc',
|
|
|
|
|
])
|
2009-01-24 18:47:47 +00:00
|
|
|
sim.uselib = 'RT'
|
|
|
|
|
|
2008-09-08 12:19:46 +01:00
|
|
|
|