author | Peter D. Barnes, Jr. <barnes26@llnl.gov> |
Tue, 05 Jul 2016 15:18:47 -0700 | |
changeset 12179 | cd49c3198528 |
parent 12144 | 9b1e40cd0a70 |
child 12236 | fd72e9c4c558 |
permissions | -rw-r--r-- |
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
1 |
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- |
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4029
diff
changeset
|
2 |
|
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4029
diff
changeset
|
3 |
# python lib modules |
11634
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11544
diff
changeset
|
4 |
from __future__ import print_function |
647
04f34a8befb8
In WAF win32 builds, add -Wl,--enable-runtime-pseudo-reloc to LINKFLAGS to solve dll linking problems.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
642
diff
changeset
|
5 |
import sys |
695
90a68c1c4328
WAF: add a dist_hook function to exclude the generated documentation from waf dist
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
694
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:
1213
diff
changeset
|
7 |
import types |
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:
1213
diff
changeset
|
8 |
import optparse |
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:
1213
diff
changeset
|
9 |
import os.path |
4450
0ca9b9b410a0
bug 567: --enable-static does not work on i686
Andrey Hippo <ahippo@yandex.ru>
parents:
4447
diff
changeset
|
10 |
import re |
6670
c43b992a4f5b
Bug 1032 - Unable to specify multiple Compiler/Linker flags
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6669
diff
changeset
|
11 |
import shlex |
9277
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9261
diff
changeset
|
12 |
import subprocess |
7088
3f0535480de9
Bug 1110 - Sort alphabetically and display Modules built in columns
Mitch Watrous <watrous@u.washington.edu>
parents:
7066
diff
changeset
|
13 |
import textwrap |
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
14 |
|
9277
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9261
diff
changeset
|
15 |
from utils import read_config_file |
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9261
diff
changeset
|
16 |
|
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9261
diff
changeset
|
17 |
|
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4029
diff
changeset
|
18 |
# WAF modules |
9277
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9261
diff
changeset
|
19 |
from waflib import Utils, Scripting, Configure, Build, Options, TaskGen, Context, Task, Logs, Errors |
7494
d93f5e8e0a59
waf-1.6: Mac OSX and other fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7493
diff
changeset
|
20 |
from waflib.Errors import WafError |
d93f5e8e0a59
waf-1.6: Mac OSX and other fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7493
diff
changeset
|
21 |
|
9277
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9261
diff
changeset
|
22 |
|
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9261
diff
changeset
|
23 |
# local modules |
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9261
diff
changeset
|
24 |
import wutils |
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9261
diff
changeset
|
25 |
|
6857
d7db3cee241f
Add parsing of ns-3 configuration file
Mitch Watrous <watrous@u.washington.edu>
parents:
6834
diff
changeset
|
26 |
|
7024
4392d52b3536
Make examples not be built by default
Mitch Watrous <watrous@u.washington.edu>
parents:
7023
diff
changeset
|
27 |
# By default, all modules will be enabled, examples will be disabled, |
7023
af9c5ac72f2c
Make examples and tests be enabled from the .ns3rc file
Mitch Watrous <watrous@u.washington.edu>
parents:
7019
diff
changeset
|
28 |
# and tests will be disabled. |
af9c5ac72f2c
Make examples and tests be enabled from the .ns3rc file
Mitch Watrous <watrous@u.washington.edu>
parents:
7019
diff
changeset
|
29 |
modules_enabled = ['all_modules'] |
7024
4392d52b3536
Make examples not be built by default
Mitch Watrous <watrous@u.washington.edu>
parents:
7023
diff
changeset
|
30 |
examples_enabled = False |
7023
af9c5ac72f2c
Make examples and tests be enabled from the .ns3rc file
Mitch Watrous <watrous@u.washington.edu>
parents:
7019
diff
changeset
|
31 |
tests_enabled = False |
6857
d7db3cee241f
Add parsing of ns-3 configuration file
Mitch Watrous <watrous@u.washington.edu>
parents:
6834
diff
changeset
|
32 |
|
11682
daa3bfadabef
bug 2181: Xcode 7.0 (clang-602.0.53) errors
Tom Henderson <tomh@tomh.org>
parents:
11661
diff
changeset
|
33 |
# Compiler warning suppressions |
daa3bfadabef
bug 2181: Xcode 7.0 (clang-602.0.53) errors
Tom Henderson <tomh@tomh.org>
parents:
11661
diff
changeset
|
34 |
|
10790
b445436fd51f
bug 1868: enable -Wstrict-overflow only for newer gcc versions
Tom Henderson <tomh@tomh.org>
parents:
10769
diff
changeset
|
35 |
# Bug 1868: be conservative about -Wstrict-overflow for optimized builds |
b445436fd51f
bug 1868: enable -Wstrict-overflow only for newer gcc versions
Tom Henderson <tomh@tomh.org>
parents:
10769
diff
changeset
|
36 |
# on older compilers; it can generate spurious warnings. |
10800
85f484cffccd
bug 1868: restrict the compiler version for Wstrict-overflow=5 until gcc-4.9 issues are addressed
Tom Henderson <tomh@tomh.org>
parents:
10790
diff
changeset
|
37 |
cc_version_warn_strict_overflow = ('4', '8', '2') |
10790
b445436fd51f
bug 1868: enable -Wstrict-overflow only for newer gcc versions
Tom Henderson <tomh@tomh.org>
parents:
10769
diff
changeset
|
38 |
|
11682
daa3bfadabef
bug 2181: Xcode 7.0 (clang-602.0.53) errors
Tom Henderson <tomh@tomh.org>
parents:
11661
diff
changeset
|
39 |
# Bug 2181: clang warnings about unused local typedefs and potentially |
daa3bfadabef
bug 2181: Xcode 7.0 (clang-602.0.53) errors
Tom Henderson <tomh@tomh.org>
parents:
11661
diff
changeset
|
40 |
# evaluated expressions affecting darwin clang/LLVM version 7.0.0 (Xcode 7) |
daa3bfadabef
bug 2181: Xcode 7.0 (clang-602.0.53) errors
Tom Henderson <tomh@tomh.org>
parents:
11661
diff
changeset
|
41 |
# or clang/LLVM version 3.6 or greater. We must make this platform-specific. |
daa3bfadabef
bug 2181: Xcode 7.0 (clang-602.0.53) errors
Tom Henderson <tomh@tomh.org>
parents:
11661
diff
changeset
|
42 |
darwin_clang_version_warn_unused_local_typedefs = ('7', '0', '0') |
daa3bfadabef
bug 2181: Xcode 7.0 (clang-602.0.53) errors
Tom Henderson <tomh@tomh.org>
parents:
11661
diff
changeset
|
43 |
darwin_clang_version_warn_potentially_evaluated = ('7', '0', '0') |
daa3bfadabef
bug 2181: Xcode 7.0 (clang-602.0.53) errors
Tom Henderson <tomh@tomh.org>
parents:
11661
diff
changeset
|
44 |
clang_version_warn_unused_local_typedefs = ('3', '6', '0') |
daa3bfadabef
bug 2181: Xcode 7.0 (clang-602.0.53) errors
Tom Henderson <tomh@tomh.org>
parents:
11661
diff
changeset
|
45 |
clang_version_warn_potentially_evaluated = ('3', '6', '0') |
daa3bfadabef
bug 2181: Xcode 7.0 (clang-602.0.53) errors
Tom Henderson <tomh@tomh.org>
parents:
11661
diff
changeset
|
46 |
|
7023
af9c5ac72f2c
Make examples and tests be enabled from the .ns3rc file
Mitch Watrous <watrous@u.washington.edu>
parents:
7019
diff
changeset
|
47 |
# Get the information out of the NS-3 configuration file. |
af9c5ac72f2c
Make examples and tests be enabled from the .ns3rc file
Mitch Watrous <watrous@u.washington.edu>
parents:
7019
diff
changeset
|
48 |
config_file_exists = False |
af9c5ac72f2c
Make examples and tests be enabled from the .ns3rc file
Mitch Watrous <watrous@u.washington.edu>
parents:
7019
diff
changeset
|
49 |
(config_file_exists, modules_enabled, examples_enabled, tests_enabled) = read_config_file() |
6857
d7db3cee241f
Add parsing of ns-3 configuration file
Mitch Watrous <watrous@u.washington.edu>
parents:
6834
diff
changeset
|
50 |
|
5447
bfa1fc626775
Upgrade to upstream WAF 1.5.9 plus a bunch of 'waf tools' layered on top.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
5201
diff
changeset
|
51 |
sys.path.insert(0, os.path.abspath('waf-tools')) |
6274
3e8b3f2306c9
Upgrade to WAF 1.5.16. Fixes bug #855.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6254
diff
changeset
|
52 |
try: |
3e8b3f2306c9
Upgrade to WAF 1.5.16. Fixes bug #855.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6254
diff
changeset
|
53 |
import cflags # override the build profiles from waf |
3e8b3f2306c9
Upgrade to WAF 1.5.16. Fixes bug #855.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6254
diff
changeset
|
54 |
finally: |
3e8b3f2306c9
Upgrade to WAF 1.5.16. Fixes bug #855.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6254
diff
changeset
|
55 |
sys.path.pop(0) |
5447
bfa1fc626775
Upgrade to upstream WAF 1.5.9 plus a bunch of 'waf tools' layered on top.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
5201
diff
changeset
|
56 |
|
4069
430a6edb0fa0
New WAF cflags tool, to add back the compilation flags (debug/optimized)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4064
diff
changeset
|
57 |
cflags.profiles = { |
430a6edb0fa0
New WAF cflags tool, to add back the compilation flags (debug/optimized)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4064
diff
changeset
|
58 |
# profile name: [optimization_level, warnings_level, debug_level] |
430a6edb0fa0
New WAF cflags tool, to add back the compilation flags (debug/optimized)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4064
diff
changeset
|
59 |
'debug': [0, 2, 3], |
430a6edb0fa0
New WAF cflags tool, to add back the compilation flags (debug/optimized)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4064
diff
changeset
|
60 |
'optimized': [3, 2, 1], |
5452
15524c57a627
introduce new build profile "release": -O3 -g0.
Andrey Mazo <mazo@iitp.ru>
parents:
5448
diff
changeset
|
61 |
'release': [3, 2, 0], |
4069
430a6edb0fa0
New WAF cflags tool, to add back the compilation flags (debug/optimized)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4064
diff
changeset
|
62 |
} |
430a6edb0fa0
New WAF cflags tool, to add back the compilation flags (debug/optimized)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4064
diff
changeset
|
63 |
cflags.default_profile = 'debug' |
430a6edb0fa0
New WAF cflags tool, to add back the compilation flags (debug/optimized)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4064
diff
changeset
|
64 |
|
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
65 |
Configure.autoconfig = 0 |
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
66 |
|
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
67 |
# the following two variables are used by the target "waf dist" |
11634
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11544
diff
changeset
|
68 |
VERSION = open("VERSION", "rt").read().strip() |
694
bfad4514a789
WAF: correct values of VERSION and APPNAME, for waf dist
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
693
diff
changeset
|
69 |
APPNAME = 'ns' |
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
70 |
|
3866
9e946fee902c
Refactor wscript code to move regression testing code to a separate python module (bug 325)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3845
diff
changeset
|
71 |
wutils.VERSION = VERSION |
9e946fee902c
Refactor wscript code to move regression testing code to a separate python module (bug 325)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3845
diff
changeset
|
72 |
wutils.APPNAME = APPNAME |
9e946fee902c
Refactor wscript code to move regression testing code to a separate python module (bug 325)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3845
diff
changeset
|
73 |
|
7688
6f5c9b870e45
Still Bug 1327: disable VNUM in libraries, fix the .pc file deps
Vedran Miletić
parents:
7682
diff
changeset
|
74 |
# we don't use VNUM anymore (see bug #1327 for details) |
7463
53b784adf3f4
Bug 1251 - OSX: test.py reports dyld: Library not loaded
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7430
diff
changeset
|
75 |
wutils.VNUM = None |
7320
7334aa839e46
Bug 1175 postfix: only enable vnum if the VERSION matches x.y(.z) dotted number format
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7293
diff
changeset
|
76 |
|
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
77 |
# these variables are mandatory ('/' are converted automatically) |
7488
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
78 |
top = '.' |
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
79 |
out = 'build' |
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
80 |
|
4594
14ce84fd7ae3
make dist generation work again
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4550
diff
changeset
|
81 |
def load_env(): |
14ce84fd7ae3
make dist generation work again
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4550
diff
changeset
|
82 |
bld_cls = getattr(Utils.g_module, 'build_context', Utils.Context) |
14ce84fd7ae3
make dist generation work again
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4550
diff
changeset
|
83 |
bld_ctx = bld_cls() |
14ce84fd7ae3
make dist generation work again
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4550
diff
changeset
|
84 |
bld_ctx.load_dirs(os.path.abspath(os.path.join (srcdir,'..')), |
14ce84fd7ae3
make dist generation work again
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4550
diff
changeset
|
85 |
os.path.abspath(os.path.join (srcdir,'..', blddir))) |
14ce84fd7ae3
make dist generation work again
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4550
diff
changeset
|
86 |
bld_ctx.load_envs() |
14ce84fd7ae3
make dist generation work again
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4550
diff
changeset
|
87 |
env = bld_ctx.get_env() |
14ce84fd7ae3
make dist generation work again
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4550
diff
changeset
|
88 |
return env |
14ce84fd7ae3
make dist generation work again
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4550
diff
changeset
|
89 |
|
14ce84fd7ae3
make dist generation work again
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4550
diff
changeset
|
90 |
def get_files(base_dir): |
14ce84fd7ae3
make dist generation work again
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4550
diff
changeset
|
91 |
retval = [] |
14ce84fd7ae3
make dist generation work again
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4550
diff
changeset
|
92 |
reference=os.path.dirname(base_dir) |
14ce84fd7ae3
make dist generation work again
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4550
diff
changeset
|
93 |
for root, dirs, files in os.walk(base_dir): |
14ce84fd7ae3
make dist generation work again
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4550
diff
changeset
|
94 |
if root.find('.hg') != -1: |
14ce84fd7ae3
make dist generation work again
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4550
diff
changeset
|
95 |
continue |
14ce84fd7ae3
make dist generation work again
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4550
diff
changeset
|
96 |
for file in files: |
14ce84fd7ae3
make dist generation work again
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4550
diff
changeset
|
97 |
if file.find('.hg') != -1: |
14ce84fd7ae3
make dist generation work again
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4550
diff
changeset
|
98 |
continue |
14ce84fd7ae3
make dist generation work again
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4550
diff
changeset
|
99 |
fullname = os.path.join(root,file) |
14ce84fd7ae3
make dist generation work again
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4550
diff
changeset
|
100 |
# we can't use os.path.relpath because it's new in python 2.6 |
14ce84fd7ae3
make dist generation work again
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4550
diff
changeset
|
101 |
relname = fullname.replace(reference + '/','') |
14ce84fd7ae3
make dist generation work again
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4550
diff
changeset
|
102 |
retval.append([fullname,relname]) |
14ce84fd7ae3
make dist generation work again
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4550
diff
changeset
|
103 |
return retval |
14ce84fd7ae3
make dist generation work again
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4550
diff
changeset
|
104 |
|
2881
81d1080cd0ae
Integrate regression testing into the main waf script.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2866
diff
changeset
|
105 |
|
1531
ebd805503b55
WAF: update to WAF trunk to get bug fixes and smaller script.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1506
diff
changeset
|
106 |
def dist_hook(): |
2886
8226157800a8
Create regression traces tarball automatically on waf dist.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2884
diff
changeset
|
107 |
import tarfile |
921
37b54ed96b09
WAF: ignore errors on shutil.rmtree in dist_hook, so that waf dist works even when no docs were previously generated.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
919
diff
changeset
|
108 |
shutil.rmtree("doc/html", True) |
37b54ed96b09
WAF: ignore errors on shutil.rmtree in dist_hook, so that waf dist works even when no docs were previously generated.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
919
diff
changeset
|
109 |
shutil.rmtree("doc/latex", True) |
3627
672f2a6de8b4
Exclude any possible 'nsc' folder from the dist tarball (nsc is ~= 100MB).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3625
diff
changeset
|
110 |
shutil.rmtree("nsc", True) |
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
111 |
|
7293
0f574c532cee
Make test module not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7291
diff
changeset
|
112 |
# Print the sorted list of module names in columns. |
7291
d39c09dbc3d9
Make emu and template modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7131
diff
changeset
|
113 |
def print_module_names(names): |
7293
0f574c532cee
Make test module not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7291
diff
changeset
|
114 |
# Sort the list of module names. |
0f574c532cee
Make test module not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7291
diff
changeset
|
115 |
names.sort() |
7291
d39c09dbc3d9
Make emu and template modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7131
diff
changeset
|
116 |
|
d39c09dbc3d9
Make emu and template modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7131
diff
changeset
|
117 |
# Print the list of module names in 3 columns. |
d39c09dbc3d9
Make emu and template modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7131
diff
changeset
|
118 |
i = 1 |
7293
0f574c532cee
Make test module not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7291
diff
changeset
|
119 |
for name in names: |
11634
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11544
diff
changeset
|
120 |
print(name.ljust(25), end=' ') |
7291
d39c09dbc3d9
Make emu and template modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7131
diff
changeset
|
121 |
if i == 3: |
11634
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11544
diff
changeset
|
122 |
print() |
7291
d39c09dbc3d9
Make emu and template modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7131
diff
changeset
|
123 |
i = 0 |
d39c09dbc3d9
Make emu and template modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7131
diff
changeset
|
124 |
i = i+1 |
d39c09dbc3d9
Make emu and template modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7131
diff
changeset
|
125 |
|
d39c09dbc3d9
Make emu and template modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7131
diff
changeset
|
126 |
if i != 1: |
11634
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11544
diff
changeset
|
127 |
print() |
7291
d39c09dbc3d9
Make emu and template modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7131
diff
changeset
|
128 |
|
11661
68c0e7f87bdf
additional Python 2/3 compatibility
Tom Henderson <tomh@tomh.org>
parents:
11650
diff
changeset
|
129 |
# return types of some APIs differ in Python 2/3 (type string vs class bytes) |
68c0e7f87bdf
additional Python 2/3 compatibility
Tom Henderson <tomh@tomh.org>
parents:
11650
diff
changeset
|
130 |
# This method will decode('utf-8') a byte object in Python 3, |
68c0e7f87bdf
additional Python 2/3 compatibility
Tom Henderson <tomh@tomh.org>
parents:
11650
diff
changeset
|
131 |
# and do nothing in Python 2 |
68c0e7f87bdf
additional Python 2/3 compatibility
Tom Henderson <tomh@tomh.org>
parents:
11650
diff
changeset
|
132 |
def maybe_decode(input): |
68c0e7f87bdf
additional Python 2/3 compatibility
Tom Henderson <tomh@tomh.org>
parents:
11650
diff
changeset
|
133 |
if sys.version_info < (3,): |
68c0e7f87bdf
additional Python 2/3 compatibility
Tom Henderson <tomh@tomh.org>
parents:
11650
diff
changeset
|
134 |
return input |
68c0e7f87bdf
additional Python 2/3 compatibility
Tom Henderson <tomh@tomh.org>
parents:
11650
diff
changeset
|
135 |
else: |
68c0e7f87bdf
additional Python 2/3 compatibility
Tom Henderson <tomh@tomh.org>
parents:
11650
diff
changeset
|
136 |
try: |
68c0e7f87bdf
additional Python 2/3 compatibility
Tom Henderson <tomh@tomh.org>
parents:
11650
diff
changeset
|
137 |
return input.decode('utf-8') |
68c0e7f87bdf
additional Python 2/3 compatibility
Tom Henderson <tomh@tomh.org>
parents:
11650
diff
changeset
|
138 |
except: |
68c0e7f87bdf
additional Python 2/3 compatibility
Tom Henderson <tomh@tomh.org>
parents:
11650
diff
changeset
|
139 |
sys.exc_clear() |
68c0e7f87bdf
additional Python 2/3 compatibility
Tom Henderson <tomh@tomh.org>
parents:
11650
diff
changeset
|
140 |
return input |
68c0e7f87bdf
additional Python 2/3 compatibility
Tom Henderson <tomh@tomh.org>
parents:
11650
diff
changeset
|
141 |
|
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
142 |
def options(opt): |
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
143 |
# options provided by the modules |
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
144 |
opt.load('compiler_c') |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
145 |
opt.load('compiler_cxx') |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
146 |
opt.load('cflags') |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
147 |
opt.load('gnu_dirs') |
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
148 |
|
2846
7689461231ac
start of regression tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
2622
diff
changeset
|
149 |
opt.add_option('--cwd', |
7689461231ac
start of regression tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
2622
diff
changeset
|
150 |
help=('Set the working directory for a program.'), |
7689461231ac
start of regression tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
2622
diff
changeset
|
151 |
action="store", type="string", default=None, |
7689461231ac
start of regression tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
2622
diff
changeset
|
152 |
dest='cwd_launch') |
7689461231ac
start of regression tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
2622
diff
changeset
|
153 |
|
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
154 |
opt.add_option('--enable-gcov', |
787
778784e6bd8d
WAF: simplify --debug-level option to only have debug and optimized as possible values (debug becomes the former ultradebug); Add a warning to some options help text saying they only work in configure.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
786
diff
changeset
|
155 |
help=('Enable code coverage analysis.' |
778784e6bd8d
WAF: simplify --debug-level option to only have debug and optimized as possible values (debug becomes the former ultradebug); Add a warning to some options help text saying they only work in configure.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
786
diff
changeset
|
156 |
' WARNING: this option only has effect ' |
778784e6bd8d
WAF: simplify --debug-level option to only have debug and optimized as possible values (debug becomes the former ultradebug); Add a warning to some options help text saying they only work in configure.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
786
diff
changeset
|
157 |
'with the configure command.'), |
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
158 |
action="store_true", default=False, |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
159 |
dest='enable_gcov') |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
160 |
|
2866
1d829915f092
Add a --no-task-lines WAF option; together with -v it makes WAF just print executed commands, like 'make' does.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2846
diff
changeset
|
161 |
opt.add_option('--no-task-lines', |
1d829915f092
Add a --no-task-lines WAF option; together with -v it makes WAF just print executed commands, like 'make' does.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2846
diff
changeset
|
162 |
help=("Don't print task lines, i.e. messages saying which tasks are being executed by WAF." |
1d829915f092
Add a --no-task-lines WAF option; together with -v it makes WAF just print executed commands, like 'make' does.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2846
diff
changeset
|
163 |
" Coupled with a single -v will cause WAF to output only the executed commands," |
1d829915f092
Add a --no-task-lines WAF option; together with -v it makes WAF just print executed commands, like 'make' does.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2846
diff
changeset
|
164 |
" just like 'make' does by default."), |
1d829915f092
Add a --no-task-lines WAF option; together with -v it makes WAF just print executed commands, like 'make' does.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2846
diff
changeset
|
165 |
action="store_true", default=False, |
1d829915f092
Add a --no-task-lines WAF option; together with -v it makes WAF just print executed commands, like 'make' does.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2846
diff
changeset
|
166 |
dest='no_task_lines') |
1d829915f092
Add a --no-task-lines WAF option; together with -v it makes WAF just print executed commands, like 'make' does.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2846
diff
changeset
|
167 |
|
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
168 |
opt.add_option('--lcov-report', |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
169 |
help=('Generate a code coverage report ' |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
170 |
'(use this option at build time, not in configure)'), |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
171 |
action="store_true", default=False, |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
172 |
dest='lcov_report') |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
173 |
|
672
184d5a505279
WAF: remove the rpath options, and add --run and --shell as replacements; additionally, the new options "should" work on Mac OS X, as well as linux2 and win32.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
671
diff
changeset
|
174 |
opt.add_option('--run', |
935
53e1e53c373f
WAF: add a --command-template option to e.g. allow running programs with valgrind, gdb, etc.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
934
diff
changeset
|
175 |
help=('Run a locally built program; argument can be a program name,' |
53e1e53c373f
WAF: add a --command-template option to e.g. allow running programs with valgrind, gdb, etc.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
934
diff
changeset
|
176 |
' or a command starting with the program name.'), |
672
184d5a505279
WAF: remove the rpath options, and add --run and --shell as replacements; additionally, the new options "should" work on Mac OS X, as well as linux2 and win32.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
671
diff
changeset
|
177 |
type="string", default='', dest='run') |
6676
8a57344a8d09
Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6670
diff
changeset
|
178 |
opt.add_option('--visualize', |
8a57344a8d09
Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6670
diff
changeset
|
179 |
help=('Modify --run arguments to enable the visualizer'), |
8a57344a8d09
Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6670
diff
changeset
|
180 |
action="store_true", default=False, dest='visualize') |
935
53e1e53c373f
WAF: add a --command-template option to e.g. allow running programs with valgrind, gdb, etc.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
934
diff
changeset
|
181 |
opt.add_option('--command-template', |
53e1e53c373f
WAF: add a --command-template option to e.g. allow running programs with valgrind, gdb, etc.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
934
diff
changeset
|
182 |
help=('Template of the command used to run the program given by --run;' |
53e1e53c373f
WAF: add a --command-template option to e.g. allow running programs with valgrind, gdb, etc.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
934
diff
changeset
|
183 |
' It should be a shell command string containing %s inside,' |
53e1e53c373f
WAF: add a --command-template option to e.g. allow running programs with valgrind, gdb, etc.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
934
diff
changeset
|
184 |
' which will be replaced by the actual program.'), |
53e1e53c373f
WAF: add a --command-template option to e.g. allow running programs with valgrind, gdb, etc.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
934
diff
changeset
|
185 |
type="string", default=None, dest='command_template') |
3419
8d3f5c0f55fa
Add WAF option --pyrun, to make it easier to run Python programs.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3418
diff
changeset
|
186 |
opt.add_option('--pyrun', |
8d3f5c0f55fa
Add WAF option --pyrun, to make it easier to run Python programs.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3418
diff
changeset
|
187 |
help=('Run a python program using locally built ns3 python module;' |
8d3f5c0f55fa
Add WAF option --pyrun, to make it easier to run Python programs.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3418
diff
changeset
|
188 |
' argument is the path to the python program, optionally followed' |
8d3f5c0f55fa
Add WAF option --pyrun, to make it easier to run Python programs.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3418
diff
changeset
|
189 |
' by command-line options that are passed to the program.'), |
8d3f5c0f55fa
Add WAF option --pyrun, to make it easier to run Python programs.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3418
diff
changeset
|
190 |
type="string", default='', dest='pyrun') |
2207
d841cca00990
Add a --valgrind WAF option (bug #124)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2178
diff
changeset
|
191 |
opt.add_option('--valgrind', |
d841cca00990
Add a --valgrind WAF option (bug #124)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2178
diff
changeset
|
192 |
help=('Change the default command template to run programs and unit tests with valgrind'), |
d841cca00990
Add a --valgrind WAF option (bug #124)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2178
diff
changeset
|
193 |
action="store_true", default=False, |
d841cca00990
Add a --valgrind WAF option (bug #124)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2178
diff
changeset
|
194 |
dest='valgrind') |
672
184d5a505279
WAF: remove the rpath options, and add --run and --shell as replacements; additionally, the new options "should" work on Mac OS X, as well as linux2 and win32.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
671
diff
changeset
|
195 |
opt.add_option('--shell', |
4326
179f86838e62
Upgrade to WAF 1.5.4
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4202
diff
changeset
|
196 |
help=('DEPRECATED (run ./waf shell)'), |
672
184d5a505279
WAF: remove the rpath options, and add --run and --shell as replacements; additionally, the new options "should" work on Mac OS X, as well as linux2 and win32.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
671
diff
changeset
|
197 |
action="store_true", default=False, |
184d5a505279
WAF: remove the rpath options, and add --run and --shell as replacements; additionally, the new options "should" work on Mac OS X, as well as linux2 and win32.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
671
diff
changeset
|
198 |
dest='shell') |
4164
1f6ae48061a9
checkpoint tap bridge
Craig Dowell <craigdo@ee.washington.edu>
parents:
4119
diff
changeset
|
199 |
opt.add_option('--enable-sudo', |
1f6ae48061a9
checkpoint tap bridge
Craig Dowell <craigdo@ee.washington.edu>
parents:
4119
diff
changeset
|
200 |
help=('Use sudo to setup suid bits on ns3 executables.'), |
1f6ae48061a9
checkpoint tap bridge
Craig Dowell <craigdo@ee.washington.edu>
parents:
4119
diff
changeset
|
201 |
dest='enable_sudo', action='store_true', |
1f6ae48061a9
checkpoint tap bridge
Craig Dowell <craigdo@ee.washington.edu>
parents:
4119
diff
changeset
|
202 |
default=False) |
6998
1c2b8cfb71d2
Make tests not be built by default
Mitch Watrous <watrous@u.washington.edu>
parents:
6981
diff
changeset
|
203 |
opt.add_option('--enable-tests', |
1c2b8cfb71d2
Make tests not be built by default
Mitch Watrous <watrous@u.washington.edu>
parents:
6981
diff
changeset
|
204 |
help=('Build the ns-3 tests.'), |
1c2b8cfb71d2
Make tests not be built by default
Mitch Watrous <watrous@u.washington.edu>
parents:
6981
diff
changeset
|
205 |
dest='enable_tests', action='store_true', |
1c2b8cfb71d2
Make tests not be built by default
Mitch Watrous <watrous@u.washington.edu>
parents:
6981
diff
changeset
|
206 |
default=False) |
1c2b8cfb71d2
Make tests not be built by default
Mitch Watrous <watrous@u.washington.edu>
parents:
6981
diff
changeset
|
207 |
opt.add_option('--disable-tests', |
1c2b8cfb71d2
Make tests not be built by default
Mitch Watrous <watrous@u.washington.edu>
parents:
6981
diff
changeset
|
208 |
help=('Do not build the ns-3 tests.'), |
7023
af9c5ac72f2c
Make examples and tests be enabled from the .ns3rc file
Mitch Watrous <watrous@u.washington.edu>
parents:
7019
diff
changeset
|
209 |
dest='disable_tests', action='store_true', |
af9c5ac72f2c
Make examples and tests be enabled from the .ns3rc file
Mitch Watrous <watrous@u.washington.edu>
parents:
7019
diff
changeset
|
210 |
default=False) |
5369
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
5368
diff
changeset
|
211 |
opt.add_option('--enable-examples', |
7025
32212c736ab4
Move examples out of samples directory and remove it
Mitch Watrous <watrous@u.washington.edu>
parents:
7024
diff
changeset
|
212 |
help=('Build the ns-3 examples.'), |
5369
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
5368
diff
changeset
|
213 |
dest='enable_examples', action='store_true', |
7023
af9c5ac72f2c
Make examples and tests be enabled from the .ns3rc file
Mitch Watrous <watrous@u.washington.edu>
parents:
7019
diff
changeset
|
214 |
default=False) |
5369
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
5368
diff
changeset
|
215 |
opt.add_option('--disable-examples', |
7025
32212c736ab4
Move examples out of samples directory and remove it
Mitch Watrous <watrous@u.washington.edu>
parents:
7024
diff
changeset
|
216 |
help=('Do not build the ns-3 examples.'), |
7023
af9c5ac72f2c
Make examples and tests be enabled from the .ns3rc file
Mitch Watrous <watrous@u.washington.edu>
parents:
7019
diff
changeset
|
217 |
dest='disable_examples', action='store_true', |
af9c5ac72f2c
Make examples and tests be enabled from the .ns3rc file
Mitch Watrous <watrous@u.washington.edu>
parents:
7019
diff
changeset
|
218 |
default=False) |
4531
14a102415139
Run unit tests as indenpendent WAF tasks
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4450
diff
changeset
|
219 |
opt.add_option('--check', |
5361
e8989b44bffb
Doxygen and wscript messages point to test.py
Craig Dowell <craigdo@ee.washington.edu>
parents:
5252
diff
changeset
|
220 |
help=('DEPRECATED (run ./test.py)'), |
4531
14a102415139
Run unit tests as indenpendent WAF tasks
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4450
diff
changeset
|
221 |
default=False, dest='check', action="store_true") |
4392
25d38a0c9851
bug 537: no support to build static ns-3 binaries
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4388
diff
changeset
|
222 |
opt.add_option('--enable-static', |
25d38a0c9851
bug 537: no support to build static ns-3 binaries
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4388
diff
changeset
|
223 |
help=('Compile NS-3 statically: works only on linux, without python'), |
25d38a0c9851
bug 537: no support to build static ns-3 binaries
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4388
diff
changeset
|
224 |
dest='enable_static', action='store_true', |
25d38a0c9851
bug 537: no support to build static ns-3 binaries
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4388
diff
changeset
|
225 |
default=False) |
6113
0ce37bf4f1c1
Merge distributed simulation code
Josh Pelkey <jpelkey@gatech.edu>
parents:
6099
diff
changeset
|
226 |
opt.add_option('--enable-mpi', |
0ce37bf4f1c1
Merge distributed simulation code
Josh Pelkey <jpelkey@gatech.edu>
parents:
6099
diff
changeset
|
227 |
help=('Compile NS-3 with MPI and distributed simulation support'), |
0ce37bf4f1c1
Merge distributed simulation code
Josh Pelkey <jpelkey@gatech.edu>
parents:
6099
diff
changeset
|
228 |
dest='enable_mpi', action='store_true', |
0ce37bf4f1c1
Merge distributed simulation code
Josh Pelkey <jpelkey@gatech.edu>
parents:
6099
diff
changeset
|
229 |
default=False) |
5468
6eebad1fb54d
Bring back the --doxygen-no-build option from the dead.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
5463
diff
changeset
|
230 |
opt.add_option('--doxygen-no-build', |
6eebad1fb54d
Bring back the --doxygen-no-build option from the dead.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
5463
diff
changeset
|
231 |
help=('Run doxygen to generate html documentation from source comments, ' |
6eebad1fb54d
Bring back the --doxygen-no-build option from the dead.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
5463
diff
changeset
|
232 |
'but do not wait for ns-3 to finish the full build.'), |
6eebad1fb54d
Bring back the --doxygen-no-build option from the dead.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
5463
diff
changeset
|
233 |
action="store_true", default=False, |
6eebad1fb54d
Bring back the --doxygen-no-build option from the dead.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
5463
diff
changeset
|
234 |
dest='doxygen_no_build') |
2881
81d1080cd0ae
Integrate regression testing into the main waf script.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2866
diff
changeset
|
235 |
|
5468
6eebad1fb54d
Bring back the --doxygen-no-build option from the dead.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
5463
diff
changeset
|
236 |
# options provided in subdirectories |
9277
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9261
diff
changeset
|
237 |
opt.recurse('src') |
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9261
diff
changeset
|
238 |
opt.recurse('bindings/python') |
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9261
diff
changeset
|
239 |
opt.recurse('src/internet') |
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
240 |
|
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
241 |
|
7539
fd2a26e455b3
Determine whether static can be enabled based on link flags tests rather than a hardcoded whitelist of supported platforms
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7538
diff
changeset
|
242 |
def _check_compilation_flag(conf, flag, mode='cxx', linkflags=None): |
3407
038f13c8741c
Check that the compiler accepts -Wno-error=deprecated-declarations before using it
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3406
diff
changeset
|
243 |
""" |
038f13c8741c
Check that the compiler accepts -Wno-error=deprecated-declarations before using it
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3406
diff
changeset
|
244 |
Checks if the C++ compiler accepts a certain compilation flag or flags |
038f13c8741c
Check that the compiler accepts -Wno-error=deprecated-declarations before using it
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3406
diff
changeset
|
245 |
flag: can be a string or a list of strings |
038f13c8741c
Check that the compiler accepts -Wno-error=deprecated-declarations before using it
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3406
diff
changeset
|
246 |
""" |
7539
fd2a26e455b3
Determine whether static can be enabled based on link flags tests rather than a hardcoded whitelist of supported platforms
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7538
diff
changeset
|
247 |
l = [] |
fd2a26e455b3
Determine whether static can be enabled based on link flags tests rather than a hardcoded whitelist of supported platforms
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7538
diff
changeset
|
248 |
if flag: |
fd2a26e455b3
Determine whether static can be enabled based on link flags tests rather than a hardcoded whitelist of supported platforms
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7538
diff
changeset
|
249 |
l.append(flag) |
fd2a26e455b3
Determine whether static can be enabled based on link flags tests rather than a hardcoded whitelist of supported platforms
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7538
diff
changeset
|
250 |
if isinstance(linkflags, list): |
fd2a26e455b3
Determine whether static can be enabled based on link flags tests rather than a hardcoded whitelist of supported platforms
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7538
diff
changeset
|
251 |
l.extend(linkflags) |
fd2a26e455b3
Determine whether static can be enabled based on link flags tests rather than a hardcoded whitelist of supported platforms
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7538
diff
changeset
|
252 |
else: |
fd2a26e455b3
Determine whether static can be enabled based on link flags tests rather than a hardcoded whitelist of supported platforms
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7538
diff
changeset
|
253 |
if linkflags: |
fd2a26e455b3
Determine whether static can be enabled based on link flags tests rather than a hardcoded whitelist of supported platforms
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7538
diff
changeset
|
254 |
l.append(linkflags) |
fd2a26e455b3
Determine whether static can be enabled based on link flags tests rather than a hardcoded whitelist of supported platforms
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7538
diff
changeset
|
255 |
if len(l) > 1: |
fd2a26e455b3
Determine whether static can be enabled based on link flags tests rather than a hardcoded whitelist of supported platforms
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7538
diff
changeset
|
256 |
flag_str = 'flags ' + ' '.join(l) |
fd2a26e455b3
Determine whether static can be enabled based on link flags tests rather than a hardcoded whitelist of supported platforms
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7538
diff
changeset
|
257 |
else: |
fd2a26e455b3
Determine whether static can be enabled based on link flags tests rather than a hardcoded whitelist of supported platforms
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7538
diff
changeset
|
258 |
flag_str = 'flag ' + ' '.join(l) |
11634
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11544
diff
changeset
|
259 |
if len(flag_str) > 28: |
7539
fd2a26e455b3
Determine whether static can be enabled based on link flags tests rather than a hardcoded whitelist of supported platforms
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7538
diff
changeset
|
260 |
flag_str = flag_str[:28] + "..." |
3407
038f13c8741c
Check that the compiler accepts -Wno-error=deprecated-declarations before using it
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3406
diff
changeset
|
261 |
|
7539
fd2a26e455b3
Determine whether static can be enabled based on link flags tests rather than a hardcoded whitelist of supported platforms
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7538
diff
changeset
|
262 |
conf.start_msg('Checking for compilation %s support' % (flag_str,)) |
9277
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9261
diff
changeset
|
263 |
env = conf.env.derive() |
7539
fd2a26e455b3
Determine whether static can be enabled based on link flags tests rather than a hardcoded whitelist of supported platforms
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7538
diff
changeset
|
264 |
|
11457
5f76cbf2850b
Update Waf to 1.8.11
Matthieu Coudron <mattator@gmail.com>
parents:
11276
diff
changeset
|
265 |
retval = False |
7539
fd2a26e455b3
Determine whether static can be enabled based on link flags tests rather than a hardcoded whitelist of supported platforms
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7538
diff
changeset
|
266 |
if mode == 'cc': |
fd2a26e455b3
Determine whether static can be enabled based on link flags tests rather than a hardcoded whitelist of supported platforms
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7538
diff
changeset
|
267 |
mode = 'c' |
fd2a26e455b3
Determine whether static can be enabled based on link flags tests rather than a hardcoded whitelist of supported platforms
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7538
diff
changeset
|
268 |
|
6099
b37a72870f2d
Test the support for the -Wno-error=deprecated-declarations option independently for the C and C++ compilers
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6001
diff
changeset
|
269 |
if mode == 'cxx': |
b37a72870f2d
Test the support for the -Wno-error=deprecated-declarations option independently for the C and C++ compilers
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6001
diff
changeset
|
270 |
env.append_value('CXXFLAGS', flag) |
b37a72870f2d
Test the support for the -Wno-error=deprecated-declarations option independently for the C and C++ compilers
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6001
diff
changeset
|
271 |
else: |
7539
fd2a26e455b3
Determine whether static can be enabled based on link flags tests rather than a hardcoded whitelist of supported platforms
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7538
diff
changeset
|
272 |
env.append_value('CFLAGS', flag) |
fd2a26e455b3
Determine whether static can be enabled based on link flags tests rather than a hardcoded whitelist of supported platforms
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7538
diff
changeset
|
273 |
|
fd2a26e455b3
Determine whether static can be enabled based on link flags tests rather than a hardcoded whitelist of supported platforms
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7538
diff
changeset
|
274 |
if linkflags is not None: |
fd2a26e455b3
Determine whether static can be enabled based on link flags tests rather than a hardcoded whitelist of supported platforms
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7538
diff
changeset
|
275 |
env.append_value("LINKFLAGS", linkflags) |
fd2a26e455b3
Determine whether static can be enabled based on link flags tests rather than a hardcoded whitelist of supported platforms
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7538
diff
changeset
|
276 |
|
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4029
diff
changeset
|
277 |
try: |
11476
77692ede4417
Use proper environment when checking for supported compiler flags
Vedran Miletić <rivanvx@gmail.com>
parents:
11475
diff
changeset
|
278 |
retval = conf.check(compiler=mode, fragment='int main() { return 0; }', features='c', env=env) |
9277
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9261
diff
changeset
|
279 |
except Errors.ConfigurationError: |
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4029
diff
changeset
|
280 |
ok = False |
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4029
diff
changeset
|
281 |
else: |
11457
5f76cbf2850b
Update Waf to 1.8.11
Matthieu Coudron <mattator@gmail.com>
parents:
11276
diff
changeset
|
282 |
ok = (retval == True) |
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
283 |
conf.end_msg(ok) |
4069
430a6edb0fa0
New WAF cflags tool, to add back the compilation flags (debug/optimized)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4064
diff
changeset
|
284 |
return ok |
3407
038f13c8741c
Check that the compiler accepts -Wno-error=deprecated-declarations before using it
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3406
diff
changeset
|
285 |
|
11457
5f76cbf2850b
Update Waf to 1.8.11
Matthieu Coudron <mattator@gmail.com>
parents:
11276
diff
changeset
|
286 |
|
3625
30afad8324d5
Add a summary of optional features at the end of the configuration stage.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3623
diff
changeset
|
287 |
def report_optional_feature(conf, name, caption, was_enabled, reason_not_enabled): |
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
288 |
conf.env.append_value('NS3_OPTIONAL_FEATURES', [(name, caption, was_enabled, reason_not_enabled)]) |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
289 |
|
11457
5f76cbf2850b
Update Waf to 1.8.11
Matthieu Coudron <mattator@gmail.com>
parents:
11276
diff
changeset
|
290 |
|
7712
e22640804bf7
Bug 1355 - visualizer dependencies not detected at buildtime
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7707
diff
changeset
|
291 |
def check_optional_feature(conf, name): |
e22640804bf7
Bug 1355 - visualizer dependencies not detected at buildtime
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7707
diff
changeset
|
292 |
for (name1, caption, was_enabled, reason_not_enabled) in conf.env.NS3_OPTIONAL_FEATURES: |
e22640804bf7
Bug 1355 - visualizer dependencies not detected at buildtime
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7707
diff
changeset
|
293 |
if name1 == name: |
e22640804bf7
Bug 1355 - visualizer dependencies not detected at buildtime
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7707
diff
changeset
|
294 |
return was_enabled |
e22640804bf7
Bug 1355 - visualizer dependencies not detected at buildtime
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7707
diff
changeset
|
295 |
raise KeyError("Feature %r not declared yet" % (name,)) |
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
296 |
|
11457
5f76cbf2850b
Update Waf to 1.8.11
Matthieu Coudron <mattator@gmail.com>
parents:
11276
diff
changeset
|
297 |
|
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
298 |
# starting with waf 1.6, conf.check() becomes fatal by default if the |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
299 |
# test fails, this alternative method makes the test non-fatal, as it |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
300 |
# was in waf <= 1.5 |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
301 |
def _check_nonfatal(conf, *args, **kwargs): |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
302 |
try: |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
303 |
return conf.check(*args, **kwargs) |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
304 |
except conf.errors.ConfigurationError: |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
305 |
return None |
3407
038f13c8741c
Check that the compiler accepts -Wno-error=deprecated-declarations before using it
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3406
diff
changeset
|
306 |
|
11457
5f76cbf2850b
Update Waf to 1.8.11
Matthieu Coudron <mattator@gmail.com>
parents:
11276
diff
changeset
|
307 |
|
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
308 |
def configure(conf): |
9277
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9261
diff
changeset
|
309 |
conf.load('relocation', tooldir=['waf-tools']) |
7544
51f8237d285a
Bug 1265 - Make ns-3 directory "movable"
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7539
diff
changeset
|
310 |
|
3625
30afad8324d5
Add a summary of optional features at the end of the configuration stage.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3623
diff
changeset
|
311 |
# attach some extra methods |
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
312 |
conf.check_nonfatal = types.MethodType(_check_nonfatal, conf) |
4326
179f86838e62
Upgrade to WAF 1.5.4
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4202
diff
changeset
|
313 |
conf.check_compilation_flag = types.MethodType(_check_compilation_flag, conf) |
3625
30afad8324d5
Add a summary of optional features at the end of the configuration stage.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3623
diff
changeset
|
314 |
conf.report_optional_feature = types.MethodType(report_optional_feature, conf) |
7712
e22640804bf7
Bug 1355 - visualizer dependencies not detected at buildtime
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7707
diff
changeset
|
315 |
conf.check_optional_feature = types.MethodType(check_optional_feature, conf) |
3625
30afad8324d5
Add a summary of optional features at the end of the configuration stage.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3623
diff
changeset
|
316 |
conf.env['NS3_OPTIONAL_FEATURES'] = [] |
30afad8324d5
Add a summary of optional features at the end of the configuration stage.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3623
diff
changeset
|
317 |
|
9277
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9261
diff
changeset
|
318 |
conf.load('compiler_c') |
11457
5f76cbf2850b
Update Waf to 1.8.11
Matthieu Coudron <mattator@gmail.com>
parents:
11276
diff
changeset
|
319 |
cc_string = '.'.join(conf.env['CC_VERSION']) |
9974
ea69d1cc3e46
display gcc version in waf configure
Tom Henderson <tomh@tomh.org>
parents:
9909
diff
changeset
|
320 |
conf.msg('Checking for cc version',cc_string,'GREEN') |
9277
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9261
diff
changeset
|
321 |
conf.load('compiler_cxx') |
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9261
diff
changeset
|
322 |
conf.load('cflags', tooldir=['waf-tools']) |
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9261
diff
changeset
|
323 |
conf.load('command', tooldir=['waf-tools']) |
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9261
diff
changeset
|
324 |
conf.load('gnu_dirs') |
11457
5f76cbf2850b
Update Waf to 1.8.11
Matthieu Coudron <mattator@gmail.com>
parents:
11276
diff
changeset
|
325 |
conf.load('clang_compilation_database', tooldir=['waf-tools']) |
7345
850237ab2111
Bug 1199 - waf install doesn't work on x86_64
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7337
diff
changeset
|
326 |
|
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
327 |
env = conf.env |
4594
14ce84fd7ae3
make dist generation work again
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4550
diff
changeset
|
328 |
|
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4029
diff
changeset
|
329 |
if Options.options.enable_gcov: |
7493
3bbefa91e694
Fix the --lcov-report option
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7492
diff
changeset
|
330 |
env['GCOV_ENABLED'] = True |
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
331 |
env.append_value('CCFLAGS', '-fprofile-arcs') |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
332 |
env.append_value('CCFLAGS', '-ftest-coverage') |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
333 |
env.append_value('CXXFLAGS', '-fprofile-arcs') |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
334 |
env.append_value('CXXFLAGS', '-ftest-coverage') |
7551 | 335 |
env.append_value('LINKFLAGS', '-lgcov') |
11067
9a2e40812460
bug 1583: fix ./waf configure --enable-gcov
Tom Henderson <tomh@tomh.org>
parents:
10800
diff
changeset
|
336 |
env.append_value('LINKFLAGS', '-coverage') |
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
337 |
|
4069
430a6edb0fa0
New WAF cflags tool, to add back the compilation flags (debug/optimized)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4064
diff
changeset
|
338 |
if Options.options.build_profile == 'debug': |
11544
cfaf2d65b33c
Build profile macros
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11476
diff
changeset
|
339 |
env.append_value('DEFINES', 'NS3_BUILD_PROFILE_DEBUG') |
7494
d93f5e8e0a59
waf-1.6: Mac OSX and other fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7493
diff
changeset
|
340 |
env.append_value('DEFINES', 'NS3_ASSERT_ENABLE') |
d93f5e8e0a59
waf-1.6: Mac OSX and other fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7493
diff
changeset
|
341 |
env.append_value('DEFINES', 'NS3_LOG_ENABLE') |
1426
30b9f2b59a1c
WAF: in optimized builds, replace -O2 with -O3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1425
diff
changeset
|
342 |
|
11544
cfaf2d65b33c
Build profile macros
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11476
diff
changeset
|
343 |
if Options.options.build_profile == 'release': |
cfaf2d65b33c
Build profile macros
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11476
diff
changeset
|
344 |
env.append_value('DEFINES', 'NS3_BUILD_PROFILE_RELEASE') |
cfaf2d65b33c
Build profile macros
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11476
diff
changeset
|
345 |
|
cfaf2d65b33c
Build profile macros
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11476
diff
changeset
|
346 |
if Options.options.build_profile == 'optimized': |
cfaf2d65b33c
Build profile macros
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11476
diff
changeset
|
347 |
env.append_value('DEFINES', 'NS3_BUILD_PROFILE_OPTIMIZED') |
cfaf2d65b33c
Build profile macros
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11476
diff
changeset
|
348 |
|
4190
b6734a5d920c
work around to allow FreeBSD to run tap-bridge
Craig Dowell <craigdo@ee.washington.edu>
parents:
4179
diff
changeset
|
349 |
env['PLATFORM'] = sys.platform |
7681
0873edb445e8
Bug 1327 - Version installed ns-3 files
Gustavo Carneiro / Vedran Miletić
parents:
7645
diff
changeset
|
350 |
env['BUILD_PROFILE'] = Options.options.build_profile |
8894
90d67c5e8255
Bug 1445 - When build with "-d release", don't suffix "-release"
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
8848
diff
changeset
|
351 |
if Options.options.build_profile == "release": |
90d67c5e8255
Bug 1445 - When build with "-d release", don't suffix "-release"
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
8848
diff
changeset
|
352 |
env['BUILD_SUFFIX'] = '' |
90d67c5e8255
Bug 1445 - When build with "-d release", don't suffix "-release"
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
8848
diff
changeset
|
353 |
else: |
90d67c5e8255
Bug 1445 - When build with "-d release", don't suffix "-release"
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
8848
diff
changeset
|
354 |
env['BUILD_SUFFIX'] = '-'+Options.options.build_profile |
90d67c5e8255
Bug 1445 - When build with "-d release", don't suffix "-release"
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
8848
diff
changeset
|
355 |
|
7682
8813ef4cec0f
Bug 1339 - test.py uses the old name for the test runner
Mitch Watrous <watrous@u.washington.edu>
parents:
7681
diff
changeset
|
356 |
env['APPNAME'] = wutils.APPNAME |
8813ef4cec0f
Bug 1339 - test.py uses the old name for the test runner
Mitch Watrous <watrous@u.washington.edu>
parents:
7681
diff
changeset
|
357 |
env['VERSION'] = wutils.VERSION |
4190
b6734a5d920c
work around to allow FreeBSD to run tap-bridge
Craig Dowell <craigdo@ee.washington.edu>
parents:
4179
diff
changeset
|
358 |
|
5252
481053e0cd10
Bug 681: wrong compilation options for icpc (Intel C/C++ Compiler)
Andrey Mazo <mazo@iitp.ru>
parents:
5201
diff
changeset
|
359 |
if conf.env['CXX_NAME'] in ['gcc', 'icc']: |
5463
f2f95faff5bb
omit -march=native for <gcc-4.2;
Andrey Mazo <mazo@iitp.ru>
parents:
5454
diff
changeset
|
360 |
if Options.options.build_profile == 'release': |
f2f95faff5bb
omit -march=native for <gcc-4.2;
Andrey Mazo <mazo@iitp.ru>
parents:
5454
diff
changeset
|
361 |
env.append_value('CXXFLAGS', '-fomit-frame-pointer') |
8894
90d67c5e8255
Bug 1445 - When build with "-d release", don't suffix "-release"
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
8848
diff
changeset
|
362 |
if Options.options.build_profile == 'optimized': |
5463
f2f95faff5bb
omit -march=native for <gcc-4.2;
Andrey Mazo <mazo@iitp.ru>
parents:
5454
diff
changeset
|
363 |
if conf.check_compilation_flag('-march=native'): |
f2f95faff5bb
omit -march=native for <gcc-4.2;
Andrey Mazo <mazo@iitp.ru>
parents:
5454
diff
changeset
|
364 |
env.append_value('CXXFLAGS', '-march=native') |
10769
2a65963e27ac
[Bug 1868] Optimized builds are sensitive to -fstrict-overflow
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10604
diff
changeset
|
365 |
env.append_value('CXXFLAGS', '-fstrict-overflow') |
10800
85f484cffccd
bug 1868: restrict the compiler version for Wstrict-overflow=5 until gcc-4.9 issues are addressed
Tom Henderson <tomh@tomh.org>
parents:
10790
diff
changeset
|
366 |
if conf.env['CC_VERSION'] == cc_version_warn_strict_overflow: |
10790
b445436fd51f
bug 1868: enable -Wstrict-overflow only for newer gcc versions
Tom Henderson <tomh@tomh.org>
parents:
10769
diff
changeset
|
367 |
env.append_value('CXXFLAGS', '-Wstrict-overflow=5') |
5463
f2f95faff5bb
omit -march=native for <gcc-4.2;
Andrey Mazo <mazo@iitp.ru>
parents:
5454
diff
changeset
|
368 |
|
4348
0572c4011b3d
Enable the link option --enable-auto-import on cygwin; closes #525.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4333
diff
changeset
|
369 |
if sys.platform == 'win32': |
4069
430a6edb0fa0
New WAF cflags tool, to add back the compilation flags (debug/optimized)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4064
diff
changeset
|
370 |
env.append_value("LINKFLAGS", "-Wl,--enable-runtime-pseudo-reloc") |
4348
0572c4011b3d
Enable the link option --enable-auto-import on cygwin; closes #525.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4333
diff
changeset
|
371 |
elif sys.platform == 'cygwin': |
0572c4011b3d
Enable the link option --enable-auto-import on cygwin; closes #525.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4333
diff
changeset
|
372 |
env.append_value("LINKFLAGS", "-Wl,--enable-auto-import") |
4446
56b16bcd3afc
Add -Wl,--soname=libns3.so to link flags to allow dlopen hacks
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4441
diff
changeset
|
373 |
|
9137
822abb428976
Allow using CXX='distcc g++' with ./waf configure.
Vedran Miletić <rivanvx@gmail.com>
parents:
9076
diff
changeset
|
374 |
cxx = env['CXX'] |
9143
1573a6ddf0fe
Fix bug introduced by changeset 9137:822abb428976 Allow using CXX='distcc g++' with ./waf configure.
Vedran Miletić <rivanvx@gmail.com>
parents:
9137
diff
changeset
|
375 |
cxx_check_libstdcxx = cxx + ['-print-file-name=libstdc++.so'] |
9137
822abb428976
Allow using CXX='distcc g++' with ./waf configure.
Vedran Miletić <rivanvx@gmail.com>
parents:
9076
diff
changeset
|
376 |
p = subprocess.Popen(cxx_check_libstdcxx, stdout=subprocess.PIPE) |
11661
68c0e7f87bdf
additional Python 2/3 compatibility
Tom Henderson <tomh@tomh.org>
parents:
11650
diff
changeset
|
377 |
libstdcxx_output = maybe_decode(p.stdout.read().strip()) |
68c0e7f87bdf
additional Python 2/3 compatibility
Tom Henderson <tomh@tomh.org>
parents:
11650
diff
changeset
|
378 |
libstdcxx_location = os.path.dirname(libstdcxx_output) |
4386
2e79cbd62d28
bug 553: Running code built with a special gcc
Gustavo Carneiro <gjcarneiro@gmail.com>
parents:
4369
diff
changeset
|
379 |
p.wait() |
4387
dff0992d7cce
Make sure the 'g++ -print-file-name' code does not break if gcc doesn't know anything about the libstdc++.so file.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4386
diff
changeset
|
380 |
if libstdcxx_location: |
dff0992d7cce
Make sure the 'g++ -print-file-name' code does not break if gcc doesn't know anything about the libstdc++.so file.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4386
diff
changeset
|
381 |
conf.env.append_value('NS3_MODULE_PATH', libstdcxx_location) |
647
04f34a8befb8
In WAF win32 builds, add -Wl,--enable-runtime-pseudo-reloc to LINKFLAGS to solve dll linking problems.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
642
diff
changeset
|
382 |
|
4447
0b42685f6b78
Don't event try to enable -Wl,--soname option if we're not on linux.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4446
diff
changeset
|
383 |
if Options.platform in ['linux']: |
0b42685f6b78
Don't event try to enable -Wl,--soname option if we're not on linux.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4446
diff
changeset
|
384 |
if conf.check_compilation_flag('-Wl,--soname=foo'): |
0b42685f6b78
Don't event try to enable -Wl,--soname option if we're not on linux.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4446
diff
changeset
|
385 |
env['WL_SONAME_SUPPORTED'] = True |
4446
56b16bcd3afc
Add -Wl,--soname=libns3.so to link flags to allow dlopen hacks
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4441
diff
changeset
|
386 |
|
11682
daa3bfadabef
bug 2181: Xcode 7.0 (clang-602.0.53) errors
Tom Henderson <tomh@tomh.org>
parents:
11661
diff
changeset
|
387 |
# bug 2181 on clang warning suppressions |
daa3bfadabef
bug 2181: Xcode 7.0 (clang-602.0.53) errors
Tom Henderson <tomh@tomh.org>
parents:
11661
diff
changeset
|
388 |
if conf.env['CXX_NAME'] in ['clang']: |
daa3bfadabef
bug 2181: Xcode 7.0 (clang-602.0.53) errors
Tom Henderson <tomh@tomh.org>
parents:
11661
diff
changeset
|
389 |
if Options.platform == 'darwin': |
daa3bfadabef
bug 2181: Xcode 7.0 (clang-602.0.53) errors
Tom Henderson <tomh@tomh.org>
parents:
11661
diff
changeset
|
390 |
if conf.env['CC_VERSION'] >= darwin_clang_version_warn_unused_local_typedefs: |
daa3bfadabef
bug 2181: Xcode 7.0 (clang-602.0.53) errors
Tom Henderson <tomh@tomh.org>
parents:
11661
diff
changeset
|
391 |
env.append_value('CXXFLAGS', '-Wno-unused-local-typedefs') |
daa3bfadabef
bug 2181: Xcode 7.0 (clang-602.0.53) errors
Tom Henderson <tomh@tomh.org>
parents:
11661
diff
changeset
|
392 |
if conf.env['CC_VERSION'] >= darwin_clang_version_warn_potentially_evaluated: |
daa3bfadabef
bug 2181: Xcode 7.0 (clang-602.0.53) errors
Tom Henderson <tomh@tomh.org>
parents:
11661
diff
changeset
|
393 |
env.append_value('CXXFLAGS', '-Wno-potentially-evaluated-expression') |
daa3bfadabef
bug 2181: Xcode 7.0 (clang-602.0.53) errors
Tom Henderson <tomh@tomh.org>
parents:
11661
diff
changeset
|
394 |
else: |
daa3bfadabef
bug 2181: Xcode 7.0 (clang-602.0.53) errors
Tom Henderson <tomh@tomh.org>
parents:
11661
diff
changeset
|
395 |
if conf.env['CC_VERSION'] >= clang_version_warn_unused_local_typedefs: |
daa3bfadabef
bug 2181: Xcode 7.0 (clang-602.0.53) errors
Tom Henderson <tomh@tomh.org>
parents:
11661
diff
changeset
|
396 |
env.append_value('CXXFLAGS', '-Wno-unused-local-typedefs') |
daa3bfadabef
bug 2181: Xcode 7.0 (clang-602.0.53) errors
Tom Henderson <tomh@tomh.org>
parents:
11661
diff
changeset
|
397 |
if conf.env['CC_VERSION'] >= clang_version_warn_potentially_evaluated: |
daa3bfadabef
bug 2181: Xcode 7.0 (clang-602.0.53) errors
Tom Henderson <tomh@tomh.org>
parents:
11661
diff
changeset
|
398 |
env.append_value('CXXFLAGS', '-Wno-potentially-evaluated-expression') |
7291
d39c09dbc3d9
Make emu and template modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7131
diff
changeset
|
399 |
env['ENABLE_STATIC_NS3'] = False |
7491
dea6f61d3247
Remove the --enable-shared-and-static option
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7489
diff
changeset
|
400 |
if Options.options.enable_static: |
7539
fd2a26e455b3
Determine whether static can be enabled based on link flags tests rather than a hardcoded whitelist of supported platforms
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7538
diff
changeset
|
401 |
if Options.platform == 'darwin': |
fd2a26e455b3
Determine whether static can be enabled based on link flags tests rather than a hardcoded whitelist of supported platforms
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7538
diff
changeset
|
402 |
if conf.check_compilation_flag(flag=[], linkflags=['-Wl,-all_load']): |
7291
d39c09dbc3d9
Make emu and template modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7131
diff
changeset
|
403 |
conf.report_optional_feature("static", "Static build", True, '') |
7539
fd2a26e455b3
Determine whether static can be enabled based on link flags tests rather than a hardcoded whitelist of supported platforms
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7538
diff
changeset
|
404 |
env['ENABLE_STATIC_NS3'] = True |
fd2a26e455b3
Determine whether static can be enabled based on link flags tests rather than a hardcoded whitelist of supported platforms
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7538
diff
changeset
|
405 |
else: |
fd2a26e455b3
Determine whether static can be enabled based on link flags tests rather than a hardcoded whitelist of supported platforms
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7538
diff
changeset
|
406 |
conf.report_optional_feature("static", "Static build", False, |
fd2a26e455b3
Determine whether static can be enabled based on link flags tests rather than a hardcoded whitelist of supported platforms
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7538
diff
changeset
|
407 |
"Link flag -Wl,-all_load does not work") |
fd2a26e455b3
Determine whether static can be enabled based on link flags tests rather than a hardcoded whitelist of supported platforms
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7538
diff
changeset
|
408 |
else: |
fd2a26e455b3
Determine whether static can be enabled based on link flags tests rather than a hardcoded whitelist of supported platforms
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7538
diff
changeset
|
409 |
if conf.check_compilation_flag(flag=[], linkflags=['-Wl,--whole-archive,-Bstatic', '-Wl,-Bdynamic,--no-whole-archive']): |
7291
d39c09dbc3d9
Make emu and template modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7131
diff
changeset
|
410 |
conf.report_optional_feature("static", "Static build", True, '') |
7539
fd2a26e455b3
Determine whether static can be enabled based on link flags tests rather than a hardcoded whitelist of supported platforms
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7538
diff
changeset
|
411 |
env['ENABLE_STATIC_NS3'] = True |
fd2a26e455b3
Determine whether static can be enabled based on link flags tests rather than a hardcoded whitelist of supported platforms
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7538
diff
changeset
|
412 |
else: |
fd2a26e455b3
Determine whether static can be enabled based on link flags tests rather than a hardcoded whitelist of supported platforms
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7538
diff
changeset
|
413 |
conf.report_optional_feature("static", "Static build", False, |
fd2a26e455b3
Determine whether static can be enabled based on link flags tests rather than a hardcoded whitelist of supported platforms
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7538
diff
changeset
|
414 |
"Link flag -Wl,--whole-archive,-Bstatic does not work") |
7291
d39c09dbc3d9
Make emu and template modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7131
diff
changeset
|
415 |
|
12144
9b1e40cd0a70
waf: (fixes #2270) Support -std=c++11 by default
Tom Henderson <tomh@tomh.org>
parents:
12098
diff
changeset
|
416 |
# Enable C++-11 support |
9b1e40cd0a70
waf: (fixes #2270) Support -std=c++11 by default
Tom Henderson <tomh@tomh.org>
parents:
12098
diff
changeset
|
417 |
env.append_value('CXXFLAGS', '-std=c++11') |
9b1e40cd0a70
waf: (fixes #2270) Support -std=c++11 by default
Tom Henderson <tomh@tomh.org>
parents:
12098
diff
changeset
|
418 |
|
7636
58181e75d0f0
bug 1305 - do not list modules when exiting waf shell
Mitch Watrous <watrous@u.washington.edu>
parents:
7593
diff
changeset
|
419 |
# Set this so that the lists won't be printed at the end of this |
58181e75d0f0
bug 1305 - do not list modules when exiting waf shell
Mitch Watrous <watrous@u.washington.edu>
parents:
7593
diff
changeset
|
420 |
# configure command. |
58181e75d0f0
bug 1305 - do not list modules when exiting waf shell
Mitch Watrous <watrous@u.washington.edu>
parents:
7593
diff
changeset
|
421 |
conf.env['PRINT_BUILT_MODULES_AT_END'] = False |
58181e75d0f0
bug 1305 - do not list modules when exiting waf shell
Mitch Watrous <watrous@u.washington.edu>
parents:
7593
diff
changeset
|
422 |
|
7293
0f574c532cee
Make test module not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7291
diff
changeset
|
423 |
conf.env['MODULES_NOT_BUILT'] = [] |
0f574c532cee
Make test module not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7291
diff
changeset
|
424 |
|
9277
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9261
diff
changeset
|
425 |
conf.recurse('bindings/python') |
7712
e22640804bf7
Bug 1355 - visualizer dependencies not detected at buildtime
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7707
diff
changeset
|
426 |
|
9277
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9261
diff
changeset
|
427 |
conf.recurse('src') |
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
428 |
|
6857
d7db3cee241f
Add parsing of ns-3 configuration file
Mitch Watrous <watrous@u.washington.edu>
parents:
6834
diff
changeset
|
429 |
# Set the list of enabled modules. |
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4029
diff
changeset
|
430 |
if Options.options.enable_modules: |
6857
d7db3cee241f
Add parsing of ns-3 configuration file
Mitch Watrous <watrous@u.washington.edu>
parents:
6834
diff
changeset
|
431 |
# Use the modules explicitly enabled. |
1880
0148d5911946
New waf snapshot; move the ns3 library back to the top build dir (the 'lib' was only a workaround for a waf problem); allow --enable-modules on a per build run basis.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1858
diff
changeset
|
432 |
conf.env['NS3_ENABLED_MODULES'] = ['ns3-'+mod for mod in |
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4029
diff
changeset
|
433 |
Options.options.enable_modules.split(',')] |
6857
d7db3cee241f
Add parsing of ns-3 configuration file
Mitch Watrous <watrous@u.washington.edu>
parents:
6834
diff
changeset
|
434 |
else: |
d7db3cee241f
Add parsing of ns-3 configuration file
Mitch Watrous <watrous@u.washington.edu>
parents:
6834
diff
changeset
|
435 |
# Use the enabled modules list from the ns3 configuration file. |
d7db3cee241f
Add parsing of ns-3 configuration file
Mitch Watrous <watrous@u.washington.edu>
parents:
6834
diff
changeset
|
436 |
if modules_enabled[0] == 'all_modules': |
d7db3cee241f
Add parsing of ns-3 configuration file
Mitch Watrous <watrous@u.washington.edu>
parents:
6834
diff
changeset
|
437 |
# Enable all modules if requested. |
d7db3cee241f
Add parsing of ns-3 configuration file
Mitch Watrous <watrous@u.washington.edu>
parents:
6834
diff
changeset
|
438 |
conf.env['NS3_ENABLED_MODULES'] = conf.env['NS3_MODULES'] |
d7db3cee241f
Add parsing of ns-3 configuration file
Mitch Watrous <watrous@u.washington.edu>
parents:
6834
diff
changeset
|
439 |
else: |
d7db3cee241f
Add parsing of ns-3 configuration file
Mitch Watrous <watrous@u.washington.edu>
parents:
6834
diff
changeset
|
440 |
# Enable the modules from the list. |
d7db3cee241f
Add parsing of ns-3 configuration file
Mitch Watrous <watrous@u.washington.edu>
parents:
6834
diff
changeset
|
441 |
conf.env['NS3_ENABLED_MODULES'] = ['ns3-'+mod for mod in |
d7db3cee241f
Add parsing of ns-3 configuration file
Mitch Watrous <watrous@u.washington.edu>
parents:
6834
diff
changeset
|
442 |
modules_enabled] |
7291
d39c09dbc3d9
Make emu and template modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7131
diff
changeset
|
443 |
|
7293
0f574c532cee
Make test module not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7291
diff
changeset
|
444 |
# Add the template module to the list of enabled modules that |
0f574c532cee
Make test module not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7291
diff
changeset
|
445 |
# should not be built if this is a static build on Darwin. They |
0f574c532cee
Make test module not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7291
diff
changeset
|
446 |
# don't work there for the template module, and this is probably |
0f574c532cee
Make test module not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7291
diff
changeset
|
447 |
# because the template module has no source files. |
0f574c532cee
Make test module not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7291
diff
changeset
|
448 |
if conf.env['ENABLE_STATIC_NS3'] and sys.platform == 'darwin': |
0f574c532cee
Make test module not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7291
diff
changeset
|
449 |
conf.env['MODULES_NOT_BUILT'].append('template') |
7291
d39c09dbc3d9
Make emu and template modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7131
diff
changeset
|
450 |
|
7293
0f574c532cee
Make test module not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7291
diff
changeset
|
451 |
# Remove these modules from the list of enabled modules. |
0f574c532cee
Make test module not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7291
diff
changeset
|
452 |
for not_built in conf.env['MODULES_NOT_BUILT']: |
0f574c532cee
Make test module not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7291
diff
changeset
|
453 |
not_built_name = 'ns3-' + not_built |
0f574c532cee
Make test module not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7291
diff
changeset
|
454 |
if not_built_name in conf.env['NS3_ENABLED_MODULES']: |
0f574c532cee
Make test module not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7291
diff
changeset
|
455 |
conf.env['NS3_ENABLED_MODULES'].remove(not_built_name) |
7291
d39c09dbc3d9
Make emu and template modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7131
diff
changeset
|
456 |
if not conf.env['NS3_ENABLED_MODULES']: |
7496
ce1ec79d488c
waf1.6: make the all_modules in src/wscript be automatically discovered
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7495
diff
changeset
|
457 |
raise WafError('Exiting because the ' + not_built + ' module can not be built and it was the only one enabled.') |
7291
d39c09dbc3d9
Make emu and template modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7131
diff
changeset
|
458 |
|
9277
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9261
diff
changeset
|
459 |
conf.recurse('src/mpi') |
1880
0148d5911946
New waf snapshot; move the ns3 library back to the top build dir (the 'lib' was only a workaround for a waf problem); allow --enable-modules on a per build run basis.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1858
diff
changeset
|
460 |
|
3826
40c5841b616d
merge in tap device
Craig Dowell <craigdo@ee.washington.edu>
parents:
3703
diff
changeset
|
461 |
# for suid bits |
7524
b5df4870db14
Don't fail on missing sudo or valgrind
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7518
diff
changeset
|
462 |
try: |
b5df4870db14
Don't fail on missing sudo or valgrind
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7518
diff
changeset
|
463 |
conf.find_program('sudo', var='SUDO') |
b5df4870db14
Don't fail on missing sudo or valgrind
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7518
diff
changeset
|
464 |
except WafError: |
b5df4870db14
Don't fail on missing sudo or valgrind
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7518
diff
changeset
|
465 |
pass |
3826
40c5841b616d
merge in tap device
Craig Dowell <craigdo@ee.washington.edu>
parents:
3703
diff
changeset
|
466 |
|
4171
902589866374
teach enable-sudo to be a config time thing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4164
diff
changeset
|
467 |
why_not_sudo = "because we like it" |
902589866374
teach enable-sudo to be a config time thing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4164
diff
changeset
|
468 |
if Options.options.enable_sudo and conf.env['SUDO']: |
902589866374
teach enable-sudo to be a config time thing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4164
diff
changeset
|
469 |
env['ENABLE_SUDO'] = True |
902589866374
teach enable-sudo to be a config time thing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4164
diff
changeset
|
470 |
else: |
902589866374
teach enable-sudo to be a config time thing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4164
diff
changeset
|
471 |
env['ENABLE_SUDO'] = False |
902589866374
teach enable-sudo to be a config time thing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4164
diff
changeset
|
472 |
if Options.options.enable_sudo: |
902589866374
teach enable-sudo to be a config time thing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4164
diff
changeset
|
473 |
why_not_sudo = "program sudo not found" |
902589866374
teach enable-sudo to be a config time thing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4164
diff
changeset
|
474 |
else: |
902589866374
teach enable-sudo to be a config time thing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4164
diff
changeset
|
475 |
why_not_sudo = "option --enable-sudo not selected" |
902589866374
teach enable-sudo to be a config time thing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4164
diff
changeset
|
476 |
|
902589866374
teach enable-sudo to be a config time thing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4164
diff
changeset
|
477 |
conf.report_optional_feature("ENABLE_SUDO", "Use sudo to set suid bit", env['ENABLE_SUDO'], why_not_sudo) |
902589866374
teach enable-sudo to be a config time thing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4164
diff
changeset
|
478 |
|
7023
af9c5ac72f2c
Make examples and tests be enabled from the .ns3rc file
Mitch Watrous <watrous@u.washington.edu>
parents:
7019
diff
changeset
|
479 |
# Decide if tests will be built or not. |
6998
1c2b8cfb71d2
Make tests not be built by default
Mitch Watrous <watrous@u.washington.edu>
parents:
6981
diff
changeset
|
480 |
if Options.options.enable_tests: |
7023
af9c5ac72f2c
Make examples and tests be enabled from the .ns3rc file
Mitch Watrous <watrous@u.washington.edu>
parents:
7019
diff
changeset
|
481 |
# Tests were explicitly enabled. |
6998
1c2b8cfb71d2
Make tests not be built by default
Mitch Watrous <watrous@u.washington.edu>
parents:
6981
diff
changeset
|
482 |
env['ENABLE_TESTS'] = True |
1c2b8cfb71d2
Make tests not be built by default
Mitch Watrous <watrous@u.washington.edu>
parents:
6981
diff
changeset
|
483 |
why_not_tests = "option --enable-tests selected" |
7023
af9c5ac72f2c
Make examples and tests be enabled from the .ns3rc file
Mitch Watrous <watrous@u.washington.edu>
parents:
7019
diff
changeset
|
484 |
elif Options.options.disable_tests: |
af9c5ac72f2c
Make examples and tests be enabled from the .ns3rc file
Mitch Watrous <watrous@u.washington.edu>
parents:
7019
diff
changeset
|
485 |
# Tests were explicitly disabled. |
6998
1c2b8cfb71d2
Make tests not be built by default
Mitch Watrous <watrous@u.washington.edu>
parents:
6981
diff
changeset
|
486 |
env['ENABLE_TESTS'] = False |
7023
af9c5ac72f2c
Make examples and tests be enabled from the .ns3rc file
Mitch Watrous <watrous@u.washington.edu>
parents:
7019
diff
changeset
|
487 |
why_not_tests = "option --disable-tests selected" |
af9c5ac72f2c
Make examples and tests be enabled from the .ns3rc file
Mitch Watrous <watrous@u.washington.edu>
parents:
7019
diff
changeset
|
488 |
else: |
af9c5ac72f2c
Make examples and tests be enabled from the .ns3rc file
Mitch Watrous <watrous@u.washington.edu>
parents:
7019
diff
changeset
|
489 |
# Enable tests based on the ns3 configuration file. |
af9c5ac72f2c
Make examples and tests be enabled from the .ns3rc file
Mitch Watrous <watrous@u.washington.edu>
parents:
7019
diff
changeset
|
490 |
env['ENABLE_TESTS'] = tests_enabled |
af9c5ac72f2c
Make examples and tests be enabled from the .ns3rc file
Mitch Watrous <watrous@u.washington.edu>
parents:
7019
diff
changeset
|
491 |
if config_file_exists: |
af9c5ac72f2c
Make examples and tests be enabled from the .ns3rc file
Mitch Watrous <watrous@u.washington.edu>
parents:
7019
diff
changeset
|
492 |
why_not_tests = "based on configuration file" |
af9c5ac72f2c
Make examples and tests be enabled from the .ns3rc file
Mitch Watrous <watrous@u.washington.edu>
parents:
7019
diff
changeset
|
493 |
elif tests_enabled: |
af9c5ac72f2c
Make examples and tests be enabled from the .ns3rc file
Mitch Watrous <watrous@u.washington.edu>
parents:
7019
diff
changeset
|
494 |
why_not_tests = "defaults to enabled" |
af9c5ac72f2c
Make examples and tests be enabled from the .ns3rc file
Mitch Watrous <watrous@u.washington.edu>
parents:
7019
diff
changeset
|
495 |
else: |
af9c5ac72f2c
Make examples and tests be enabled from the .ns3rc file
Mitch Watrous <watrous@u.washington.edu>
parents:
7019
diff
changeset
|
496 |
why_not_tests = "defaults to disabled" |
6998
1c2b8cfb71d2
Make tests not be built by default
Mitch Watrous <watrous@u.washington.edu>
parents:
6981
diff
changeset
|
497 |
|
12179
cd49c3198528
[core] Sort configuration report
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
12144
diff
changeset
|
498 |
conf.report_optional_feature("ENABLE_TESTS", "Tests", env['ENABLE_TESTS'], why_not_tests) |
6998
1c2b8cfb71d2
Make tests not be built by default
Mitch Watrous <watrous@u.washington.edu>
parents:
6981
diff
changeset
|
499 |
|
7023
af9c5ac72f2c
Make examples and tests be enabled from the .ns3rc file
Mitch Watrous <watrous@u.washington.edu>
parents:
7019
diff
changeset
|
500 |
# Decide if examples will be built or not. |
5369
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
5368
diff
changeset
|
501 |
if Options.options.enable_examples: |
7023
af9c5ac72f2c
Make examples and tests be enabled from the .ns3rc file
Mitch Watrous <watrous@u.washington.edu>
parents:
7019
diff
changeset
|
502 |
# Examples were explicitly enabled. |
5369
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
5368
diff
changeset
|
503 |
env['ENABLE_EXAMPLES'] = True |
7023
af9c5ac72f2c
Make examples and tests be enabled from the .ns3rc file
Mitch Watrous <watrous@u.washington.edu>
parents:
7019
diff
changeset
|
504 |
why_not_examples = "option --enable-examples selected" |
af9c5ac72f2c
Make examples and tests be enabled from the .ns3rc file
Mitch Watrous <watrous@u.washington.edu>
parents:
7019
diff
changeset
|
505 |
elif Options.options.disable_examples: |
af9c5ac72f2c
Make examples and tests be enabled from the .ns3rc file
Mitch Watrous <watrous@u.washington.edu>
parents:
7019
diff
changeset
|
506 |
# Examples were explicitly disabled. |
5369
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
5368
diff
changeset
|
507 |
env['ENABLE_EXAMPLES'] = False |
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
5368
diff
changeset
|
508 |
why_not_examples = "option --disable-examples selected" |
7023
af9c5ac72f2c
Make examples and tests be enabled from the .ns3rc file
Mitch Watrous <watrous@u.washington.edu>
parents:
7019
diff
changeset
|
509 |
else: |
af9c5ac72f2c
Make examples and tests be enabled from the .ns3rc file
Mitch Watrous <watrous@u.washington.edu>
parents:
7019
diff
changeset
|
510 |
# Enable examples based on the ns3 configuration file. |
af9c5ac72f2c
Make examples and tests be enabled from the .ns3rc file
Mitch Watrous <watrous@u.washington.edu>
parents:
7019
diff
changeset
|
511 |
env['ENABLE_EXAMPLES'] = examples_enabled |
af9c5ac72f2c
Make examples and tests be enabled from the .ns3rc file
Mitch Watrous <watrous@u.washington.edu>
parents:
7019
diff
changeset
|
512 |
if config_file_exists: |
af9c5ac72f2c
Make examples and tests be enabled from the .ns3rc file
Mitch Watrous <watrous@u.washington.edu>
parents:
7019
diff
changeset
|
513 |
why_not_examples = "based on configuration file" |
af9c5ac72f2c
Make examples and tests be enabled from the .ns3rc file
Mitch Watrous <watrous@u.washington.edu>
parents:
7019
diff
changeset
|
514 |
elif examples_enabled: |
af9c5ac72f2c
Make examples and tests be enabled from the .ns3rc file
Mitch Watrous <watrous@u.washington.edu>
parents:
7019
diff
changeset
|
515 |
why_not_examples = "defaults to enabled" |
af9c5ac72f2c
Make examples and tests be enabled from the .ns3rc file
Mitch Watrous <watrous@u.washington.edu>
parents:
7019
diff
changeset
|
516 |
else: |
af9c5ac72f2c
Make examples and tests be enabled from the .ns3rc file
Mitch Watrous <watrous@u.washington.edu>
parents:
7019
diff
changeset
|
517 |
why_not_examples = "defaults to disabled" |
5369
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
5368
diff
changeset
|
518 |
|
12179
cd49c3198528
[core] Sort configuration report
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
12144
diff
changeset
|
519 |
conf.report_optional_feature("ENABLE_EXAMPLES", "Examples", env['ENABLE_EXAMPLES'], |
5369
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
5368
diff
changeset
|
520 |
why_not_examples) |
11650
7f374ac3b2f8
populate EXAMPLE_DIRECTORIES variable in the configuration cache for use by test.py
Tom Henderson <tomh@tomh.org>
parents:
11634
diff
changeset
|
521 |
try: |
7f374ac3b2f8
populate EXAMPLE_DIRECTORIES variable in the configuration cache for use by test.py
Tom Henderson <tomh@tomh.org>
parents:
11634
diff
changeset
|
522 |
for dir in os.listdir('examples'): |
7f374ac3b2f8
populate EXAMPLE_DIRECTORIES variable in the configuration cache for use by test.py
Tom Henderson <tomh@tomh.org>
parents:
11634
diff
changeset
|
523 |
if dir.startswith('.') or dir == 'CVS': |
7f374ac3b2f8
populate EXAMPLE_DIRECTORIES variable in the configuration cache for use by test.py
Tom Henderson <tomh@tomh.org>
parents:
11634
diff
changeset
|
524 |
continue |
7f374ac3b2f8
populate EXAMPLE_DIRECTORIES variable in the configuration cache for use by test.py
Tom Henderson <tomh@tomh.org>
parents:
11634
diff
changeset
|
525 |
conf.env.append_value('EXAMPLE_DIRECTORIES', dir) |
7f374ac3b2f8
populate EXAMPLE_DIRECTORIES variable in the configuration cache for use by test.py
Tom Henderson <tomh@tomh.org>
parents:
11634
diff
changeset
|
526 |
except OSError: |
7f374ac3b2f8
populate EXAMPLE_DIRECTORIES variable in the configuration cache for use by test.py
Tom Henderson <tomh@tomh.org>
parents:
11634
diff
changeset
|
527 |
return |
5369
86beb5869f67
split examples, add examples, tweak test.py to minimize builds
Craig Dowell <craigdo@ee.washington.edu>
parents:
5368
diff
changeset
|
528 |
|
9832
02642e139f19
Bug 1695 - improve test.py output when -g selected without valgrind
Mitch Watrous <watrous@u.washington.edu>
parents:
9827
diff
changeset
|
529 |
env['VALGRIND_FOUND'] = False |
7524
b5df4870db14
Don't fail on missing sudo or valgrind
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7518
diff
changeset
|
530 |
try: |
b5df4870db14
Don't fail on missing sudo or valgrind
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7518
diff
changeset
|
531 |
conf.find_program('valgrind', var='VALGRIND') |
9832
02642e139f19
Bug 1695 - improve test.py output when -g selected without valgrind
Mitch Watrous <watrous@u.washington.edu>
parents:
9827
diff
changeset
|
532 |
env['VALGRIND_FOUND'] = True |
7524
b5df4870db14
Don't fail on missing sudo or valgrind
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7518
diff
changeset
|
533 |
except WafError: |
b5df4870db14
Don't fail on missing sudo or valgrind
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7518
diff
changeset
|
534 |
pass |
4119
9ffcf2400aa5
Bug #323: waf --valgrind doesn't check for valgrind first
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4118
diff
changeset
|
535 |
|
6913
54679ab32585
Create separate module and test-module libraries
Mitch Watrous <watrous@u.washington.edu>
parents:
6886
diff
changeset
|
536 |
# These flags are used for the implicitly dependent modules. |
54679ab32585
Create separate module and test-module libraries
Mitch Watrous <watrous@u.washington.edu>
parents:
6886
diff
changeset
|
537 |
if env['ENABLE_STATIC_NS3']: |
54679ab32585
Create separate module and test-module libraries
Mitch Watrous <watrous@u.washington.edu>
parents:
6886
diff
changeset
|
538 |
if sys.platform == 'darwin': |
9277
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9261
diff
changeset
|
539 |
env.STLIB_MARKER = '-Wl,-all_load' |
6913
54679ab32585
Create separate module and test-module libraries
Mitch Watrous <watrous@u.washington.edu>
parents:
6886
diff
changeset
|
540 |
else: |
9277
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9261
diff
changeset
|
541 |
env.STLIB_MARKER = '-Wl,--whole-archive,-Bstatic' |
6913
54679ab32585
Create separate module and test-module libraries
Mitch Watrous <watrous@u.washington.edu>
parents:
6886
diff
changeset
|
542 |
env.SHLIB_MARKER = '-Wl,-Bdynamic,--no-whole-archive' |
54679ab32585
Create separate module and test-module libraries
Mitch Watrous <watrous@u.washington.edu>
parents:
6886
diff
changeset
|
543 |
|
9277
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9261
diff
changeset
|
544 |
|
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9261
diff
changeset
|
545 |
have_gsl = conf.check_cfg(package='gsl', args=['--cflags', '--libs'], |
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9261
diff
changeset
|
546 |
uselib_store='GSL', mandatory=False) |
4773
904c1803d5dc
test framework should probably work on all supported machines
Craig Dowell <craigdo@ee.washington.edu>
parents:
4770
diff
changeset
|
547 |
conf.env['ENABLE_GSL'] = have_gsl |
904c1803d5dc
test framework should probably work on all supported machines
Craig Dowell <craigdo@ee.washington.edu>
parents:
4770
diff
changeset
|
548 |
conf.report_optional_feature("GSL", "GNU Scientific Library (GSL)", |
904c1803d5dc
test framework should probably work on all supported machines
Craig Dowell <craigdo@ee.washington.edu>
parents:
4770
diff
changeset
|
549 |
conf.env['ENABLE_GSL'], |
904c1803d5dc
test framework should probably work on all supported machines
Craig Dowell <craigdo@ee.washington.edu>
parents:
4770
diff
changeset
|
550 |
"GSL not found") |
4392
25d38a0c9851
bug 537: no support to build static ns-3 binaries
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4388
diff
changeset
|
551 |
|
11809
8a71cfb6b773
[Waf] Improve libgcrypt detection
Matt <matthieu.coudron@lip6.fr>
parents:
11805
diff
changeset
|
552 |
conf.find_program('libgcrypt-config', var='LIBGCRYPT_CONFIG', msg="python-config", mandatory=False) |
8a71cfb6b773
[Waf] Improve libgcrypt detection
Matt <matthieu.coudron@lip6.fr>
parents:
11805
diff
changeset
|
553 |
if env.LIBGCRYPT_CONFIG: |
8a71cfb6b773
[Waf] Improve libgcrypt detection
Matt <matthieu.coudron@lip6.fr>
parents:
11805
diff
changeset
|
554 |
conf.check_cfg(path=env.LIBGCRYPT_CONFIG, msg="Checking for libgcrypt", args='--cflags --libs', package='', |
8a71cfb6b773
[Waf] Improve libgcrypt detection
Matt <matthieu.coudron@lip6.fr>
parents:
11805
diff
changeset
|
555 |
define_name="HAVE_CRYPTO", global_define=True, uselib_store='GCRYPT', mandatory=False) |
11788
232d7ad5a88d
Added libgcrypt detection. It will be used to generate sha1 hashes for MPTCP
Matt <matthieu.coudron@lip6.fr>
parents:
11682
diff
changeset
|
556 |
conf.report_optional_feature("libgcrypt", "Gcrypt library", |
11809
8a71cfb6b773
[Waf] Improve libgcrypt detection
Matt <matthieu.coudron@lip6.fr>
parents:
11805
diff
changeset
|
557 |
conf.env.HAVE_GCRYPT, "libgcrypt not found: you can use libgcrypt-config to find its location.") |
11788
232d7ad5a88d
Added libgcrypt detection. It will be used to generate sha1 hashes for MPTCP
Matt <matthieu.coudron@lip6.fr>
parents:
11682
diff
changeset
|
558 |
|
232d7ad5a88d
Added libgcrypt detection. It will be used to generate sha1 hashes for MPTCP
Matt <matthieu.coudron@lip6.fr>
parents:
11682
diff
changeset
|
559 |
|
5996
84c404ad1d26
WAF: allow NS-3 modules to compile pure C code sources mixed with the C++ ones
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
5975
diff
changeset
|
560 |
# for compiling C code, copy over the CXX* flags |
84c404ad1d26
WAF: allow NS-3 modules to compile pure C code sources mixed with the C++ ones
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
5975
diff
changeset
|
561 |
conf.env.append_value('CCFLAGS', conf.env['CXXFLAGS']) |
84c404ad1d26
WAF: allow NS-3 modules to compile pure C code sources mixed with the C++ ones
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
5975
diff
changeset
|
562 |
|
6362
ca7a4f7e24e7
Add -fstrict-aliasing and -Wstrict-aliasing compilation flags, to catch some potential strict aliasing violations earlier
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6274
diff
changeset
|
563 |
def add_gcc_flag(flag): |
ca7a4f7e24e7
Add -fstrict-aliasing and -Wstrict-aliasing compilation flags, to catch some potential strict aliasing violations earlier
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6274
diff
changeset
|
564 |
if env['COMPILER_CXX'] == 'g++' and 'CXXFLAGS' not in os.environ: |
ca7a4f7e24e7
Add -fstrict-aliasing and -Wstrict-aliasing compilation flags, to catch some potential strict aliasing violations earlier
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6274
diff
changeset
|
565 |
if conf.check_compilation_flag(flag, mode='cxx'): |
ca7a4f7e24e7
Add -fstrict-aliasing and -Wstrict-aliasing compilation flags, to catch some potential strict aliasing violations earlier
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6274
diff
changeset
|
566 |
env.append_value('CXXFLAGS', flag) |
ca7a4f7e24e7
Add -fstrict-aliasing and -Wstrict-aliasing compilation flags, to catch some potential strict aliasing violations earlier
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6274
diff
changeset
|
567 |
if env['COMPILER_CC'] == 'gcc' and 'CCFLAGS' not in os.environ: |
ca7a4f7e24e7
Add -fstrict-aliasing and -Wstrict-aliasing compilation flags, to catch some potential strict aliasing violations earlier
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6274
diff
changeset
|
568 |
if conf.check_compilation_flag(flag, mode='cc'): |
ca7a4f7e24e7
Add -fstrict-aliasing and -Wstrict-aliasing compilation flags, to catch some potential strict aliasing violations earlier
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6274
diff
changeset
|
569 |
env.append_value('CCFLAGS', flag) |
ca7a4f7e24e7
Add -fstrict-aliasing and -Wstrict-aliasing compilation flags, to catch some potential strict aliasing violations earlier
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6274
diff
changeset
|
570 |
|
ca7a4f7e24e7
Add -fstrict-aliasing and -Wstrict-aliasing compilation flags, to catch some potential strict aliasing violations earlier
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6274
diff
changeset
|
571 |
add_gcc_flag('-Wno-error=deprecated-declarations') |
ca7a4f7e24e7
Add -fstrict-aliasing and -Wstrict-aliasing compilation flags, to catch some potential strict aliasing violations earlier
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6274
diff
changeset
|
572 |
add_gcc_flag('-fstrict-aliasing') |
ca7a4f7e24e7
Add -fstrict-aliasing and -Wstrict-aliasing compilation flags, to catch some potential strict aliasing violations earlier
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6274
diff
changeset
|
573 |
add_gcc_flag('-Wstrict-aliasing') |
ca7a4f7e24e7
Add -fstrict-aliasing and -Wstrict-aliasing compilation flags, to catch some potential strict aliasing violations earlier
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6274
diff
changeset
|
574 |
|
7494
d93f5e8e0a59
waf-1.6: Mac OSX and other fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7493
diff
changeset
|
575 |
try: |
d93f5e8e0a59
waf-1.6: Mac OSX and other fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7493
diff
changeset
|
576 |
conf.find_program('doxygen', var='DOXYGEN') |
d93f5e8e0a59
waf-1.6: Mac OSX and other fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7493
diff
changeset
|
577 |
except WafError: |
d93f5e8e0a59
waf-1.6: Mac OSX and other fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7493
diff
changeset
|
578 |
pass |
6099
b37a72870f2d
Test the support for the -Wno-error=deprecated-declarations option independently for the C and C++ compilers
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6001
diff
changeset
|
579 |
|
5454
6db6a279dfff
append {CC,CXX,LINK,LD}FLAGS_EXTRA to corresponding {CC,CXX,LINK}FLAGS.
Andrey Mazo <mazo@iitp.ru>
parents:
5453
diff
changeset
|
580 |
# append user defined flags after all our ones |
6db6a279dfff
append {CC,CXX,LINK,LD}FLAGS_EXTRA to corresponding {CC,CXX,LINK}FLAGS.
Andrey Mazo <mazo@iitp.ru>
parents:
5453
diff
changeset
|
581 |
for (confvar, envvar) in [['CCFLAGS', 'CCFLAGS_EXTRA'], |
6db6a279dfff
append {CC,CXX,LINK,LD}FLAGS_EXTRA to corresponding {CC,CXX,LINK}FLAGS.
Andrey Mazo <mazo@iitp.ru>
parents:
5453
diff
changeset
|
582 |
['CXXFLAGS', 'CXXFLAGS_EXTRA'], |
6db6a279dfff
append {CC,CXX,LINK,LD}FLAGS_EXTRA to corresponding {CC,CXX,LINK}FLAGS.
Andrey Mazo <mazo@iitp.ru>
parents:
5453
diff
changeset
|
583 |
['LINKFLAGS', 'LINKFLAGS_EXTRA'], |
6db6a279dfff
append {CC,CXX,LINK,LD}FLAGS_EXTRA to corresponding {CC,CXX,LINK}FLAGS.
Andrey Mazo <mazo@iitp.ru>
parents:
5453
diff
changeset
|
584 |
['LINKFLAGS', 'LDFLAGS_EXTRA']]: |
6db6a279dfff
append {CC,CXX,LINK,LD}FLAGS_EXTRA to corresponding {CC,CXX,LINK}FLAGS.
Andrey Mazo <mazo@iitp.ru>
parents:
5453
diff
changeset
|
585 |
if envvar in os.environ: |
6670
c43b992a4f5b
Bug 1032 - Unable to specify multiple Compiler/Linker flags
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6669
diff
changeset
|
586 |
value = shlex.split(os.environ[envvar]) |
c43b992a4f5b
Bug 1032 - Unable to specify multiple Compiler/Linker flags
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6669
diff
changeset
|
587 |
conf.env.append_value(confvar, value) |
5454
6db6a279dfff
append {CC,CXX,LINK,LD}FLAGS_EXTRA to corresponding {CC,CXX,LINK}FLAGS.
Andrey Mazo <mazo@iitp.ru>
parents:
5453
diff
changeset
|
588 |
|
3625
30afad8324d5
Add a summary of optional features at the end of the configuration stage.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3623
diff
changeset
|
589 |
# Write a summary of optional features status |
11634
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11544
diff
changeset
|
590 |
print("---- Summary of optional NS-3 features:") |
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11544
diff
changeset
|
591 |
print("%-30s: %s%s%s" % ("Build profile", Logs.colors('GREEN'), |
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11544
diff
changeset
|
592 |
Options.options.build_profile, Logs.colors('NORMAL'))) |
10604
eed0cb486e3f
Repeat the build output directory and the build profile in the configure report.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10147
diff
changeset
|
593 |
bld = wutils.bld |
11634
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11544
diff
changeset
|
594 |
print("%-30s: %s%s%s" % ("Build directory", Logs.colors('GREEN'), |
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11544
diff
changeset
|
595 |
Options.options.out, Logs.colors('NORMAL'))) |
10604
eed0cb486e3f
Repeat the build output directory and the build profile in the configure report.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10147
diff
changeset
|
596 |
|
eed0cb486e3f
Repeat the build output directory and the build profile in the configure report.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10147
diff
changeset
|
597 |
|
12179
cd49c3198528
[core] Sort configuration report
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
12144
diff
changeset
|
598 |
for (name, caption, was_enabled, reason_not_enabled) in sorted(conf.env['NS3_OPTIONAL_FEATURES'], key=lambda s : s[1]): |
3625
30afad8324d5
Add a summary of optional features at the end of the configuration stage.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3623
diff
changeset
|
599 |
if was_enabled: |
30afad8324d5
Add a summary of optional features at the end of the configuration stage.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3623
diff
changeset
|
600 |
status = 'enabled' |
9168
2ff57d50b827
add colors to optional features report
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
9143
diff
changeset
|
601 |
color = 'GREEN' |
3625
30afad8324d5
Add a summary of optional features at the end of the configuration stage.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3623
diff
changeset
|
602 |
else: |
30afad8324d5
Add a summary of optional features at the end of the configuration stage.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3623
diff
changeset
|
603 |
status = 'not enabled (%s)' % reason_not_enabled |
9168
2ff57d50b827
add colors to optional features report
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
9143
diff
changeset
|
604 |
color = 'RED' |
11634
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11544
diff
changeset
|
605 |
print("%-30s: %s%s%s" % (caption, Logs.colors(color), status, Logs.colors('NORMAL'))) |
3625
30afad8324d5
Add a summary of optional features at the end of the configuration stage.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3623
diff
changeset
|
606 |
|
7488
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
607 |
|
9277
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9261
diff
changeset
|
608 |
class SuidBuild_task(Task.Task): |
3826
40c5841b616d
merge in tap device
Craig Dowell <craigdo@ee.washington.edu>
parents:
3703
diff
changeset
|
609 |
"""task that makes a binary Suid |
40c5841b616d
merge in tap device
Craig Dowell <craigdo@ee.washington.edu>
parents:
3703
diff
changeset
|
610 |
""" |
7488
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
611 |
after = 'link' |
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
612 |
def __init__(self, *args, **kwargs): |
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
613 |
super(SuidBuild_task, self).__init__(*args, **kwargs) |
3826
40c5841b616d
merge in tap device
Craig Dowell <craigdo@ee.washington.edu>
parents:
3703
diff
changeset
|
614 |
self.m_display = 'build-suid' |
40c5841b616d
merge in tap device
Craig Dowell <craigdo@ee.washington.edu>
parents:
3703
diff
changeset
|
615 |
try: |
7692
2a3b879f4b5f
Fix issue with --enable-sudo, broken by the versioning of programs
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7688
diff
changeset
|
616 |
program_obj = wutils.find_program(self.generator.name, self.generator.env) |
11634
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11544
diff
changeset
|
617 |
except ValueError as ex: |
7488
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
618 |
raise WafError(str(ex)) |
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
619 |
program_node = program_obj.path.find_or_declare(program_obj.target) |
9277
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9261
diff
changeset
|
620 |
self.filename = program_node.get_bld().abspath() |
3826
40c5841b616d
merge in tap device
Craig Dowell <craigdo@ee.washington.edu>
parents:
3703
diff
changeset
|
621 |
|
4179
2758871405b7
tweak wifi example, fix waf problems (thanks to Gustavo)
Craig Dowell <craigdo@ee.washington.edu>
parents:
4172
diff
changeset
|
622 |
|
2758871405b7
tweak wifi example, fix waf problems (thanks to Gustavo)
Craig Dowell <craigdo@ee.washington.edu>
parents:
4172
diff
changeset
|
623 |
def run(self): |
11634
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11544
diff
changeset
|
624 |
print('setting suid bit on executable ' + self.filename, file=sys.stderr) |
4179
2758871405b7
tweak wifi example, fix waf problems (thanks to Gustavo)
Craig Dowell <craigdo@ee.washington.edu>
parents:
4172
diff
changeset
|
625 |
if subprocess.Popen(['sudo', 'chown', 'root', self.filename]).wait(): |
2758871405b7
tweak wifi example, fix waf problems (thanks to Gustavo)
Craig Dowell <craigdo@ee.washington.edu>
parents:
4172
diff
changeset
|
626 |
return 1 |
2758871405b7
tweak wifi example, fix waf problems (thanks to Gustavo)
Craig Dowell <craigdo@ee.washington.edu>
parents:
4172
diff
changeset
|
627 |
if subprocess.Popen(['sudo', 'chmod', 'u+s', self.filename]).wait(): |
2758871405b7
tweak wifi example, fix waf problems (thanks to Gustavo)
Craig Dowell <craigdo@ee.washington.edu>
parents:
4172
diff
changeset
|
628 |
return 1 |
2758871405b7
tweak wifi example, fix waf problems (thanks to Gustavo)
Craig Dowell <craigdo@ee.washington.edu>
parents:
4172
diff
changeset
|
629 |
return 0 |
2758871405b7
tweak wifi example, fix waf problems (thanks to Gustavo)
Craig Dowell <craigdo@ee.washington.edu>
parents:
4172
diff
changeset
|
630 |
|
2758871405b7
tweak wifi example, fix waf problems (thanks to Gustavo)
Craig Dowell <craigdo@ee.washington.edu>
parents:
4172
diff
changeset
|
631 |
def runnable_status(self): |
2758871405b7
tweak wifi example, fix waf problems (thanks to Gustavo)
Craig Dowell <craigdo@ee.washington.edu>
parents:
4172
diff
changeset
|
632 |
"RUN_ME SKIP_ME or ASK_LATER" |
7693
c452ea61d893
Fix small bug in SuidBuild_task
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7692
diff
changeset
|
633 |
try: |
c452ea61d893
Fix small bug in SuidBuild_task
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7692
diff
changeset
|
634 |
st = os.stat(self.filename) |
c452ea61d893
Fix small bug in SuidBuild_task
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7692
diff
changeset
|
635 |
except OSError: |
c452ea61d893
Fix small bug in SuidBuild_task
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7692
diff
changeset
|
636 |
return Task.ASK_LATER |
4179
2758871405b7
tweak wifi example, fix waf problems (thanks to Gustavo)
Craig Dowell <craigdo@ee.washington.edu>
parents:
4172
diff
changeset
|
637 |
if st.st_uid == 0: |
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
638 |
return Task.SKIP_ME |
4179
2758871405b7
tweak wifi example, fix waf problems (thanks to Gustavo)
Craig Dowell <craigdo@ee.washington.edu>
parents:
4172
diff
changeset
|
639 |
else: |
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
640 |
return Task.RUN_ME |
3826
40c5841b616d
merge in tap device
Craig Dowell <craigdo@ee.washington.edu>
parents:
3703
diff
changeset
|
641 |
|
40c5841b616d
merge in tap device
Craig Dowell <craigdo@ee.washington.edu>
parents:
3703
diff
changeset
|
642 |
def create_suid_program(bld, name): |
7488
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
643 |
grp = bld.current_group |
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
644 |
bld.add_group() # this to make sure no two sudo tasks run at the same time |
9277
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9261
diff
changeset
|
645 |
program = bld(features='cxx cxxprogram') |
3826
40c5841b616d
merge in tap device
Craig Dowell <craigdo@ee.washington.edu>
parents:
3703
diff
changeset
|
646 |
program.is_ns3_program = True |
40c5841b616d
merge in tap device
Craig Dowell <craigdo@ee.washington.edu>
parents:
3703
diff
changeset
|
647 |
program.module_deps = list() |
40c5841b616d
merge in tap device
Craig Dowell <craigdo@ee.washington.edu>
parents:
3703
diff
changeset
|
648 |
program.name = name |
8894
90d67c5e8255
Bug 1445 - When build with "-d release", don't suffix "-release"
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
8848
diff
changeset
|
649 |
program.target = "%s%s-%s%s" % (wutils.APPNAME, wutils.VERSION, name, bld.env.BUILD_SUFFIX) |
4164
1f6ae48061a9
checkpoint tap bridge
Craig Dowell <craigdo@ee.washington.edu>
parents:
4119
diff
changeset
|
650 |
|
4171
902589866374
teach enable-sudo to be a config time thing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4164
diff
changeset
|
651 |
if bld.env['ENABLE_SUDO']: |
7488
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
652 |
program.create_task("SuidBuild") |
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
653 |
|
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
654 |
bld.set_group(grp) |
4171
902589866374
teach enable-sudo to be a config time thing
Craig Dowell <craigdo@ee.washington.edu>
parents:
4164
diff
changeset
|
655 |
|
3826
40c5841b616d
merge in tap device
Craig Dowell <craigdo@ee.washington.edu>
parents:
3703
diff
changeset
|
656 |
return program |
40c5841b616d
merge in tap device
Craig Dowell <craigdo@ee.washington.edu>
parents:
3703
diff
changeset
|
657 |
|
6821
203367ae7433
merge src/simulator into src/core; move src/core to new module layout
Tom Henderson <tomh@tomh.org>
parents:
6676
diff
changeset
|
658 |
def create_ns3_program(bld, name, dependencies=('core',)): |
9277
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9261
diff
changeset
|
659 |
program = bld(features='cxx cxxprogram') |
7593
fe607d42ec05
Correcting compilation behavior in Ubuntu 11.10. I guess, default behavior of ldd has been changed... As a result, many dynamic features of NS were not working
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
7551
diff
changeset
|
660 |
|
3001
f7aa2796627f
WAF: convert code to WAF 1.4 API; the 'waf' script bundle will be updated later, for now has been disabled.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2990
diff
changeset
|
661 |
program.is_ns3_program = True |
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:
1213
diff
changeset
|
662 |
program.name = name |
8894
90d67c5e8255
Bug 1445 - When build with "-d release", don't suffix "-release"
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
8848
diff
changeset
|
663 |
program.target = "%s%s-%s%s" % (wutils.APPNAME, wutils.VERSION, name, bld.env.BUILD_SUFFIX) |
6913
54679ab32585
Create separate module and test-module libraries
Mitch Watrous <watrous@u.washington.edu>
parents:
6886
diff
changeset
|
664 |
# Each of the modules this program depends on has its own library. |
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:
1855
diff
changeset
|
665 |
program.ns3_module_dependencies = ['ns3-'+dep for dep in dependencies] |
9261
13b3ddbaac67
bug 1602: do not include directory above in gcc include path
Tom Henderson <tomh@tomh.org>
parents:
9239
diff
changeset
|
666 |
program.includes = "#" |
7495
d87f20fd2421
waf1.6: remove code not needed, fix static build, cleanup
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7494
diff
changeset
|
667 |
program.use = program.ns3_module_dependencies |
d87f20fd2421
waf1.6: remove code not needed, fix static build, cleanup
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7494
diff
changeset
|
668 |
if program.env['ENABLE_STATIC_NS3']: |
d87f20fd2421
waf1.6: remove code not needed, fix static build, cleanup
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7494
diff
changeset
|
669 |
if sys.platform == 'darwin': |
d87f20fd2421
waf1.6: remove code not needed, fix static build, cleanup
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7494
diff
changeset
|
670 |
program.env.STLIB_MARKER = '-Wl,-all_load' |
d87f20fd2421
waf1.6: remove code not needed, fix static build, cleanup
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7494
diff
changeset
|
671 |
else: |
9277
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9261
diff
changeset
|
672 |
program.env.STLIB_MARKER = '-Wl,-Bstatic,--whole-archive' |
7495
d87f20fd2421
waf1.6: remove code not needed, fix static build, cleanup
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7494
diff
changeset
|
673 |
program.env.SHLIB_MARKER = '-Wl,-Bdynamic,--no-whole-archive' |
7593
fe607d42ec05
Correcting compilation behavior in Ubuntu 11.10. I guess, default behavior of ldd has been changed... As a result, many dynamic features of NS were not working
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
7551
diff
changeset
|
674 |
else: |
fe607d42ec05
Correcting compilation behavior in Ubuntu 11.10. I guess, default behavior of ldd has been changed... As a result, many dynamic features of NS were not working
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
7551
diff
changeset
|
675 |
if program.env.DEST_BINFMT == 'elf': |
fe607d42ec05
Correcting compilation behavior in Ubuntu 11.10. I guess, default behavior of ldd has been changed... As a result, many dynamic features of NS were not working
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
7551
diff
changeset
|
676 |
# All ELF platforms are impacted but only the gcc compiler has a flag to fix it. |
fe607d42ec05
Correcting compilation behavior in Ubuntu 11.10. I guess, default behavior of ldd has been changed... As a result, many dynamic features of NS were not working
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
7551
diff
changeset
|
677 |
if 'gcc' in (program.env.CXX_NAME, program.env.CC_NAME): |
fe607d42ec05
Correcting compilation behavior in Ubuntu 11.10. I guess, default behavior of ldd has been changed... As a result, many dynamic features of NS were not working
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
7551
diff
changeset
|
678 |
program.env.append_value ('SHLIB_MARKER', '-Wl,--no-as-needed') |
fe607d42ec05
Correcting compilation behavior in Ubuntu 11.10. I guess, default behavior of ldd has been changed... As a result, many dynamic features of NS were not working
Alexander Afanasyev <alexander.afanasyev@ucla.edu>
parents:
7551
diff
changeset
|
679 |
|
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:
1213
diff
changeset
|
680 |
return program |
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:
1213
diff
changeset
|
681 |
|
7094
f0748224dd68
Write a status file during waf build step
Mitch Watrous <watrous@u.washington.edu>
parents:
7088
diff
changeset
|
682 |
def register_ns3_script(bld, name, dependencies=('core',)): |
f0748224dd68
Write a status file during waf build step
Mitch Watrous <watrous@u.washington.edu>
parents:
7088
diff
changeset
|
683 |
ns3_module_dependencies = ['ns3-'+dep for dep in dependencies] |
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
684 |
bld.env.append_value('NS3_SCRIPT_DEPENDENCIES', [(name, ns3_module_dependencies)]) |
7094
f0748224dd68
Write a status file during waf build step
Mitch Watrous <watrous@u.washington.edu>
parents:
7088
diff
changeset
|
685 |
|
5848
ee2c83ed68cf
get rid of examples waf script
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
5468
diff
changeset
|
686 |
def add_examples_programs(bld): |
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
687 |
env = bld.env |
5848
ee2c83ed68cf
get rid of examples waf script
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
5468
diff
changeset
|
688 |
if env['ENABLE_EXAMPLES']: |
11475
f1837a4f71c0
Handle the case where scratch or examples directory is missing
Vedran Miletić <rivanvx@gmail.com>
parents:
11474
diff
changeset
|
689 |
try: |
f1837a4f71c0
Handle the case where scratch or examples directory is missing
Vedran Miletić <rivanvx@gmail.com>
parents:
11474
diff
changeset
|
690 |
for dir in os.listdir('examples'): |
f1837a4f71c0
Handle the case where scratch or examples directory is missing
Vedran Miletić <rivanvx@gmail.com>
parents:
11474
diff
changeset
|
691 |
if dir.startswith('.') or dir == 'CVS': |
f1837a4f71c0
Handle the case where scratch or examples directory is missing
Vedran Miletić <rivanvx@gmail.com>
parents:
11474
diff
changeset
|
692 |
continue |
f1837a4f71c0
Handle the case where scratch or examples directory is missing
Vedran Miletić <rivanvx@gmail.com>
parents:
11474
diff
changeset
|
693 |
if os.path.isdir(os.path.join('examples', dir)): |
f1837a4f71c0
Handle the case where scratch or examples directory is missing
Vedran Miletić <rivanvx@gmail.com>
parents:
11474
diff
changeset
|
694 |
bld.recurse(os.path.join('examples', dir)) |
f1837a4f71c0
Handle the case where scratch or examples directory is missing
Vedran Miletić <rivanvx@gmail.com>
parents:
11474
diff
changeset
|
695 |
except OSError: |
f1837a4f71c0
Handle the case where scratch or examples directory is missing
Vedran Miletić <rivanvx@gmail.com>
parents:
11474
diff
changeset
|
696 |
return |
5848
ee2c83ed68cf
get rid of examples waf script
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
5468
diff
changeset
|
697 |
|
3275
b0d91237f2ec
[Bug 221] need a scratch directory
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3189
diff
changeset
|
698 |
def add_scratch_programs(bld): |
6962
7df7b903d035
Bug 1083 - scratch doesn't work when only some modules are enabled
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6925
diff
changeset
|
699 |
all_modules = [mod[len("ns3-"):] for mod in bld.env['NS3_ENABLED_MODULES']] |
11475
f1837a4f71c0
Handle the case where scratch or examples directory is missing
Vedran Miletić <rivanvx@gmail.com>
parents:
11474
diff
changeset
|
700 |
try: |
f1837a4f71c0
Handle the case where scratch or examples directory is missing
Vedran Miletić <rivanvx@gmail.com>
parents:
11474
diff
changeset
|
701 |
for filename in os.listdir("scratch"): |
f1837a4f71c0
Handle the case where scratch or examples directory is missing
Vedran Miletić <rivanvx@gmail.com>
parents:
11474
diff
changeset
|
702 |
if filename.startswith('.') or filename == 'CVS': |
f1837a4f71c0
Handle the case where scratch or examples directory is missing
Vedran Miletić <rivanvx@gmail.com>
parents:
11474
diff
changeset
|
703 |
continue |
f1837a4f71c0
Handle the case where scratch or examples directory is missing
Vedran Miletić <rivanvx@gmail.com>
parents:
11474
diff
changeset
|
704 |
if os.path.isdir(os.path.join("scratch", filename)): |
f1837a4f71c0
Handle the case where scratch or examples directory is missing
Vedran Miletić <rivanvx@gmail.com>
parents:
11474
diff
changeset
|
705 |
obj = bld.create_ns3_program(filename, all_modules) |
f1837a4f71c0
Handle the case where scratch or examples directory is missing
Vedran Miletić <rivanvx@gmail.com>
parents:
11474
diff
changeset
|
706 |
obj.path = obj.path.find_dir('scratch').find_dir(filename) |
f1837a4f71c0
Handle the case where scratch or examples directory is missing
Vedran Miletić <rivanvx@gmail.com>
parents:
11474
diff
changeset
|
707 |
obj.source = obj.path.ant_glob('*.cc') |
f1837a4f71c0
Handle the case where scratch or examples directory is missing
Vedran Miletić <rivanvx@gmail.com>
parents:
11474
diff
changeset
|
708 |
obj.target = filename |
f1837a4f71c0
Handle the case where scratch or examples directory is missing
Vedran Miletić <rivanvx@gmail.com>
parents:
11474
diff
changeset
|
709 |
obj.name = obj.target |
f1837a4f71c0
Handle the case where scratch or examples directory is missing
Vedran Miletić <rivanvx@gmail.com>
parents:
11474
diff
changeset
|
710 |
obj.install_path = None |
f1837a4f71c0
Handle the case where scratch or examples directory is missing
Vedran Miletić <rivanvx@gmail.com>
parents:
11474
diff
changeset
|
711 |
elif filename.endswith(".cc"): |
f1837a4f71c0
Handle the case where scratch or examples directory is missing
Vedran Miletić <rivanvx@gmail.com>
parents:
11474
diff
changeset
|
712 |
name = filename[:-len(".cc")] |
f1837a4f71c0
Handle the case where scratch or examples directory is missing
Vedran Miletić <rivanvx@gmail.com>
parents:
11474
diff
changeset
|
713 |
obj = bld.create_ns3_program(name, all_modules) |
f1837a4f71c0
Handle the case where scratch or examples directory is missing
Vedran Miletić <rivanvx@gmail.com>
parents:
11474
diff
changeset
|
714 |
obj.path = obj.path.find_dir('scratch') |
f1837a4f71c0
Handle the case where scratch or examples directory is missing
Vedran Miletić <rivanvx@gmail.com>
parents:
11474
diff
changeset
|
715 |
obj.source = filename |
f1837a4f71c0
Handle the case where scratch or examples directory is missing
Vedran Miletić <rivanvx@gmail.com>
parents:
11474
diff
changeset
|
716 |
obj.target = name |
f1837a4f71c0
Handle the case where scratch or examples directory is missing
Vedran Miletić <rivanvx@gmail.com>
parents:
11474
diff
changeset
|
717 |
obj.name = obj.target |
f1837a4f71c0
Handle the case where scratch or examples directory is missing
Vedran Miletić <rivanvx@gmail.com>
parents:
11474
diff
changeset
|
718 |
obj.install_path = None |
f1837a4f71c0
Handle the case where scratch or examples directory is missing
Vedran Miletić <rivanvx@gmail.com>
parents:
11474
diff
changeset
|
719 |
except OSError: |
f1837a4f71c0
Handle the case where scratch or examples directory is missing
Vedran Miletić <rivanvx@gmail.com>
parents:
11474
diff
changeset
|
720 |
return |
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:
1213
diff
changeset
|
721 |
|
7488
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
722 |
def _get_all_task_gen(self): |
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
723 |
for group in self.groups: |
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
724 |
for taskgen in group: |
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
725 |
yield taskgen |
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
726 |
|
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
727 |
|
7488
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
728 |
# ok, so WAF does not provide an API to prevent an |
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
729 |
# arbitrary taskgen from running; we have to muck around with |
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
730 |
# WAF internal state, something that might stop working if |
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
731 |
# WAF is upgraded... |
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
732 |
def _exclude_taskgen(self, taskgen): |
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
733 |
for group in self.groups: |
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
734 |
for tg1 in group: |
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
735 |
if tg1 is taskgen: |
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
736 |
group.remove(tg1) |
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
737 |
break |
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
738 |
else: |
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
739 |
continue |
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
740 |
break |
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
741 |
|
7331
827246e3bc4c
Bug 1174 - Ns-3 does not generate static libraries
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7326
diff
changeset
|
742 |
|
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:
7712
diff
changeset
|
743 |
def _find_ns3_module(self, name): |
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:
7712
diff
changeset
|
744 |
for obj in _get_all_task_gen(self): |
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:
7712
diff
changeset
|
745 |
# disable the modules themselves |
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:
7712
diff
changeset
|
746 |
if hasattr(obj, "is_ns3_module") and obj.name == name: |
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:
7712
diff
changeset
|
747 |
return obj |
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:
7712
diff
changeset
|
748 |
raise KeyError(name) |
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:
7712
diff
changeset
|
749 |
|
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:
7712
diff
changeset
|
750 |
|
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
751 |
def build(bld): |
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
752 |
env = bld.env |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
753 |
|
11805
391bf90839ed
add waf --check-profile option
Tom Henderson <tomh@tomh.org>
parents:
11788
diff
changeset
|
754 |
if Options.options.check_profile: |
12098
fbf04c68c217
waf: (fixes #2387) Fix check-profile command
Tom Henderson <tomh@tomh.org>
parents:
11809
diff
changeset
|
755 |
# Parse the waf lockfile generated by latest 'configure' operation |
fbf04c68c217
waf: (fixes #2387) Fix check-profile command
Tom Henderson <tomh@tomh.org>
parents:
11809
diff
changeset
|
756 |
lockfile = os.environ.get('WAFLOCK', '.lock-waf_%s_build' % sys.platform) |
fbf04c68c217
waf: (fixes #2387) Fix check-profile command
Tom Henderson <tomh@tomh.org>
parents:
11809
diff
changeset
|
757 |
profile = "not found" |
fbf04c68c217
waf: (fixes #2387) Fix check-profile command
Tom Henderson <tomh@tomh.org>
parents:
11809
diff
changeset
|
758 |
with open(lockfile, "r") as f: |
fbf04c68c217
waf: (fixes #2387) Fix check-profile command
Tom Henderson <tomh@tomh.org>
parents:
11809
diff
changeset
|
759 |
for line in f: |
fbf04c68c217
waf: (fixes #2387) Fix check-profile command
Tom Henderson <tomh@tomh.org>
parents:
11809
diff
changeset
|
760 |
if line.startswith("options ="): |
fbf04c68c217
waf: (fixes #2387) Fix check-profile command
Tom Henderson <tomh@tomh.org>
parents:
11809
diff
changeset
|
761 |
key, val = line.split('=') |
fbf04c68c217
waf: (fixes #2387) Fix check-profile command
Tom Henderson <tomh@tomh.org>
parents:
11809
diff
changeset
|
762 |
arr = val.split(',') |
fbf04c68c217
waf: (fixes #2387) Fix check-profile command
Tom Henderson <tomh@tomh.org>
parents:
11809
diff
changeset
|
763 |
for x in arr: |
fbf04c68c217
waf: (fixes #2387) Fix check-profile command
Tom Henderson <tomh@tomh.org>
parents:
11809
diff
changeset
|
764 |
optkey,optval = x.split(':') |
fbf04c68c217
waf: (fixes #2387) Fix check-profile command
Tom Henderson <tomh@tomh.org>
parents:
11809
diff
changeset
|
765 |
if (optkey.lstrip() == '\'build_profile\''): |
fbf04c68c217
waf: (fixes #2387) Fix check-profile command
Tom Henderson <tomh@tomh.org>
parents:
11809
diff
changeset
|
766 |
profile = str(optval.lstrip()).replace("'","") |
fbf04c68c217
waf: (fixes #2387) Fix check-profile command
Tom Henderson <tomh@tomh.org>
parents:
11809
diff
changeset
|
767 |
print("Build profile: %s" % profile) |
11805
391bf90839ed
add waf --check-profile option
Tom Henderson <tomh@tomh.org>
parents:
11788
diff
changeset
|
768 |
raise SystemExit(0) |
391bf90839ed
add waf --check-profile option
Tom Henderson <tomh@tomh.org>
parents:
11788
diff
changeset
|
769 |
return |
391bf90839ed
add waf --check-profile option
Tom Henderson <tomh@tomh.org>
parents:
11788
diff
changeset
|
770 |
|
7131
77b75cd826d0
Make modules no longer be enabled from waf build
Mitch Watrous <watrous@u.washington.edu>
parents:
7100
diff
changeset
|
771 |
# If --enabled-modules option was given, then print a warning |
77b75cd826d0
Make modules no longer be enabled from waf build
Mitch Watrous <watrous@u.washington.edu>
parents:
7100
diff
changeset
|
772 |
# message and exit this function. |
77b75cd826d0
Make modules no longer be enabled from waf build
Mitch Watrous <watrous@u.washington.edu>
parents:
7100
diff
changeset
|
773 |
if Options.options.enable_modules: |
77b75cd826d0
Make modules no longer be enabled from waf build
Mitch Watrous <watrous@u.washington.edu>
parents:
7100
diff
changeset
|
774 |
Logs.warn("No modules were built. Use waf configure --enable-modules to enable modules.") |
77b75cd826d0
Make modules no longer be enabled from waf build
Mitch Watrous <watrous@u.washington.edu>
parents:
7100
diff
changeset
|
775 |
return |
77b75cd826d0
Make modules no longer be enabled from waf build
Mitch Watrous <watrous@u.washington.edu>
parents:
7100
diff
changeset
|
776 |
|
6925
43d9c7eedf7b
Test implicitly dependent modules
Mitch Watrous <watrous@u.washington.edu>
parents:
6919
diff
changeset
|
777 |
bld.env['NS3_MODULES_WITH_TEST_LIBRARIES'] = [] |
6913
54679ab32585
Create separate module and test-module libraries
Mitch Watrous <watrous@u.washington.edu>
parents:
6886
diff
changeset
|
778 |
bld.env['NS3_ENABLED_MODULE_TEST_LIBRARIES'] = [] |
7094
f0748224dd68
Write a status file during waf build step
Mitch Watrous <watrous@u.washington.edu>
parents:
7088
diff
changeset
|
779 |
bld.env['NS3_SCRIPT_DEPENDENCIES'] = [] |
f0748224dd68
Write a status file during waf build step
Mitch Watrous <watrous@u.washington.edu>
parents:
7088
diff
changeset
|
780 |
bld.env['NS3_RUNNABLE_PROGRAMS'] = [] |
f0748224dd68
Write a status file during waf build step
Mitch Watrous <watrous@u.washington.edu>
parents:
7088
diff
changeset
|
781 |
bld.env['NS3_RUNNABLE_SCRIPTS'] = [] |
6913
54679ab32585
Create separate module and test-module libraries
Mitch Watrous <watrous@u.washington.edu>
parents:
6886
diff
changeset
|
782 |
|
4326
179f86838e62
Upgrade to WAF 1.5.4
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4202
diff
changeset
|
783 |
wutils.bld = bld |
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4029
diff
changeset
|
784 |
if Options.options.no_task_lines: |
9277
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9261
diff
changeset
|
785 |
from waflib import Runner |
2866
1d829915f092
Add a --no-task-lines WAF option; together with -v it makes WAF just print executed commands, like 'make' does.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2846
diff
changeset
|
786 |
def null_printout(s): |
1d829915f092
Add a --no-task-lines WAF option; together with -v it makes WAF just print executed commands, like 'make' does.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2846
diff
changeset
|
787 |
pass |
1d829915f092
Add a --no-task-lines WAF option; together with -v it makes WAF just print executed commands, like 'make' does.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2846
diff
changeset
|
788 |
Runner.printout = null_printout |
1d829915f092
Add a --no-task-lines WAF option; together with -v it makes WAF just print executed commands, like 'make' does.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2846
diff
changeset
|
789 |
|
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4029
diff
changeset
|
790 |
Options.cwd_launch = bld.path.abspath() |
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:
1213
diff
changeset
|
791 |
bld.create_ns3_program = types.MethodType(create_ns3_program, bld) |
7094
f0748224dd68
Write a status file during waf build step
Mitch Watrous <watrous@u.washington.edu>
parents:
7088
diff
changeset
|
792 |
bld.register_ns3_script = types.MethodType(register_ns3_script, bld) |
3826
40c5841b616d
merge in tap device
Craig Dowell <craigdo@ee.washington.edu>
parents:
3703
diff
changeset
|
793 |
bld.create_suid_program = types.MethodType(create_suid_program, bld) |
7488
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
794 |
bld.__class__.all_task_gen = property(_get_all_task_gen) |
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
795 |
bld.exclude_taskgen = types.MethodType(_exclude_taskgen, bld) |
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:
7712
diff
changeset
|
796 |
bld.find_ns3_module = types.MethodType(_find_ns3_module, bld) |
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4029
diff
changeset
|
797 |
|
9239
02de8e19ce08
bug 1517: waf clean/distclean doesn't remove the doc/html directory
Tom Henderson <tomh@tomh.org>
parents:
9169
diff
changeset
|
798 |
# Clean documentation build directories; other cleaning happens later |
02de8e19ce08
bug 1517: waf clean/distclean doesn't remove the doc/html directory
Tom Henderson <tomh@tomh.org>
parents:
9169
diff
changeset
|
799 |
if bld.cmd == 'clean': |
02de8e19ce08
bug 1517: waf clean/distclean doesn't remove the doc/html directory
Tom Henderson <tomh@tomh.org>
parents:
9169
diff
changeset
|
800 |
_cleandocs() |
02de8e19ce08
bug 1517: waf clean/distclean doesn't remove the doc/html directory
Tom Henderson <tomh@tomh.org>
parents:
9169
diff
changeset
|
801 |
|
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
802 |
# process subfolders from here |
9277
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9261
diff
changeset
|
803 |
bld.recurse('src') |
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
804 |
|
6925
43d9c7eedf7b
Test implicitly dependent modules
Mitch Watrous <watrous@u.washington.edu>
parents:
6919
diff
changeset
|
805 |
# If modules have been enabled, then set lists of enabled modules |
43d9c7eedf7b
Test implicitly dependent modules
Mitch Watrous <watrous@u.washington.edu>
parents:
6919
diff
changeset
|
806 |
# and enabled module test libraries. |
1880
0148d5911946
New waf snapshot; move the ns3 library back to the top build dir (the 'lib' was only a workaround for a waf problem); allow --enable-modules on a per build run basis.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1858
diff
changeset
|
807 |
if env['NS3_ENABLED_MODULES']: |
0148d5911946
New waf snapshot; move the ns3 library back to the top build dir (the 'lib' was only a workaround for a waf problem); allow --enable-modules on a per build run basis.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1858
diff
changeset
|
808 |
modules = env['NS3_ENABLED_MODULES'] |
6638
ec4cdb1ca3ed
Revive the option --enable-modules from bit-rot; however it won't yet work in practice due to dependencies not declared and non-modular python bindings
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6637
diff
changeset
|
809 |
|
ec4cdb1ca3ed
Revive the option --enable-modules from bit-rot; however it won't yet work in practice due to dependencies not declared and non-modular python bindings
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6637
diff
changeset
|
810 |
# Find out about additional modules that need to be enabled |
ec4cdb1ca3ed
Revive the option --enable-modules from bit-rot; however it won't yet work in practice due to dependencies not declared and non-modular python bindings
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6637
diff
changeset
|
811 |
# due to dependency constraints. |
1880
0148d5911946
New waf snapshot; move the ns3 library back to the top build dir (the 'lib' was only a workaround for a waf problem); allow --enable-modules on a per build run basis.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1858
diff
changeset
|
812 |
changed = True |
0148d5911946
New waf snapshot; move the ns3 library back to the top build dir (the 'lib' was only a workaround for a waf problem); allow --enable-modules on a per build run basis.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1858
diff
changeset
|
813 |
while changed: |
0148d5911946
New waf snapshot; move the ns3 library back to the top build dir (the 'lib' was only a workaround for a waf problem); allow --enable-modules on a per build run basis.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1858
diff
changeset
|
814 |
changed = False |
0148d5911946
New waf snapshot; move the ns3 library back to the top build dir (the 'lib' was only a workaround for a waf problem); allow --enable-modules on a per build run basis.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1858
diff
changeset
|
815 |
for module in modules: |
7488
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
816 |
module_obj = bld.get_tgen_by_name(module) |
1880
0148d5911946
New waf snapshot; move the ns3 library back to the top build dir (the 'lib' was only a workaround for a waf problem); allow --enable-modules on a per build run basis.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1858
diff
changeset
|
817 |
if module_obj is None: |
0148d5911946
New waf snapshot; move the ns3 library back to the top build dir (the 'lib' was only a workaround for a waf problem); allow --enable-modules on a per build run basis.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1858
diff
changeset
|
818 |
raise ValueError("module %s not found" % module) |
6913
54679ab32585
Create separate module and test-module libraries
Mitch Watrous <watrous@u.washington.edu>
parents:
6886
diff
changeset
|
819 |
# Each enabled module has its own library. |
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
820 |
for dep in module_obj.use: |
1880
0148d5911946
New waf snapshot; move the ns3 library back to the top build dir (the 'lib' was only a workaround for a waf problem); allow --enable-modules on a per build run basis.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1858
diff
changeset
|
821 |
if not dep.startswith('ns3-'): |
0148d5911946
New waf snapshot; move the ns3 library back to the top build dir (the 'lib' was only a workaround for a waf problem); allow --enable-modules on a per build run basis.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1858
diff
changeset
|
822 |
continue |
0148d5911946
New waf snapshot; move the ns3 library back to the top build dir (the 'lib' was only a workaround for a waf problem); allow --enable-modules on a per build run basis.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1858
diff
changeset
|
823 |
if dep not in modules: |
0148d5911946
New waf snapshot; move the ns3 library back to the top build dir (the 'lib' was only a workaround for a waf problem); allow --enable-modules on a per build run basis.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1858
diff
changeset
|
824 |
modules.append(dep) |
0148d5911946
New waf snapshot; move the ns3 library back to the top build dir (the 'lib' was only a workaround for a waf problem); allow --enable-modules on a per build run basis.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1858
diff
changeset
|
825 |
changed = True |
0148d5911946
New waf snapshot; move the ns3 library back to the top build dir (the 'lib' was only a workaround for a waf problem); allow --enable-modules on a per build run basis.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1858
diff
changeset
|
826 |
|
6638
ec4cdb1ca3ed
Revive the option --enable-modules from bit-rot; however it won't yet work in practice due to dependencies not declared and non-modular python bindings
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6637
diff
changeset
|
827 |
env['NS3_ENABLED_MODULES'] = modules |
ec4cdb1ca3ed
Revive the option --enable-modules from bit-rot; however it won't yet work in practice due to dependencies not declared and non-modular python bindings
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6637
diff
changeset
|
828 |
|
6998
1c2b8cfb71d2
Make tests not be built by default
Mitch Watrous <watrous@u.washington.edu>
parents:
6981
diff
changeset
|
829 |
# If tests are being built, then set the list of the enabled |
1c2b8cfb71d2
Make tests not be built by default
Mitch Watrous <watrous@u.washington.edu>
parents:
6981
diff
changeset
|
830 |
# module test libraries. |
1c2b8cfb71d2
Make tests not be built by default
Mitch Watrous <watrous@u.washington.edu>
parents:
6981
diff
changeset
|
831 |
if env['ENABLE_TESTS']: |
1c2b8cfb71d2
Make tests not be built by default
Mitch Watrous <watrous@u.washington.edu>
parents:
6981
diff
changeset
|
832 |
for (mod, testlib) in bld.env['NS3_MODULES_WITH_TEST_LIBRARIES']: |
1c2b8cfb71d2
Make tests not be built by default
Mitch Watrous <watrous@u.washington.edu>
parents:
6981
diff
changeset
|
833 |
if mod in bld.env['NS3_ENABLED_MODULES']: |
1c2b8cfb71d2
Make tests not be built by default
Mitch Watrous <watrous@u.washington.edu>
parents:
6981
diff
changeset
|
834 |
bld.env.append_value('NS3_ENABLED_MODULE_TEST_LIBRARIES', testlib) |
6925
43d9c7eedf7b
Test implicitly dependent modules
Mitch Watrous <watrous@u.washington.edu>
parents:
6919
diff
changeset
|
835 |
|
43d9c7eedf7b
Test implicitly dependent modules
Mitch Watrous <watrous@u.washington.edu>
parents:
6919
diff
changeset
|
836 |
add_examples_programs(bld) |
43d9c7eedf7b
Test implicitly dependent modules
Mitch Watrous <watrous@u.washington.edu>
parents:
6919
diff
changeset
|
837 |
add_scratch_programs(bld) |
43d9c7eedf7b
Test implicitly dependent modules
Mitch Watrous <watrous@u.washington.edu>
parents:
6919
diff
changeset
|
838 |
|
43d9c7eedf7b
Test implicitly dependent modules
Mitch Watrous <watrous@u.washington.edu>
parents:
6919
diff
changeset
|
839 |
if env['NS3_ENABLED_MODULES']: |
43d9c7eedf7b
Test implicitly dependent modules
Mitch Watrous <watrous@u.washington.edu>
parents:
6919
diff
changeset
|
840 |
modules = env['NS3_ENABLED_MODULES'] |
6913
54679ab32585
Create separate module and test-module libraries
Mitch Watrous <watrous@u.washington.edu>
parents:
6886
diff
changeset
|
841 |
|
6638
ec4cdb1ca3ed
Revive the option --enable-modules from bit-rot; however it won't yet work in practice due to dependencies not declared and non-modular python bindings
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6637
diff
changeset
|
842 |
# Exclude the programs other misc task gens that depend on disabled modules |
4326
179f86838e62
Upgrade to WAF 1.5.4
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4202
diff
changeset
|
843 |
for obj in list(bld.all_task_gen): |
6638
ec4cdb1ca3ed
Revive the option --enable-modules from bit-rot; however it won't yet work in practice due to dependencies not declared and non-modular python bindings
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6637
diff
changeset
|
844 |
|
ec4cdb1ca3ed
Revive the option --enable-modules from bit-rot; however it won't yet work in practice due to dependencies not declared and non-modular python bindings
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6637
diff
changeset
|
845 |
# check for ns3moduleheader_taskgen |
7488
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
846 |
if 'ns3moduleheader' in getattr(obj, "features", []): |
6638
ec4cdb1ca3ed
Revive the option --enable-modules from bit-rot; however it won't yet work in practice due to dependencies not declared and non-modular python bindings
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6637
diff
changeset
|
847 |
if ("ns3-%s" % obj.module) not in modules: |
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:
6641
diff
changeset
|
848 |
obj.mode = 'remove' # tell it to remove headers instead of installing |
6638
ec4cdb1ca3ed
Revive the option --enable-modules from bit-rot; however it won't yet work in practice due to dependencies not declared and non-modular python bindings
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6637
diff
changeset
|
849 |
|
ec4cdb1ca3ed
Revive the option --enable-modules from bit-rot; however it won't yet work in practice due to dependencies not declared and non-modular python bindings
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6637
diff
changeset
|
850 |
# check for programs |
1880
0148d5911946
New waf snapshot; move the ns3 library back to the top build dir (the 'lib' was only a workaround for a waf problem); allow --enable-modules on a per build run basis.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1858
diff
changeset
|
851 |
if hasattr(obj, 'ns3_module_dependencies'): |
6638
ec4cdb1ca3ed
Revive the option --enable-modules from bit-rot; however it won't yet work in practice due to dependencies not declared and non-modular python bindings
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6637
diff
changeset
|
852 |
# this is an NS-3 program (bld.create_ns3_program) |
7094
f0748224dd68
Write a status file during waf build step
Mitch Watrous <watrous@u.washington.edu>
parents:
7088
diff
changeset
|
853 |
program_built = True |
1880
0148d5911946
New waf snapshot; move the ns3 library back to the top build dir (the 'lib' was only a workaround for a waf problem); allow --enable-modules on a per build run basis.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1858
diff
changeset
|
854 |
for dep in obj.ns3_module_dependencies: |
6638
ec4cdb1ca3ed
Revive the option --enable-modules from bit-rot; however it won't yet work in practice due to dependencies not declared and non-modular python bindings
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6637
diff
changeset
|
855 |
if dep not in modules: # prog. depends on a module that isn't enabled? |
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
856 |
bld.exclude_taskgen(obj) |
7094
f0748224dd68
Write a status file during waf build step
Mitch Watrous <watrous@u.washington.edu>
parents:
7088
diff
changeset
|
857 |
program_built = False |
1880
0148d5911946
New waf snapshot; move the ns3 library back to the top build dir (the 'lib' was only a workaround for a waf problem); allow --enable-modules on a per build run basis.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1858
diff
changeset
|
858 |
break |
6638
ec4cdb1ca3ed
Revive the option --enable-modules from bit-rot; however it won't yet work in practice due to dependencies not declared and non-modular python bindings
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6637
diff
changeset
|
859 |
|
7094
f0748224dd68
Write a status file during waf build step
Mitch Watrous <watrous@u.washington.edu>
parents:
7088
diff
changeset
|
860 |
# Add this program to the list if all of its |
f0748224dd68
Write a status file during waf build step
Mitch Watrous <watrous@u.washington.edu>
parents:
7088
diff
changeset
|
861 |
# dependencies will be built. |
f0748224dd68
Write a status file during waf build step
Mitch Watrous <watrous@u.washington.edu>
parents:
7088
diff
changeset
|
862 |
if program_built: |
8894
90d67c5e8255
Bug 1445 - When build with "-d release", don't suffix "-release"
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
8848
diff
changeset
|
863 |
object_name = "%s%s-%s%s" % (wutils.APPNAME, wutils.VERSION, |
90d67c5e8255
Bug 1445 - When build with "-d release", don't suffix "-release"
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
8848
diff
changeset
|
864 |
obj.name, bld.env.BUILD_SUFFIX) |
9076
7c9f34fa2dd6
Bug 1463 - ./test.py --example should automatically detect the path
Mitch Watrous <watrous@u.washington.edu>
parents:
8967
diff
changeset
|
865 |
|
7c9f34fa2dd6
Bug 1463 - ./test.py --example should automatically detect the path
Mitch Watrous <watrous@u.washington.edu>
parents:
8967
diff
changeset
|
866 |
# Get the relative path to the program from the |
7c9f34fa2dd6
Bug 1463 - ./test.py --example should automatically detect the path
Mitch Watrous <watrous@u.washington.edu>
parents:
8967
diff
changeset
|
867 |
# launch directory. |
7c9f34fa2dd6
Bug 1463 - ./test.py --example should automatically detect the path
Mitch Watrous <watrous@u.washington.edu>
parents:
8967
diff
changeset
|
868 |
launch_dir = os.path.abspath(Context.launch_dir) |
7c9f34fa2dd6
Bug 1463 - ./test.py --example should automatically detect the path
Mitch Watrous <watrous@u.washington.edu>
parents:
8967
diff
changeset
|
869 |
object_relative_path = os.path.join( |
9277
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9261
diff
changeset
|
870 |
wutils.relpath(obj.path.get_bld().abspath(), launch_dir), |
9076
7c9f34fa2dd6
Bug 1463 - ./test.py --example should automatically detect the path
Mitch Watrous <watrous@u.washington.edu>
parents:
8967
diff
changeset
|
871 |
object_name) |
7c9f34fa2dd6
Bug 1463 - ./test.py --example should automatically detect the path
Mitch Watrous <watrous@u.washington.edu>
parents:
8967
diff
changeset
|
872 |
|
7c9f34fa2dd6
Bug 1463 - ./test.py --example should automatically detect the path
Mitch Watrous <watrous@u.washington.edu>
parents:
8967
diff
changeset
|
873 |
bld.env.append_value('NS3_RUNNABLE_PROGRAMS', object_relative_path) |
7094
f0748224dd68
Write a status file during waf build step
Mitch Watrous <watrous@u.washington.edu>
parents:
7088
diff
changeset
|
874 |
|
6641
cfd3533cc1ef
One more stop to fixing --enable-modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6638
diff
changeset
|
875 |
# disable the modules themselves |
6638
ec4cdb1ca3ed
Revive the option --enable-modules from bit-rot; however it won't yet work in practice due to dependencies not declared and non-modular python bindings
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6637
diff
changeset
|
876 |
if hasattr(obj, "is_ns3_module") and obj.name not in modules: |
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
877 |
bld.exclude_taskgen(obj) # kill the module |
6641
cfd3533cc1ef
One more stop to fixing --enable-modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6638
diff
changeset
|
878 |
|
6913
54679ab32585
Create separate module and test-module libraries
Mitch Watrous <watrous@u.washington.edu>
parents:
6886
diff
changeset
|
879 |
# disable the module test libraries |
6998
1c2b8cfb71d2
Make tests not be built by default
Mitch Watrous <watrous@u.washington.edu>
parents:
6981
diff
changeset
|
880 |
if hasattr(obj, "is_ns3_module_test_library"): |
1c2b8cfb71d2
Make tests not be built by default
Mitch Watrous <watrous@u.washington.edu>
parents:
6981
diff
changeset
|
881 |
if not env['ENABLE_TESTS'] or (obj.module_name not in modules): |
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
882 |
bld.exclude_taskgen(obj) # kill the module test library |
6913
54679ab32585
Create separate module and test-module libraries
Mitch Watrous <watrous@u.washington.edu>
parents:
6886
diff
changeset
|
883 |
|
6641
cfd3533cc1ef
One more stop to fixing --enable-modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6638
diff
changeset
|
884 |
# disable the ns3header_taskgen |
7488
72d0c878f3c7
More waf 1.6.7 build fixes
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7487
diff
changeset
|
885 |
if 'ns3header' in getattr(obj, "features", []): |
6641
cfd3533cc1ef
One more stop to fixing --enable-modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6638
diff
changeset
|
886 |
if ("ns3-%s" % obj.module) not in modules: |
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:
6641
diff
changeset
|
887 |
obj.mode = 'remove' # tell it to remove headers instead of installing |
1880
0148d5911946
New waf snapshot; move the ns3 library back to the top build dir (the 'lib' was only a workaround for a waf problem); allow --enable-modules on a per build run basis.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1858
diff
changeset
|
888 |
|
11183
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11067
diff
changeset
|
889 |
# disable the ns3privateheader_taskgen |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11067
diff
changeset
|
890 |
if 'ns3privateheader' in getattr(obj, "features", []): |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11067
diff
changeset
|
891 |
if ("ns3-%s" % obj.module) not in modules: |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11067
diff
changeset
|
892 |
obj.mode = 'remove' # tell it to remove headers instead of installing |
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11067
diff
changeset
|
893 |
|
7707
42c37d556d61
Bug 1331 - waf generates and installs pkgconfig .pc files even for disabled modules and tests
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7706
diff
changeset
|
894 |
# disable pcfile taskgens for disabled modules |
42c37d556d61
Bug 1331 - waf generates and installs pkgconfig .pc files even for disabled modules and tests
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7706
diff
changeset
|
895 |
if 'ns3pcfile' in getattr(obj, "features", []): |
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:
7712
diff
changeset
|
896 |
if obj.module not in bld.env.NS3_ENABLED_MODULES: |
7707
42c37d556d61
Bug 1331 - waf generates and installs pkgconfig .pc files even for disabled modules and tests
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7706
diff
changeset
|
897 |
bld.exclude_taskgen(obj) |
42c37d556d61
Bug 1331 - waf generates and installs pkgconfig .pc files even for disabled modules and tests
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7706
diff
changeset
|
898 |
|
42c37d556d61
Bug 1331 - waf generates and installs pkgconfig .pc files even for disabled modules and tests
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7706
diff
changeset
|
899 |
|
1880
0148d5911946
New waf snapshot; move the ns3 library back to the top build dir (the 'lib' was only a workaround for a waf problem); allow --enable-modules on a per build run basis.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1858
diff
changeset
|
900 |
if env['NS3_ENABLED_MODULES']: |
3408
2cc40b3e4fa5
python bindings
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3331
diff
changeset
|
901 |
env['NS3_ENABLED_MODULES'] = list(modules) |
1880
0148d5911946
New waf snapshot; move the ns3 library back to the top build dir (the 'lib' was only a workaround for a waf problem); allow --enable-modules on a per build run basis.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1858
diff
changeset
|
902 |
|
7094
f0748224dd68
Write a status file during waf build step
Mitch Watrous <watrous@u.washington.edu>
parents:
7088
diff
changeset
|
903 |
# Determine which scripts will be runnable. |
f0748224dd68
Write a status file during waf build step
Mitch Watrous <watrous@u.washington.edu>
parents:
7088
diff
changeset
|
904 |
for (script, dependencies) in bld.env['NS3_SCRIPT_DEPENDENCIES']: |
f0748224dd68
Write a status file during waf build step
Mitch Watrous <watrous@u.washington.edu>
parents:
7088
diff
changeset
|
905 |
script_runnable = True |
f0748224dd68
Write a status file during waf build step
Mitch Watrous <watrous@u.washington.edu>
parents:
7088
diff
changeset
|
906 |
for dep in dependencies: |
f0748224dd68
Write a status file during waf build step
Mitch Watrous <watrous@u.washington.edu>
parents:
7088
diff
changeset
|
907 |
if dep not in modules: |
f0748224dd68
Write a status file during waf build step
Mitch Watrous <watrous@u.washington.edu>
parents:
7088
diff
changeset
|
908 |
script_runnable = False |
f0748224dd68
Write a status file during waf build step
Mitch Watrous <watrous@u.washington.edu>
parents:
7088
diff
changeset
|
909 |
break |
f0748224dd68
Write a status file during waf build step
Mitch Watrous <watrous@u.washington.edu>
parents:
7088
diff
changeset
|
910 |
|
f0748224dd68
Write a status file during waf build step
Mitch Watrous <watrous@u.washington.edu>
parents:
7088
diff
changeset
|
911 |
# Add this script to the list if all of its dependencies will |
f0748224dd68
Write a status file during waf build step
Mitch Watrous <watrous@u.washington.edu>
parents:
7088
diff
changeset
|
912 |
# be built. |
f0748224dd68
Write a status file during waf build step
Mitch Watrous <watrous@u.washington.edu>
parents:
7088
diff
changeset
|
913 |
if script_runnable: |
f0748224dd68
Write a status file during waf build step
Mitch Watrous <watrous@u.washington.edu>
parents:
7088
diff
changeset
|
914 |
bld.env.append_value('NS3_RUNNABLE_SCRIPTS', script) |
f0748224dd68
Write a status file during waf build step
Mitch Watrous <watrous@u.washington.edu>
parents:
7088
diff
changeset
|
915 |
|
9277
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9261
diff
changeset
|
916 |
bld.recurse('bindings/python') |
1880
0148d5911946
New waf snapshot; move the ns3 library back to the top build dir (the 'lib' was only a workaround for a waf problem); allow --enable-modules on a per build run basis.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1858
diff
changeset
|
917 |
|
7337
ac13a12e9dd4
Bug 1206 - Test libraries are built but test suites are not being run in test.py
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7331
diff
changeset
|
918 |
# Process this subfolder here after the lists of enabled modules |
ac13a12e9dd4
Bug 1206 - Test libraries are built but test suites are not being run in test.py
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7331
diff
changeset
|
919 |
# and module test libraries have been set. |
9277
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9261
diff
changeset
|
920 |
bld.recurse('utils') |
7337
ac13a12e9dd4
Bug 1206 - Test libraries are built but test suites are not being run in test.py
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7331
diff
changeset
|
921 |
|
7636
58181e75d0f0
bug 1305 - do not list modules when exiting waf shell
Mitch Watrous <watrous@u.washington.edu>
parents:
7593
diff
changeset
|
922 |
# Set this so that the lists will be printed at the end of this |
58181e75d0f0
bug 1305 - do not list modules when exiting waf shell
Mitch Watrous <watrous@u.washington.edu>
parents:
7593
diff
changeset
|
923 |
# build command. |
58181e75d0f0
bug 1305 - do not list modules when exiting waf shell
Mitch Watrous <watrous@u.washington.edu>
parents:
7593
diff
changeset
|
924 |
bld.env['PRINT_BUILT_MODULES_AT_END'] = True |
58181e75d0f0
bug 1305 - do not list modules when exiting waf shell
Mitch Watrous <watrous@u.washington.edu>
parents:
7593
diff
changeset
|
925 |
|
9823
a22cd11590bd
bug 1305: remove list of modules at end of waf clean
Alexander D'souza <moijes12@gmail.com>
parents:
9277
diff
changeset
|
926 |
# Do not print the modules built if build command was "clean" |
a22cd11590bd
bug 1305: remove list of modules at end of waf clean
Alexander D'souza <moijes12@gmail.com>
parents:
9277
diff
changeset
|
927 |
if bld.cmd == 'clean': |
a22cd11590bd
bug 1305: remove list of modules at end of waf clean
Alexander D'souza <moijes12@gmail.com>
parents:
9277
diff
changeset
|
928 |
bld.env['PRINT_BUILT_MODULES_AT_END'] = False |
a22cd11590bd
bug 1305: remove list of modules at end of waf clean
Alexander D'souza <moijes12@gmail.com>
parents:
9277
diff
changeset
|
929 |
|
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4029
diff
changeset
|
930 |
if Options.options.run: |
3919
fd796ed5b166
Post-fix the last patch, to make sure invalid program names passed into --run trigger an informative error message as before.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3918
diff
changeset
|
931 |
# Check that the requested program name is valid |
4119
9ffcf2400aa5
Bug #323: waf --valgrind doesn't check for valgrind first
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4118
diff
changeset
|
932 |
program_name, dummy_program_argv = wutils.get_run_program(Options.options.run, wutils.get_command_template(env)) |
3933
3c149230e98a
Fix waf problem running programs with arguments.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3927
diff
changeset
|
933 |
|
3919
fd796ed5b166
Post-fix the last patch, to make sure invalid program names passed into --run trigger an informative error message as before.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3918
diff
changeset
|
934 |
# When --run'ing a program, tell WAF to only build that program, |
fd796ed5b166
Post-fix the last patch, to make sure invalid program names passed into --run trigger an informative error message as before.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3918
diff
changeset
|
935 |
# nothing more; this greatly speeds up compilation when all you |
fd796ed5b166
Post-fix the last patch, to make sure invalid program names passed into --run trigger an informative error message as before.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3918
diff
changeset
|
936 |
# want to do is run a test program. |
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
937 |
Options.options.targets += ',' + os.path.basename(program_name) |
8848
9a34e12fab31
Automatically add the visualizer module to programs running with waf --run --vis
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7863
diff
changeset
|
938 |
if getattr(Options.options, "visualize", False): |
9a34e12fab31
Automatically add the visualizer module to programs running with waf --run --vis
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7863
diff
changeset
|
939 |
program_obj = wutils.find_program(program_name, bld.env) |
9a34e12fab31
Automatically add the visualizer module to programs running with waf --run --vis
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7863
diff
changeset
|
940 |
program_obj.use.append('ns3-visualizer') |
4760
f774ff724ee4
Bug #609: --check and --regression should build only the required binaries
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4751
diff
changeset
|
941 |
for gen in bld.all_task_gen: |
11183
52ff59697ec9
bug 2002: Hardcoded include paths cause breakage
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11067
diff
changeset
|
942 |
if type(gen).__name__ in ['ns3header_taskgen', 'ns3privateheader_taskgen', 'ns3moduleheader_taskgen']: |
4760
f774ff724ee4
Bug #609: --check and --regression should build only the required binaries
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4751
diff
changeset
|
943 |
gen.post() |
7645
0baf0aea844a
suppress list of modules built when running program from waf
Tom Henderson <tomh@tomh.org>
parents:
7636
diff
changeset
|
944 |
bld.env['PRINT_BUILT_MODULES_AT_END'] = False |
3919
fd796ed5b166
Post-fix the last patch, to make sure invalid program names passed into --run trigger an informative error message as before.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3918
diff
changeset
|
945 |
|
5468
6eebad1fb54d
Bring back the --doxygen-no-build option from the dead.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
5463
diff
changeset
|
946 |
if Options.options.doxygen_no_build: |
6eebad1fb54d
Bring back the --doxygen-no-build option from the dead.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
5463
diff
changeset
|
947 |
_doxygen(bld) |
6eebad1fb54d
Bring back the --doxygen-no-build option from the dead.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
5463
diff
changeset
|
948 |
raise SystemExit(0) |
6eebad1fb54d
Bring back the --doxygen-no-build option from the dead.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
5463
diff
changeset
|
949 |
|
9239
02de8e19ce08
bug 1517: waf clean/distclean doesn't remove the doc/html directory
Tom Henderson <tomh@tomh.org>
parents:
9169
diff
changeset
|
950 |
def _cleandir(name): |
02de8e19ce08
bug 1517: waf clean/distclean doesn't remove the doc/html directory
Tom Henderson <tomh@tomh.org>
parents:
9169
diff
changeset
|
951 |
try: |
02de8e19ce08
bug 1517: waf clean/distclean doesn't remove the doc/html directory
Tom Henderson <tomh@tomh.org>
parents:
9169
diff
changeset
|
952 |
shutil.rmtree(name) |
02de8e19ce08
bug 1517: waf clean/distclean doesn't remove the doc/html directory
Tom Henderson <tomh@tomh.org>
parents:
9169
diff
changeset
|
953 |
except: |
02de8e19ce08
bug 1517: waf clean/distclean doesn't remove the doc/html directory
Tom Henderson <tomh@tomh.org>
parents:
9169
diff
changeset
|
954 |
pass |
7495
d87f20fd2421
waf1.6: remove code not needed, fix static build, cleanup
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7494
diff
changeset
|
955 |
|
9239
02de8e19ce08
bug 1517: waf clean/distclean doesn't remove the doc/html directory
Tom Henderson <tomh@tomh.org>
parents:
9169
diff
changeset
|
956 |
def _cleandocs(): |
02de8e19ce08
bug 1517: waf clean/distclean doesn't remove the doc/html directory
Tom Henderson <tomh@tomh.org>
parents:
9169
diff
changeset
|
957 |
_cleandir('doc/html') |
02de8e19ce08
bug 1517: waf clean/distclean doesn't remove the doc/html directory
Tom Henderson <tomh@tomh.org>
parents:
9169
diff
changeset
|
958 |
_cleandir('doc/manual/build') |
9909
e8571e4f5394
include tutorial-pt-br in documentation build
Tom Henderson <tomh@tomh.org>
parents:
9874
diff
changeset
|
959 |
_cleandir('doc/manual/source-temp') |
9239
02de8e19ce08
bug 1517: waf clean/distclean doesn't remove the doc/html directory
Tom Henderson <tomh@tomh.org>
parents:
9169
diff
changeset
|
960 |
_cleandir('doc/tutorial/build') |
9909
e8571e4f5394
include tutorial-pt-br in documentation build
Tom Henderson <tomh@tomh.org>
parents:
9874
diff
changeset
|
961 |
_cleandir('doc/tutorial-pt-br/build') |
9239
02de8e19ce08
bug 1517: waf clean/distclean doesn't remove the doc/html directory
Tom Henderson <tomh@tomh.org>
parents:
9169
diff
changeset
|
962 |
_cleandir('doc/models/build') |
02de8e19ce08
bug 1517: waf clean/distclean doesn't remove the doc/html directory
Tom Henderson <tomh@tomh.org>
parents:
9169
diff
changeset
|
963 |
_cleandir('doc/models/source-temp') |
02de8e19ce08
bug 1517: waf clean/distclean doesn't remove the doc/html directory
Tom Henderson <tomh@tomh.org>
parents:
9169
diff
changeset
|
964 |
|
02de8e19ce08
bug 1517: waf clean/distclean doesn't remove the doc/html directory
Tom Henderson <tomh@tomh.org>
parents:
9169
diff
changeset
|
965 |
# 'distclean' typically only cleans out build/ directory |
02de8e19ce08
bug 1517: waf clean/distclean doesn't remove the doc/html directory
Tom Henderson <tomh@tomh.org>
parents:
9169
diff
changeset
|
966 |
# Here we clean out any build or documentation artifacts not in build/ |
02de8e19ce08
bug 1517: waf clean/distclean doesn't remove the doc/html directory
Tom Henderson <tomh@tomh.org>
parents:
9169
diff
changeset
|
967 |
def distclean(ctx): |
02de8e19ce08
bug 1517: waf clean/distclean doesn't remove the doc/html directory
Tom Henderson <tomh@tomh.org>
parents:
9169
diff
changeset
|
968 |
_cleandocs() |
02de8e19ce08
bug 1517: waf clean/distclean doesn't remove the doc/html directory
Tom Henderson <tomh@tomh.org>
parents:
9169
diff
changeset
|
969 |
# Now call waf's normal distclean |
02de8e19ce08
bug 1517: waf clean/distclean doesn't remove the doc/html directory
Tom Henderson <tomh@tomh.org>
parents:
9169
diff
changeset
|
970 |
Scripting.distclean(ctx) |
7495
d87f20fd2421
waf1.6: remove code not needed, fix static build, cleanup
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7494
diff
changeset
|
971 |
|
4326
179f86838e62
Upgrade to WAF 1.5.4
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4202
diff
changeset
|
972 |
def shutdown(ctx): |
179f86838e62
Upgrade to WAF 1.5.4
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4202
diff
changeset
|
973 |
bld = wutils.bld |
4328 | 974 |
if wutils.bld is None: |
975 |
return |
|
4326
179f86838e62
Upgrade to WAF 1.5.4
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4202
diff
changeset
|
976 |
env = bld.env |
179f86838e62
Upgrade to WAF 1.5.4
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4202
diff
changeset
|
977 |
|
7636
58181e75d0f0
bug 1305 - do not list modules when exiting waf shell
Mitch Watrous <watrous@u.washington.edu>
parents:
7593
diff
changeset
|
978 |
# Only print the lists if a build was done. |
58181e75d0f0
bug 1305 - do not list modules when exiting waf shell
Mitch Watrous <watrous@u.washington.edu>
parents:
7593
diff
changeset
|
979 |
if (env['PRINT_BUILT_MODULES_AT_END']): |
7100
c3796788794a
Make built modules list not be printed for clean and distclean
Mitch Watrous <watrous@u.washington.edu>
parents:
7097
diff
changeset
|
980 |
|
7291
d39c09dbc3d9
Make emu and template modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7131
diff
changeset
|
981 |
# Print the list of built modules. |
11634
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11544
diff
changeset
|
982 |
print() |
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11544
diff
changeset
|
983 |
print('Modules built:') |
7863
5a610391f3f1
Bug 1392 - Modules built report does not clarify C++ or Python
Mitch Watrous <watrous@u.washington.edu>
parents:
7821
diff
changeset
|
984 |
names_without_prefix = [] |
5a610391f3f1
Bug 1392 - Modules built report does not clarify C++ or Python
Mitch Watrous <watrous@u.washington.edu>
parents:
7821
diff
changeset
|
985 |
for name in env['NS3_ENABLED_MODULES']: |
5a610391f3f1
Bug 1392 - Modules built report does not clarify C++ or Python
Mitch Watrous <watrous@u.washington.edu>
parents:
7821
diff
changeset
|
986 |
name1 = name[len('ns3-'):] |
5a610391f3f1
Bug 1392 - Modules built report does not clarify C++ or Python
Mitch Watrous <watrous@u.washington.edu>
parents:
7821
diff
changeset
|
987 |
if name not in env.MODULAR_BINDINGS_MODULES: |
5a610391f3f1
Bug 1392 - Modules built report does not clarify C++ or Python
Mitch Watrous <watrous@u.washington.edu>
parents:
7821
diff
changeset
|
988 |
name1 += " (no Python)" |
5a610391f3f1
Bug 1392 - Modules built report does not clarify C++ or Python
Mitch Watrous <watrous@u.washington.edu>
parents:
7821
diff
changeset
|
989 |
names_without_prefix.append(name1) |
7293
0f574c532cee
Make test module not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7291
diff
changeset
|
990 |
print_module_names(names_without_prefix) |
11634
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11544
diff
changeset
|
991 |
print() |
7291
d39c09dbc3d9
Make emu and template modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7131
diff
changeset
|
992 |
|
d39c09dbc3d9
Make emu and template modules not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7131
diff
changeset
|
993 |
# Print the list of enabled modules that were not built. |
7293
0f574c532cee
Make test module not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7291
diff
changeset
|
994 |
if env['MODULES_NOT_BUILT']: |
11634
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11544
diff
changeset
|
995 |
print('Modules not built (see ns-3 tutorial for explanation):') |
7293
0f574c532cee
Make test module not be built if not appropriate
Mitch Watrous <watrous@u.washington.edu>
parents:
7291
diff
changeset
|
996 |
print_module_names(env['MODULES_NOT_BUILT']) |
11634
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11544
diff
changeset
|
997 |
print() |
7066
948694386867
Print modules built list at end of waf build
Mitch Watrous <watrous@u.washington.edu>
parents:
7062
diff
changeset
|
998 |
|
7636
58181e75d0f0
bug 1305 - do not list modules when exiting waf shell
Mitch Watrous <watrous@u.washington.edu>
parents:
7593
diff
changeset
|
999 |
# Set this so that the lists won't be printed until the next |
58181e75d0f0
bug 1305 - do not list modules when exiting waf shell
Mitch Watrous <watrous@u.washington.edu>
parents:
7593
diff
changeset
|
1000 |
# build is done. |
58181e75d0f0
bug 1305 - do not list modules when exiting waf shell
Mitch Watrous <watrous@u.washington.edu>
parents:
7593
diff
changeset
|
1001 |
bld.env['PRINT_BUILT_MODULES_AT_END'] = False |
58181e75d0f0
bug 1305 - do not list modules when exiting waf shell
Mitch Watrous <watrous@u.washington.edu>
parents:
7593
diff
changeset
|
1002 |
|
7094
f0748224dd68
Write a status file during waf build step
Mitch Watrous <watrous@u.washington.edu>
parents:
7088
diff
changeset
|
1003 |
# Write the build status file. |
7495
d87f20fd2421
waf1.6: remove code not needed, fix static build, cleanup
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7494
diff
changeset
|
1004 |
build_status_file = os.path.join(bld.out_dir, 'build-status.py') |
7094
f0748224dd68
Write a status file during waf build step
Mitch Watrous <watrous@u.washington.edu>
parents:
7088
diff
changeset
|
1005 |
out = open(build_status_file, 'w') |
f0748224dd68
Write a status file during waf build step
Mitch Watrous <watrous@u.washington.edu>
parents:
7088
diff
changeset
|
1006 |
out.write('#! /usr/bin/env python\n') |
f0748224dd68
Write a status file during waf build step
Mitch Watrous <watrous@u.washington.edu>
parents:
7088
diff
changeset
|
1007 |
out.write('\n') |
f0748224dd68
Write a status file during waf build step
Mitch Watrous <watrous@u.washington.edu>
parents:
7088
diff
changeset
|
1008 |
out.write('# Programs that are runnable.\n') |
7096
7357a40d2dde
Make test.py not run examples that are not runnable
Mitch Watrous <watrous@u.washington.edu>
parents:
7094
diff
changeset
|
1009 |
out.write('ns3_runnable_programs = ' + str(env['NS3_RUNNABLE_PROGRAMS']) + '\n') |
7094
f0748224dd68
Write a status file during waf build step
Mitch Watrous <watrous@u.washington.edu>
parents:
7088
diff
changeset
|
1010 |
out.write('\n') |
f0748224dd68
Write a status file during waf build step
Mitch Watrous <watrous@u.washington.edu>
parents:
7088
diff
changeset
|
1011 |
out.write('# Scripts that are runnable.\n') |
7096
7357a40d2dde
Make test.py not run examples that are not runnable
Mitch Watrous <watrous@u.washington.edu>
parents:
7094
diff
changeset
|
1012 |
out.write('ns3_runnable_scripts = ' + str(env['NS3_RUNNABLE_SCRIPTS']) + '\n') |
7094
f0748224dd68
Write a status file during waf build step
Mitch Watrous <watrous@u.washington.edu>
parents:
7088
diff
changeset
|
1013 |
out.write('\n') |
f0748224dd68
Write a status file during waf build step
Mitch Watrous <watrous@u.washington.edu>
parents:
7088
diff
changeset
|
1014 |
out.close() |
f0748224dd68
Write a status file during waf build step
Mitch Watrous <watrous@u.washington.edu>
parents:
7088
diff
changeset
|
1015 |
|
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4029
diff
changeset
|
1016 |
if Options.options.lcov_report: |
7493
3bbefa91e694
Fix the --lcov-report option
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7492
diff
changeset
|
1017 |
lcov_report(bld) |
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
1018 |
|
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4029
diff
changeset
|
1019 |
if Options.options.run: |
6676
8a57344a8d09
Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6670
diff
changeset
|
1020 |
wutils.run_program(Options.options.run, env, wutils.get_command_template(env), |
8a57344a8d09
Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6670
diff
changeset
|
1021 |
visualize=Options.options.visualize) |
935
53e1e53c373f
WAF: add a --command-template option to e.g. allow running programs with valgrind, gdb, etc.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
934
diff
changeset
|
1022 |
raise SystemExit(0) |
53e1e53c373f
WAF: add a --command-template option to e.g. allow running programs with valgrind, gdb, etc.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
934
diff
changeset
|
1023 |
|
4064
10222f483860
Upgrade to new WAF, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4029
diff
changeset
|
1024 |
if Options.options.pyrun: |
6676
8a57344a8d09
Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6670
diff
changeset
|
1025 |
wutils.run_python_program(Options.options.pyrun, env, |
8a57344a8d09
Codereview Issue 2692041: Add pyviz module
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6670
diff
changeset
|
1026 |
visualize=Options.options.visualize) |
3419
8d3f5c0f55fa
Add WAF option --pyrun, to make it easier to run Python programs.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3418
diff
changeset
|
1027 |
raise SystemExit(0) |
8d3f5c0f55fa
Add WAF option --pyrun, to make it easier to run Python programs.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3418
diff
changeset
|
1028 |
|
4326
179f86838e62
Upgrade to WAF 1.5.4
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4202
diff
changeset
|
1029 |
if Options.options.shell: |
7496
ce1ec79d488c
waf1.6: make the all_modules in src/wscript be automatically discovered
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7495
diff
changeset
|
1030 |
raise WafError("Please run `./waf shell' now, instead of `./waf --shell'") |
4326
179f86838e62
Upgrade to WAF 1.5.4
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4202
diff
changeset
|
1031 |
|
5361
e8989b44bffb
Doxygen and wscript messages point to test.py
Craig Dowell <craigdo@ee.washington.edu>
parents:
5252
diff
changeset
|
1032 |
if Options.options.check: |
7496
ce1ec79d488c
waf1.6: make the all_modules in src/wscript be automatically discovered
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7495
diff
changeset
|
1033 |
raise WafError("Please run `./test.py' now, instead of `./waf --check'") |
4326
179f86838e62
Upgrade to WAF 1.5.4
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4202
diff
changeset
|
1034 |
|
179f86838e62
Upgrade to WAF 1.5.4
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4202
diff
changeset
|
1035 |
check_shell(bld) |
179f86838e62
Upgrade to WAF 1.5.4
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4202
diff
changeset
|
1036 |
|
7495
d87f20fd2421
waf1.6: remove code not needed, fix static build, cleanup
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7494
diff
changeset
|
1037 |
|
7510
aabd5141cd16
Fix waf check
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7496
diff
changeset
|
1038 |
|
aabd5141cd16
Fix waf check
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7496
diff
changeset
|
1039 |
class CheckContext(Context.Context): |
5372
716ca842b52c
convince waf to run test.py on check command
Craig Dowell <craigdo@ee.washington.edu>
parents:
5369
diff
changeset
|
1040 |
"""run the equivalent of the old ns-3 unit tests using test.py""" |
7510
aabd5141cd16
Fix waf check
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7496
diff
changeset
|
1041 |
cmd = 'check' |
aabd5141cd16
Fix waf check
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7496
diff
changeset
|
1042 |
def execute(self): |
aabd5141cd16
Fix waf check
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7496
diff
changeset
|
1043 |
# first we execute the build |
11634
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11544
diff
changeset
|
1044 |
bld = Context.create_context("build") |
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11544
diff
changeset
|
1045 |
bld.options = Options.options # provided for convenience |
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11544
diff
changeset
|
1046 |
bld.cmd = "build" |
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11544
diff
changeset
|
1047 |
bld.execute() |
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11544
diff
changeset
|
1048 |
|
7510
aabd5141cd16
Fix waf check
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7496
diff
changeset
|
1049 |
wutils.bld = bld |
aabd5141cd16
Fix waf check
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7496
diff
changeset
|
1050 |
wutils.run_python_program("test.py -n -c core", bld.env) |
4531
14a102415139
Run unit tests as indenpendent WAF tasks
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4450
diff
changeset
|
1051 |
|
7495
d87f20fd2421
waf1.6: remove code not needed, fix static build, cleanup
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7494
diff
changeset
|
1052 |
|
4531
14a102415139
Run unit tests as indenpendent WAF tasks
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4450
diff
changeset
|
1053 |
class print_introspected_doxygen_task(Task.TaskBase): |
9277
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9261
diff
changeset
|
1054 |
after = 'cxx link' |
4531
14a102415139
Run unit tests as indenpendent WAF tasks
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4450
diff
changeset
|
1055 |
color = 'BLUE' |
14a102415139
Run unit tests as indenpendent WAF tasks
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4450
diff
changeset
|
1056 |
|
14a102415139
Run unit tests as indenpendent WAF tasks
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4450
diff
changeset
|
1057 |
def __init__(self, bld): |
14a102415139
Run unit tests as indenpendent WAF tasks
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4450
diff
changeset
|
1058 |
self.bld = bld |
14a102415139
Run unit tests as indenpendent WAF tasks
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4450
diff
changeset
|
1059 |
super(print_introspected_doxygen_task, self).__init__(generator=self) |
14a102415139
Run unit tests as indenpendent WAF tasks
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4450
diff
changeset
|
1060 |
|
14a102415139
Run unit tests as indenpendent WAF tasks
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4450
diff
changeset
|
1061 |
def __str__(self): |
14a102415139
Run unit tests as indenpendent WAF tasks
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4450
diff
changeset
|
1062 |
return 'print-introspected-doxygen\n' |
14a102415139
Run unit tests as indenpendent WAF tasks
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4450
diff
changeset
|
1063 |
|
14a102415139
Run unit tests as indenpendent WAF tasks
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4450
diff
changeset
|
1064 |
def runnable_status(self): |
14a102415139
Run unit tests as indenpendent WAF tasks
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4450
diff
changeset
|
1065 |
return Task.RUN_ME |
1540
fd4e69513199
Now run doxygen again before the build, but the doc/trace-source-list.h is generated during waf check; make doxygen less verbose, and give a warning when doc/trace-source-list.h is missing.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1536
diff
changeset
|
1066 |
|
4531
14a102415139
Run unit tests as indenpendent WAF tasks
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4450
diff
changeset
|
1067 |
def run(self): |
14a102415139
Run unit tests as indenpendent WAF tasks
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4450
diff
changeset
|
1068 |
## generate the trace sources list docs |
14a102415139
Run unit tests as indenpendent WAF tasks
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4450
diff
changeset
|
1069 |
env = wutils.bld.env |
14a102415139
Run unit tests as indenpendent WAF tasks
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4450
diff
changeset
|
1070 |
proc_env = wutils.get_proc_env() |
14a102415139
Run unit tests as indenpendent WAF tasks
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4450
diff
changeset
|
1071 |
try: |
14a102415139
Run unit tests as indenpendent WAF tasks
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4450
diff
changeset
|
1072 |
program_obj = wutils.find_program('print-introspected-doxygen', env) |
14a102415139
Run unit tests as indenpendent WAF tasks
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4450
diff
changeset
|
1073 |
except ValueError: # could happen if print-introspected-doxygen is |
14a102415139
Run unit tests as indenpendent WAF tasks
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4450
diff
changeset
|
1074 |
# not built because of waf configure |
14a102415139
Run unit tests as indenpendent WAF tasks
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4450
diff
changeset
|
1075 |
# --enable-modules=xxx |
14a102415139
Run unit tests as indenpendent WAF tasks
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4450
diff
changeset
|
1076 |
pass |
14a102415139
Run unit tests as indenpendent WAF tasks
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4450
diff
changeset
|
1077 |
else: |
9277
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9261
diff
changeset
|
1078 |
prog = program_obj.path.find_or_declare(ccroot.get_target_name(program_obj)).get_bld().abspath(env) |
7527
6e8c5ebcc1ae
Make waf create text file with introspected information
Mitch Watrous <watrous@u.washington.edu>
parents:
7524
diff
changeset
|
1079 |
|
7528
95f7f32d51d0
Fix tabbing for code that creates introspected text files
Mitch Watrous <watrous@u.washington.edu>
parents:
7527
diff
changeset
|
1080 |
# Create a header file with the introspected information. |
95f7f32d51d0
Fix tabbing for code that creates introspected text files
Mitch Watrous <watrous@u.washington.edu>
parents:
7527
diff
changeset
|
1081 |
doxygen_out = open(os.path.join('doc', 'introspected-doxygen.h'), 'w') |
95f7f32d51d0
Fix tabbing for code that creates introspected text files
Mitch Watrous <watrous@u.washington.edu>
parents:
7527
diff
changeset
|
1082 |
if subprocess.Popen([prog], stdout=doxygen_out, env=proc_env).wait(): |
95f7f32d51d0
Fix tabbing for code that creates introspected text files
Mitch Watrous <watrous@u.washington.edu>
parents:
7527
diff
changeset
|
1083 |
raise SystemExit(1) |
95f7f32d51d0
Fix tabbing for code that creates introspected text files
Mitch Watrous <watrous@u.washington.edu>
parents:
7527
diff
changeset
|
1084 |
doxygen_out.close() |
95f7f32d51d0
Fix tabbing for code that creates introspected text files
Mitch Watrous <watrous@u.washington.edu>
parents:
7527
diff
changeset
|
1085 |
|
95f7f32d51d0
Fix tabbing for code that creates introspected text files
Mitch Watrous <watrous@u.washington.edu>
parents:
7527
diff
changeset
|
1086 |
# Create a text file with the introspected information. |
95f7f32d51d0
Fix tabbing for code that creates introspected text files
Mitch Watrous <watrous@u.washington.edu>
parents:
7527
diff
changeset
|
1087 |
text_out = open(os.path.join('doc', 'ns3-object.txt'), 'w') |
95f7f32d51d0
Fix tabbing for code that creates introspected text files
Mitch Watrous <watrous@u.washington.edu>
parents:
7527
diff
changeset
|
1088 |
if subprocess.Popen([prog, '--output-text'], stdout=text_out, env=proc_env).wait(): |
95f7f32d51d0
Fix tabbing for code that creates introspected text files
Mitch Watrous <watrous@u.washington.edu>
parents:
7527
diff
changeset
|
1089 |
raise SystemExit(1) |
95f7f32d51d0
Fix tabbing for code that creates introspected text files
Mitch Watrous <watrous@u.washington.edu>
parents:
7527
diff
changeset
|
1090 |
text_out.close() |
1536
23593050aa96
Run the program print-trace-sources to generate doc/trace-source-list.h when generating docs. As a side effect, --doxygen is now has to be processed at the end of the build.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1532
diff
changeset
|
1091 |
|
4531
14a102415139
Run unit tests as indenpendent WAF tasks
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4450
diff
changeset
|
1092 |
class run_python_unit_tests_task(Task.TaskBase): |
9277
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9261
diff
changeset
|
1093 |
after = 'cxx link' |
4531
14a102415139
Run unit tests as indenpendent WAF tasks
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4450
diff
changeset
|
1094 |
color = 'BLUE' |
14a102415139
Run unit tests as indenpendent WAF tasks
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4450
diff
changeset
|
1095 |
|
14a102415139
Run unit tests as indenpendent WAF tasks
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4450
diff
changeset
|
1096 |
def __init__(self, bld): |
14a102415139
Run unit tests as indenpendent WAF tasks
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4450
diff
changeset
|
1097 |
self.bld = bld |
14a102415139
Run unit tests as indenpendent WAF tasks
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4450
diff
changeset
|
1098 |
super(run_python_unit_tests_task, self).__init__(generator=self) |
14a102415139
Run unit tests as indenpendent WAF tasks
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4450
diff
changeset
|
1099 |
|
14a102415139
Run unit tests as indenpendent WAF tasks
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4450
diff
changeset
|
1100 |
def __str__(self): |
14a102415139
Run unit tests as indenpendent WAF tasks
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4450
diff
changeset
|
1101 |
return 'run-python-unit-tests\n' |
14a102415139
Run unit tests as indenpendent WAF tasks
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4450
diff
changeset
|
1102 |
|
14a102415139
Run unit tests as indenpendent WAF tasks
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4450
diff
changeset
|
1103 |
def runnable_status(self): |
14a102415139
Run unit tests as indenpendent WAF tasks
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4450
diff
changeset
|
1104 |
return Task.RUN_ME |
14a102415139
Run unit tests as indenpendent WAF tasks
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4450
diff
changeset
|
1105 |
|
14a102415139
Run unit tests as indenpendent WAF tasks
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4450
diff
changeset
|
1106 |
def run(self): |
14a102415139
Run unit tests as indenpendent WAF tasks
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4450
diff
changeset
|
1107 |
proc_env = wutils.get_proc_env() |
14a102415139
Run unit tests as indenpendent WAF tasks
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4450
diff
changeset
|
1108 |
wutils.run_argv([self.bld.env['PYTHON'], os.path.join("..", "utils", "python-unit-tests.py")], |
14a102415139
Run unit tests as indenpendent WAF tasks
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4450
diff
changeset
|
1109 |
self.bld.env, proc_env, force_no_valgrind=True) |
3408
2cc40b3e4fa5
python bindings
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
3331
diff
changeset
|
1110 |
|
4326
179f86838e62
Upgrade to WAF 1.5.4
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4202
diff
changeset
|
1111 |
def check_shell(bld): |
5975
c85cb9b073a0
comparing with http://code.nsnam.org/ns-3-dev
Craig Dowell <craigdo@ee.washington.edu>
parents:
5848
diff
changeset
|
1112 |
if ('NS3_MODULE_PATH' not in os.environ) or ('NS3_EXECUTABLE_PATH' not in os.environ): |
1016
58a56b52a08b
Detect when running waf --shell with stale environment variables and give an error when it happens.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1015
diff
changeset
|
1113 |
return |
4326
179f86838e62
Upgrade to WAF 1.5.4
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4202
diff
changeset
|
1114 |
env = bld.env |
1016
58a56b52a08b
Detect when running waf --shell with stale environment variables and give an error when it happens.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1015
diff
changeset
|
1115 |
correct_modpath = os.pathsep.join(env['NS3_MODULE_PATH']) |
58a56b52a08b
Detect when running waf --shell with stale environment variables and give an error when it happens.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1015
diff
changeset
|
1116 |
found_modpath = os.environ['NS3_MODULE_PATH'] |
5975
c85cb9b073a0
comparing with http://code.nsnam.org/ns-3-dev
Craig Dowell <craigdo@ee.washington.edu>
parents:
5848
diff
changeset
|
1117 |
correct_execpath = os.pathsep.join(env['NS3_EXECUTABLE_PATH']) |
c85cb9b073a0
comparing with http://code.nsnam.org/ns-3-dev
Craig Dowell <craigdo@ee.washington.edu>
parents:
5848
diff
changeset
|
1118 |
found_execpath = os.environ['NS3_EXECUTABLE_PATH'] |
c85cb9b073a0
comparing with http://code.nsnam.org/ns-3-dev
Craig Dowell <craigdo@ee.washington.edu>
parents:
5848
diff
changeset
|
1119 |
if (found_modpath != correct_modpath) or (correct_execpath != found_execpath): |
4326
179f86838e62
Upgrade to WAF 1.5.4
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4202
diff
changeset
|
1120 |
msg = ("Detected shell (./waf shell) with incorrect configuration\n" |
1016
58a56b52a08b
Detect when running waf --shell with stale environment variables and give an error when it happens.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1015
diff
changeset
|
1121 |
"=========================================================\n" |
58a56b52a08b
Detect when running waf --shell with stale environment variables and give an error when it happens.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1015
diff
changeset
|
1122 |
"Possible reasons for this problem:\n" |
58a56b52a08b
Detect when running waf --shell with stale environment variables and give an error when it happens.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1015
diff
changeset
|
1123 |
" 1. You switched to another ns-3 tree from inside this shell\n" |
58a56b52a08b
Detect when running waf --shell with stale environment variables and give an error when it happens.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1015
diff
changeset
|
1124 |
" 2. You switched ns-3 debug level (waf configure --debug)\n" |
58a56b52a08b
Detect when running waf --shell with stale environment variables and give an error when it happens.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1015
diff
changeset
|
1125 |
" 3. You modified the list of built ns-3 modules\n" |
58a56b52a08b
Detect when running waf --shell with stale environment variables and give an error when it happens.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1015
diff
changeset
|
1126 |
"You should correct this situation before running any program. Possible solutions:\n" |
58a56b52a08b
Detect when running waf --shell with stale environment variables and give an error when it happens.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1015
diff
changeset
|
1127 |
" 1. Exit this shell, and start a new one\n" |
58a56b52a08b
Detect when running waf --shell with stale environment variables and give an error when it happens.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1015
diff
changeset
|
1128 |
" 2. Run a new nested shell") |
7496
ce1ec79d488c
waf1.6: make the all_modules in src/wscript be automatically discovered
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7495
diff
changeset
|
1129 |
raise WafError(msg) |
1016
58a56b52a08b
Detect when running waf --shell with stale environment variables and give an error when it happens.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1015
diff
changeset
|
1130 |
|
672
184d5a505279
WAF: remove the rpath options, and add --run and --shell as replacements; additionally, the new options "should" work on Mac OS X, as well as linux2 and win32.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
671
diff
changeset
|
1131 |
|
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
1132 |
class Ns3ShellContext(Context.Context): |
4326
179f86838e62
Upgrade to WAF 1.5.4
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4202
diff
changeset
|
1133 |
"""run a shell with an environment suitably modified to run locally built programs""" |
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
1134 |
cmd = 'shell' |
11634
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11544
diff
changeset
|
1135 |
|
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
1136 |
def execute(self): |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
1137 |
# first we execute the build |
11634
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11544
diff
changeset
|
1138 |
bld = Context.create_context("build") |
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11544
diff
changeset
|
1139 |
bld.options = Options.options # provided for convenience |
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11544
diff
changeset
|
1140 |
bld.cmd = "build" |
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11544
diff
changeset
|
1141 |
bld.execute() |
4326
179f86838e62
Upgrade to WAF 1.5.4
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4202
diff
changeset
|
1142 |
|
7636
58181e75d0f0
bug 1305 - do not list modules when exiting waf shell
Mitch Watrous <watrous@u.washington.edu>
parents:
7593
diff
changeset
|
1143 |
# Set this so that the lists won't be printed when the user |
58181e75d0f0
bug 1305 - do not list modules when exiting waf shell
Mitch Watrous <watrous@u.washington.edu>
parents:
7593
diff
changeset
|
1144 |
# exits the shell. |
58181e75d0f0
bug 1305 - do not list modules when exiting waf shell
Mitch Watrous <watrous@u.washington.edu>
parents:
7593
diff
changeset
|
1145 |
bld.env['PRINT_BUILT_MODULES_AT_END'] = False |
11634
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11544
diff
changeset
|
1146 |
|
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
1147 |
if sys.platform == 'win32': |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
1148 |
shell = os.environ.get("COMSPEC", "cmd.exe") |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
1149 |
else: |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
1150 |
shell = os.environ.get("SHELL", "/bin/sh") |
1016
58a56b52a08b
Detect when running waf --shell with stale environment variables and give an error when it happens.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1015
diff
changeset
|
1151 |
|
7487
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
1152 |
env = bld.env |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
1153 |
os_env = { |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
1154 |
'NS3_MODULE_PATH': os.pathsep.join(env['NS3_MODULE_PATH']), |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
1155 |
'NS3_EXECUTABLE_PATH': os.pathsep.join(env['NS3_EXECUTABLE_PATH']), |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
1156 |
} |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
1157 |
wutils.run_argv([shell], env, os_env) |
82cd20da9650
Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7463
diff
changeset
|
1158 |
|
672
184d5a505279
WAF: remove the rpath options, and add --run and --shell as replacements; additionally, the new options "should" work on Mac OS X, as well as linux2 and win32.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
671
diff
changeset
|
1159 |
|
5468
6eebad1fb54d
Bring back the --doxygen-no-build option from the dead.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
5463
diff
changeset
|
1160 |
def _doxygen(bld): |
5392
80b9ae7b5e26
remind waf how to generate introspected doxygen
Craig Dowell <craigdo@ee.washington.edu>
parents:
5372
diff
changeset
|
1161 |
env = wutils.bld.env |
80b9ae7b5e26
remind waf how to generate introspected doxygen
Craig Dowell <craigdo@ee.washington.edu>
parents:
5372
diff
changeset
|
1162 |
proc_env = wutils.get_proc_env() |
1536
23593050aa96
Run the program print-trace-sources to generate doc/trace-source-list.h when generating docs. As a side effect, --doxygen is now has to be processed at the end of the build.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1532
diff
changeset
|
1163 |
|
6669
dbf2efe4b762
Give a more user-friendly error message when doxygen is not found
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
1164 |
if not env['DOXYGEN']: |
dbf2efe4b762
Give a more user-friendly error message when doxygen is not found
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
1165 |
Logs.error("waf configure did not detect doxygen in the system -> cannot build api docs.") |
dbf2efe4b762
Give a more user-friendly error message when doxygen is not found
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
1166 |
raise SystemExit(1) |
dbf2efe4b762
Give a more user-friendly error message when doxygen is not found
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
1167 |
return |
dbf2efe4b762
Give a more user-friendly error message when doxygen is not found
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6647
diff
changeset
|
1168 |
|
5392
80b9ae7b5e26
remind waf how to generate introspected doxygen
Craig Dowell <craigdo@ee.washington.edu>
parents:
5372
diff
changeset
|
1169 |
try: |
80b9ae7b5e26
remind waf how to generate introspected doxygen
Craig Dowell <craigdo@ee.washington.edu>
parents:
5372
diff
changeset
|
1170 |
program_obj = wutils.find_program('print-introspected-doxygen', env) |
80b9ae7b5e26
remind waf how to generate introspected doxygen
Craig Dowell <craigdo@ee.washington.edu>
parents:
5372
diff
changeset
|
1171 |
except ValueError: |
80b9ae7b5e26
remind waf how to generate introspected doxygen
Craig Dowell <craigdo@ee.washington.edu>
parents:
5372
diff
changeset
|
1172 |
Logs.warn("print-introspected-doxygen does not exist") |
80b9ae7b5e26
remind waf how to generate introspected doxygen
Craig Dowell <craigdo@ee.washington.edu>
parents:
5372
diff
changeset
|
1173 |
raise SystemExit(1) |
80b9ae7b5e26
remind waf how to generate introspected doxygen
Craig Dowell <craigdo@ee.washington.edu>
parents:
5372
diff
changeset
|
1174 |
return |
80b9ae7b5e26
remind waf how to generate introspected doxygen
Craig Dowell <craigdo@ee.washington.edu>
parents:
5372
diff
changeset
|
1175 |
|
9277
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9261
diff
changeset
|
1176 |
prog = program_obj.path.find_or_declare(program_obj.target).get_bld().abspath() |
6254
e794047931fb
Make --doxygen-no-build check if print-introspected-doxygen has been built, error out if not. Fixes #884
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6214
diff
changeset
|
1177 |
|
e794047931fb
Make --doxygen-no-build check if print-introspected-doxygen has been built, error out if not. Fixes #884
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6214
diff
changeset
|
1178 |
if not os.path.exists(prog): |
e794047931fb
Make --doxygen-no-build check if print-introspected-doxygen has been built, error out if not. Fixes #884
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6214
diff
changeset
|
1179 |
Logs.error("print-introspected-doxygen has not been built yet." |
e794047931fb
Make --doxygen-no-build check if print-introspected-doxygen has been built, error out if not. Fixes #884
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6214
diff
changeset
|
1180 |
" You need to build ns-3 at least once before " |
e794047931fb
Make --doxygen-no-build check if print-introspected-doxygen has been built, error out if not. Fixes #884
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6214
diff
changeset
|
1181 |
"generating doxygen docs...") |
e794047931fb
Make --doxygen-no-build check if print-introspected-doxygen has been built, error out if not. Fixes #884
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6214
diff
changeset
|
1182 |
raise SystemExit(1) |
e794047931fb
Make --doxygen-no-build check if print-introspected-doxygen has been built, error out if not. Fixes #884
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
6214
diff
changeset
|
1183 |
|
7527
6e8c5ebcc1ae
Make waf create text file with introspected information
Mitch Watrous <watrous@u.washington.edu>
parents:
7524
diff
changeset
|
1184 |
# Create a header file with the introspected information. |
6e8c5ebcc1ae
Make waf create text file with introspected information
Mitch Watrous <watrous@u.washington.edu>
parents:
7524
diff
changeset
|
1185 |
doxygen_out = open(os.path.join('doc', 'introspected-doxygen.h'), 'w') |
6e8c5ebcc1ae
Make waf create text file with introspected information
Mitch Watrous <watrous@u.washington.edu>
parents:
7524
diff
changeset
|
1186 |
if subprocess.Popen([prog], stdout=doxygen_out, env=proc_env).wait(): |
6e8c5ebcc1ae
Make waf create text file with introspected information
Mitch Watrous <watrous@u.washington.edu>
parents:
7524
diff
changeset
|
1187 |
raise SystemExit(1) |
6e8c5ebcc1ae
Make waf create text file with introspected information
Mitch Watrous <watrous@u.washington.edu>
parents:
7524
diff
changeset
|
1188 |
doxygen_out.close() |
5392
80b9ae7b5e26
remind waf how to generate introspected doxygen
Craig Dowell <craigdo@ee.washington.edu>
parents:
5372
diff
changeset
|
1189 |
|
7527
6e8c5ebcc1ae
Make waf create text file with introspected information
Mitch Watrous <watrous@u.washington.edu>
parents:
7524
diff
changeset
|
1190 |
# Create a text file with the introspected information. |
6e8c5ebcc1ae
Make waf create text file with introspected information
Mitch Watrous <watrous@u.washington.edu>
parents:
7524
diff
changeset
|
1191 |
text_out = open(os.path.join('doc', 'ns3-object.txt'), 'w') |
6e8c5ebcc1ae
Make waf create text file with introspected information
Mitch Watrous <watrous@u.washington.edu>
parents:
7524
diff
changeset
|
1192 |
if subprocess.Popen([prog, '--output-text'], stdout=text_out, env=proc_env).wait(): |
5392
80b9ae7b5e26
remind waf how to generate introspected doxygen
Craig Dowell <craigdo@ee.washington.edu>
parents:
5372
diff
changeset
|
1193 |
raise SystemExit(1) |
7527
6e8c5ebcc1ae
Make waf create text file with introspected information
Mitch Watrous <watrous@u.washington.edu>
parents:
7524
diff
changeset
|
1194 |
text_out.close() |
5392
80b9ae7b5e26
remind waf how to generate introspected doxygen
Craig Dowell <craigdo@ee.washington.edu>
parents:
5372
diff
changeset
|
1195 |
|
8963
97f93bf462bd
Call get_version.sh early, add option, env for public urls.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
8951
diff
changeset
|
1196 |
_getVersion() |
671
4bec4600950c
WAF: cleanup code by putting lcov and doxygen handling into their own separate functions
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
649
diff
changeset
|
1197 |
doxygen_config = os.path.join('doc', 'doxygen.conf') |
11467
51a6ce206f8b
Fix doxygen command after update to waf 1.8 in r11458, 126b15bc1efc
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11457
diff
changeset
|
1198 |
if subprocess.Popen(env['DOXYGEN'] + [doxygen_config]).wait(): |
8967
3594c3c9f942
Log script errors, fix bogus copy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
8963
diff
changeset
|
1199 |
Logs.error("Doxygen build returned an error.") |
671
4bec4600950c
WAF: cleanup code by putting lcov and doxygen handling into their own separate functions
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
649
diff
changeset
|
1200 |
raise SystemExit(1) |
4bec4600950c
WAF: cleanup code by putting lcov and doxygen handling into their own separate functions
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
649
diff
changeset
|
1201 |
|
7518
91f889c8fc43
Possibly fix the waf doxygen command
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7510
diff
changeset
|
1202 |
|
8944
623ce21e27c2
Menu bar in doc web pages; build html, singlehtml, pdf; automatic version string in docs; fix singlehtml title.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
8939
diff
changeset
|
1203 |
def _getVersion(): |
623ce21e27c2
Menu bar in doc web pages; build html, singlehtml, pdf; automatic version string in docs; fix singlehtml title.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
8939
diff
changeset
|
1204 |
"""update the ns3_version.js file, when building documentation""" |
623ce21e27c2
Menu bar in doc web pages; build html, singlehtml, pdf; automatic version string in docs; fix singlehtml title.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
8939
diff
changeset
|
1205 |
|
8963
97f93bf462bd
Call get_version.sh early, add option, env for public urls.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
8951
diff
changeset
|
1206 |
prog = "doc/ns3_html_theme/get_version.sh" |
97f93bf462bd
Call get_version.sh early, add option, env for public urls.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
8951
diff
changeset
|
1207 |
if subprocess.Popen([prog]).wait() : |
8967
3594c3c9f942
Log script errors, fix bogus copy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
8963
diff
changeset
|
1208 |
Logs.error(prog + " returned an error") |
8944
623ce21e27c2
Menu bar in doc web pages; build html, singlehtml, pdf; automatic version string in docs; fix singlehtml title.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
8939
diff
changeset
|
1209 |
raise SystemExit(1) |
623ce21e27c2
Menu bar in doc web pages; build html, singlehtml, pdf; automatic version string in docs; fix singlehtml title.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
8939
diff
changeset
|
1210 |
|
7532
0b875c99c8b4
Fix copy-paste typo
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7528
diff
changeset
|
1211 |
class Ns3DoxygenContext(Context.Context): |
5468
6eebad1fb54d
Bring back the --doxygen-no-build option from the dead.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
5463
diff
changeset
|
1212 |
"""do a full build, generate the introspected doxygen and then the doxygen""" |
7518
91f889c8fc43
Possibly fix the waf doxygen command
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7510
diff
changeset
|
1213 |
cmd = 'doxygen' |
91f889c8fc43
Possibly fix the waf doxygen command
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7510
diff
changeset
|
1214 |
def execute(self): |
91f889c8fc43
Possibly fix the waf doxygen command
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7510
diff
changeset
|
1215 |
# first we execute the build |
11634
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11544
diff
changeset
|
1216 |
bld = Context.create_context("build") |
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11544
diff
changeset
|
1217 |
bld.options = Options.options # provided for convenience |
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11544
diff
changeset
|
1218 |
bld.cmd = "build" |
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11544
diff
changeset
|
1219 |
bld.execute() |
7518
91f889c8fc43
Possibly fix the waf doxygen command
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7510
diff
changeset
|
1220 |
_doxygen(bld) |
5468
6eebad1fb54d
Bring back the --doxygen-no-build option from the dead.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
5463
diff
changeset
|
1221 |
|
8903
204fed372b38
Add waf options to build the Sphinx docs, all docs
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
8894
diff
changeset
|
1222 |
class Ns3SphinxContext(Context.Context): |
204fed372b38
Add waf options to build the Sphinx docs, all docs
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
8894
diff
changeset
|
1223 |
"""build the Sphinx documentation: manual, tutorial, models""" |
204fed372b38
Add waf options to build the Sphinx docs, all docs
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
8894
diff
changeset
|
1224 |
|
204fed372b38
Add waf options to build the Sphinx docs, all docs
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
8894
diff
changeset
|
1225 |
cmd = 'sphinx' |
7518
91f889c8fc43
Possibly fix the waf doxygen command
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7510
diff
changeset
|
1226 |
|
8903
204fed372b38
Add waf options to build the Sphinx docs, all docs
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
8894
diff
changeset
|
1227 |
def sphinx_build(self, path): |
11634
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11544
diff
changeset
|
1228 |
print() |
99173c0ad09b
port wscripts, test.py, and waf-tools to Python3
Siddharth Santurkar <siddharth.santurkar@ieee.org>
parents:
11544
diff
changeset
|
1229 |
print("[waf] Building sphinx docs for " + path) |
8944
623ce21e27c2
Menu bar in doc web pages; build html, singlehtml, pdf; automatic version string in docs; fix singlehtml title.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
8939
diff
changeset
|
1230 |
if subprocess.Popen(["make", "SPHINXOPTS=-N", "-k", |
623ce21e27c2
Menu bar in doc web pages; build html, singlehtml, pdf; automatic version string in docs; fix singlehtml title.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
8939
diff
changeset
|
1231 |
"html", "singlehtml", "latexpdf" ], |
8939
c1beb94d42af
Build singlehtml, rewrite html header links with version-dependent paths
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
8935
diff
changeset
|
1232 |
cwd=path).wait() : |
8967
3594c3c9f942
Log script errors, fix bogus copy
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
8963
diff
changeset
|
1233 |
Logs.error("Sphinx build of " + path + " returned an error.") |
8903
204fed372b38
Add waf options to build the Sphinx docs, all docs
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
8894
diff
changeset
|
1234 |
raise SystemExit(1) |
204fed372b38
Add waf options to build the Sphinx docs, all docs
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
8894
diff
changeset
|
1235 |
|
204fed372b38
Add waf options to build the Sphinx docs, all docs
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
8894
diff
changeset
|
1236 |
def execute(self): |
8963
97f93bf462bd
Call get_version.sh early, add option, env for public urls.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
8951
diff
changeset
|
1237 |
_getVersion() |
9909
e8571e4f5394
include tutorial-pt-br in documentation build
Tom Henderson <tomh@tomh.org>
parents:
9874
diff
changeset
|
1238 |
for sphinxdir in ["manual", "models", "tutorial", "tutorial-pt-br"] : |
8903
204fed372b38
Add waf options to build the Sphinx docs, all docs
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
8894
diff
changeset
|
1239 |
self.sphinx_build(os.path.join("doc", sphinxdir)) |
204fed372b38
Add waf options to build the Sphinx docs, all docs
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
8894
diff
changeset
|
1240 |
|
204fed372b38
Add waf options to build the Sphinx docs, all docs
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
8894
diff
changeset
|
1241 |
|
204fed372b38
Add waf options to build the Sphinx docs, all docs
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
8894
diff
changeset
|
1242 |
class Ns3DocContext(Context.Context): |
204fed372b38
Add waf options to build the Sphinx docs, all docs
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
8894
diff
changeset
|
1243 |
"""build all the documentation: doxygen, manual, tutorial, models""" |
204fed372b38
Add waf options to build the Sphinx docs, all docs
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
8894
diff
changeset
|
1244 |
|
204fed372b38
Add waf options to build the Sphinx docs, all docs
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
8894
diff
changeset
|
1245 |
cmd = 'docs' |
204fed372b38
Add waf options to build the Sphinx docs, all docs
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
8894
diff
changeset
|
1246 |
|
204fed372b38
Add waf options to build the Sphinx docs, all docs
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
8894
diff
changeset
|
1247 |
def execute(self): |
204fed372b38
Add waf options to build the Sphinx docs, all docs
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
8894
diff
changeset
|
1248 |
steps = ['doxygen', 'sphinx'] |
204fed372b38
Add waf options to build the Sphinx docs, all docs
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
8894
diff
changeset
|
1249 |
Options.commands = steps + Options.commands |
204fed372b38
Add waf options to build the Sphinx docs, all docs
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
8894
diff
changeset
|
1250 |
|
7518
91f889c8fc43
Possibly fix the waf doxygen command
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7510
diff
changeset
|
1251 |
|
7493
3bbefa91e694
Fix the --lcov-report option
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7492
diff
changeset
|
1252 |
def lcov_report(bld): |
3bbefa91e694
Fix the --lcov-report option
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7492
diff
changeset
|
1253 |
env = bld.env |
671
4bec4600950c
WAF: cleanup code by putting lcov and doxygen handling into their own separate functions
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
649
diff
changeset
|
1254 |
|
7493
3bbefa91e694
Fix the --lcov-report option
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7492
diff
changeset
|
1255 |
if not env['GCOV_ENABLED']: |
3bbefa91e694
Fix the --lcov-report option
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7492
diff
changeset
|
1256 |
raise WafError("project not configured for code coverage;" |
3bbefa91e694
Fix the --lcov-report option
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7492
diff
changeset
|
1257 |
" reconfigure with --enable-gcov") |
671
4bec4600950c
WAF: cleanup code by putting lcov and doxygen handling into their own separate functions
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
649
diff
changeset
|
1258 |
|
7493
3bbefa91e694
Fix the --lcov-report option
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7492
diff
changeset
|
1259 |
os.chdir(out) |
671
4bec4600950c
WAF: cleanup code by putting lcov and doxygen handling into their own separate functions
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
649
diff
changeset
|
1260 |
try: |
7493
3bbefa91e694
Fix the --lcov-report option
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7492
diff
changeset
|
1261 |
lcov_report_dir = 'lcov-report' |
671
4bec4600950c
WAF: cleanup code by putting lcov and doxygen handling into their own separate functions
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
649
diff
changeset
|
1262 |
create_dir_command = "rm -rf " + lcov_report_dir |
4bec4600950c
WAF: cleanup code by putting lcov and doxygen handling into their own separate functions
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
649
diff
changeset
|
1263 |
create_dir_command += " && mkdir " + lcov_report_dir + ";" |
4bec4600950c
WAF: cleanup code by putting lcov and doxygen handling into their own separate functions
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
649
diff
changeset
|
1264 |
|
4bec4600950c
WAF: cleanup code by putting lcov and doxygen handling into their own separate functions
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
649
diff
changeset
|
1265 |
if subprocess.Popen(create_dir_command, shell=True).wait(): |
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
1266 |
raise SystemExit(1) |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
1267 |
|
7493
3bbefa91e694
Fix the --lcov-report option
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
7492
diff
changeset
|
1268 |
info_file = os.path.join(lcov_report_dir, 'report.info') |
671
4bec4600950c
WAF: cleanup code by putting lcov and doxygen handling into their own separate functions
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
649
diff
changeset
|
1269 |
lcov_command = "../utils/lcov/lcov -c -d . -o " + info_file |
7551 | 1270 |
lcov_command += " -b " + os.getcwd() |
671
4bec4600950c
WAF: cleanup code by putting lcov and doxygen handling into their own separate functions
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
649
diff
changeset
|
1271 |
if subprocess.Popen(lcov_command, shell=True).wait(): |
4bec4600950c
WAF: cleanup code by putting lcov and doxygen handling into their own separate functions
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
649
diff
changeset
|
1272 |
raise SystemExit(1) |
4bec4600950c
WAF: cleanup code by putting lcov and doxygen handling into their own separate functions
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
649
diff
changeset
|
1273 |
|
4bec4600950c
WAF: cleanup code by putting lcov and doxygen handling into their own separate functions
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
649
diff
changeset
|
1274 |
genhtml_command = "../utils/lcov/genhtml -o " + lcov_report_dir |
4bec4600950c
WAF: cleanup code by putting lcov and doxygen handling into their own separate functions
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
649
diff
changeset
|
1275 |
genhtml_command += " " + info_file |
4bec4600950c
WAF: cleanup code by putting lcov and doxygen handling into their own separate functions
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
649
diff
changeset
|
1276 |
if subprocess.Popen(genhtml_command, shell=True).wait(): |
4bec4600950c
WAF: cleanup code by putting lcov and doxygen handling into their own separate functions
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
649
diff
changeset
|
1277 |
raise SystemExit(1) |
4bec4600950c
WAF: cleanup code by putting lcov and doxygen handling into their own separate functions
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
649
diff
changeset
|
1278 |
finally: |
4bec4600950c
WAF: cleanup code by putting lcov and doxygen handling into their own separate functions
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
649
diff
changeset
|
1279 |
os.chdir("..") |
4bec4600950c
WAF: cleanup code by putting lcov and doxygen handling into their own separate functions
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
649
diff
changeset
|
1280 |