author | Mirko Banchi <mk.banchi@gmail.com> |
Fri, 24 Apr 2009 09:16:28 +0200 | |
changeset 4404 | e10005ac0701 |
parent 4395 | 489abe44ed7e |
child 4470 | 51b5c1a272d3 |
child 4536 | dee7215f0334 |
permissions | -rw-r--r-- |
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
1 |
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
2 |
|
761
0ffbc9fa8ef0
Define env['NS3_MODULE_PATH'] in configure rather than build.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
693
diff
changeset
|
3 |
import os, os.path |
693
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
4 |
import shutil |
1217
2f7791ae388d
WAF: add new bld.create_ns3_module() and bld.create_ns3_program() methods to make declaration of modules and programs simpler, and allowing us to change how ns-3 is built in a centralized way, without needing to change every module wscript file.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1214
diff
changeset
|
5 |
import types |
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
6 |
import warnings |
693
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
7 |
|
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
8 |
import TaskGen |
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
9 |
import Task |
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
10 |
import Options |
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
11 |
import Build |
4326
179f86838e62
Upgrade to WAF 1.5.4
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4164
diff
changeset
|
12 |
import Utils |
693
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
13 |
|
969
3c3ce40492a6
WAF: make list of modules (all_modules) a tuple instead of list, because it is hashable, and this way newer WAF is able to notice changes in it and automatically trigger a reconfiguration.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
968
diff
changeset
|
14 |
all_modules = ( |
600
fd944dbf33c6
WAF: simplify wscripts using the new chained uselib_local dependencies feature of WAF SVN; now build all samples and examples; add --disable-rpath configure option; add WAF build instructions.
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
537
diff
changeset
|
15 |
'core', |
fd944dbf33c6
WAF: simplify wscripts using the new chained uselib_local dependencies feature of WAF SVN; now build all samples and examples; add --disable-rpath configure option; add WAF build instructions.
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
537
diff
changeset
|
16 |
'common', |
fd944dbf33c6
WAF: simplify wscripts using the new chained uselib_local dependencies feature of WAF SVN; now build all samples and examples; add --disable-rpath configure option; add WAF build instructions.
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
537
diff
changeset
|
17 |
'simulator', |
1878
f947cd18f0bb
Create a new contrib module; move event-garbage-collector.{h,cc} to the contrib module.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1877
diff
changeset
|
18 |
'contrib', |
600
fd944dbf33c6
WAF: simplify wscripts using the new chained uselib_local dependencies feature of WAF SVN; now build all samples and examples; add --disable-rpath configure option; add WAF build instructions.
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
537
diff
changeset
|
19 |
'node', |
3260
8c0ab08144e6
bug 186: internet-node directory must be renamed to internet-stack
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3063
diff
changeset
|
20 |
'internet-stack', |
972
6946c8237a73
src/devices/p2p -> src/devices/point-to-point
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
969
diff
changeset
|
21 |
'devices/point-to-point', |
1272 | 22 |
'devices/csma', |
3854 | 23 |
'devices/emu', |
3826
40c5841b616d
merge in tap device
Craig Dowell <craigdo@ee.washington.edu>
parents:
3581
diff
changeset
|
24 |
'devices/bridge', |
4163
8c48682b3d42
checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
4126
diff
changeset
|
25 |
'devices/tap-bridge', |
1496
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
1306
diff
changeset
|
26 |
'applications/onoff', |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
1306
diff
changeset
|
27 |
'applications/packet-sink', |
0ad4c18b475c
start of udp echo applications
Craig Dowell <craigdo@ee.washington.edu>
parents:
1306
diff
changeset
|
28 |
'applications/udp-echo', |
1716
9757633a85da
Add OLSR routing support, (loosely) based on Francisco J. Ros's NS-2 code (University of Murcia).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
969
diff
changeset
|
29 |
'routing/olsr', |
1120 | 30 |
'routing/global-routing', |
968
70d02500c9d5
mobility models
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
955
diff
changeset
|
31 |
'mobility', |
1882
061f7f7f9992
start of work towards port of wifi code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1272
diff
changeset
|
32 |
'devices/wifi', |
2603
1308da4cb3bf
move helpers to their own dir.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2178
diff
changeset
|
33 |
'helper', |
3570
44b0bc6817c6
Stats module and example merged in.
tjkopena@cs.drexel.edu
parents:
3498
diff
changeset
|
34 |
'contrib/stats', |
3821
9ea825f066a2
Apply icmp-application patch frm lacage
Craig Dowell <craigdo@ee.washington.edu>
parents:
3581
diff
changeset
|
35 |
'applications/v4ping', |
969
3c3ce40492a6
WAF: make list of modules (all_modules) a tuple instead of list, because it is hashable, and this way newer WAF is able to notice changes in it and automatically trigger a reconfiguration.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
968
diff
changeset
|
36 |
) |
600
fd944dbf33c6
WAF: simplify wscripts using the new chained uselib_local dependencies feature of WAF SVN; now build all samples and examples; add --disable-rpath configure option; add WAF build instructions.
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
537
diff
changeset
|
37 |
|
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
38 |
def set_options(opt): |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
39 |
opt.sub_options('simulator') |
955
c9be0df711d2
WAF: add back the --enable-rpath option, per Mathieu's request, though disabled by default.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
954
diff
changeset
|
40 |
|
c9be0df711d2
WAF: add back the --enable-rpath option, per Mathieu's request, though disabled by default.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
954
diff
changeset
|
41 |
opt.add_option('--enable-rpath', |
c9be0df711d2
WAF: add back the --enable-rpath option, per Mathieu's request, though disabled by default.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
954
diff
changeset
|
42 |
help=("Link programs with rpath" |
c9be0df711d2
WAF: add back the --enable-rpath option, per Mathieu's request, though disabled by default.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
954
diff
changeset
|
43 |
" (normally not needed, see " |
c9be0df711d2
WAF: add back the --enable-rpath option, per Mathieu's request, though disabled by default.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
954
diff
changeset
|
44 |
" --run and --shell; moreover, only works in some" |
c9be0df711d2
WAF: add back the --enable-rpath option, per Mathieu's request, though disabled by default.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
954
diff
changeset
|
45 |
" specific platforms, such as Linux and Solaris)"), |
c9be0df711d2
WAF: add back the --enable-rpath option, per Mathieu's request, though disabled by default.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
954
diff
changeset
|
46 |
action="store_true", dest='enable_rpath', default=False) |
4164
1f6ae48061a9
checkpoint tap bridge
Craig Dowell <craigdo@ee.washington.edu>
parents:
4163
diff
changeset
|
47 |
|
1858
68e1964c19e8
WAF: add a new --enable-modules configure option, to tell WAF to build only the specified set of ns-3 modules and its dependencies; programs depending on those modules are automatically excluded from the build.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1747
diff
changeset
|
48 |
opt.add_option('--enable-modules', |
68e1964c19e8
WAF: add a new --enable-modules configure option, to tell WAF to build only the specified set of ns-3 modules and its dependencies; programs depending on those modules are automatically excluded from the build.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1747
diff
changeset
|
49 |
help=("Build only these modules (and dependencies)"), |
68e1964c19e8
WAF: add a new --enable-modules configure option, to tell WAF to build only the specified set of ns-3 modules and its dependencies; programs depending on those modules are automatically excluded from the build.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1747
diff
changeset
|
50 |
dest='enable_modules') |
68e1964c19e8
WAF: add a new --enable-modules configure option, to tell WAF to build only the specified set of ns-3 modules and its dependencies; programs depending on those modules are automatically excluded from the build.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1747
diff
changeset
|
51 |
|
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
52 |
def configure(conf): |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
53 |
conf.sub_config('core') |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
54 |
conf.sub_config('simulator') |
3854 | 55 |
conf.sub_config('devices/emu') |
4163
8c48682b3d42
checkpoint tap development
Craig Dowell <craigdo@ee.washington.edu>
parents:
4126
diff
changeset
|
56 |
conf.sub_config('devices/tap-bridge') |
3063
a1c532e3bf18
a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3001
diff
changeset
|
57 |
conf.sub_config('contrib') |
3579
9e5eaef3e082
nsc: enable network simulation cradle
Florian Westphal <fw@strlen.de>
parents:
3498
diff
changeset
|
58 |
conf.sub_config('internet-stack') |
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
59 |
|
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
60 |
blddir = os.path.abspath(os.path.join(conf.blddir, conf.env.variant())) |
3498
ce35418645e9
bug 266: src/wscript unconditionally sets conf.env['NS3_MODULE_PATH']
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3439
diff
changeset
|
61 |
conf.env.append_value('NS3_MODULE_PATH', blddir) |
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
62 |
if Options.options.enable_rpath: |
1306
8834e434187f
Build the ns3 library in the build/<variant> root, not in build/<variant>/src.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1272
diff
changeset
|
63 |
conf.env.append_value('RPATH', '-Wl,-rpath=%s' % (os.path.join(blddir),)) |
761
0ffbc9fa8ef0
Define env['NS3_MODULE_PATH'] in configure rather than build.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
693
diff
changeset
|
64 |
|
928
218063b19458
WAF: derive the variable NS3_MODULES from the 'all_modules' list in src/wscript, instead of requiring every module to define a configure function to register themselves. This way module registration is done in one place only: src/wscript. Requires module naming conventions, though.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
770
diff
changeset
|
65 |
## Used to link the 'run-tests' program with all of ns-3 code |
218063b19458
WAF: derive the variable NS3_MODULES from the 'all_modules' list in src/wscript, instead of requiring every module to define a configure function to register themselves. This way module registration is done in one place only: src/wscript. Requires module naming conventions, though.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
770
diff
changeset
|
66 |
conf.env['NS3_MODULES'] = ['ns3-' + module.split('/')[-1] for module in all_modules] |
218063b19458
WAF: derive the variable NS3_MODULES from the 'all_modules' list in src/wscript, instead of requiring every module to define a configure function to register themselves. This way module registration is done in one place only: src/wscript. Requires module naming conventions, though.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
770
diff
changeset
|
67 |
|
1858
68e1964c19e8
WAF: add a new --enable-modules configure option, to tell WAF to build only the specified set of ns-3 modules and its dependencies; programs depending on those modules are automatically excluded from the build.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1747
diff
changeset
|
68 |
|
1217
2f7791ae388d
WAF: add new bld.create_ns3_module() and bld.create_ns3_program() methods to make declaration of modules and programs simpler, and allowing us to change how ns-3 is built in a centralized way, without needing to change every module wscript file.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1214
diff
changeset
|
69 |
def create_ns3_module(bld, name, dependencies=()): |
4368
fc00cd53d37b
Upgrade to WAF 1.5.5
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4326
diff
changeset
|
70 |
module = bld.new_task_gen('cxx') |
1217
2f7791ae388d
WAF: add new bld.create_ns3_module() and bld.create_ns3_program() methods to make declaration of modules and programs simpler, and allowing us to change how ns-3 is built in a centralized way, without needing to change every module wscript file.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1214
diff
changeset
|
71 |
module.name = 'ns3-' + name |
2f7791ae388d
WAF: add new bld.create_ns3_module() and bld.create_ns3_program() methods to make declaration of modules and programs simpler, and allowing us to change how ns-3 is built in a centralized way, without needing to change every module wscript file.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1214
diff
changeset
|
72 |
module.target = module.name |
1220
4933e0890acd
Build all modules as a single ns3 shared library.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1217
diff
changeset
|
73 |
module.add_objects = ['ns3-' + dep for dep in dependencies] |
2611
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
74 |
module.module_deps = list(dependencies) |
4392
25d38a0c9851
bug 537: no support to build static ns-3 binaries
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4389
diff
changeset
|
75 |
if not module.env['ENABLE_STATIC_NS3']: |
25d38a0c9851
bug 537: no support to build static ns-3 binaries
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4389
diff
changeset
|
76 |
module.env.append_value('CXXFLAGS', module.env['shlib_CXXFLAGS']) |
4395
489abe44ed7e
enable static builds, even when python is enabled
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4392
diff
changeset
|
77 |
elif module.env['CXX_NAME'] == 'gcc' and \ |
489abe44ed7e
enable static builds, even when python is enabled
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4392
diff
changeset
|
78 |
os.uname()[4] == 'x86_64' and \ |
489abe44ed7e
enable static builds, even when python is enabled
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4392
diff
changeset
|
79 |
module.env['ENABLE_PYTHON_BINDINGS']: |
489abe44ed7e
enable static builds, even when python is enabled
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4392
diff
changeset
|
80 |
# enable that flag for static builds only on x86-64 platforms |
489abe44ed7e
enable static builds, even when python is enabled
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4392
diff
changeset
|
81 |
# when gcc is present and only when we want python bindings |
489abe44ed7e
enable static builds, even when python is enabled
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4392
diff
changeset
|
82 |
# (it's more efficient to not use this option if we can avoid it) |
489abe44ed7e
enable static builds, even when python is enabled
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4392
diff
changeset
|
83 |
module.env.append_value('CXXFLAGS', '-mcmodel=large') |
489abe44ed7e
enable static builds, even when python is enabled
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4392
diff
changeset
|
84 |
|
2611
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
85 |
module.env.append_value('CXXDEFINES', "NS3_MODULE_COMPILATION") |
1217
2f7791ae388d
WAF: add new bld.create_ns3_module() and bld.create_ns3_program() methods to make declaration of modules and programs simpler, and allowing us to change how ns-3 is built in a centralized way, without needing to change every module wscript file.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1214
diff
changeset
|
86 |
return module |
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
87 |
|
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
88 |
def create_obj(bld, *args): |
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
89 |
warnings.warn("(in %s) Use bld.new_task_gen(...) now, instead of bld.create_obj(...)" % str(bld.path), |
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
90 |
DeprecationWarning, stacklevel=2) |
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
91 |
return bld.new_task_gen(*args) |
955
c9be0df711d2
WAF: add back the --enable-rpath option, per Mathieu's request, though disabled by default.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
954
diff
changeset
|
92 |
|
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
93 |
def build(bld): |
1217
2f7791ae388d
WAF: add new bld.create_ns3_module() and bld.create_ns3_program() methods to make declaration of modules and programs simpler, and allowing us to change how ns-3 is built in a centralized way, without needing to change every module wscript file.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1214
diff
changeset
|
94 |
bld.create_ns3_module = types.MethodType(create_ns3_module, bld) |
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
95 |
bld.create_obj = types.MethodType(create_obj, bld) |
600
fd944dbf33c6
WAF: simplify wscripts using the new chained uselib_local dependencies feature of WAF SVN; now build all samples and examples; add --disable-rpath configure option; add WAF build instructions.
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
537
diff
changeset
|
96 |
|
969
3c3ce40492a6
WAF: make list of modules (all_modules) a tuple instead of list, because it is hashable, and this way newer WAF is able to notice changes in it and automatically trigger a reconfiguration.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
968
diff
changeset
|
97 |
bld.add_subdirs(list(all_modules)) |
693
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
98 |
|
2611
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
99 |
for module in all_modules: |
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
100 |
modheader = bld.new_task_gen('ns3moduleheader') |
2611
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
101 |
modheader.module = module.split('/')[-1] |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
102 |
|
1220
4933e0890acd
Build all modules as a single ns3 shared library.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1217
diff
changeset
|
103 |
|
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
104 |
class ns3header_taskgen(TaskGen.task_gen): |
693
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
105 |
"""A set of NS-3 header files""" |
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
106 |
COLOR = 'BLUE' |
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
107 |
def __init__(self, *args, **kwargs): |
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
108 |
super(ns3header_taskgen, self).__init__(*args, **kwargs) |
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
109 |
self.install_path = None |
1877
b2ebc493cd58
Add support for publishing ns3 headers in a subdir of ns3/ (we probably won't be needing this, but since it was implemented it might as well be commited, in case we ever need it)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1858
diff
changeset
|
110 |
self.sub_dir = None # if not None, header files will be published as ns3/sub_dir/file.h |
2609
931d59bb1303
Add a 'module' attribute to the ns3header object specifying which module each set of headers belongs to.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2603
diff
changeset
|
111 |
self.module = None # module name |
2611
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
112 |
|
693
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
113 |
def apply(self): |
2609
931d59bb1303
Add a 'module' attribute to the ns3header object specifying which module each set of headers belongs to.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2603
diff
changeset
|
114 |
if self.module is None: |
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
115 |
raise Utils.WafError("'module' missing on ns3headers object %s" % self) |
4326
179f86838e62
Upgrade to WAF 1.5.4
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4164
diff
changeset
|
116 |
ns3_dir_node = self.bld.path.find_dir("ns3") |
1877
b2ebc493cd58
Add support for publishing ns3 headers in a subdir of ns3/ (we probably won't be needing this, but since it was implemented it might as well be commited, in case we ever need it)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1858
diff
changeset
|
117 |
if self.sub_dir is not None: |
b2ebc493cd58
Add support for publishing ns3 headers in a subdir of ns3/ (we probably won't be needing this, but since it was implemented it might as well be commited, in case we ever need it)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1858
diff
changeset
|
118 |
ns3_dir_node = ns3_dir_node.find_dir(self.sub_dir) |
693
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
119 |
for filename in self.to_list(self.source): |
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
120 |
src_node = self.path.find_resource(filename) |
693
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
121 |
if src_node is None: |
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
122 |
raise Utils.WafError("source ns3 header file %s not found" % (filename,)) |
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
123 |
dst_node = ns3_dir_node.find_or_declare(os.path.basename(filename)) |
693
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
124 |
assert dst_node is not None |
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
125 |
task = self.create_task('ns3header', self.env) |
954
a54d59850d03
WAF: use a separate 'waf task' for installing each public ns3 header to work around a dependency tracking bug in waf causing too many rebuilds when a single header file changes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
928
diff
changeset
|
126 |
task.set_inputs([src_node]) |
a54d59850d03
WAF: use a separate 'waf task' for installing each public ns3 header to work around a dependency tracking bug in waf causing too many rebuilds when a single header file changes.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
928
diff
changeset
|
127 |
task.set_outputs([dst_node]) |
693
c8fc89076aa2
WAF: cleanup the main wscript file by moving the definition of the ns3header object type into src/wscript
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
672
diff
changeset
|
128 |
|
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
129 |
class ns3header_task(Task.Task): |
4066
d2309cf765d8
Fix --python-scan
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4064
diff
changeset
|
130 |
before = 'cc cxx gen_ns3_module_header_task' |
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
131 |
color = 'BLUE' |
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
132 |
def run(self): |
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
133 |
assert len(self.inputs) == len(self.outputs) |
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
134 |
inputs = [node.srcpath(self.env) for node in self.inputs] |
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
135 |
outputs = [node.bldpath(self.env) for node in self.outputs] |
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
136 |
for src, dst in zip(inputs, outputs): |
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
137 |
try: |
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
138 |
os.chmod(dst, 0600) |
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
139 |
except OSError: |
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
140 |
pass |
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
141 |
shutil.copy2(src, dst) |
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
142 |
## make the headers in builddir read-only, to prevent |
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
143 |
## accidental modification |
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
144 |
os.chmod(dst, 0400) |
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
145 |
return 0 |
2611
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
146 |
|
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
147 |
|
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
148 |
|
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
149 |
class gen_ns3_module_header_task(Task.Task): |
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
150 |
before = 'cc cxx' |
4066
d2309cf765d8
Fix --python-scan
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4064
diff
changeset
|
151 |
after = 'ns3header_task' |
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
152 |
color = 'BLUE' |
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
153 |
def run(self): |
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
154 |
assert len(self.outputs) == 1 |
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
155 |
header_files = [os.path.basename(node.abspath(self.env)) for node in self.inputs] |
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
156 |
outfile = file(self.outputs[0].bldpath(self.env), "w") |
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
157 |
header_files.sort() |
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
158 |
|
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
159 |
print >> outfile, """ |
2611
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
160 |
#ifdef NS3_MODULE_COMPILATION |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
161 |
# error "Do not include ns3 module aggregator headers from other modules; these are meant only for end user scripts." |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
162 |
#endif |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
163 |
|
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
164 |
#ifndef NS3_MODULE_%s |
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
165 |
""" % (self.module.upper().replace('-', '_'),) |
2611
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
166 |
|
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
167 |
# if self.module_deps: |
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
168 |
# print >> outfile, "// Module dependencies:" |
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
169 |
# for dep in self.module_deps: |
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
170 |
# print >> outfile, "#include \"%s-module.h\"" % dep |
2611
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
171 |
|
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
172 |
print >> outfile |
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
173 |
print >> outfile, "// Module headers:" |
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
174 |
for header in header_files: |
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
175 |
print >> outfile, "#include \"%s\"" % (header,) |
2611
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
176 |
|
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
177 |
print >> outfile, "#endif" |
2611
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
178 |
|
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
179 |
outfile.close() |
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
180 |
return 0 |
2611
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
181 |
|
4126
0ba0346d655b
Workaround WAF issue 325 for generating module header files
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4066
diff
changeset
|
182 |
def sig_explicit_deps(self): |
4326
179f86838e62
Upgrade to WAF 1.5.4
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4164
diff
changeset
|
183 |
m = Utils.md5() |
4126
0ba0346d655b
Workaround WAF issue 325 for generating module header files
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4066
diff
changeset
|
184 |
m.update('\n'.join([node.abspath(self.env) for node in self.inputs])) |
0ba0346d655b
Workaround WAF issue 325 for generating module header files
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4066
diff
changeset
|
185 |
return m.digest() |
0ba0346d655b
Workaround WAF issue 325 for generating module header files
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4066
diff
changeset
|
186 |
|
0ba0346d655b
Workaround WAF issue 325 for generating module header files
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4066
diff
changeset
|
187 |
def unique_id(self): |
0ba0346d655b
Workaround WAF issue 325 for generating module header files
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4066
diff
changeset
|
188 |
try: |
0ba0346d655b
Workaround WAF issue 325 for generating module header files
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4066
diff
changeset
|
189 |
return self.uid |
0ba0346d655b
Workaround WAF issue 325 for generating module header files
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4066
diff
changeset
|
190 |
except AttributeError: |
0ba0346d655b
Workaround WAF issue 325 for generating module header files
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4066
diff
changeset
|
191 |
"this is not a real hot zone, but we want to avoid surprizes here" |
4326
179f86838e62
Upgrade to WAF 1.5.4
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4164
diff
changeset
|
192 |
m = Utils.md5() |
4126
0ba0346d655b
Workaround WAF issue 325 for generating module header files
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4066
diff
changeset
|
193 |
m.update("ns-3-module-header-%s" % self.module) |
0ba0346d655b
Workaround WAF issue 325 for generating module header files
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4066
diff
changeset
|
194 |
self.uid = m.digest() |
0ba0346d655b
Workaround WAF issue 325 for generating module header files
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4066
diff
changeset
|
195 |
return self.uid |
0ba0346d655b
Workaround WAF issue 325 for generating module header files
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4066
diff
changeset
|
196 |
|
2611
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
197 |
|
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
198 |
class ns3moduleheader_taskgen(TaskGen.task_gen): |
2611
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
199 |
""" |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
200 |
Generates a 'ns3/foo-module.h' header file that includes all |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
201 |
public ns3 headers of a certain module. |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
202 |
""" |
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
203 |
COLOR = 'BLUE' |
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
204 |
def __init__(self, *args, **kwargs): |
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
205 |
super(ns3moduleheader_taskgen, self).__init__(*args, **kwargs) |
2611
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
206 |
|
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
207 |
def apply(self): |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
208 |
## get all of the ns3 headers |
4326
179f86838e62
Upgrade to WAF 1.5.4
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4164
diff
changeset
|
209 |
ns3_dir_node = self.bld.path.find_dir("ns3") |
2611
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
210 |
all_headers_inputs = [] |
4326
179f86838e62
Upgrade to WAF 1.5.4
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4164
diff
changeset
|
211 |
for ns3headers in self.bld.all_task_gen: |
3001
f7aa2796627f
WAF: convert code to WAF 1.4 API; the 'waf' script bundle will be updated later, for now has been disabled.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2750
diff
changeset
|
212 |
if isinstance(ns3headers, ns3header_taskgen): |
2611
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
213 |
if ns3headers.module != self.module: |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
214 |
continue |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
215 |
for source in ns3headers.to_list(ns3headers.source): |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
216 |
source = os.path.basename(source) |
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
217 |
node = ns3_dir_node.find_or_declare(os.path.basename(source)) |
2611
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
218 |
if node is None: |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
219 |
fatal("missing header file %s" % (source,)) |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
220 |
all_headers_inputs.append(node) |
4326
179f86838e62
Upgrade to WAF 1.5.4
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4164
diff
changeset
|
221 |
if not all_headers_inputs: |
179f86838e62
Upgrade to WAF 1.5.4
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4164
diff
changeset
|
222 |
raise Utils.WscriptError("error finding headers for module %s" % self.module) |
2611
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
223 |
assert all_headers_inputs |
4326
179f86838e62
Upgrade to WAF 1.5.4
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4164
diff
changeset
|
224 |
module_obj = self.bld.name_to_obj("ns3-" + self.module, self.env) |
2611
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
225 |
assert module_obj is not None |
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
226 |
all_headers_outputs = [ns3_dir_node.find_or_declare("%s-module.h" % self.module)] |
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
227 |
task = self.create_task('gen_ns3_module_header', self.env) |
2611
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
228 |
task.set_inputs(all_headers_inputs) |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
229 |
task.set_outputs(all_headers_outputs) |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
230 |
task.module = self.module |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
231 |
task.module_deps = module_obj.module_deps |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
232 |
|
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
233 |
def install(self): |
79b1c42fef3e
Generate foo-module.h module aggreator header files, for use in user scripts.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2609
diff
changeset
|
234 |
pass |