WAF: allow NS-3 modules to compile pure C code sources mixed with the C++ ones
This commit is contained in:
@@ -83,13 +83,14 @@ def configure(conf):
|
||||
|
||||
|
||||
def create_ns3_module(bld, name, dependencies=()):
|
||||
module = bld.new_task_gen('cxx')
|
||||
module = bld.new_task_gen('cxx', 'cc')
|
||||
module.name = 'ns3-' + name
|
||||
module.target = module.name
|
||||
module.add_objects = ['ns3-' + dep for dep in dependencies]
|
||||
module.module_deps = list(dependencies)
|
||||
if not module.env['ENABLE_STATIC_NS3']:
|
||||
module.env.append_value('CXXFLAGS', module.env['shlib_CXXFLAGS'])
|
||||
module.env.append_value('CCFLAGS', module.env['shlib_CXXFLAGS'])
|
||||
elif module.env['CXX_NAME'] in ['gcc', 'icc'] and \
|
||||
os.uname()[4] == 'x86_64' and \
|
||||
module.env['ENABLE_PYTHON_BINDINGS']:
|
||||
@@ -97,8 +98,10 @@ def create_ns3_module(bld, name, dependencies=()):
|
||||
# when gcc is present and only when we want python bindings
|
||||
# (it's more efficient to not use this option if we can avoid it)
|
||||
module.env.append_value('CXXFLAGS', '-mcmodel=large')
|
||||
module.env.append_value('CCFLAGS', '-mcmodel=large')
|
||||
|
||||
module.env.append_value('CXXDEFINES', "NS3_MODULE_COMPILATION")
|
||||
module.env.append_value('CCDEFINES', "NS3_MODULE_COMPILATION")
|
||||
return module
|
||||
|
||||
def create_obj(bld, *args):
|
||||
|
||||
6
wscript
6
wscript
@@ -112,6 +112,7 @@ def dist_hook():
|
||||
|
||||
def set_options(opt):
|
||||
# options provided by the modules
|
||||
opt.tool_options('compiler_cc')
|
||||
opt.tool_options('compiler_cxx')
|
||||
opt.tool_options('cflags')
|
||||
|
||||
@@ -236,6 +237,7 @@ def configure(conf):
|
||||
conf.env['NS3_OPTIONAL_FEATURES'] = []
|
||||
|
||||
conf.env['NS3_BUILDDIR'] = conf.blddir
|
||||
conf.check_tool('compiler_cc')
|
||||
conf.check_tool('compiler_cxx')
|
||||
conf.check_tool('cflags')
|
||||
try:
|
||||
@@ -388,6 +390,10 @@ def configure(conf):
|
||||
conf.env.append_value('CXXDEFINES', "ENABLE_GSL")
|
||||
conf.env.append_value('CCDEFINES', "ENABLE_GSL")
|
||||
|
||||
# for compiling C code, copy over the CXX* flags
|
||||
conf.env.append_value('CCFLAGS', conf.env['CXXFLAGS'])
|
||||
conf.env.append_value('CCDEFINES', conf.env['CXXDEFINES'])
|
||||
|
||||
# append user defined flags after all our ones
|
||||
for (confvar, envvar) in [['CCFLAGS', 'CCFLAGS_EXTRA'],
|
||||
['CXXFLAGS', 'CXXFLAGS_EXTRA'],
|
||||
|
||||
Reference in New Issue
Block a user