stats: (fixes #228) Disable bindings for SQLite options when not enabled

Further work on patch originally started by Tommaso Pecorella in the tracker
This commit is contained in:
Tom Henderson
2020-06-21 08:09:58 -07:00
parent b7ca218cdf
commit 700fb009c5
2 changed files with 10 additions and 10 deletions

View File

@@ -3,10 +3,10 @@ import os
def post_register_types(root_module):
enabled_features = os.environ['NS3_ENABLED_FEATURES'].split(',')
# if no sqlite, the class SqliteDataOutput is disabled
if 'SqliteDataOutput' not in enabled_features:
try:
root_module.classes.remove(root_module['ns3::SqliteDataOutput'])
except KeyError:
pass
# If no sqlite support, disable bindings for those (optional) features
if 'SQLiteStats' not in enabled_features:
for clsname in ['SimpleRefCount< ns3::SQLiteOutput, ns3::empty, ns3::DefaultDeleter<ns3::SQLiteOutput> >', 'SQLiteOutput', 'SqliteDataOutput', 'DefaultDeleter< ns3::SQLiteOutput >']:
try:
root_module.classes.remove(root_module['ns3::%s' % clsname])
except:
pass

View File

@@ -6,11 +6,11 @@ def configure(conf):
mandatory=False)
conf.env['SQLITE_STATS'] = have_sqlite3
conf.report_optional_feature("SqliteDataOutput", "SQlite stats data output",
conf.env['SQLITE_STATS'],
"library 'sqlite3' not found")
have_sem = conf.check_nonfatal(header_name='semaphore.h', define_name='HAVE_SEMAPHORE_H')
conf.env['SEMAPHORE_ENABLED'] = have_sem
conf.report_optional_feature("SQLiteStats", "SQLite stats support",
conf.env['SQLITE_STATS'] and conf.env['SEMAPHORE_ENABLED'],
"library 'sqlite3' and/or semaphore.h not found")
conf.write_config_header('ns3/stats-config.h', top=True)
def build(bld):