Build all modules as a single ns3 shared library.
This commit is contained in:
14
src/wscript
14
src/wscript
@@ -39,9 +39,9 @@ def configure(conf):
|
||||
conf.sub_config('simulator')
|
||||
|
||||
blddir = os.path.abspath(os.path.join(conf.m_blddir, conf.env.variant()))
|
||||
conf.env['NS3_MODULE_PATH'] = [os.path.join(blddir, 'src')]
|
||||
for module in all_modules:
|
||||
module_path = os.path.join(blddir, 'src', module)
|
||||
conf.env.append_value('NS3_MODULE_PATH', module_path)
|
||||
if Params.g_options.enable_rpath:
|
||||
conf.env.append_value('RPATH', '-Wl,-rpath=%s' % (module_path,))
|
||||
|
||||
@@ -49,10 +49,11 @@ def configure(conf):
|
||||
conf.env['NS3_MODULES'] = ['ns3-' + module.split('/')[-1] for module in all_modules]
|
||||
|
||||
def create_ns3_module(bld, name, dependencies=()):
|
||||
module = bld.create_obj('cpp', 'shlib')
|
||||
module = bld.create_obj('cpp', 'objects')
|
||||
module.name = 'ns3-' + name
|
||||
module.target = module.name
|
||||
module.uselib_local = ['ns3-' + dep for dep in dependencies]
|
||||
module.add_objects = ['ns3-' + dep for dep in dependencies]
|
||||
module.env.append_value('CXXFLAGS', module.env['shlib_CXXFLAGS'])
|
||||
return module
|
||||
|
||||
|
||||
@@ -63,6 +64,13 @@ def build(bld):
|
||||
|
||||
bld.add_subdirs(list(all_modules))
|
||||
|
||||
## Create a single ns3 library containing all modules
|
||||
lib = bld.create_obj('cpp', 'shlib')
|
||||
lib.name = 'ns3'
|
||||
lib.target = 'ns3'
|
||||
lib.add_objects = list(bld.env_of_name('default')['NS3_MODULES'])
|
||||
|
||||
|
||||
class Ns3Header(Object.genobj):
|
||||
"""A set of NS-3 header files"""
|
||||
def __init__(self, env=None):
|
||||
|
||||
@@ -9,7 +9,7 @@ def build(bld):
|
||||
unit_tests.unit_test = 1 # runs on 'waf check'
|
||||
unit_tests.source = 'run-tests.cc'
|
||||
## link unit test program with all ns3 modules
|
||||
unit_tests.uselib_local = env['NS3_MODULES']
|
||||
unit_tests.uselib_local = 'ns3'
|
||||
|
||||
obj = bld.create_ns3_program('bench-simulator', ['simulator'])
|
||||
obj.source = 'bench-simulator.cc'
|
||||
|
||||
2
wscript
2
wscript
@@ -140,7 +140,7 @@ def create_ns3_program(bld, name, dependencies=('simulator',)):
|
||||
program = bld.create_obj('cpp', 'program')
|
||||
program.name = name
|
||||
program.target = program.name
|
||||
program.uselib_local = ['ns3-' + dep for dep in dependencies]
|
||||
program.uselib_local = 'ns3'
|
||||
return program
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user