merge src/simulator into src/core; move src/core to new module layout

This commit is contained in:
Tom Henderson
2011-02-18 16:05:39 -08:00
parent 9471e3121f
commit df07734f32
241 changed files with 358 additions and 386 deletions

View File

@@ -1,7 +1,19 @@
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
import sys
import Options
def set_options(opt):
opt.add_option('--high-precision-as-double',
help=('Whether to use a double floating point'
' type for high precision time values'
' WARNING: this option only has effect '
'with the configure command.'),
action="store_true", default=False,
dest='high_precision_as_double')
def configure(conf):
if conf.check(header_name='stdlib.h'):
conf.define('HAVE_STDLIB_H', 1)
@@ -41,119 +53,221 @@ int main ()
conf.env['ENABLE_THREADING'],
"<pthread.h> include not detected")
a = conf.check(type_name='uint128_t', define_name='HAVE_UINT128_T')
b = conf.check(type_name='__uint128_t', define_name='HAVE___UINT128_T')
if Options.options.high_precision_as_double:
conf.define('USE_HIGH_PRECISION_DOUBLE', 1)
conf.env['USE_HIGH_PRECISION_DOUBLE'] = 1
highprec = 'long double'
elif a or b:
conf.define('USE_HIGH_PRECISION_128', 1)
conf.env['USE_HIGH_PRECISION_128'] = 1
highprec = '128-bit integer'
else:
conf.define('USE_HIGH_PRECISION_CAIRO', 1)
conf.env['USE_HIGH_PRECISION_CAIRO'] = 1
highprec = 'cairo 128-bit integer'
conf.check_message_custom('high precision time', 'implementation', highprec)
conf.check(header_name='stdint.h', define_name='HAVE_STDINT_H')
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')
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']
conf.write_config_header('ns3/core-config.h', top=True)
def build(bld):
core = bld.create_ns3_module('core')
core.source = [
'log.cc',
'breakpoint.cc',
'type-id.cc',
'attribute-list.cc',
'object-base.cc',
'ref-count-base.cc',
'object.cc',
'test.cc',
'random-variable.cc',
'rng-stream.cc',
'command-line.cc',
'type-name.cc',
'attribute.cc',
'boolean.cc',
'integer.cc',
'uinteger.cc',
'enum.cc',
'double.cc',
'string.cc',
'pointer.cc',
'object-vector.cc',
'object-factory.cc',
'global-value.cc',
'trace-source-accessor.cc',
'config.cc',
'callback.cc',
'names.cc',
'vector.cc',
'attribute-test-suite.cc',
'callback-test-suite.cc',
'names-test-suite.cc',
'type-traits-test-suite.cc',
'traced-callback-test-suite.cc',
'ptr-test-suite.cc',
'fatal-impl.cc',
'model/high-precision.cc',
'model/time-base.cc',
'model/time.cc',
'model/event-id.cc',
'model/scheduler.cc',
'model/list-scheduler.cc',
'model/map-scheduler.cc',
'model/heap-scheduler.cc',
'model/calendar-scheduler.cc',
'model/ns2-calendar-scheduler.cc',
'model/event-impl.cc',
'model/simulator.cc',
'model/simulator-impl.cc',
'model/default-simulator-impl.cc',
'model/timer.cc',
'model/watchdog.cc',
'model/synchronizer.cc',
'model/make-event.cc',
'model/log.cc',
'model/breakpoint.cc',
'model/type-id.cc',
'model/attribute-list.cc',
'model/object-base.cc',
'model/ref-count-base.cc',
'model/object.cc',
'model/test.cc',
'model/random-variable.cc',
'model/rng-stream.cc',
'model/command-line.cc',
'model/type-name.cc',
'model/attribute.cc',
'model/boolean.cc',
'model/integer.cc',
'model/uinteger.cc',
'model/enum.cc',
'model/double.cc',
'model/string.cc',
'model/pointer.cc',
'model/object-vector.cc',
'model/object-factory.cc',
'model/global-value.cc',
'model/trace-source-accessor.cc',
'model/config.cc',
'model/callback.cc',
'model/names.cc',
'model/vector.cc',
'model/fatal-impl.cc',
'test/attribute-test-suite.cc',
'test/callback-test-suite.cc',
'test/names-test-suite.cc',
'test/type-traits-test-suite.cc',
'test/traced-callback-test-suite.cc',
'test/ptr-test-suite.cc',
]
headers = bld.new_task_gen('ns3header')
headers.module = 'core'
headers.source = [
'system-wall-clock-ms.h',
'empty.h',
'callback.h',
'object-base.h',
'ref-count-base.h',
'simple-ref-count.h',
'type-id.h',
'attribute-list.h',
'ptr.h',
'object.h',
'log.h',
'assert.h',
'breakpoint.h',
'fatal-error.h',
'test.h',
'random-variable.h',
'rng-stream.h',
'command-line.h',
'type-name.h',
'type-traits.h',
'int-to-type.h',
'attribute.h',
'attribute-accessor-helper.h',
'boolean.h',
'integer.h',
'uinteger.h',
'double.h',
'enum.h',
'string.h',
'pointer.h',
'object-factory.h',
'attribute-helper.h',
'global-value.h',
'traced-callback.h',
'traced-value.h',
'trace-source-accessor.h',
'config.h',
'object-vector.h',
'deprecated.h',
'abort.h',
'names.h',
'vector.h',
'default-deleter.h',
'fatal-impl.h',
'model/high-precision.h',
'model/time-base.h',
'model/nstime.h',
'model/event-id.h',
'model/event-impl.h',
'model/simulator.h',
'model/simulator-impl.h',
'model/default-simulator-impl.h',
'model/scheduler.h',
'model/list-scheduler.h',
'model/map-scheduler.h',
'model/heap-scheduler.h',
'model/calendar-scheduler.h',
'model/ns2-calendar-scheduler.h',
'model/simulation-singleton.h',
'model/timer.h',
'model/timer-impl.h',
'model/watchdog.h',
'model/synchronizer.h',
'model/make-event.h',
'model/system-wall-clock-ms.h',
'model/empty.h',
'model/callback.h',
'model/object-base.h',
'model/ref-count-base.h',
'model/simple-ref-count.h',
'model/type-id.h',
'model/attribute-list.h',
'model/ptr.h',
'model/object.h',
'model/log.h',
'model/assert.h',
'model/breakpoint.h',
'model/fatal-error.h',
'model/test.h',
'model/random-variable.h',
'model/rng-stream.h',
'model/command-line.h',
'model/type-name.h',
'model/type-traits.h',
'model/int-to-type.h',
'model/attribute.h',
'model/attribute-accessor-helper.h',
'model/boolean.h',
'model/integer.h',
'model/uinteger.h',
'model/double.h',
'model/enum.h',
'model/string.h',
'model/pointer.h',
'model/object-factory.h',
'model/attribute-helper.h',
'model/global-value.h',
'model/traced-callback.h',
'model/traced-value.h',
'model/trace-source-accessor.h',
'model/config.h',
'model/object-vector.h',
'model/deprecated.h',
'model/abort.h',
'model/names.h',
'model/vector.h',
'model/default-deleter.h',
'model/fatal-impl.h',
]
if sys.platform == 'win32':
core.source.extend([
'win32-system-wall-clock-ms.cc',
'model/win32-system-wall-clock-ms.cc',
])
else:
core.source.extend([
'unix-system-wall-clock-ms.cc',
'model/unix-system-wall-clock-ms.cc',
])
if bld.env['ENABLE_THREADING']:
env = bld.env_of_name('default')
if env['USE_HIGH_PRECISION_DOUBLE']:
headers.source.extend(['model/high-precision-double.h'])
elif env['USE_HIGH_PRECISION_128']:
headers.source.extend(['model/high-precision-128.h'])
core.source.extend(['model/high-precision-128.cc'])
elif env['USE_HIGH_PRECISION_CAIRO']:
core.source.extend([
'unix-system-thread.cc',
'unix-system-mutex.cc',
'unix-system-condition.cc',
'model/high-precision-cairo.cc',
# 'model/cairo-wideint.c',
])
core.uselib = 'PTHREAD'
headers.source.extend([
'system-mutex.h',
'system-thread.h',
'system-condition.h',
'model/high-precision-cairo.h',
'model/cairo-wideint-private.h',
])
if env['ENABLE_REAL_TIME']:
headers.source.extend([
'model/realtime-simulator-impl.h',
'model/wall-clock-synchronizer.h',
])
core.source.extend([
'model/realtime-simulator-impl.cc',
'model/wall-clock-synchronizer.cc',
])
core.uselib = 'RT'
else:
core.uselib = ''
if env['ENABLE_THREADING']:
core.source.extend([
'model/unix-fd-reader.cc',
'model/unix-system-thread.cc',
'model/unix-system-mutex.cc',
'model/unix-system-condition.cc',
])
core.uselib = core.uselib + ' PTHREAD'
headers.source.extend([
'model/unix-fd-reader.h',
'model/system-mutex.h',
'model/system-thread.h',
'model/system-condition.h',
])
if bld.env['ENABLE_GSL']:
if env['ENABLE_GSL']:
core.uselib = core.uselib + ' GSL GSLCBLAS M'
core.source.extend(['rng-test-suite.cc'])
core.source.extend(['test/rng-test-suite.cc'])