diff --git a/src/simulator/cairo-wideint-private.h b/src/core/cairo-wideint-private.h similarity index 99% rename from src/simulator/cairo-wideint-private.h rename to src/core/cairo-wideint-private.h index bbbca4fd7..5b407ef14 100644 --- a/src/simulator/cairo-wideint-private.h +++ b/src/core/cairo-wideint-private.h @@ -32,7 +32,7 @@ #ifndef CAIRO_WIDEINT_H #define CAIRO_WIDEINT_H -#include "ns3/simulator-config.h" +#include "ns3/core-config.h" #define cairo_private #define HAVE_UINT64_T 1 diff --git a/src/simulator/cairo-wideint.c b/src/core/cairo-wideint.c similarity index 100% rename from src/simulator/cairo-wideint.c rename to src/core/cairo-wideint.c diff --git a/src/simulator/int64x64-128.cc b/src/core/int64x64-128.cc similarity index 100% rename from src/simulator/int64x64-128.cc rename to src/core/int64x64-128.cc diff --git a/src/simulator/int64x64-128.h b/src/core/int64x64-128.h similarity index 100% rename from src/simulator/int64x64-128.h rename to src/core/int64x64-128.h diff --git a/src/simulator/int64x64-cairo.cc b/src/core/int64x64-cairo.cc similarity index 100% rename from src/simulator/int64x64-cairo.cc rename to src/core/int64x64-cairo.cc diff --git a/src/simulator/int64x64-cairo.h b/src/core/int64x64-cairo.h similarity index 100% rename from src/simulator/int64x64-cairo.h rename to src/core/int64x64-cairo.h diff --git a/src/simulator/int64x64-double.h b/src/core/int64x64-double.h similarity index 100% rename from src/simulator/int64x64-double.h rename to src/core/int64x64-double.h diff --git a/src/simulator/int64x64.cc b/src/core/int64x64.cc similarity index 100% rename from src/simulator/int64x64.cc rename to src/core/int64x64.cc diff --git a/src/simulator/int64x64.h b/src/core/int64x64.h similarity index 98% rename from src/simulator/int64x64.h rename to src/core/int64x64.h index a6466a5fa..797160017 100644 --- a/src/simulator/int64x64.h +++ b/src/core/int64x64.h @@ -1,7 +1,7 @@ #ifndef INT64X64_H #define INT64X64_H -#include "ns3/simulator-config.h" +#include "ns3/core-config.h" #if defined (INT64X64_USE_DOUBLE) #include "int64x64-double.h" diff --git a/src/core/wscript b/src/core/wscript index ae8b29f56..747ad0722 100644 --- a/src/core/wscript +++ b/src/core/wscript @@ -2,7 +2,41 @@ import sys import Options +def set_options(opt): + opt.add_option('--int64x64-as-double', + help=('Whether to use a double floating point' + ' type for int64x64 values' + ' WARNING: this option only has effect ' + 'with the configure command.'), + action="store_true", default=False, + dest='int64x64_as_double') + + def configure(conf): + 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.int64x64_as_double: + conf.define('INT64X64_USE_DOUBLE', 1) + conf.env['INT64X64_USE_DOUBLE'] = 1 + highprec = 'long double' + elif a or b: + conf.define('INT64X64_USE_128', 1) + conf.env['INT64X64_USE_128'] = 1 + highprec = '128-bit integer' + else: + conf.define('INT64X64_USE_CAIRO', 1) + conf.env['INT64X64_USE_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 conf.check(header_name='stdlib.h'): conf.define('HAVE_STDLIB_H', 1) conf.define('HAVE_GETENV', 1) @@ -81,6 +115,7 @@ def build(bld): 'traced-callback-test-suite.cc', 'ptr-test-suite.cc', 'fatal-impl.cc', + 'int64x64.cc', ] headers = bld.new_task_gen('ns3header') @@ -130,6 +165,7 @@ def build(bld): 'vector.h', 'default-deleter.h', 'fatal-impl.h', + 'int64x64.h', ] if sys.platform == 'win32': @@ -154,6 +190,21 @@ def build(bld): 'system-condition.h', ]) + env = bld.env_of_name('default') + if env['INT64X64_USE_DOUBLE']: + headers.source.extend(['int64x64-double.h']) + elif env['INT64X64_USE_128']: + headers.source.extend(['int64x64-128.h']) + core.source.extend(['int64x64-128.cc']) + elif env['INT64X64_USE_CAIRO']: + core.source.extend([ + 'int64x64-cairo.cc', + ]) + headers.source.extend([ + 'int64x64-cairo.h', + 'cairo-wideint-private.h', + ]) + if bld.env['ENABLE_GSL']: core.uselib = 'GSL GSLCBLAS M' core.source.extend(['rng-test-suite.cc']) diff --git a/src/simulator/nstime.h b/src/simulator/nstime.h index 75558e6f2..76db04dc0 100644 --- a/src/simulator/nstime.h +++ b/src/simulator/nstime.h @@ -23,7 +23,7 @@ #include "ns3/assert.h" #include "ns3/attribute.h" #include "ns3/attribute-helper.h" -#include "int64x64.h" +#include "ns3/int64x64.h" #include #include #include diff --git a/src/simulator/wscript b/src/simulator/wscript index 906aa703c..7d4c57daa 100644 --- a/src/simulator/wscript +++ b/src/simulator/wscript @@ -1,46 +1,8 @@ ## -*- 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): - 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('INT64X64_USE_DOUBLE', 1) - conf.env['USE_HIGH_PRECISION_DOUBLE'] = 1 - highprec = 'long double' - elif a or b: - conf.define('INT64X64_USE_128', 1) - conf.env['USE_HIGH_PRECISION_128'] = 1 - highprec = '128-bit integer' - else: - conf.define('INT64X64_USE_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') - - conf.write_config_header('ns3/simulator-config.h', top=True) - 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") @@ -54,7 +16,6 @@ def configure(conf): def build(bld): sim = bld.create_ns3_module('simulator', ['core']) sim.source = [ - 'int64x64.cc', 'time.cc', 'event-id.cc', 'scheduler.cc', @@ -76,7 +37,6 @@ def build(bld): headers = bld.new_task_gen('ns3header') headers.module = 'simulator' headers.source = [ - 'int64x64.h', 'nstime.h', 'event-id.h', 'event-impl.h', @@ -98,20 +58,6 @@ def build(bld): ] env = bld.env_of_name('default') - if env['USE_HIGH_PRECISION_DOUBLE']: - headers.source.extend(['int64x64-double.h']) - elif env['USE_HIGH_PRECISION_128']: - headers.source.extend(['int64x64-128.h']) - sim.source.extend(['int64x64-128.cc']) - elif env['USE_HIGH_PRECISION_CAIRO']: - sim.source.extend([ - 'int64x64-cairo.cc', - ]) - headers.source.extend([ - 'int64x64-cairo.h', - 'cairo-wideint-private.h', - ]) - if env['ENABLE_REAL_TIME']: headers.source.extend([ 'realtime-simulator-impl.h', diff --git a/src/wscript b/src/wscript index b833636c7..1d0ce6f0c 100644 --- a/src/wscript +++ b/src/wscript @@ -64,7 +64,7 @@ all_modules = ( ) def set_options(opt): - opt.sub_options('simulator') + opt.sub_options('core') opt.add_option('--enable-rpath', help=("Link programs with rpath"