Index: contrib/wscript |
=================================================================== |
--- a/contrib/wscript |
+++ b/contrib/wscript |
@@ -15,15 +15,28 @@ |
except NameError: |
from sets import Set as set # Python 2.3 fallback |
+ |
+# Allow mulitple modules to live in a single directory in contrib. |
+# For example, a directory structure like: |
+# contrib/package/module1 |
+# /module2 |
+# Useful for external projects that are building interdependent modules that |
+# are logically packaged together. |
all_contrib_modules = [] |
-for dirname in os.listdir('contrib'): |
- if dirname.startswith('.') or dirname == 'CVS': |
+for dirpath in os.listdir('contrib'): |
+ if dirpath.startswith('.') or dirpath.endswith('CVS'): |
continue |
- path = os.path.join('contrib', dirname) |
- if not os.path.isdir(path): |
+ dirpath = os.path.join("contrib", dirpath) |
+ if not os.path.isdir(dirpath): |
continue |
- if os.path.exists(os.path.join(path, 'wscript')): |
- all_contrib_modules.append(dirname) |
+ # Assume that all directories with a wscript file |
+ # are the top level of a module |
+ if os.path.exists(os.path.join(dirpath, 'wscript')): |
+ fullDirPath = os.path.realpath(dirpath) |
+ moduleDir=fullDirPath.replace(os.path.commonprefix([os.getcwd(), fullDirPath]), "", 1) |
+ moduleDir=moduleDir.replace(os.path.sep + 'contrib' + os.path.sep, "", 1) |
+ all_contrib_modules.append(moduleDir) |
+ |
all_contrib_modules.sort() |
def options(opt): |
@@ -31,6 +44,14 @@ |
opt.recurse(module, mandatory=False) |
def configure(conf): |
+ # Append blddir to the module path before recursing into modules |
+ # This is required for contrib modules with test suites |
+ blddir = os.path.abspath(os.path.join(conf.bldnode.abspath(), conf.variant)) |
+ conf.env.append_value('NS3_MODULE_PATH', blddir) |
+ |
+ # Remove duplicate path items |
+ conf.env['NS3_MODULE_PATH'] = wutils.uniquify_list(conf.env['NS3_MODULE_PATH']) |
+ |
for module in all_contrib_modules: |
conf.recurse(module, mandatory=False) |
@@ -48,8 +69,11 @@ |
module = bld(features='cxx cxxstlib ns3module') |
else: |
module = bld(features='cxx cxxshlib ns3module') |
- module.target = '%s/lib/ns%s-%s%s' % (bld.srcnode.path_from(module.path), wutils.VERSION, |
- name, bld.env.BUILD_SUFFIX) |
+ target = '%s/lib/ns%s-%s%s' % (bld.srcnode.path_from(module.path), |
+ wutils.VERSION, |
+ name, bld.env.BUILD_SUFFIX) |
+ |
+ module.target = target |
linkflags = [] |
cxxflags = [] |
ccflags = [] |
@@ -149,7 +173,7 @@ |
return |
if ("ns3-%s" % (module,)) not in env.NS3_ENABLED_MODULES: |
- #print "bindings for module %s which is not enabled, skip" % module |
+ #print "bindings for module %s which is not enabled, skip" % module) |
return |
env.append_value('PYTHON_MODULES_BUILT', module) |