author | Tom Henderson <tomh@tomh.org> |
Wed, 09 Sep 2015 15:14:27 -0700 | |
changeset 11661 | 68c0e7f87bdf |
parent 11660 | 47325a00bda8 |
permissions | -rw-r--r-- |
11275
00495fc6dd11
Handle broken versions of Clang better
Vedran Miletić <rivanvx@gmail.com>
parents:
11183
diff
changeset
|
1 |
|
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
2 |
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- |
11634
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11521
diff
changeset
|
3 |
from __future__ import print_function |
761
0ffbc9fa8ef0
Define env['NS3_MODULE_PATH'] in configure rather than build.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
693
diff
changeset
|
4 |
import os, os.path |
7291
d39c09dbc3d9
Make emu and template modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7237
diff
changeset
|
5 |
import sys |
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
|
6 |
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
|
7 |
import types |
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
8 |
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
|
9 |
|
9278
0a749c0f1afd
Fix Python bindings and openflow for waf 1.7.10 upgrade and take care about boost requirements globally
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
9173
diff
changeset
|
10 |
from waflib import TaskGen, Task, Options, Build, Utils |
7488
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
11 |
from waflib.Errors import WafError |
7319
175c382cfab0
Bug 1175 - the shared libraries is not versioned, based on patch by YunQiang Su
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7303
diff
changeset
|
12 |
import wutils |
175c382cfab0
Bug 1175 - the shared libraries is not versioned, based on patch by YunQiang Su
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7303
diff
changeset
|
13 |
|
6168
c737d0a0e9a0
Bug 860: waf dies while executing ns3header task in case of parallel jobs.
Andrey Mazo <mazo@iitp.ru>
parents:
6127
diff
changeset
|
14 |
try: |
c737d0a0e9a0
Bug 860: waf dies while executing ns3header task in case of parallel jobs.
Andrey Mazo <mazo@iitp.ru>
parents:
6127
diff
changeset
|
15 |
set |
c737d0a0e9a0
Bug 860: waf dies while executing ns3header task in case of parallel jobs.
Andrey Mazo <mazo@iitp.ru>
parents:
6127
diff
changeset
|
16 |
except NameError: |
c737d0a0e9a0
Bug 860: waf dies while executing ns3header task in case of parallel jobs.
Andrey Mazo <mazo@iitp.ru>
parents:
6127
diff
changeset
|
17 |
from sets import Set as set # Python 2.3 fallback |
c737d0a0e9a0
Bug 860: waf dies while executing ns3header task in case of parallel jobs.
Andrey Mazo <mazo@iitp.ru>
parents:
6127
diff
changeset
|
18 |
|
7496
ce1ec79d488c
waf1.6: make the all_modules in src/wscript be automatically discovered
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7494
diff
changeset
|
19 |
|
10713
84e9327f67ba
align lr-wpan with ns-3.13 spectrum API changes
Gary Pei <guangyu.pei@boeing.com>
parents:
10658
diff
changeset
|
20 |
|
7496
ce1ec79d488c
waf1.6: make the all_modules in src/wscript be automatically discovered
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7494
diff
changeset
|
21 |
all_modules = [] |
ce1ec79d488c
waf1.6: make the all_modules in src/wscript be automatically discovered
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7494
diff
changeset
|
22 |
for dirname in os.listdir('src'): |
7675 | 23 |
if dirname.startswith('.') or dirname == 'CVS': |
7496
ce1ec79d488c
waf1.6: make the all_modules in src/wscript be automatically discovered
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7494
diff
changeset
|
24 |
continue |
ce1ec79d488c
waf1.6: make the all_modules in src/wscript be automatically discovered
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7494
diff
changeset
|
25 |
path = os.path.join('src', dirname) |
ce1ec79d488c
waf1.6: make the all_modules in src/wscript be automatically discovered
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7494
diff
changeset
|
26 |
if not os.path.isdir(path): |
ce1ec79d488c
waf1.6: make the all_modules in src/wscript be automatically discovered
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7494
diff
changeset
|
27 |
continue |
ce1ec79d488c
waf1.6: make the all_modules in src/wscript be automatically discovered
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7494
diff
changeset
|
28 |
if os.path.exists(os.path.join(path, 'wscript')): |
ce1ec79d488c
waf1.6: make the all_modules in src/wscript be automatically discovered
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7494
diff
changeset
|
29 |
all_modules.append(dirname) |
ce1ec79d488c
waf1.6: make the all_modules in src/wscript be automatically discovered
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7494
diff
changeset
|
30 |
all_modules.sort() |
ce1ec79d488c
waf1.6: make the all_modules in src/wscript be automatically discovered
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7494
diff
changeset
|
31 |
|
ce1ec79d488c
waf1.6: make the all_modules in src/wscript be automatically discovered
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7494
diff
changeset
|
32 |
|
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
|
33 |
|
7488
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
34 |
def options(opt): |
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
|
35 |
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
|
36 |
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
|
37 |
" (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
|
38 |
" --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
|
39 |
" 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
|
40 |
action="store_true", dest='enable_rpath', default=False) |
4164
1f6ae48061a9
checkpoint tap bridge
Craig Dowell <craigdo@ee.washington.edu>
parents:
4163
diff
changeset
|
41 |
|
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
|
42 |
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
|
43 |
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
|
44 |
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
|
45 |
|
9278
0a749c0f1afd
Fix Python bindings and openflow for waf 1.7.10 upgrade and take care about boost requirements globally
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
9173
diff
changeset
|
46 |
opt.load('boost', tooldir=['waf-tools']) |
0a749c0f1afd
Fix Python bindings and openflow for waf 1.7.10 upgrade and take care about boost requirements globally
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
9173
diff
changeset
|
47 |
|
7496
ce1ec79d488c
waf1.6: make the all_modules in src/wscript be automatically discovered
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7494
diff
changeset
|
48 |
for module in all_modules: |
9278
0a749c0f1afd
Fix Python bindings and openflow for waf 1.7.10 upgrade and take care about boost requirements globally
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
9173
diff
changeset
|
49 |
opt.recurse(module, mandatory=False) |
7496
ce1ec79d488c
waf1.6: make the all_modules in src/wscript be automatically discovered
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7494
diff
changeset
|
50 |
|
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
51 |
def configure(conf): |
9278
0a749c0f1afd
Fix Python bindings and openflow for waf 1.7.10 upgrade and take care about boost requirements globally
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
9173
diff
changeset
|
52 |
conf.env['REQUIRED_BOOST_LIBS'] = [] |
7496
ce1ec79d488c
waf1.6: make the all_modules in src/wscript be automatically discovered
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7494
diff
changeset
|
53 |
for module in all_modules: |
9278
0a749c0f1afd
Fix Python bindings and openflow for waf 1.7.10 upgrade and take care about boost requirements globally
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
9173
diff
changeset
|
54 |
conf.recurse (module, name="required_boost_libs", mandatory=False) |
0a749c0f1afd
Fix Python bindings and openflow for waf 1.7.10 upgrade and take care about boost requirements globally
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
9173
diff
changeset
|
55 |
|
0a749c0f1afd
Fix Python bindings and openflow for waf 1.7.10 upgrade and take care about boost requirements globally
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
9173
diff
changeset
|
56 |
if conf.env['REQUIRED_BOOST_LIBS'] is not []: |
0a749c0f1afd
Fix Python bindings and openflow for waf 1.7.10 upgrade and take care about boost requirements globally
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
9173
diff
changeset
|
57 |
conf.load('boost') |
0a749c0f1afd
Fix Python bindings and openflow for waf 1.7.10 upgrade and take care about boost requirements globally
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
9173
diff
changeset
|
58 |
conf.check_boost(lib=' '.join (conf.env['REQUIRED_BOOST_LIBS']), mandatory=False) |
0a749c0f1afd
Fix Python bindings and openflow for waf 1.7.10 upgrade and take care about boost requirements globally
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
9173
diff
changeset
|
59 |
if not conf.env['LIB_BOOST']: |
0a749c0f1afd
Fix Python bindings and openflow for waf 1.7.10 upgrade and take care about boost requirements globally
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
9173
diff
changeset
|
60 |
conf.check_boost(lib=' '.join (conf.env['REQUIRED_BOOST_LIBS']), libpath="/usr/lib64", mandatory=False) |
0a749c0f1afd
Fix Python bindings and openflow for waf 1.7.10 upgrade and take care about boost requirements globally
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
9173
diff
changeset
|
61 |
if not conf.env['LIB_BOOST']: |
0a749c0f1afd
Fix Python bindings and openflow for waf 1.7.10 upgrade and take care about boost requirements globally
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
9173
diff
changeset
|
62 |
conf.env['LIB_BOOST'] = [] |
0a749c0f1afd
Fix Python bindings and openflow for waf 1.7.10 upgrade and take care about boost requirements globally
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
9173
diff
changeset
|
63 |
|
10658
2a407999964e
bug 1869: append local build directory before recursing into modules
Tom Henderson <tomh@tomh.org>
parents:
9278
diff
changeset
|
64 |
# Append blddir to the module path before recursing into modules |
2a407999964e
bug 1869: append local build directory before recursing into modules
Tom Henderson <tomh@tomh.org>
parents:
9278
diff
changeset
|
65 |
blddir = os.path.abspath(os.path.join(conf.bldnode.abspath(), conf.variant)) |
2a407999964e
bug 1869: append local build directory before recursing into modules
Tom Henderson <tomh@tomh.org>
parents:
9278
diff
changeset
|
66 |
conf.env.append_value('NS3_MODULE_PATH', blddir) |
2a407999964e
bug 1869: append local build directory before recursing into modules
Tom Henderson <tomh@tomh.org>
parents:
9278
diff
changeset
|
67 |
|
9278
0a749c0f1afd
Fix Python bindings and openflow for waf 1.7.10 upgrade and take care about boost requirements globally
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
9173
diff
changeset
|
68 |
for module in all_modules: |
0a749c0f1afd
Fix Python bindings and openflow for waf 1.7.10 upgrade and take care about boost requirements globally
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
9173
diff
changeset
|
69 |
conf.recurse(module, mandatory=False) |
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
70 |
|
10658
2a407999964e
bug 1869: append local build directory before recursing into modules
Tom Henderson <tomh@tomh.org>
parents:
9278
diff
changeset
|
71 |
# Remove duplicate path items |
2a407999964e
bug 1869: append local build directory before recursing into modules
Tom Henderson <tomh@tomh.org>
parents:
9278
diff
changeset
|
72 |
conf.env['NS3_MODULE_PATH'] = wutils.uniquify_list(conf.env['NS3_MODULE_PATH']) |
2a407999964e
bug 1869: append local build directory before recursing into modules
Tom Henderson <tomh@tomh.org>
parents:
9278
diff
changeset
|
73 |
|
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
74 |
if Options.options.enable_rpath: |
9173
513f8ec65729
bug 1525 Linker error with mpi on Mac 10.8
Brian Swenson <bswenson3@gatech.edu>
parents:
8894
diff
changeset
|
75 |
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
|
76 |
|
5361
e8989b44bffb
Doxygen and wscript messages point to test.py
Craig Dowell <craigdo@ee.washington.edu>
parents:
5270
diff
changeset
|
77 |
## Used to link the 'test-runner' program with all of ns-3 code |
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
|
78 |
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
|
79 |
|
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
|
80 |
|
7331
827246e3bc4c
Bug 1174 - Ns-3 does not generate static libraries
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7320
diff
changeset
|
81 |
|
7492
5299fc683dfa
Clean some dead waf code
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7490
diff
changeset
|
82 |
# we need the 'ns3module' waf "feature" to be created because code |
5299fc683dfa
Clean some dead waf code
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7490
diff
changeset
|
83 |
# elsewhere looks for it to find the ns3 module objects. |
7488
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
84 |
@TaskGen.feature('ns3module') |
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
85 |
def _add_test_code(module): |
7492
5299fc683dfa
Clean some dead waf code
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7490
diff
changeset
|
86 |
pass |
7488
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
87 |
|
7016
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
88 |
def create_ns3_module(bld, name, dependencies=(), test=False): |
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
89 |
static = bool(bld.env.ENABLE_STATIC_NS3) |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
90 |
# Create a separate library for this module. |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
91 |
if static: |
9278
0a749c0f1afd
Fix Python bindings and openflow for waf 1.7.10 upgrade and take care about boost requirements globally
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
9173
diff
changeset
|
92 |
module = bld(features='cxx cxxstlib ns3module') |
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
93 |
else: |
9278
0a749c0f1afd
Fix Python bindings and openflow for waf 1.7.10 upgrade and take care about boost requirements globally
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
9173
diff
changeset
|
94 |
module = bld(features='cxx cxxshlib ns3module') |
0a749c0f1afd
Fix Python bindings and openflow for waf 1.7.10 upgrade and take care about boost requirements globally
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
9173
diff
changeset
|
95 |
module.target = '%s/ns%s-%s%s' % (bld.srcnode.path_from(module.path), wutils.VERSION, |
8894
90d67c5e8255
Bug 1445 - When build with "-d release", don't suffix "-release"
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
8702
diff
changeset
|
96 |
name, bld.env.BUILD_SUFFIX) |
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
97 |
linkflags = [] |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
98 |
cxxflags = [] |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
99 |
ccflags = [] |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
100 |
if not static: |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
101 |
cxxflags = module.env['shlib_CXXFLAGS'] |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
102 |
ccflags = module.env['shlib_CXXFLAGS'] |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
103 |
# Turn on the link flags for shared libraries if we have the |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
104 |
# proper compiler and platform. |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
105 |
if module.env['CXX_NAME'] in ['gcc', 'icc'] and module.env['WL_SONAME_SUPPORTED']: |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
106 |
# Get the module library name without any relative paths |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
107 |
# at its beginning because all of the libraries will end |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
108 |
# up in the same directory. |
7489
994360413f55
waf 1.6: bring back -Wl,--soname, fix waf warnings
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7488
diff
changeset
|
109 |
module_library_name = module.env.cshlib_PATTERN % (os.path.basename(module.target),) |
994360413f55
waf 1.6: bring back -Wl,--soname, fix waf warnings
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7488
diff
changeset
|
110 |
linkflags = '-Wl,--soname=' + module_library_name |
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
111 |
cxxdefines = ["NS3_MODULE_COMPILATION"] |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
112 |
ccdefines = ["NS3_MODULE_COMPILATION"] |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
113 |
|
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
114 |
module.env.append_value('CXXFLAGS', cxxflags) |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
115 |
module.env.append_value('CCFLAGS', ccflags) |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
116 |
module.env.append_value('LINKFLAGS', linkflags) |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
117 |
module.env.append_value('CXXDEFINES', cxxdefines) |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
118 |
module.env.append_value('CCDEFINES', ccdefines) |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
119 |
|
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
120 |
module.is_static = static |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
121 |
module.vnum = wutils.VNUM |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
122 |
# Add the proper path to the module's name. |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
123 |
# Set the libraries this module depends on. |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
124 |
module.module_deps = list(dependencies) |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
125 |
|
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
126 |
module.install_path = "${LIBDIR}" |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
127 |
|
7331
827246e3bc4c
Bug 1174 - Ns-3 does not generate static libraries
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7320
diff
changeset
|
128 |
module.name = "ns3-" + name |
827246e3bc4c
Bug 1174 - Ns-3 does not generate static libraries
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7320
diff
changeset
|
129 |
module.dependencies = dependencies |
7023
af9c5ac72f2c
Make examples and tests be enabled from the .ns3rc file
Mitch Watrous <watrous@u.washington.edu>
parents:
7021
diff
changeset
|
130 |
# Initially create an empty value for this because the pcfile |
af9c5ac72f2c
Make examples and tests be enabled from the .ns3rc file
Mitch Watrous <watrous@u.washington.edu>
parents:
7021
diff
changeset
|
131 |
# writing task assumes every module has a uselib attribute. |
af9c5ac72f2c
Make examples and tests be enabled from the .ns3rc file
Mitch Watrous <watrous@u.washington.edu>
parents:
7021
diff
changeset
|
132 |
module.uselib = '' |
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
133 |
module.use = ['ns3-' + dep for dep in dependencies] |
7331
827246e3bc4c
Bug 1174 - Ns-3 does not generate static libraries
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7320
diff
changeset
|
134 |
module.test = test |
827246e3bc4c
Bug 1174 - Ns-3 does not generate static libraries
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7320
diff
changeset
|
135 |
module.is_ns3_module = True |
9278
0a749c0f1afd
Fix Python bindings and openflow for waf 1.7.10 upgrade and take care about boost requirements globally
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
9173
diff
changeset
|
136 |
module.ns3_dir_location = bld.path.path_from(bld.srcnode) |
7331
827246e3bc4c
Bug 1174 - Ns-3 does not generate static libraries
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7320
diff
changeset
|
137 |
|
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
138 |
module.env.append_value("INCLUDES", '#') |
7511
6d03bec01c5c
Fix .pc file generation
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7496
diff
changeset
|
139 |
|
7681
0873edb445e8
Bug 1327 - Version installed ns-3 files
Gustavo Carneiro / Vedran Miletić
parents:
7679
diff
changeset
|
140 |
module.pcfilegen = bld(features='ns3pcfile') |
7821
270a2b7f82ad
Bug 1406 - waf exits with maximum recursion depth exceeded while calling a Python object if wscript has wrong filename
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7688
diff
changeset
|
141 |
module.pcfilegen.module = module.name |
7488
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
142 |
|
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
143 |
return module |
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
144 |
|
7488
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
145 |
@TaskGen.feature("ns3testlib") |
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
146 |
@TaskGen.before_method("apply_incpaths") |
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
147 |
def apply_incpaths_ns3testlib(self): |
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
148 |
if not self.source: |
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
149 |
return |
9278
0a749c0f1afd
Fix Python bindings and openflow for waf 1.7.10 upgrade and take care about boost requirements globally
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
9173
diff
changeset
|
150 |
testdir = self.source[-1].parent.path_from(self.bld.srcnode) |
7488
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
151 |
self.env.append_value("DEFINES", 'NS_TEST_SOURCEDIR="%s"' % (testdir,)) |
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
152 |
|
7331
827246e3bc4c
Bug 1174 - Ns-3 does not generate static libraries
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7320
diff
changeset
|
153 |
|
6913
54679ab32585
Create separate module and test-module libraries
Mitch Watrous <watrous@u.washington.edu>
parents:
6902
diff
changeset
|
154 |
def create_ns3_module_test_library(bld, name): |
54679ab32585
Create separate module and test-module libraries
Mitch Watrous <watrous@u.washington.edu>
parents:
6902
diff
changeset
|
155 |
# Create an ns3 module for the test library that depends only on |
54679ab32585
Create separate module and test-module libraries
Mitch Watrous <watrous@u.washington.edu>
parents:
6902
diff
changeset
|
156 |
# the module being tested. |
54679ab32585
Create separate module and test-module libraries
Mitch Watrous <watrous@u.washington.edu>
parents:
6902
diff
changeset
|
157 |
library_name = name + "-test" |
7488
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
158 |
library = bld.create_ns3_module(library_name, [name], test=True) |
9278
0a749c0f1afd
Fix Python bindings and openflow for waf 1.7.10 upgrade and take care about boost requirements globally
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
9173
diff
changeset
|
159 |
library.features += " ns3testlib" |
6913
54679ab32585
Create separate module and test-module libraries
Mitch Watrous <watrous@u.washington.edu>
parents:
6902
diff
changeset
|
160 |
|
54679ab32585
Create separate module and test-module libraries
Mitch Watrous <watrous@u.washington.edu>
parents:
6902
diff
changeset
|
161 |
# Modify attributes for the test library that are different from a |
54679ab32585
Create separate module and test-module libraries
Mitch Watrous <watrous@u.washington.edu>
parents:
6902
diff
changeset
|
162 |
# normal module. |
54679ab32585
Create separate module and test-module libraries
Mitch Watrous <watrous@u.washington.edu>
parents:
6902
diff
changeset
|
163 |
del library.is_ns3_module |
54679ab32585
Create separate module and test-module libraries
Mitch Watrous <watrous@u.washington.edu>
parents:
6902
diff
changeset
|
164 |
library.is_ns3_module_test_library = True |
54679ab32585
Create separate module and test-module libraries
Mitch Watrous <watrous@u.washington.edu>
parents:
6902
diff
changeset
|
165 |
library.module_name = 'ns3-' + name |
54679ab32585
Create separate module and test-module libraries
Mitch Watrous <watrous@u.washington.edu>
parents:
6902
diff
changeset
|
166 |
|
6925
43d9c7eedf7b
Test implicitly dependent modules
Mitch Watrous <watrous@u.washington.edu>
parents:
6921
diff
changeset
|
167 |
# Add this module and test library to the list. |
7488
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
168 |
bld.env.append_value('NS3_MODULES_WITH_TEST_LIBRARIES', [(library.module_name, library.name)]) |
6913
54679ab32585
Create separate module and test-module libraries
Mitch Watrous <watrous@u.washington.edu>
parents:
6902
diff
changeset
|
169 |
|
54679ab32585
Create separate module and test-module libraries
Mitch Watrous <watrous@u.washington.edu>
parents:
6902
diff
changeset
|
170 |
# Set the include path from the build directory to modules. |
9278
0a749c0f1afd
Fix Python bindings and openflow for waf 1.7.10 upgrade and take care about boost requirements globally
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
9173
diff
changeset
|
171 |
relative_path_from_build_to_here = bld.path.path_from(bld.bldnode) |
6913
54679ab32585
Create separate module and test-module libraries
Mitch Watrous <watrous@u.washington.edu>
parents:
6902
diff
changeset
|
172 |
include_flag = '-I' + relative_path_from_build_to_here |
54679ab32585
Create separate module and test-module libraries
Mitch Watrous <watrous@u.washington.edu>
parents:
6902
diff
changeset
|
173 |
library.env.append_value('CXXFLAGS', include_flag) |
54679ab32585
Create separate module and test-module libraries
Mitch Watrous <watrous@u.washington.edu>
parents:
6902
diff
changeset
|
174 |
library.env.append_value('CCFLAGS', include_flag) |
54679ab32585
Create separate module and test-module libraries
Mitch Watrous <watrous@u.washington.edu>
parents:
6902
diff
changeset
|
175 |
|
54679ab32585
Create separate module and test-module libraries
Mitch Watrous <watrous@u.washington.edu>
parents:
6902
diff
changeset
|
176 |
return library |
54679ab32585
Create separate module and test-module libraries
Mitch Watrous <watrous@u.washington.edu>
parents:
6902
diff
changeset
|
177 |
|
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
178 |
def create_obj(bld, *args): |
9278
0a749c0f1afd
Fix Python bindings and openflow for waf 1.7.10 upgrade and take care about boost requirements globally
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
9173
diff
changeset
|
179 |
warnings.warn("(in %s) Use bld(...) call now, instead of bld.create_obj(...)" % str(bld.path), |
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
180 |
DeprecationWarning, stacklevel=2) |
9278
0a749c0f1afd
Fix Python bindings and openflow for waf 1.7.10 upgrade and take care about boost requirements globally
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
9173
diff
changeset
|
181 |
return bld(*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
|
182 |
|
6874
c7537e62f2fa
Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
183 |
|
c7537e62f2fa
Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
184 |
def ns3_python_bindings(bld): |
7490
886cf992ade6
waf 1.6: fix python bindings apiscan
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7489
diff
changeset
|
185 |
|
6933
4bbaa92c3220
./waf --apiscan=all: now only scans modules that have bld.ns3_python_bindings() in their wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6925
diff
changeset
|
186 |
# this method is called from a module wscript, so remember bld.path is not bindings/python! |
4bbaa92c3220
./waf --apiscan=all: now only scans modules that have bld.ns3_python_bindings() in their wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6925
diff
changeset
|
187 |
module_abs_src_path = bld.path.abspath() |
4bbaa92c3220
./waf --apiscan=all: now only scans modules that have bld.ns3_python_bindings() in their wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6925
diff
changeset
|
188 |
module = os.path.basename(module_abs_src_path) |
6874
c7537e62f2fa
Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
189 |
env = bld.env |
6933
4bbaa92c3220
./waf --apiscan=all: now only scans modules that have bld.ns3_python_bindings() in their wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6925
diff
changeset
|
190 |
env.append_value("MODULAR_BINDINGS_MODULES", "ns3-"+module) |
4bbaa92c3220
./waf --apiscan=all: now only scans modules that have bld.ns3_python_bindings() in their wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6925
diff
changeset
|
191 |
|
7583
e42004e38839
Fix issue with waf --apiscan=all
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7545
diff
changeset
|
192 |
if Options.options.apiscan: |
e42004e38839
Fix issue with waf --apiscan=all
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7545
diff
changeset
|
193 |
return |
e42004e38839
Fix issue with waf --apiscan=all
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7545
diff
changeset
|
194 |
|
6874
c7537e62f2fa
Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
195 |
if not env['ENABLE_PYTHON_BINDINGS']: |
c7537e62f2fa
Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
196 |
return |
c7537e62f2fa
Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
197 |
|
6942
3b9ce3a727a5
./waf --apiscan: fix bug in detection of whether the per-module bindings dir exists
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6941
diff
changeset
|
198 |
bindings_dir = bld.path.find_dir("bindings") |
3b9ce3a727a5
./waf --apiscan: fix bug in detection of whether the per-module bindings dir exists
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6941
diff
changeset
|
199 |
if bindings_dir is None or not os.path.exists(bindings_dir.abspath()): |
6876
9ac9bd55541d
Make ns3_python_bindings skip bindings with warning if apidefs dir not found
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6875
diff
changeset
|
200 |
warnings.warn("(in %s) Requested to build modular python bindings, but apidefs dir not found " |
9ac9bd55541d
Make ns3_python_bindings skip bindings with warning if apidefs dir not found
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6875
diff
changeset
|
201 |
"=> skipped the bindings." % str(bld.path), |
9ac9bd55541d
Make ns3_python_bindings skip bindings with warning if apidefs dir not found
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6875
diff
changeset
|
202 |
Warning, stacklevel=2) |
9ac9bd55541d
Make ns3_python_bindings skip bindings with warning if apidefs dir not found
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6875
diff
changeset
|
203 |
return |
9ac9bd55541d
Make ns3_python_bindings skip bindings with warning if apidefs dir not found
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6875
diff
changeset
|
204 |
|
6920
b1b821ae64c1
Modular bindings: skip a binding module if the corresponding ns-3 module is not enabled
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6913
diff
changeset
|
205 |
if ("ns3-%s" % (module,)) not in env.NS3_ENABLED_MODULES: |
b1b821ae64c1
Modular bindings: skip a binding module if the corresponding ns-3 module is not enabled
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6913
diff
changeset
|
206 |
#print "bindings for module %s which is not enabled, skip" % module |
b1b821ae64c1
Modular bindings: skip a binding module if the corresponding ns-3 module is not enabled
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6913
diff
changeset
|
207 |
return |
b1b821ae64c1
Modular bindings: skip a binding module if the corresponding ns-3 module is not enabled
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6913
diff
changeset
|
208 |
|
6897
f338f17b0238
Modular bindings: generate a compatibility 'ns3' module that imports the modular bindings
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6894
diff
changeset
|
209 |
env.append_value('PYTHON_MODULES_BUILT', module) |
11275
00495fc6dd11
Handle broken versions of Clang better
Vedran Miletić <rivanvx@gmail.com>
parents:
11183
diff
changeset
|
210 |
try: |
00495fc6dd11
Handle broken versions of Clang better
Vedran Miletić <rivanvx@gmail.com>
parents:
11183
diff
changeset
|
211 |
apidefs = env['PYTHON_BINDINGS_APIDEFS'].replace("-", "_") |
00495fc6dd11
Handle broken versions of Clang better
Vedran Miletić <rivanvx@gmail.com>
parents:
11183
diff
changeset
|
212 |
except AttributeError: |
00495fc6dd11
Handle broken versions of Clang better
Vedran Miletić <rivanvx@gmail.com>
parents:
11183
diff
changeset
|
213 |
# we likely got an empty list for env['PYTHON_BINDINGS_APIDEFS'] |
00495fc6dd11
Handle broken versions of Clang better
Vedran Miletić <rivanvx@gmail.com>
parents:
11183
diff
changeset
|
214 |
return |
6874
c7537e62f2fa
Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
215 |
|
c7537e62f2fa
Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
216 |
#debug = ('PYBINDGEN_DEBUG' in os.environ) |
c7537e62f2fa
Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
217 |
debug = True # XXX |
9278
0a749c0f1afd
Fix Python bindings and openflow for waf 1.7.10 upgrade and take care about boost requirements globally
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
9173
diff
changeset
|
218 |
source = [bld.srcnode.find_resource('bindings/python/ns3modulegen-modular.py'), |
0a749c0f1afd
Fix Python bindings and openflow for waf 1.7.10 upgrade and take care about boost requirements globally
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
9173
diff
changeset
|
219 |
bld.path.find_resource("bindings/modulegen__%s.py" % apidefs)] |
6874
c7537e62f2fa
Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
220 |
|
9278
0a749c0f1afd
Fix Python bindings and openflow for waf 1.7.10 upgrade and take care about boost requirements globally
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
9173
diff
changeset
|
221 |
modulegen_customizations = bindings_dir.find_resource("modulegen_customizations.py") |
0a749c0f1afd
Fix Python bindings and openflow for waf 1.7.10 upgrade and take care about boost requirements globally
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
9173
diff
changeset
|
222 |
if modulegen_customizations is not None: |
0a749c0f1afd
Fix Python bindings and openflow for waf 1.7.10 upgrade and take care about boost requirements globally
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
9173
diff
changeset
|
223 |
source.append(modulegen_customizations) |
6956
4a3bb1ba53fb
Modular bindings: add missing dep on the modulegen_customizations.py file, when found
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6946
diff
changeset
|
224 |
|
9278
0a749c0f1afd
Fix Python bindings and openflow for waf 1.7.10 upgrade and take care about boost requirements globally
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
9173
diff
changeset
|
225 |
modulegen_local = bld.path.find_resource("bindings/modulegen_local.py") |
6874
c7537e62f2fa
Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
226 |
# the local customization file may or not exist |
9278
0a749c0f1afd
Fix Python bindings and openflow for waf 1.7.10 upgrade and take care about boost requirements globally
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
9173
diff
changeset
|
227 |
if modulegen_local is not None: |
6874
c7537e62f2fa
Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
228 |
source.append("bindings/modulegen_local.py") |
c7537e62f2fa
Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
229 |
|
6957
5f49d23b4a74
Modular bindings: add support for <module>.py and _<module>.so layout, for extending modules in Python
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6956
diff
changeset
|
230 |
module_py_name = module.replace('-', '_') |
9278
0a749c0f1afd
Fix Python bindings and openflow for waf 1.7.10 upgrade and take care about boost requirements globally
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
9173
diff
changeset
|
231 |
module_target_dir = bld.srcnode.find_dir("bindings/python/ns").path_from(bld.path) |
6957
5f49d23b4a74
Modular bindings: add support for <module>.py and _<module>.so layout, for extending modules in Python
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6956
diff
changeset
|
232 |
|
5f49d23b4a74
Modular bindings: add support for <module>.py and _<module>.so layout, for extending modules in Python
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6956
diff
changeset
|
233 |
# if bindings/<module>.py exists, it becomes the module frontend, and the C extension befomes _<module> |
5f49d23b4a74
Modular bindings: add support for <module>.py and _<module>.so layout, for extending modules in Python
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6956
diff
changeset
|
234 |
if bld.path.find_resource("bindings/%s.py" % (module_py_name,)) is not None: |
9278
0a749c0f1afd
Fix Python bindings and openflow for waf 1.7.10 upgrade and take care about boost requirements globally
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
9173
diff
changeset
|
235 |
bld(features='copy', |
6957
5f49d23b4a74
Modular bindings: add support for <module>.py and _<module>.so layout, for extending modules in Python
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6956
diff
changeset
|
236 |
source=("bindings/%s.py" % (module_py_name,)), |
5f49d23b4a74
Modular bindings: add support for <module>.py and _<module>.so layout, for extending modules in Python
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6956
diff
changeset
|
237 |
target=('%s/%s.py' % (module_target_dir, module_py_name))) |
5f49d23b4a74
Modular bindings: add support for <module>.py and _<module>.so layout, for extending modules in Python
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6956
diff
changeset
|
238 |
extension_name = '_%s' % (module_py_name,) |
7673
1997b1a91020
Install python modules to PYTHONARCHDIR instead of PYTHONDIR; should fix #1329.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7667
diff
changeset
|
239 |
bld.install_files('${PYTHONARCHDIR}/ns', ["bindings/%s.py" % (module_py_name,)]) |
6957
5f49d23b4a74
Modular bindings: add support for <module>.py and _<module>.so layout, for extending modules in Python
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6956
diff
changeset
|
240 |
else: |
5f49d23b4a74
Modular bindings: add support for <module>.py and _<module>.so layout, for extending modules in Python
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6956
diff
changeset
|
241 |
extension_name = module_py_name |
5f49d23b4a74
Modular bindings: add support for <module>.py and _<module>.so layout, for extending modules in Python
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6956
diff
changeset
|
242 |
|
6893
5dccd86f90cf
Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6882
diff
changeset
|
243 |
target = ['bindings/ns3module.cc', 'bindings/ns3module.h', 'bindings/ns3modulegen.log'] |
6874
c7537e62f2fa
Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
244 |
#if not debug: |
c7537e62f2fa
Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
245 |
# target.append('ns3modulegen.log') |
c7537e62f2fa
Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
246 |
|
7408
4f1f961b6cdc
Bug 1224 - Ns-3-allinone fails to compile on Lion
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7384
diff
changeset
|
247 |
argv = ['NS3_ENABLED_FEATURES=${FEATURES}', |
4f1f961b6cdc
Bug 1224 - Ns-3-allinone fails to compile on Lion
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7384
diff
changeset
|
248 |
'GCC_RTTI_ABI_COMPLETE=${GCC_RTTI_ABI_COMPLETE}', |
4f1f961b6cdc
Bug 1224 - Ns-3-allinone fails to compile on Lion
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7384
diff
changeset
|
249 |
'${PYTHON}'] |
6874
c7537e62f2fa
Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
250 |
#if debug: |
c7537e62f2fa
Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
251 |
# argv.extend(["-m", "pdb"]) |
c7537e62f2fa
Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
252 |
|
6957
5f49d23b4a74
Modular bindings: add support for <module>.py and _<module>.so layout, for extending modules in Python
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6956
diff
changeset
|
253 |
argv.extend(['${SRC[0]}', module_abs_src_path, apidefs, extension_name, '${TGT[0]}']) |
6893
5dccd86f90cf
Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6882
diff
changeset
|
254 |
|
5dccd86f90cf
Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6882
diff
changeset
|
255 |
argv.extend(['2>', '${TGT[2]}']) # 2> ns3modulegen.log |
6874
c7537e62f2fa
Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
256 |
|
c7537e62f2fa
Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
257 |
features = [] |
c7537e62f2fa
Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
258 |
for (name, caption, was_enabled, reason_not_enabled) in env['NS3_OPTIONAL_FEATURES']: |
c7537e62f2fa
Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
259 |
if was_enabled: |
c7537e62f2fa
Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
260 |
features.append(name) |
c7537e62f2fa
Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
261 |
|
9278
0a749c0f1afd
Fix Python bindings and openflow for waf 1.7.10 upgrade and take care about boost requirements globally
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
9173
diff
changeset
|
262 |
bindgen = bld(features='command', source=source, target=target, command=argv) |
6874
c7537e62f2fa
Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
263 |
bindgen.env['FEATURES'] = ','.join(features) |
7408
4f1f961b6cdc
Bug 1224 - Ns-3-allinone fails to compile on Lion
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7384
diff
changeset
|
264 |
bindgen.dep_vars = ['FEATURES', "GCC_RTTI_ABI_COMPLETE"] |
6874
c7537e62f2fa
Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
265 |
bindgen.before = 'cxx' |
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
266 |
bindgen.after = 'gen_ns3_module_header' |
6874
c7537e62f2fa
Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
267 |
bindgen.name = "pybindgen(ns3 module %s)" % module |
7545
ac0569e8cb7d
Avoid installation of ns3modulegen-modular.py as a python module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7541
diff
changeset
|
268 |
bindgen.install_path = None |
6874
c7537e62f2fa
Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
269 |
|
6957
5f49d23b4a74
Modular bindings: add support for <module>.py and _<module>.so layout, for extending modules in Python
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6956
diff
changeset
|
270 |
# generate the extension module |
9278
0a749c0f1afd
Fix Python bindings and openflow for waf 1.7.10 upgrade and take care about boost requirements globally
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
9173
diff
changeset
|
271 |
pymod = bld(features='cxx cxxshlib pyext') |
6893
5dccd86f90cf
Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6882
diff
changeset
|
272 |
pymod.source = ['bindings/ns3module.cc'] |
6957
5f49d23b4a74
Modular bindings: add support for <module>.py and _<module>.so layout, for extending modules in Python
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6956
diff
changeset
|
273 |
pymod.target = '%s/%s' % (module_target_dir, extension_name) |
6874
c7537e62f2fa
Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
274 |
pymod.name = 'ns3module_%s' % module |
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
275 |
pymod.use = ["%s" % mod for mod in pymod.env['NS3_ENABLED_MODULES']] # Should be '"ns3-"+module', but see bug 1117 |
6874
c7537e62f2fa
Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
276 |
if pymod.env['ENABLE_STATIC_NS3']: |
c7537e62f2fa
Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
277 |
if sys.platform == 'darwin': |
c7537e62f2fa
Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
278 |
pymod.env.append_value('LINKFLAGS', '-Wl,-all_load') |
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
279 |
for mod in pymod.usel: |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
280 |
#mod = mod.split("--lib")[0] |
6913
54679ab32585
Create separate module and test-module libraries
Mitch Watrous <watrous@u.washington.edu>
parents:
6902
diff
changeset
|
281 |
pymod.env.append_value('LINKFLAGS', '-l' + mod) |
6874
c7537e62f2fa
Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
282 |
else: |
c7537e62f2fa
Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
283 |
pymod.env.append_value('LINKFLAGS', '-Wl,--whole-archive,-Bstatic') |
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
284 |
for mod in pymod.use: |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
285 |
#mod = mod.split("--lib")[0] |
6913
54679ab32585
Create separate module and test-module libraries
Mitch Watrous <watrous@u.washington.edu>
parents:
6902
diff
changeset
|
286 |
pymod.env.append_value('LINKFLAGS', '-l' + mod) |
6874
c7537e62f2fa
Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
287 |
pymod.env.append_value('LINKFLAGS', '-Wl,-Bdynamic,--no-whole-archive') |
7494
d93f5e8e0a59
waf-1.6: Mac OSX and other fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7492
diff
changeset
|
288 |
defines = list(pymod.env['DEFINES']) |
6874
c7537e62f2fa
Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
289 |
defines.extend(['NS_DEPRECATED=', 'NS3_DEPRECATED_H']) |
c7537e62f2fa
Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
290 |
if Options.platform == 'win32': |
c7537e62f2fa
Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
291 |
try: |
c7537e62f2fa
Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
292 |
defines.remove('_DEBUG') # causes undefined symbols on win32 |
c7537e62f2fa
Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
293 |
except ValueError: |
c7537e62f2fa
Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
294 |
pass |
7494
d93f5e8e0a59
waf-1.6: Mac OSX and other fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7492
diff
changeset
|
295 |
pymod.env['DEFINES'] = defines |
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
296 |
pymod.includes = '# bindings' |
7673
1997b1a91020
Install python modules to PYTHONARCHDIR instead of PYTHONDIR; should fix #1329.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7667
diff
changeset
|
297 |
pymod.install_path = '${PYTHONARCHDIR}/ns' |
7678
a4c56ef461ba
Bug 1335 - waf 1.6.10 upgrade breaks OS X build when Python enabled
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7675
diff
changeset
|
298 |
|
a4c56ef461ba
Bug 1335 - waf 1.6.10 upgrade breaks OS X build when Python enabled
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7675
diff
changeset
|
299 |
# Workaround to a WAF bug, remove this when ns-3 upgrades to WAF > 1.6.10 |
a4c56ef461ba
Bug 1335 - waf 1.6.10 upgrade breaks OS X build when Python enabled
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7675
diff
changeset
|
300 |
# https://www.nsnam.org/bugzilla/show_bug.cgi?id=1335 |
a4c56ef461ba
Bug 1335 - waf 1.6.10 upgrade breaks OS X build when Python enabled
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7675
diff
changeset
|
301 |
# http://code.google.com/p/waf/issues/detail?id=1098 |
7679
5a9a0a21b553
Bug #1335 postfix
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7678
diff
changeset
|
302 |
if Utils.unversioned_sys_platform() == 'darwin': |
5a9a0a21b553
Bug #1335 postfix
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7678
diff
changeset
|
303 |
pymod.mac_bundle = True |
7678
a4c56ef461ba
Bug 1335 - waf 1.6.10 upgrade breaks OS X build when Python enabled
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7675
diff
changeset
|
304 |
|
6893
5dccd86f90cf
Modular Python bindings work (many bug fixes, more modules tested)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6882
diff
changeset
|
305 |
return pymod |
6874
c7537e62f2fa
Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
306 |
|
c7537e62f2fa
Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
307 |
|
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
308 |
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
|
309 |
bld.create_ns3_module = types.MethodType(create_ns3_module, bld) |
6913
54679ab32585
Create separate module and test-module libraries
Mitch Watrous <watrous@u.washington.edu>
parents:
6902
diff
changeset
|
310 |
bld.create_ns3_module_test_library = types.MethodType(create_ns3_module_test_library, bld) |
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
311 |
bld.create_obj = types.MethodType(create_obj, bld) |
6874
c7537e62f2fa
Start of work on modular Python bindings, unstable
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
312 |
bld.ns3_python_bindings = types.MethodType(ns3_python_bindings, 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
|
313 |
|
7293
0f574c532cee
Make test module not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7291
diff
changeset
|
314 |
# Remove these modules from the list of all modules. |
0f574c532cee
Make test module not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7291
diff
changeset
|
315 |
for not_built in bld.env['MODULES_NOT_BUILT']: |
7303
8359b3ac1ab0
Handle extra relative paths for ns3tcp and ns3wifi modules
Mitch Watrous <watrous@u.washington.edu>
parents:
7297
diff
changeset
|
316 |
|
8359b3ac1ab0
Handle extra relative paths for ns3tcp and ns3wifi modules
Mitch Watrous <watrous@u.washington.edu>
parents:
7297
diff
changeset
|
317 |
# XXX Becaue these modules are located in subdirectories of |
8359b3ac1ab0
Handle extra relative paths for ns3tcp and ns3wifi modules
Mitch Watrous <watrous@u.washington.edu>
parents:
7297
diff
changeset
|
318 |
# test, their names in the all_modules list include the extra |
8359b3ac1ab0
Handle extra relative paths for ns3tcp and ns3wifi modules
Mitch Watrous <watrous@u.washington.edu>
parents:
7297
diff
changeset
|
319 |
# relative path "test/". If these modules are moved into the |
8359b3ac1ab0
Handle extra relative paths for ns3tcp and ns3wifi modules
Mitch Watrous <watrous@u.washington.edu>
parents:
7297
diff
changeset
|
320 |
# src directory, then this if block should be removed. |
8359b3ac1ab0
Handle extra relative paths for ns3tcp and ns3wifi modules
Mitch Watrous <watrous@u.washington.edu>
parents:
7297
diff
changeset
|
321 |
if not_built == 'ns3tcp' or not_built == 'ns3wifi': |
8359b3ac1ab0
Handle extra relative paths for ns3tcp and ns3wifi modules
Mitch Watrous <watrous@u.washington.edu>
parents:
7297
diff
changeset
|
322 |
not_built = 'test/' + not_built |
8359b3ac1ab0
Handle extra relative paths for ns3tcp and ns3wifi modules
Mitch Watrous <watrous@u.washington.edu>
parents:
7297
diff
changeset
|
323 |
|
7293
0f574c532cee
Make test module not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7291
diff
changeset
|
324 |
if not_built in all_modules: |
0f574c532cee
Make test module not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7291
diff
changeset
|
325 |
all_modules.remove(not_built) |
7291
d39c09dbc3d9
Make emu and template modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7237
diff
changeset
|
326 |
|
9278
0a749c0f1afd
Fix Python bindings and openflow for waf 1.7.10 upgrade and take care about boost requirements globally
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
9173
diff
changeset
|
327 |
bld.recurse(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
|
328 |
|
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
|
329 |
for module in all_modules: |
9278
0a749c0f1afd
Fix Python bindings and openflow for waf 1.7.10 upgrade and take care about boost requirements globally
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
9173
diff
changeset
|
330 |
modheader = bld(features='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
|
331 |
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
|
332 |
|
7016
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
333 |
class ns3pcfile_task(Task.Task): |
9278
0a749c0f1afd
Fix Python bindings and openflow for waf 1.7.10 upgrade and take care about boost requirements globally
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
9173
diff
changeset
|
334 |
after = 'cxx' |
7512
bbdfcec0d97d
More pc file fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7511
diff
changeset
|
335 |
|
7016
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
336 |
def __str__(self): |
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
337 |
"string to display to the user" |
11457
5f76cbf2850b
Update Waf to 1.8.11
Matthieu Coudron <mattator@gmail.com>
parents:
11277
diff
changeset
|
338 |
tgt_str = ' '.join([a.bldpath() for a in self.outputs]) |
7016
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
339 |
return 'pcfile: %s\n' % (tgt_str) |
7512
bbdfcec0d97d
More pc file fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7511
diff
changeset
|
340 |
|
7016
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
341 |
def runnable_status(self): |
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
342 |
return super(ns3pcfile_task, self).runnable_status() |
7512
bbdfcec0d97d
More pc file fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7511
diff
changeset
|
343 |
|
7016
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
344 |
def _self_libs(self, env, name, libdir): |
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
345 |
if env['ENABLE_STATIC_NS3']: |
7520
a61ef851d443
Fix issue with generating .pc file in static build
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7514
diff
changeset
|
346 |
path_st = 'STLIBPATH_ST' |
a61ef851d443
Fix issue with generating .pc file in static build
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7514
diff
changeset
|
347 |
lib_st = 'STLIB_ST' |
a61ef851d443
Fix issue with generating .pc file in static build
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7514
diff
changeset
|
348 |
lib_marker = 'STLIB_MARKER' |
7016
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
349 |
else: |
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
350 |
path_st = 'LIBPATH_ST' |
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
351 |
lib_st = 'LIB_ST' |
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
352 |
lib_marker = 'SHLIB_MARKER' |
7523
7c6a89520349
Fix .pc file generation on OSX
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7522
diff
changeset
|
353 |
retval = [env[path_st] % libdir] |
7c6a89520349
Fix .pc file generation on OSX
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7522
diff
changeset
|
354 |
if env[lib_marker]: |
7c6a89520349
Fix .pc file generation on OSX
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7522
diff
changeset
|
355 |
retval.append(env[lib_marker]) |
7c6a89520349
Fix .pc file generation on OSX
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7522
diff
changeset
|
356 |
retval.append(env[lib_st] % name) |
7070
5635f2667e08
fix typo: % should be $
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
7053
diff
changeset
|
357 |
return retval |
7512
bbdfcec0d97d
More pc file fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7511
diff
changeset
|
358 |
|
7016
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
359 |
def _lib(self, env, dep): |
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
360 |
libpath = env['LIBPATH_%s' % dep] |
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
361 |
linkflags = env['LINKFLAGS_%s' % dep] |
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
362 |
libs = env['LIB_%s' % dep] |
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
363 |
retval = [] |
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
364 |
for path in libpath: |
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
365 |
retval.append(env['LIBPATH_ST'] % path) |
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
366 |
retval = retval + linkflags |
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
367 |
for lib in libs: |
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
368 |
retval.append(env['LIB_ST'] % lib) |
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
369 |
return retval |
7512
bbdfcec0d97d
More pc file fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7511
diff
changeset
|
370 |
|
7016
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
371 |
def _listify(self, v): |
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
372 |
if isinstance(v, list): |
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
373 |
return v |
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
374 |
else: |
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
375 |
return [v] |
7512
bbdfcec0d97d
More pc file fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7511
diff
changeset
|
376 |
|
7016
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
377 |
def _cflags(self, dep): |
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
378 |
flags = self.env['CFLAGS_%s' % dep] |
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
379 |
return self._listify(flags) |
7512
bbdfcec0d97d
More pc file fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7511
diff
changeset
|
380 |
|
7016
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
381 |
def _cxxflags(self, dep): |
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
382 |
return self._listify(self.env['CXXFLAGS_%s' % dep]) |
7512
bbdfcec0d97d
More pc file fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7511
diff
changeset
|
383 |
|
7016
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
384 |
def _defines(self, dep): |
7512
bbdfcec0d97d
More pc file fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7511
diff
changeset
|
385 |
return [self.env['DEFINES_ST'] % define for define in self.env['DEFINES_%s' % dep]] |
bbdfcec0d97d
More pc file fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7511
diff
changeset
|
386 |
|
7016
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
387 |
def _includes(self, dep): |
7512
bbdfcec0d97d
More pc file fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7511
diff
changeset
|
388 |
includes = self.env['INCLUDES_%s' % dep] |
7016
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
389 |
return [self.env['CPPPATH_ST'] % include for include in includes] |
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
390 |
|
7512
bbdfcec0d97d
More pc file fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7511
diff
changeset
|
391 |
def _generate_pcfile(self, name, use, env, outfilename): |
bbdfcec0d97d
More pc file fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7511
diff
changeset
|
392 |
outfile = open(outfilename, 'wt') |
7345
850237ab2111
Bug 1199 - waf install doesn't work on x86_64
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7331
diff
changeset
|
393 |
prefix = env.PREFIX |
7681
0873edb445e8
Bug 1327 - Version installed ns-3 files
Gustavo Carneiro / Vedran Miletić
parents:
7679
diff
changeset
|
394 |
includedir = Utils.subst_vars('${INCLUDEDIR}/%s%s' % (wutils.APPNAME, wutils.VERSION), env) |
7345
850237ab2111
Bug 1199 - waf install doesn't work on x86_64
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7331
diff
changeset
|
395 |
libdir = env.LIBDIR |
8894
90d67c5e8255
Bug 1445 - When build with "-d release", don't suffix "-release"
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
8702
diff
changeset
|
396 |
libs = self._self_libs(env, "%s%s-%s%s" % (wutils.APPNAME, wutils.VERSION, name[4:], env.BUILD_SUFFIX), '${libdir}') |
7016
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
397 |
for dep in use: |
7512
bbdfcec0d97d
More pc file fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7511
diff
changeset
|
398 |
libs += self._lib(env, dep) |
bbdfcec0d97d
More pc file fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7511
diff
changeset
|
399 |
for dep in env.LIBS: |
bbdfcec0d97d
More pc file fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7511
diff
changeset
|
400 |
libs += self.env['LIB_ST'] % dep |
7016
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
401 |
cflags = [self.env['CPPPATH_ST'] % '${includedir}'] |
7514
cac200ed9c0a
Add Requires: to the .pc file indicating inter-module dependencies
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7512
diff
changeset
|
402 |
requires = [] |
7016
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
403 |
for dep in use: |
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
404 |
cflags = cflags + self._cflags(dep) + self._cxxflags(dep) + \ |
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
405 |
self._defines(dep) + self._includes(dep) |
7514
cac200ed9c0a
Add Requires: to the .pc file indicating inter-module dependencies
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7512
diff
changeset
|
406 |
if dep.startswith('ns3-'): |
7681
0873edb445e8
Bug 1327 - Version installed ns-3 files
Gustavo Carneiro / Vedran Miletić
parents:
7679
diff
changeset
|
407 |
dep_name = dep[4:] |
8894
90d67c5e8255
Bug 1445 - When build with "-d release", don't suffix "-release"
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
8702
diff
changeset
|
408 |
requires.append("libns%s-%s%s" % (wutils.VERSION, dep_name, env.BUILD_SUFFIX)) |
11634
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11521
diff
changeset
|
409 |
print("""\ |
7016
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
410 |
prefix=%s |
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
411 |
libdir=%s |
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
412 |
includedir=%s |
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
413 |
|
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
414 |
Name: lib%s |
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
415 |
Description: ns-3 module %s |
7688
6f5c9b870e45
Still Bug 1327: disable VNUM in libraries, fix the .pc file deps
Vedran Miletić
parents:
7681
diff
changeset
|
416 |
Version: %s |
7016
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
417 |
Libs: %s |
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
418 |
Cflags: %s |
7667
42dda4375d79
Bug 1332 - Generated .pc files have blank line above and below the text
Vedran Miletić <rivanvx@gmail.com>
parents:
7583
diff
changeset
|
419 |
Requires: %s\ |
7016
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
420 |
""" % (prefix, libdir, includedir, |
11634
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11521
diff
changeset
|
421 |
name, name, wutils.VERSION, ' '.join(libs), ' '.join(cflags), ' '.join(requires)), file=outfile) |
7016
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
422 |
outfile.close() |
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
423 |
|
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
424 |
def run(self): |
7511
6d03bec01c5c
Fix .pc file generation
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7496
diff
changeset
|
425 |
output_filename = self.outputs[0].abspath() |
7522
8a7aec72d793
Don't pass first name in list when generating the pc file
Mitch Watrous <watrous@u.washington.edu>
parents:
7521
diff
changeset
|
426 |
self._generate_pcfile(self.module.name, |
7512
bbdfcec0d97d
More pc file fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7511
diff
changeset
|
427 |
self.module.to_list(self.module.use), |
7345
850237ab2111
Bug 1199 - waf install doesn't work on x86_64
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7331
diff
changeset
|
428 |
self.env, output_filename) |
7016
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
429 |
|
7511
6d03bec01c5c
Fix .pc file generation
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7496
diff
changeset
|
430 |
|
6d03bec01c5c
Fix .pc file generation
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7496
diff
changeset
|
431 |
@TaskGen.feature('ns3pcfile') |
6d03bec01c5c
Fix .pc file generation
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7496
diff
changeset
|
432 |
@TaskGen.after_method('process_rule') |
6d03bec01c5c
Fix .pc file generation
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7496
diff
changeset
|
433 |
def apply(self): |
7821
270a2b7f82ad
Bug 1406 - waf exits with maximum recursion depth exceeded while calling a Python object if wscript has wrong filename
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7688
diff
changeset
|
434 |
module = self.bld.find_ns3_module(self.module) |
270a2b7f82ad
Bug 1406 - waf exits with maximum recursion depth exceeded while calling a Python object if wscript has wrong filename
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7688
diff
changeset
|
435 |
output_filename = 'lib%s.pc' % os.path.basename(module.target) |
7511
6d03bec01c5c
Fix .pc file generation
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7496
diff
changeset
|
436 |
output_node = self.path.find_or_declare(output_filename) |
6d03bec01c5c
Fix .pc file generation
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7496
diff
changeset
|
437 |
assert output_node is not None, str(self) |
6d03bec01c5c
Fix .pc file generation
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7496
diff
changeset
|
438 |
task = self.create_task('ns3pcfile') |
6d03bec01c5c
Fix .pc file generation
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7496
diff
changeset
|
439 |
self.bld.install_files('${LIBDIR}/pkgconfig', output_node) |
6d03bec01c5c
Fix .pc file generation
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7496
diff
changeset
|
440 |
task.set_outputs([output_node]) |
7821
270a2b7f82ad
Bug 1406 - waf exits with maximum recursion depth exceeded while calling a Python object if wscript has wrong filename
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7688
diff
changeset
|
441 |
task.module = module |
7016
eab6710a6346
generate pkg-config files for installation.
Mathieu Lacage <mathieu.lacage@inria.fr>
parents:
7006
diff
changeset
|
442 |
|
1220
4933e0890acd
Build all modules as a single ns3 shared library.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1217
diff
changeset
|
443 |
|
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
|
444 |
|
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
445 |
@TaskGen.feature('ns3header') |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
446 |
@TaskGen.after_method('process_rule') |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
447 |
def apply_ns3header(self): |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
448 |
if self.module is None: |
7496
ce1ec79d488c
waf1.6: make the all_modules in src/wscript be automatically discovered
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7494
diff
changeset
|
449 |
raise WafError("'module' missing on ns3headers object %s" % self) |
11183
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
450 |
ns3_dir_node = self.bld.path.find_or_declare("ns3") |
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
451 |
for filename in set(self.to_list(self.source)): |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
452 |
src_node = self.path.find_resource(filename) |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
453 |
if src_node is None: |
7496
ce1ec79d488c
waf1.6: make the all_modules in src/wscript be automatically discovered
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7494
diff
changeset
|
454 |
raise WafError("source ns3 header file %s not found" % (filename,)) |
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
455 |
dst_node = ns3_dir_node.find_or_declare(src_node.name) |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
456 |
assert dst_node is not None |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
457 |
task = self.create_task('ns3header') |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
458 |
task.mode = getattr(self, 'mode', 'install') |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
459 |
if task.mode == 'install': |
7681
0873edb445e8
Bug 1327 - Version installed ns-3 files
Gustavo Carneiro / Vedran Miletić
parents:
7679
diff
changeset
|
460 |
self.bld.install_files('${INCLUDEDIR}/%s%s/ns3' % (wutils.APPNAME, wutils.VERSION), [src_node]) |
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
461 |
task.set_inputs([src_node]) |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
462 |
task.set_outputs([dst_node]) |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
463 |
else: |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
464 |
task.header_to_remove = dst_node |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
465 |
self.headers = set(self.to_list(self.source)) |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
466 |
self.source = '' # tell WAF not to process these files further |
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
|
467 |
|
7492
5299fc683dfa
Clean some dead waf code
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7490
diff
changeset
|
468 |
|
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
469 |
class ns3header_task(Task.Task): |
9278
0a749c0f1afd
Fix Python bindings and openflow for waf 1.7.10 upgrade and take care about boost requirements globally
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
9173
diff
changeset
|
470 |
before = 'cxx gen_ns3_module_header' |
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
471 |
color = 'BLUE' |
6647
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
472 |
|
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
473 |
def __str__(self): |
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
474 |
"string to display to the user" |
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
475 |
env = self.env |
11457
5f76cbf2850b
Update Waf to 1.8.11
Matthieu Coudron <mattator@gmail.com>
parents:
11277
diff
changeset
|
476 |
src_str = ' '.join([a.bldpath() for a in self.inputs]) |
5f76cbf2850b
Update Waf to 1.8.11
Matthieu Coudron <mattator@gmail.com>
parents:
11277
diff
changeset
|
477 |
tgt_str = ' '.join([a.bldpath() for a in self.outputs]) |
6647
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
478 |
if self.outputs: sep = ' -> ' |
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
479 |
else: sep = '' |
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
480 |
if self.mode == 'remove': |
11490
4e23f40d0df5
Remove extraneous blank lines from build chatter.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11457
diff
changeset
|
481 |
return 'rm-ns3-header %s' % (self.header_to_remove.abspath(),) |
4e23f40d0df5
Remove extraneous blank lines from build chatter.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11457
diff
changeset
|
482 |
return 'install-ns3-header: %s' % (tgt_str) |
6647
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
483 |
|
7488
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
484 |
def __repr__(self): |
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
485 |
return str(self) |
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
486 |
|
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
487 |
def uid(self): |
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
488 |
try: |
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
489 |
return self.uid_ |
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
490 |
except AttributeError: |
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
491 |
m = Utils.md5() |
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
492 |
up = m.update |
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
493 |
up(self.__class__.__name__.encode()) |
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
494 |
for x in self.inputs + self.outputs: |
11634
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11521
diff
changeset
|
495 |
up(x.abspath().encode()) |
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11521
diff
changeset
|
496 |
up(self.mode.encode()) |
7488
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
497 |
if self.mode == 'remove': |
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
498 |
up(self.header_to_remove.abspath().encode()) |
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
499 |
self.uid_ = m.digest() |
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
500 |
return self.uid_ |
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
501 |
|
6647
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
502 |
def runnable_status(self): |
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
503 |
if self.mode == 'remove': |
7488
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
504 |
if os.path.exists(self.header_to_remove.abspath()): |
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
505 |
return Task.RUN_ME |
6647
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
506 |
else: |
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
507 |
return Task.SKIP_ME |
6647
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
508 |
else: |
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
509 |
return super(ns3header_task, self).runnable_status() |
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
510 |
|
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
511 |
def run(self): |
6647
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
512 |
if self.mode == 'install': |
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
513 |
assert len(self.inputs) == len(self.outputs) |
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
514 |
inputs = [node.abspath() for node in self.inputs] |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
515 |
outputs = [node.abspath() for node in self.outputs] |
6647
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
516 |
for src, dst in zip(inputs, outputs): |
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
517 |
try: |
11634
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11521
diff
changeset
|
518 |
os.chmod(dst, 0o600) |
6647
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
519 |
except OSError: |
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
520 |
pass |
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
521 |
shutil.copy2(src, dst) |
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
522 |
## make the headers in builddir read-only, to prevent |
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
523 |
## accidental modification |
11634
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11521
diff
changeset
|
524 |
os.chmod(dst, 0o400) |
6647
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
525 |
return 0 |
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
526 |
else: |
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
527 |
assert len(self.inputs) == 0 |
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
528 |
assert len(self.outputs) == 0 |
7488
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
529 |
out_file_name = self.header_to_remove.abspath() |
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
530 |
try: |
6647
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
531 |
os.unlink(out_file_name) |
11634
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11521
diff
changeset
|
532 |
except OSError as ex: |
6647
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
533 |
if ex.errno != 2: |
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
534 |
raise |
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
535 |
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
|
536 |
|
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
|
537 |
|
11183
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
538 |
@TaskGen.feature('ns3privateheader') |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
539 |
@TaskGen.after_method('process_rule') |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
540 |
def apply_ns3privateheader(self): |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
541 |
if self.module is None: |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
542 |
raise WafError("'module' missing on ns3headers object %s" % self) |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
543 |
ns3_dir_node = self.bld.path.find_or_declare("ns3/private") |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
544 |
for filename in set(self.to_list(self.source)): |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
545 |
src_node = self.path.find_resource(filename) |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
546 |
if src_node is None: |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
547 |
raise WafError("source ns3 header file %s not found" % (filename,)) |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
548 |
dst_node = ns3_dir_node.find_or_declare(src_node.name) |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
549 |
assert dst_node is not None |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
550 |
task = self.create_task('ns3privateheader') |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
551 |
task.mode = getattr(self, 'mode', 'install') |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
552 |
if task.mode == 'install': |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
553 |
task.set_inputs([src_node]) |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
554 |
task.set_outputs([dst_node]) |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
555 |
else: |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
556 |
task.header_to_remove = dst_node |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
557 |
self.headers = set(self.to_list(self.source)) |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
558 |
self.source = '' # tell WAF not to process these files further |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
559 |
|
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
560 |
class ns3privateheader_task(Task.Task): |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
561 |
before = 'cxx gen_ns3_module_header' |
11521 | 562 |
after = 'ns3header' |
11183
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
563 |
color = 'BLUE' |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
564 |
|
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
565 |
def __str__(self): |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
566 |
"string to display to the user" |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
567 |
env = self.env |
11457
5f76cbf2850b
Update Waf to 1.8.11
Matthieu Coudron <mattator@gmail.com>
parents:
11277
diff
changeset
|
568 |
src_str = ' '.join([a.bldpath() for a in self.inputs]) |
5f76cbf2850b
Update Waf to 1.8.11
Matthieu Coudron <mattator@gmail.com>
parents:
11277
diff
changeset
|
569 |
tgt_str = ' '.join([a.bldpath() for a in self.outputs]) |
11183
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
570 |
if self.outputs: sep = ' -> ' |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
571 |
else: sep = '' |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
572 |
if self.mode == 'remove': |
11490
4e23f40d0df5
Remove extraneous blank lines from build chatter.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11457
diff
changeset
|
573 |
return 'rm-ns3-header %s' % (self.header_to_remove.abspath(),) |
4e23f40d0df5
Remove extraneous blank lines from build chatter.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11457
diff
changeset
|
574 |
return 'install-ns3-header: %s' % (tgt_str) |
11183
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
575 |
|
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
576 |
def __repr__(self): |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
577 |
return str(self) |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
578 |
|
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
579 |
def uid(self): |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
580 |
try: |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
581 |
return self.uid_ |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
582 |
except AttributeError: |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
583 |
m = Utils.md5() |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
584 |
up = m.update |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
585 |
up(self.__class__.__name__.encode()) |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
586 |
for x in self.inputs + self.outputs: |
11634
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11521
diff
changeset
|
587 |
up(x.abspath().encode()) |
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11521
diff
changeset
|
588 |
up(self.mode.encode()) |
11183
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
589 |
if self.mode == 'remove': |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
590 |
up(self.header_to_remove.abspath().encode()) |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
591 |
self.uid_ = m.digest() |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
592 |
return self.uid_ |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
593 |
|
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
594 |
def runnable_status(self): |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
595 |
if self.mode == 'remove': |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
596 |
if os.path.exists(self.header_to_remove.abspath()): |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
597 |
return Task.RUN_ME |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
598 |
else: |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
599 |
return Task.SKIP_ME |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
600 |
else: |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
601 |
return super(ns3privateheader_task, self).runnable_status() |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
602 |
|
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
603 |
def run(self): |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
604 |
if self.mode == 'install': |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
605 |
assert len(self.inputs) == len(self.outputs) |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
606 |
inputs = [node.abspath() for node in self.inputs] |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
607 |
outputs = [node.abspath() for node in self.outputs] |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
608 |
for src, dst in zip(inputs, outputs): |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
609 |
try: |
11634
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11521
diff
changeset
|
610 |
os.chmod(dst, 0o600) |
11183
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
611 |
except OSError: |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
612 |
pass |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
613 |
shutil.copy2(src, dst) |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
614 |
## make the headers in builddir read-only, to prevent |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
615 |
## accidental modification |
11634
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11521
diff
changeset
|
616 |
os.chmod(dst, 0o400) |
11183
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
617 |
return 0 |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
618 |
else: |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
619 |
assert len(self.inputs) == 0 |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
620 |
assert len(self.outputs) == 0 |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
621 |
out_file_name = self.header_to_remove.abspath() |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
622 |
try: |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
623 |
os.unlink(out_file_name) |
11634
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11521
diff
changeset
|
624 |
except OSError as ex: |
11183
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
625 |
if ex.errno != 2: |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
626 |
raise |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
627 |
return 0 |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
628 |
|
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
629 |
|
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
630 |
class gen_ns3_module_header_task(Task.Task): |
9278
0a749c0f1afd
Fix Python bindings and openflow for waf 1.7.10 upgrade and take care about boost requirements globally
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
9173
diff
changeset
|
631 |
before = 'cxx' |
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
632 |
after = 'ns3header' |
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
633 |
color = 'BLUE' |
6647
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
634 |
|
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
635 |
def runnable_status(self): |
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
636 |
if self.mode == 'remove': |
7488
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
637 |
if os.path.exists(self.header_to_remove.abspath()): |
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
638 |
return Task.RUN_ME |
6647
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
639 |
else: |
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
640 |
return Task.SKIP_ME |
6647
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
641 |
else: |
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
642 |
return super(gen_ns3_module_header_task, self).runnable_status() |
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
643 |
|
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
644 |
def __str__(self): |
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
645 |
"string to display to the user" |
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
646 |
env = self.env |
11457
5f76cbf2850b
Update Waf to 1.8.11
Matthieu Coudron <mattator@gmail.com>
parents:
11277
diff
changeset
|
647 |
src_str = ' '.join([a.bldpath() for a in self.inputs]) |
5f76cbf2850b
Update Waf to 1.8.11
Matthieu Coudron <mattator@gmail.com>
parents:
11277
diff
changeset
|
648 |
tgt_str = ' '.join([a.bldpath() for a in self.outputs]) |
6647
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
649 |
if self.outputs: sep = ' -> ' |
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
650 |
else: sep = '' |
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
651 |
if self.mode == 'remove': |
11490
4e23f40d0df5
Remove extraneous blank lines from build chatter.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11457
diff
changeset
|
652 |
return 'rm-module-header %s' % (self.header_to_remove.abspath(),) |
4e23f40d0df5
Remove extraneous blank lines from build chatter.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11457
diff
changeset
|
653 |
return 'gen-module-header: %s' % (tgt_str) |
6647
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
654 |
|
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
655 |
def run(self): |
6647
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
656 |
if self.mode == 'remove': |
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
657 |
assert len(self.inputs) == 0 |
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
658 |
assert len(self.outputs) == 0 |
7488
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
659 |
out_file_name = self.header_to_remove.abspath() |
6647
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
660 |
try: |
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
661 |
os.unlink(out_file_name) |
11634
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11521
diff
changeset
|
662 |
except OSError as ex: |
6647
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
663 |
if ex.errno != 2: |
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
664 |
raise |
bdbbfbc6bda7
When a module is disabled, remove xxx-module.h and module header files from build/variant/ns3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6639
diff
changeset
|
665 |
return 0 |
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
666 |
assert len(self.outputs) == 1 |
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
667 |
out_file_name = self.outputs[0].get_bld().abspath()#self.env) |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
668 |
header_files = [os.path.basename(node.abspath()) for node in self.inputs] |
11634
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11521
diff
changeset
|
669 |
outfile = open(out_file_name, "w") |
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
670 |
header_files.sort() |
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
671 |
|
11634
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11521
diff
changeset
|
672 |
print(""" |
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
|
673 |
#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
|
674 |
# 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
|
675 |
#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
|
676 |
|
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
|
677 |
#ifndef NS3_MODULE_%s |
11634
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11521
diff
changeset
|
678 |
""" % (self.module.upper().replace('-', '_'),), file=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
|
679 |
|
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
680 |
# if self.module_deps: |
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
681 |
# print >> outfile, "// Module dependencies:" |
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
682 |
# 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
|
683 |
# 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
|
684 |
|
11634
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11521
diff
changeset
|
685 |
print(file=outfile) |
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11521
diff
changeset
|
686 |
print("// Module headers:", file=outfile) |
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
687 |
for header in header_files: |
11634
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11521
diff
changeset
|
688 |
print("#include \"%s\"" % (header,), file=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
|
689 |
|
11634
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11521
diff
changeset
|
690 |
print("#endif", file=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
|
691 |
|
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
692 |
outfile.close() |
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3854
diff
changeset
|
693 |
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
|
694 |
|
4126
0ba0346d655b
Workaround WAF issue 325 for generating module header files
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4066
diff
changeset
|
695 |
def sig_explicit_deps(self): |
11660
47325a00bda8
ensure consistent digests for checking the build cache
Tom Henderson <tomh@tomh.org>
parents:
11634
diff
changeset
|
696 |
self.m.update('\n'.join(sorted([node.abspath() for node in self.inputs])).encode('utf-8')) |
6671
b3d5193a2f94
Bug 1004 - module header not rebuilt
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
697 |
return self.m.digest() |
4126
0ba0346d655b
Workaround WAF issue 325 for generating module header files
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4066
diff
changeset
|
698 |
|
0ba0346d655b
Workaround WAF issue 325 for generating module header files
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4066
diff
changeset
|
699 |
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
|
700 |
try: |
0ba0346d655b
Workaround WAF issue 325 for generating module header files
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4066
diff
changeset
|
701 |
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
|
702 |
except AttributeError: |
0ba0346d655b
Workaround WAF issue 325 for generating module header files
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4066
diff
changeset
|
703 |
"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
|
704 |
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
|
705 |
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
|
706 |
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
|
707 |
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
|
708 |
|
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
|
709 |
|
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
710 |
# Generates a 'ns3/foo-module.h' header file that includes all public |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
711 |
# ns3 headers of a certain module. |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
712 |
@TaskGen.feature('ns3moduleheader') |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
713 |
@TaskGen.after_method('process_rule') |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
714 |
def apply_ns3moduleheader(self): |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
715 |
## get all of the ns3 headers |
11183
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10713
diff
changeset
|
716 |
ns3_dir_node = self.bld.path.find_or_declare("ns3") |
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
717 |
all_headers_inputs = [] |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
718 |
found_the_module = False |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
719 |
for ns3headers in self.bld.all_task_gen: |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
720 |
if 'ns3header' in getattr(ns3headers, "features", []): |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
721 |
if ns3headers.module != self.module: |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
722 |
continue |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
723 |
found_the_module = True |
11661
68c0e7f87bdf
additional Python 2/3 compatibility
Tom Henderson <tomh@tomh.org>
parents:
11660
diff
changeset
|
724 |
for source in sorted(ns3headers.headers): |
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
725 |
source = os.path.basename(source) |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
726 |
node = ns3_dir_node.find_or_declare(os.path.basename(source)) |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
727 |
if node is None: |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
728 |
fatal("missing header file %s" % (source,)) |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
729 |
all_headers_inputs.append(node) |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
730 |
if not found_the_module: |
7496
ce1ec79d488c
waf1.6: make the all_modules in src/wscript be automatically discovered
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7494
diff
changeset
|
731 |
raise WafError("error finding headers for module %s" % self.module) |
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
732 |
if not all_headers_inputs: |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
733 |
return |
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
|
734 |
|
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
735 |
try: |
7488
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
736 |
module_obj = self.bld.get_tgen_by_name("ns3-" + self.module) |
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
737 |
except WafError: # maybe the module was disabled, and therefore removed |
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
738 |
return |
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
|
739 |
|
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
740 |
all_headers_outputs = [ns3_dir_node.find_or_declare("%s-module.h" % self.module)] |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
741 |
task = self.create_task('gen_ns3_module_header') |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
742 |
task.module = self.module |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
743 |
task.mode = getattr(self, "mode", "install") |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
744 |
if task.mode == 'install': |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
745 |
assert module_obj is not None, self.module |
7681
0873edb445e8
Bug 1327 - Version installed ns-3 files
Gustavo Carneiro / Vedran Miletić
parents:
7679
diff
changeset
|
746 |
self.bld.install_files('${INCLUDEDIR}/%s%s/ns3' % (wutils.APPNAME, wutils.VERSION), |
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
747 |
ns3_dir_node.find_or_declare("%s-module.h" % self.module)) |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
748 |
task.set_inputs(all_headers_inputs) |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
749 |
task.set_outputs(all_headers_outputs) |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
750 |
task.module_deps = module_obj.module_deps |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
751 |
else: |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7467
diff
changeset
|
752 |
task.header_to_remove = all_headers_outputs[0] |