build: (fixes #309) Narrow inclusion path to build directory

This commit is contained in:
Tommaso Pecorella
2020-12-25 02:13:11 +01:00
committed by Tom Henderson
parent 66c10cb70b
commit b9ebfb426e
3 changed files with 14 additions and 9 deletions

View File

@@ -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]

View File

@@ -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

View File

@@ -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']: