From b9ebfb426eb51eb3f10cac21153c63f7425f961b Mon Sep 17 00:00:00 2001 From: Tommaso Pecorella Date: Fri, 25 Dec 2020 02:13:11 +0100 Subject: [PATCH] build: (fixes #309) Narrow inclusion path to build directory --- contrib/wscript | 10 ++++++---- src/wscript | 11 +++++++---- wscript | 2 +- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/contrib/wscript b/contrib/wscript index 1d70895a3..f0903e36b 100644 --- a/contrib/wscript +++ b/contrib/wscript @@ -7,7 +7,7 @@ import shutil import types import warnings -from waflib import TaskGen, Task, Options, Build, Utils +from waflib import TaskGen, Task, Options, Build, Utils, Context from waflib.Errors import WafError import wutils @@ -140,7 +140,8 @@ def create_ns3_module(bld, name, dependencies=(), test=False): module.is_ns3_module = True module.ns3_dir_location = bld.path.path_from(bld.srcnode) - module.env.append_value("INCLUDES", '#') + builddirname = Context.top_dir + '/build' + module.env.append_value("INCLUDES", builddirname) module.pcfilegen = bld(features='ns3pcfile') module.pcfilegen.module = module.name @@ -288,7 +289,9 @@ def ns3_python_bindings(bld): except ValueError: pass pymod.env['DEFINES'] = defines - pymod.includes = '# bindings' + # The following string should lead to includes of + # '-I.', '-Isrc/core/bindings' when compiling module_helpers.cc + pymod.includes = Context.top_dir + '/build' + ' ' + Context.top_dir + '/build/src/core/bindings' pymod.install_path = '${PYTHONARCHDIR}/ns' # Workaround to a WAF bug, remove this when ns-3 upgrades to WAF > 1.6.10 @@ -318,4 +321,3 @@ def build(bld): for module in all_contrib_modules: modheader = bld(features='ns3moduleheader') modheader.module = module.split('/')[-1] - diff --git a/src/wscript b/src/wscript index d0b38d720..e776dfd37 100644 --- a/src/wscript +++ b/src/wscript @@ -7,7 +7,7 @@ import shutil import types import warnings -from waflib import TaskGen, Task, Options, Build, Utils +from waflib import TaskGen, Task, Options, Build, Utils, Context from waflib.Errors import WafError import wutils @@ -125,8 +125,9 @@ def create_ns3_module(bld, name, dependencies=(), test=False): module.is_ns3_module = True module.ns3_dir_location = bld.path.path_from(bld.srcnode) - module.env.append_value("INCLUDES", '#') - + builddirname = Context.top_dir + '/build' + module.env.append_value("INCLUDES", builddirname) + module.pcfilegen = bld(features='ns3pcfile') module.pcfilegen.module = module.name @@ -287,7 +288,9 @@ def ns3_python_bindings(bld): except ValueError: pass pymod.env['DEFINES'] = defines - pymod.includes = '# bindings' + # The following string should lead to includes of + # '-I.', '-Isrc/core/bindings' when compiling module_helpers.cc + pymod.includes = Context.top_dir + '/build' + ' ' + Context.top_dir + '/build/src/core/bindings' pymod.install_path = '${PYTHONARCHDIR}/ns' # Workaround to a WAF bug, remove this when ns-3 upgrades to WAF > 1.6.10 diff --git a/wscript b/wscript index 5b54c96f5..6797ebebb 100644 --- a/wscript +++ b/wscript @@ -763,7 +763,7 @@ def create_ns3_program(bld, name, dependencies=('core',)): program.target = "%s%s-%s%s" % (wutils.APPNAME, wutils.VERSION, name, bld.env.BUILD_SUFFIX) # Each of the modules this program depends on has its own library. program.ns3_module_dependencies = ['ns3-'+dep for dep in dependencies] - program.includes = "#" + program.includes = Context.top_dir + '/build' #make a copy here to prevent additions to program.use from polluting program.ns3_module_dependencies program.use = program.ns3_module_dependencies.copy() if program.env['ENABLE_STATIC_NS3']: