WAF: make all ns3 modules register themselves in the environment; link the run-tests program with all ns3 modules, not with a hardcoded list.
authorGustavo J. A. M. Carneiro <gjc@inescporto.pt>
Fri, 15 Jun 2007 15:19:38 +0100
changeset 770 6441e0706902
parent 769 b4c78b6bdbd1
child 771 86b8d2312ec8
WAF: make all ns3 modules register themselves in the environment; link the run-tests program with all ns3 modules, not with a hardcoded list.
src/applications/wscript
src/common/wscript
src/core/wscript
src/devices/p2p/wscript
src/internet-node/wscript
src/node/wscript
src/simulator/wscript
src/wscript
utils/wscript
--- a/src/applications/wscript	Thu Jun 14 13:09:56 2007 +0100
+++ b/src/applications/wscript	Fri Jun 15 15:19:38 2007 +0100
@@ -1,6 +1,10 @@
 ## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
 
 
+def configure(conf):
+    conf.env.append_value('NS3_MODULES', 'ns3-applications')
+
+
 def build(bld):
     obj = bld.create_obj('cpp', 'shlib')
     obj.name = 'ns3-applications'
--- a/src/common/wscript	Thu Jun 14 13:09:56 2007 +0100
+++ b/src/common/wscript	Fri Jun 15 15:19:38 2007 +0100
@@ -1,5 +1,7 @@
 ## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
 
+def configure(conf):
+    conf.env.append_value('NS3_MODULES', 'ns3-common')
 
 def build(bld):
     common = bld.create_obj('cpp', 'shlib')
--- a/src/core/wscript	Thu Jun 14 13:09:56 2007 +0100
+++ b/src/core/wscript	Fri Jun 15 15:19:38 2007 +0100
@@ -3,6 +3,8 @@
 
 
 def configure(conf):
+    conf.env.append_value('NS3_MODULES', 'ns3-core')
+
     e = conf.create_header_configurator()
     e.mandatory = False
     e.name = 'stdlib.h'
--- a/src/devices/p2p/wscript	Thu Jun 14 13:09:56 2007 +0100
+++ b/src/devices/p2p/wscript	Fri Jun 15 15:19:38 2007 +0100
@@ -1,6 +1,10 @@
 ## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
 
 
+def configure(conf):
+    conf.env.append_value('NS3_MODULES', 'ns3-p2p')
+
+
 def build(bld):
     p2p = bld.create_obj('cpp', 'shlib')
     p2p.name = 'ns3-p2p'
--- a/src/internet-node/wscript	Thu Jun 14 13:09:56 2007 +0100
+++ b/src/internet-node/wscript	Fri Jun 15 15:19:38 2007 +0100
@@ -1,6 +1,10 @@
 ## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
 
 
+def configure(conf):
+    conf.env.append_value('NS3_MODULES', 'ns3-internet-node')
+
+
 def build(bld):
     obj = bld.create_obj('cpp', 'shlib')
     obj.name = 'ns3-internet-node'
--- a/src/node/wscript	Thu Jun 14 13:09:56 2007 +0100
+++ b/src/node/wscript	Fri Jun 15 15:19:38 2007 +0100
@@ -1,5 +1,8 @@
 ## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
 
+def configure(conf):
+    conf.env.append_value('NS3_MODULES', 'ns3-node')
+
 
 def build(bld):
     node = bld.create_obj('cpp', 'shlib')
--- a/src/simulator/wscript	Thu Jun 14 13:09:56 2007 +0100
+++ b/src/simulator/wscript	Fri Jun 15 15:19:38 2007 +0100
@@ -13,6 +13,8 @@
 
 
 def configure(conf):
+    conf.env.append_value('NS3_MODULES', 'ns3-simulator')
+
     if Params.g_options.high_precision_as_double:
         conf.add_define('USE_HIGH_PRECISION_DOUBLE', 1)
         conf.env['USE_HIGH_PRECISION_DOUBLE'] = 1
--- a/src/wscript	Thu Jun 14 13:09:56 2007 +0100
+++ b/src/wscript	Fri Jun 15 15:19:38 2007 +0100
@@ -29,6 +29,7 @@
 
     blddir = os.path.abspath(os.path.join(conf.m_blddir, conf.env.variant()))
     for module in all_modules:
+        conf.sub_config(module)
         conf.env.append_value('NS3_MODULE_PATH', os.path.join(blddir, 'src', module))
 
 
--- a/utils/wscript	Thu Jun 14 13:09:56 2007 +0100
+++ b/utils/wscript	Fri Jun 15 15:19:38 2007 +0100
@@ -1,23 +1,24 @@
 ## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
-import sys
-import Params
 
 
 def build(bld):
+    env = bld.env_of_name('default')
 
     def create_ns_prog(name, source):
         obj = bld.create_obj('cpp', 'program')
         obj.target = name
-        obj.uselib_local = "ns3-core ns3-common ns3-simulator"
         obj.source = source
         return obj
 
     unit_tests = create_ns_prog('run-tests', 'run-tests.cc')
     unit_tests.install_var  = 0 # do not install
     unit_tests.unit_test    = 1 # runs on 'waf check'
+    ## link unit test program with all ns3 modules
+    unit_tests.uselib_local = env['NS3_MODULES']
+    print env['NS3_MODULES']
     
-    #if sys.platform != 'win32':
     obj = create_ns_prog('bench-simulator', 'bench-simulator.cc')
+    obj.uselib_local = "ns3-core ns3-common ns3-simulator"
+
     obj = create_ns_prog('replay-simulation', 'replay-simulation.cc')
-    ## bench-packets requires missing header files
-    #obj = create_ns_prog('bench-packets', 'bench-packets.cc')
+    obj.uselib_local = "ns3-core ns3-common ns3-simulator"