author | Gustavo J. A. M. Carneiro <gjc@inescporto.pt> |
Thu, 03 Apr 2008 14:15:17 +0100 | |
changeset 2866 | 1d829915f092 |
parent 2846 | 7689461231ac |
child 2881 | 81d1080cd0ae |
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; -*- |
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
|
2 |
import sys |
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
|
3 |
import shlex |
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
|
4 |
import shutil |
1217
2f7791ae388d
WAF: add new bld.create_ns3_module() and bld.create_ns3_program() methods to make declaration of modules and programs simpler, and allowing us to change how ns-3 is built in a centralized way, without needing to change every module wscript file.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1213
diff
changeset
|
5 |
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
|
6 |
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
|
7 |
import os.path |
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
8 |
|
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
9 |
import Params |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
10 |
import Object |
649
1d12fb509a0d
WAF: import the WAF subprocess replacement module 'pproc', to make it work on Python 2.3.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
647
diff
changeset
|
11 |
import pproc as subprocess |
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
12 |
|
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
13 |
Params.g_autoconfig = 1 |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
14 |
|
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
15 |
# the following two variables are used by the target "waf dist" |
694
bfad4514a789
WAF: correct values of VERSION and APPNAME, for waf dist
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
693
diff
changeset
|
16 |
VERSION = file("VERSION").read().strip() |
bfad4514a789
WAF: correct values of VERSION and APPNAME, for waf dist
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
693
diff
changeset
|
17 |
APPNAME = 'ns' |
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
18 |
|
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
19 |
# these variables are mandatory ('/' are converted automatically) |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
20 |
srcdir = '.' |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
21 |
blddir = 'build' |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
22 |
|
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
|
23 |
def dist_hook(): |
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
|
24 |
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
|
25 |
shutil.rmtree("doc/latex", True) |
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
26 |
|
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
27 |
def set_options(opt): |
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
|
28 |
|
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
|
29 |
def debug_option_callback(option, opt, value, parser): |
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
|
30 |
if value == 'debug': |
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
|
31 |
setattr(parser.values, option.dest, 'ultradebug') |
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
|
32 |
elif value == 'optimized': |
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
|
33 |
setattr(parser.values, option.dest, 'optimized') |
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
|
34 |
else: |
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
|
35 |
raise optparse.OptionValueError("allowed --debug-level values" |
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
|
36 |
" are debug, optimized.") |
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
|
37 |
|
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
|
38 |
opt.add_option('-d', '--debug-level', |
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
|
39 |
action='callback', |
1425
e4cdb57f162c
WAF: fix debug level to be 'ultradebug' by default, instead of 'debug'.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1424
diff
changeset
|
40 |
type="string", dest='debug_level', default='ultradebug', |
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
|
41 |
help=('Specify the debug level, does nothing if CFLAGS is set' |
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
|
42 |
' in the environment. [Allowed Values: debug, optimized].' |
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
|
43 |
' 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
|
44 |
'with the configure command.'), |
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
|
45 |
callback=debug_option_callback) |
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
|
46 |
|
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
47 |
# options provided by the modules |
642
033f1f4891ab
Make WAF check for the abstract tool 'compiler_cxx', instead of manually checking for multiple compilers.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
600
diff
changeset
|
48 |
opt.tool_options('compiler_cxx') |
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
49 |
|
2846
7689461231ac
start of regression tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
2622
diff
changeset
|
50 |
opt.add_option('--cwd', |
7689461231ac
start of regression tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
2622
diff
changeset
|
51 |
help=('Set the working directory for a program.'), |
7689461231ac
start of regression tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
2622
diff
changeset
|
52 |
action="store", type="string", default=None, |
7689461231ac
start of regression tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
2622
diff
changeset
|
53 |
dest='cwd_launch') |
7689461231ac
start of regression tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
2622
diff
changeset
|
54 |
|
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
55 |
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
|
56 |
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
|
57 |
' 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
|
58 |
'with the configure command.'), |
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
59 |
action="store_true", default=False, |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
60 |
dest='enable_gcov') |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
61 |
|
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
|
62 |
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
|
63 |
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
|
64 |
" 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
|
65 |
" 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
|
66 |
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
|
67 |
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
|
68 |
|
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
69 |
opt.add_option('--lcov-report', |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
70 |
help=('Generate a code coverage report ' |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
71 |
'(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
|
72 |
action="store_true", default=False, |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
73 |
dest='lcov_report') |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
74 |
|
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
75 |
opt.add_option('--doxygen', |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
76 |
help=('Run doxygen to generate html documentation from source comments'), |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
77 |
action="store_true", default=False, |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
78 |
dest='doxygen') |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
79 |
|
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
|
80 |
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
|
81 |
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
|
82 |
' 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
|
83 |
type="string", default='', dest='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
|
84 |
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
|
85 |
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
|
86 |
' 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
|
87 |
' 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
|
88 |
type="string", default=None, dest='command_template') |
2207
d841cca00990
Add a --valgrind WAF option (bug #124)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2178
diff
changeset
|
89 |
opt.add_option('--valgrind', |
d841cca00990
Add a --valgrind WAF option (bug #124)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2178
diff
changeset
|
90 |
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
|
91 |
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
|
92 |
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
|
93 |
opt.add_option('--shell', |
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
|
94 |
help=('Run a shell with an environment suitably modified to run locally built programs'), |
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
|
95 |
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
|
96 |
dest='shell') |
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
|
97 |
|
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
98 |
# options provided in a script in a subdirectory named "src" |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
99 |
opt.sub_options('src') |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
100 |
|
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
101 |
|
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
102 |
def configure(conf): |
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
|
103 |
conf.check_tool('compiler_cxx') |
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
104 |
|
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
105 |
# create the second environment, set the variant and set its name |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
106 |
variant_env = conf.env.copy() |
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
|
107 |
debug_level = Params.g_options.debug_level.lower() |
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
|
108 |
if debug_level == 'ultradebug': |
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
|
109 |
variant_name = 'debug' |
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
|
110 |
else: |
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
|
111 |
variant_name = debug_level |
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
112 |
|
1532
1f54822519c0
WAF: set env['INCLUDEDIR'] to PREFIX/include so that ns3 headers get installed on 'waf install' (also shuts up the warnings in waf distcheck)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1531
diff
changeset
|
113 |
variant_env['INCLUDEDIR'] = os.path.join(variant_env['PREFIX'], 'include') |
1f54822519c0
WAF: set env['INCLUDEDIR'] to PREFIX/include so that ns3 headers get installed on 'waf install' (also shuts up the warnings in waf distcheck)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1531
diff
changeset
|
114 |
|
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
115 |
if Params.g_options.enable_gcov: |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
116 |
variant_name += '-gcov' |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
117 |
variant_env.append_value('CCFLAGS', '-fprofile-arcs') |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
118 |
variant_env.append_value('CCFLAGS', '-ftest-coverage') |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
119 |
variant_env.append_value('CXXFLAGS', '-fprofile-arcs') |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
120 |
variant_env.append_value('CXXFLAGS', '-ftest-coverage') |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
121 |
variant_env.append_value('LINKFLAGS', '-fprofile-arcs') |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
122 |
|
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
123 |
conf.env['NS3_ACTIVE_VARIANT'] = variant_name |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
124 |
variant_env['NS3_ACTIVE_VARIANT'] = variant_name |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
125 |
variant_env.set_variant(variant_name) |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
126 |
conf.set_env_name(variant_name, variant_env) |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
127 |
conf.setenv(variant_name) |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
128 |
|
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
129 |
variant_env.append_value('CXXDEFINES', 'RUN_SELF_TESTS') |
786
78982ea24359
WAF: be careful not to set gcc-specific flags (like -Werror) when using a non-gcc compiler.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
785
diff
changeset
|
130 |
|
924
fa23f33acca0
WAF: don't change CXXFLAGS if CXXFLAGS is set in the OS environment (so that user CXXFLAGS take precedence).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
923
diff
changeset
|
131 |
if (os.path.basename(conf.env['CXX']).startswith("g++") |
fa23f33acca0
WAF: don't change CXXFLAGS if CXXFLAGS is set in the OS environment (so that user CXXFLAGS take precedence).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
923
diff
changeset
|
132 |
and 'CXXFLAGS' not in os.environ): |
1424
5c9314e6cfa1
WAF: remove redundant -Wall (was appearing twice)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1307
diff
changeset
|
133 |
variant_env.append_value('CXXFLAGS', ['-Werror']) |
786
78982ea24359
WAF: be careful not to set gcc-specific flags (like -Werror) when using a non-gcc compiler.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
785
diff
changeset
|
134 |
|
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
135 |
if 'debug' in Params.g_options.debug_level.lower(): |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
136 |
variant_env.append_value('CXXDEFINES', 'NS3_ASSERT_ENABLE') |
1506
3c8b23550e6a
disable log unless debug build
Craig Dowell <craigdo@ee.washington.edu>
parents:
1502
diff
changeset
|
137 |
variant_env.append_value('CXXDEFINES', 'NS3_LOG_ENABLE') |
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
138 |
|
923
f5d38217e7a2
WAF: add debugging symbols to optimized builds
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
921
diff
changeset
|
139 |
## In optimized builds we still want debugging symbols, e.g. for |
f5d38217e7a2
WAF: add debugging symbols to optimized builds
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
921
diff
changeset
|
140 |
## profiling, and at least partially usable stack traces. |
924
fa23f33acca0
WAF: don't change CXXFLAGS if CXXFLAGS is set in the OS environment (so that user CXXFLAGS take precedence).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
923
diff
changeset
|
141 |
if ('optimized' in Params.g_options.debug_level.lower() |
fa23f33acca0
WAF: don't change CXXFLAGS if CXXFLAGS is set in the OS environment (so that user CXXFLAGS take precedence).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
923
diff
changeset
|
142 |
and 'CXXFLAGS' not in os.environ): |
923
f5d38217e7a2
WAF: add debugging symbols to optimized builds
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
921
diff
changeset
|
143 |
for flag in variant_env['CXXFLAGS_DEBUG']: |
f5d38217e7a2
WAF: add debugging symbols to optimized builds
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
921
diff
changeset
|
144 |
## this probably doesn't work for MSVC |
f5d38217e7a2
WAF: add debugging symbols to optimized builds
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
921
diff
changeset
|
145 |
if flag.startswith('-g'): |
f5d38217e7a2
WAF: add debugging symbols to optimized builds
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
921
diff
changeset
|
146 |
variant_env.append_value('CXXFLAGS', flag) |
f5d38217e7a2
WAF: add debugging symbols to optimized builds
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
921
diff
changeset
|
147 |
|
1426
30b9f2b59a1c
WAF: in optimized builds, replace -O2 with -O3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1425
diff
changeset
|
148 |
## in optimized builds, replace -O2 with -O3 |
30b9f2b59a1c
WAF: in optimized builds, replace -O2 with -O3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1425
diff
changeset
|
149 |
if 'optimized' in Params.g_options.debug_level.lower(): |
30b9f2b59a1c
WAF: in optimized builds, replace -O2 with -O3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1425
diff
changeset
|
150 |
lst = variant_env['CXXFLAGS'] |
30b9f2b59a1c
WAF: in optimized builds, replace -O2 with -O3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1425
diff
changeset
|
151 |
for i, flag in enumerate(lst): |
30b9f2b59a1c
WAF: in optimized builds, replace -O2 with -O3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1425
diff
changeset
|
152 |
if flag == '-O2': |
30b9f2b59a1c
WAF: in optimized builds, replace -O2 with -O3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1425
diff
changeset
|
153 |
lst[i] = '-O3' |
30b9f2b59a1c
WAF: in optimized builds, replace -O2 with -O3
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1425
diff
changeset
|
154 |
|
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
|
155 |
if sys.platform == 'win32': |
786
78982ea24359
WAF: be careful not to set gcc-specific flags (like -Werror) when using a non-gcc compiler.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
785
diff
changeset
|
156 |
if os.path.basename(conf.env['CXX']).startswith("g++"): |
78982ea24359
WAF: be careful not to set gcc-specific flags (like -Werror) when using a non-gcc compiler.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
785
diff
changeset
|
157 |
variant_env.append_value("LINKFLAGS", "-Wl,--enable-runtime-pseudo-reloc") |
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
|
158 |
|
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
159 |
conf.sub_config('src') |
1664
306c81333d64
Add a small mobility model visualization tool
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1532
diff
changeset
|
160 |
conf.sub_config('utils') |
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
161 |
|
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
|
162 |
if Params.g_options.enable_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
|
163 |
conf.env['NS3_ENABLED_MODULES'] = ['ns3-'+mod for mod in |
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
|
164 |
Params.g_options.enable_modules.split(',')] |
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
|
165 |
|
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
166 |
|
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
|
167 |
def create_ns3_program(bld, name, dependencies=('simulator',)): |
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
|
168 |
program = bld.create_obj('cpp', '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
|
169 |
program.name = name |
2f7791ae388d
WAF: add new bld.create_ns3_module() and bld.create_ns3_program() methods to make declaration of modules and programs simpler, and allowing us to change how ns-3 is built in a centralized way, without needing to change every module wscript file.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1213
diff
changeset
|
170 |
program.target = program.name |
1220
4933e0890acd
Build all modules as a single ns3 shared library.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1217
diff
changeset
|
171 |
program.uselib_local = 'ns3' |
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
|
172 |
program.ns3_module_dependencies = ['ns3-'+dep for dep in dependencies] |
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
|
173 |
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
|
174 |
|
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
|
175 |
|
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
176 |
def build(bld): |
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
|
177 |
if Params.g_options.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
|
178 |
import Runner |
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
|
179 |
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
|
180 |
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
|
181 |
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
|
182 |
|
1307
fa2e8988fda7
Add some tweaks to enable building under emacs.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1306
diff
changeset
|
183 |
Params.g_cwd_launch = Params.g_build.m_curdirnode.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
|
184 |
bld.create_ns3_program = types.MethodType(create_ns3_program, bld) |
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
185 |
variant_name = bld.env_of_name('default')['NS3_ACTIVE_VARIANT'] |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
186 |
variant_env = bld.env_of_name(variant_name) |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
187 |
bld.m_allenvs['default'] = variant_env # switch to the active variant |
762
b64b1d4eadc0
WAF: process --run and --shell command-line options sooner, before running the build, since we may need a shell before the build finishes, in case the program to debug is part of the build itself.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
695
diff
changeset
|
188 |
|
915
9006896544b3
WAF: make the --run option work again
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
787
diff
changeset
|
189 |
if Params.g_options.shell: |
762
b64b1d4eadc0
WAF: process --run and --shell command-line options sooner, before running the build, since we may need a shell before the build finishes, in case the program to debug is part of the build itself.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
695
diff
changeset
|
190 |
run_shell() |
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
|
191 |
raise SystemExit(0) |
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
|
192 |
|
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
|
193 |
if Params.g_options.doxygen: |
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
|
194 |
doxygen() |
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
|
195 |
raise SystemExit(0) |
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
|
196 |
|
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
|
197 |
check_shell() |
762
b64b1d4eadc0
WAF: process --run and --shell command-line options sooner, before running the build, since we may need a shell before the build finishes, in case the program to debug is part of the build itself.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
695
diff
changeset
|
198 |
|
1717
61831be6aede
WAF: handle the option --doxygen before building the entire project.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
935
diff
changeset
|
199 |
if Params.g_options.doxygen: |
61831be6aede
WAF: handle the option --doxygen before building the entire project.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
935
diff
changeset
|
200 |
doxygen() |
61831be6aede
WAF: handle the option --doxygen before building the entire project.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
935
diff
changeset
|
201 |
raise SystemExit(0) |
61831be6aede
WAF: handle the option --doxygen before building the entire project.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
935
diff
changeset
|
202 |
|
2212
4ba90810ae30
Don't print 'Entering directory xxx' when running waf --shell; it is misleading.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2207
diff
changeset
|
203 |
print "Entering directory `%s/build'" % Params.g_build.m_curdirnode.abspath() |
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
204 |
# process subfolders from here |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
205 |
bld.add_subdirs('src') |
1502
4b4799567e2a
add tutorial directory and hello-simulator
Craig Dowell <craigdo@ee.washington.edu>
parents:
1426
diff
changeset
|
206 |
bld.add_subdirs('samples utils examples tutorial') |
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
207 |
|
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
|
208 |
## if --enabled-modules option was given, we disable building the |
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
|
209 |
## modules that were not enabled, and programs that depend on |
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
|
210 |
## disabled 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
|
211 |
env = bld.env() |
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
|
212 |
|
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
|
213 |
if Params.g_options.enable_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
|
214 |
Params.warning("the option --enable-modules is being applied to this build only;" |
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
|
215 |
" to make it permanent it needs to be given to waf configure.") |
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
|
216 |
env['NS3_ENABLED_MODULES'] = ['ns3-'+mod for mod in |
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
|
217 |
Params.g_options.enable_modules.split(',')] |
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
|
218 |
|
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
|
219 |
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
|
220 |
modules = 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
|
221 |
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
|
222 |
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
|
223 |
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
|
224 |
for module 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
|
225 |
module_obj = Object.name_to_obj(module) |
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
|
226 |
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
|
227 |
raise ValueError("module %s not found" % module) |
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
|
228 |
for dep in module_obj.add_objects: |
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
|
229 |
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
|
230 |
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
|
231 |
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
|
232 |
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
|
233 |
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
|
234 |
|
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
|
235 |
## remove objects that depend on modules not listed |
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
|
236 |
for obj in list(Object.g_allobjs): |
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
|
237 |
if hasattr(obj, 'ns3_module_dependencies'): |
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
|
238 |
for dep in obj.ns3_module_dependencies: |
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
|
239 |
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
|
240 |
Object.g_allobjs.remove(obj) |
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
|
241 |
break |
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
|
242 |
if obj.name in env['NS3_MODULES'] and obj.name 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
|
243 |
Object.g_allobjs.remove(obj) |
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
|
244 |
|
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
|
245 |
## Create a single ns3 library containing all 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
|
246 |
lib = bld.create_obj('cpp', 'shlib') |
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
|
247 |
lib.name = '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
|
248 |
lib.target = '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
|
249 |
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
|
250 |
lib.add_objects = list(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
|
251 |
else: |
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
|
252 |
lib.add_objects = list(env['NS3_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
|
253 |
|
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
|
254 |
|
2207
d841cca00990
Add a --valgrind WAF option (bug #124)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2178
diff
changeset
|
255 |
def get_command_template(): |
d841cca00990
Add a --valgrind WAF option (bug #124)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2178
diff
changeset
|
256 |
if Params.g_options.valgrind: |
d841cca00990
Add a --valgrind WAF option (bug #124)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2178
diff
changeset
|
257 |
if Params.g_options.command_template: |
d841cca00990
Add a --valgrind WAF option (bug #124)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2178
diff
changeset
|
258 |
Params.fatal("Options --command-template and --valgrind are conflicting") |
d841cca00990
Add a --valgrind WAF option (bug #124)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2178
diff
changeset
|
259 |
return "valgrind %s" |
d841cca00990
Add a --valgrind WAF option (bug #124)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2178
diff
changeset
|
260 |
else: |
d841cca00990
Add a --valgrind WAF option (bug #124)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2178
diff
changeset
|
261 |
return (Params.g_options.command_template or '%s') |
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
262 |
|
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
|
263 |
|
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
264 |
def shutdown(): |
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
|
265 |
#import UnitTest |
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
|
266 |
#ut = UnitTest.unit_test() |
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
|
267 |
#ut.change_to_testfile_dir = True |
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
|
268 |
#ut.want_to_see_test_output = True |
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
|
269 |
#ut.want_to_see_test_error = True |
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
|
270 |
#ut.run() |
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
271 |
#ut.print_results() |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
272 |
|
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
|
273 |
if Params.g_commands['check']: |
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
|
274 |
_run_waf_check() |
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
|
275 |
|
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
276 |
if Params.g_options.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
|
277 |
lcov_report() |
537
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
278 |
|
915
9006896544b3
WAF: make the --run option work again
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
787
diff
changeset
|
279 |
if Params.g_options.run: |
2207
d841cca00990
Add a --valgrind WAF option (bug #124)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2178
diff
changeset
|
280 |
run_program(Params.g_options.run, get_command_template()) |
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
|
281 |
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
|
282 |
|
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
|
283 |
if Params.g_options.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
|
284 |
Params.fatal("Option --command-template requires the option --run to be given") |
915
9006896544b3
WAF: make the --run option work again
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
787
diff
changeset
|
285 |
|
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
|
286 |
def _run_waf_check(): |
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
|
287 |
## generate the trace sources list docs |
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
|
288 |
env = Params.g_build.env_of_name('default') |
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
|
289 |
proc_env = _get_proc_env() |
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
|
290 |
try: |
2344
7617aa80498d
Fix a typo in the WAF scripts; don't access m_linktask directly, use the get_target_name() method instead (to make it work with waf trunk).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2212
diff
changeset
|
291 |
program_obj = _find_program('print-introspected-doxygen', env) |
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
|
292 |
except ValueError: # could happen if print-introspected-doxygen is |
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
|
293 |
# not built because of waf configure |
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
|
294 |
# --enable-modules=xxx |
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
|
295 |
pass |
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
|
296 |
else: |
2344
7617aa80498d
Fix a typo in the WAF scripts; don't access m_linktask directly, use the get_target_name() method instead (to make it work with waf trunk).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2212
diff
changeset
|
297 |
prog = program_obj.path.find_build(program_obj.get_target_name()).abspath(env) |
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
|
298 |
out = open('doc/introspected-doxygen.h', 'w') |
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
|
299 |
if subprocess.Popen([prog], stdout=out, env=proc_env).wait(): |
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
|
300 |
raise SystemExit(1) |
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
|
301 |
out.close() |
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
|
302 |
|
2207
d841cca00990
Add a --valgrind WAF option (bug #124)
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2178
diff
changeset
|
303 |
run_program('run-tests', get_command_template()) |
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
|
304 |
|
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
|
305 |
|
918
1ecec08ba4ba
WAF: option --run now filters out programs not in the subtree starting at the launch dir
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
917
diff
changeset
|
306 |
def _find_program(program_name, env): |
1ecec08ba4ba
WAF: option --run now filters out programs not in the subtree starting at the launch dir
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
917
diff
changeset
|
307 |
launch_dir = os.path.abspath(Params.g_cwd_launch) |
916
1eca7915ca9e
WAF: when the program specified by --run is not found, print a list of all available program names in the error message.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
915
diff
changeset
|
308 |
found_programs = [] |
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
|
309 |
for obj in Object.g_allobjs: |
916
1eca7915ca9e
WAF: when the program specified by --run is not found, print a list of all available program names in the error message.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
915
diff
changeset
|
310 |
if obj.m_type != 'program' or not obj.target: |
1eca7915ca9e
WAF: when the program specified by --run is not found, print a list of all available program names in the error message.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
915
diff
changeset
|
311 |
continue |
918
1ecec08ba4ba
WAF: option --run now filters out programs not in the subtree starting at the launch dir
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
917
diff
changeset
|
312 |
|
1ecec08ba4ba
WAF: option --run now filters out programs not in the subtree starting at the launch dir
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
917
diff
changeset
|
313 |
## filter out programs not in the subtree starting at the launch dir |
1ecec08ba4ba
WAF: option --run now filters out programs not in the subtree starting at the launch dir
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
917
diff
changeset
|
314 |
if not (obj.path.abspath().startswith(launch_dir) |
1ecec08ba4ba
WAF: option --run now filters out programs not in the subtree starting at the launch dir
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
917
diff
changeset
|
315 |
or obj.path.abspath(env).startswith(launch_dir)): |
1ecec08ba4ba
WAF: option --run now filters out programs not in the subtree starting at the launch dir
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
917
diff
changeset
|
316 |
continue |
1ecec08ba4ba
WAF: option --run now filters out programs not in the subtree starting at the launch dir
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
917
diff
changeset
|
317 |
|
916
1eca7915ca9e
WAF: when the program specified by --run is not found, print a list of all available program names in the error message.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
915
diff
changeset
|
318 |
found_programs.append(obj.target) |
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
|
319 |
if obj.target == program_name: |
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
|
320 |
return obj |
917
aed7f1b9e783
WAF: fix simple typo in error message.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
916
diff
changeset
|
321 |
raise ValueError("program '%s' not found; available programs are: %r" |
916
1eca7915ca9e
WAF: when the program specified by --run is not found, print a list of all available program names in the error message.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
915
diff
changeset
|
322 |
% (program_name, found_programs)) |
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
|
323 |
|
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
|
324 |
def _get_proc_env(os_env=None): |
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
|
325 |
env = Params.g_build.env_of_name('default') |
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
|
326 |
if sys.platform == 'linux2': |
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
|
327 |
pathvar = 'LD_LIBRARY_PATH' |
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
|
328 |
elif sys.platform == 'darwin': |
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
|
329 |
pathvar = 'DYLD_LIBRARY_PATH' |
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
|
330 |
elif sys.platform == 'win32': |
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
|
331 |
pathvar = 'PATH' |
785
bf8e7773836a
WAF: configure dynamic path for the cygwin platform.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
764
diff
changeset
|
332 |
elif sys.platform == 'cygwin': |
bf8e7773836a
WAF: configure dynamic path for the cygwin platform.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
764
diff
changeset
|
333 |
pathvar = 'PATH' |
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
|
334 |
else: |
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
|
335 |
Params.warning(("Don't know how to configure " |
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
|
336 |
"dynamic library path for the platform '%s'") % (sys.platform,)) |
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
|
337 |
pathvar = None |
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
|
338 |
|
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
|
339 |
proc_env = dict(os.environ) |
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
|
340 |
if os_env is not None: |
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
|
341 |
proc_env.update(os_env) |
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
|
342 |
|
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
|
343 |
if pathvar is not None: |
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
|
344 |
if pathvar in proc_env: |
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
|
345 |
proc_env[pathvar] = os.pathsep.join(list(env['NS3_MODULE_PATH']) + [proc_env[pathvar]]) |
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
|
346 |
else: |
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
|
347 |
proc_env[pathvar] = os.pathsep.join(list(env['NS3_MODULE_PATH'])) |
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
|
348 |
return proc_env |
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
|
349 |
|
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
|
350 |
def _run_argv(argv, os_env=None): |
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
|
351 |
proc_env = _get_proc_env(os_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
|
352 |
retval = subprocess.Popen(argv, env=proc_env).wait() |
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
|
353 |
if retval: |
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
|
354 |
Params.fatal("Command %s exited with code %i" % (argv, retval)) |
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
|
355 |
|
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
|
356 |
|
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
|
357 |
def run_program(program_string, command_template=None): |
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
|
358 |
""" |
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
|
359 |
if command_template is not None, then program_string == 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
|
360 |
name and argv is given by command_template with %s replaced by the |
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
|
361 |
full path to the program. Else, program_string is interpreted as |
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
|
362 |
a shell command with first name being the 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
|
363 |
""" |
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
|
364 |
env = Params.g_build.env_of_name('default') |
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
|
365 |
|
2345
79f77914c31c
Fix the WAF --run option for running a program with command line options
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2344
diff
changeset
|
366 |
if command_template in (None, '%s'): |
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
|
367 |
argv = shlex.split(program_string) |
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
|
368 |
program_name = argv[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
|
369 |
|
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
|
370 |
try: |
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
|
371 |
program_obj = _find_program(program_name, env) |
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
|
372 |
except ValueError, ex: |
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
|
373 |
Params.fatal(str(ex)) |
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
|
374 |
|
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
|
375 |
try: |
2344
7617aa80498d
Fix a typo in the WAF scripts; don't access m_linktask directly, use the get_target_name() method instead (to make it work with waf trunk).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2212
diff
changeset
|
376 |
program_node = program_obj.path.find_build(program_obj.get_target_name()) |
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
|
377 |
except AttributeError: |
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
|
378 |
Params.fatal("%s does not appear to be a program" % (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
|
379 |
|
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
|
380 |
execvec = [program_node.abspath(env)] + argv[1:] |
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
|
381 |
|
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
|
382 |
else: |
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
|
383 |
|
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
|
384 |
program_name = program_string |
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
|
385 |
try: |
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
|
386 |
program_obj = _find_program(program_name, env) |
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
|
387 |
except ValueError, ex: |
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
|
388 |
Params.fatal(str(ex)) |
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
|
389 |
try: |
2344
7617aa80498d
Fix a typo in the WAF scripts; don't access m_linktask directly, use the get_target_name() method instead (to make it work with waf trunk).
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2212
diff
changeset
|
390 |
program_node = program_obj.path.find_build(program_obj.get_target_name()) |
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
|
391 |
except AttributeError: |
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
|
392 |
Params.fatal("%s does not appear to be a program" % (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
|
393 |
|
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
|
394 |
execvec = shlex.split(command_template % (program_node.abspath(env),)) |
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
|
395 |
|
919
a9c7effce441
WAF: --run now runs the specified program from the directory where waf was invoked.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
918
diff
changeset
|
396 |
former_cwd = os.getcwd() |
2846
7689461231ac
start of regression tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
2622
diff
changeset
|
397 |
if (Params.g_options.cwd_launch): |
7689461231ac
start of regression tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
2622
diff
changeset
|
398 |
os.chdir(Params.g_options.cwd_launch) |
7689461231ac
start of regression tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
2622
diff
changeset
|
399 |
else: |
7689461231ac
start of regression tests
Craig Dowell <craigdo@ee.washington.edu>
parents:
2622
diff
changeset
|
400 |
os.chdir(Params.g_cwd_launch) |
919
a9c7effce441
WAF: --run now runs the specified program from the directory where waf was invoked.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
918
diff
changeset
|
401 |
try: |
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
|
402 |
retval = _run_argv(execvec) |
919
a9c7effce441
WAF: --run now runs the specified program from the directory where waf was invoked.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
918
diff
changeset
|
403 |
finally: |
a9c7effce441
WAF: --run now runs the specified program from the directory where waf was invoked.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
918
diff
changeset
|
404 |
os.chdir(former_cwd) |
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
|
405 |
|
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
|
406 |
return retval |
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
|
407 |
|
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
|
408 |
def check_shell(): |
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
|
409 |
if 'NS3_MODULE_PATH' not in os.environ: |
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
|
410 |
return |
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
|
411 |
env = Params.g_build.env_of_name('default') |
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
|
412 |
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
|
413 |
found_modpath = os.environ['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
|
414 |
if found_modpath != correct_modpath: |
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
|
415 |
msg = ("Detected shell (waf --shell) with incorrect configuration\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
|
416 |
"=========================================================\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
|
417 |
"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
|
418 |
" 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
|
419 |
" 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
|
420 |
" 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
|
421 |
"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
|
422 |
" 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
|
423 |
" 2. Run a new nested shell") |
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
|
424 |
Params.fatal(msg) |
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
|
425 |
|
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
|
426 |
|
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
|
427 |
def run_shell(): |
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
|
428 |
if sys.platform == 'win32': |
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
|
429 |
shell = os.environ.get("COMSPEC", "cmd.exe") |
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
|
430 |
else: |
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
|
431 |
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
|
432 |
|
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
|
433 |
env = Params.g_build.env_of_name('default') |
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
|
434 |
_run_argv([shell], {'NS3_MODULE_PATH': os.pathsep.join(env['NS3_MODULE_PATH'])}) |
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
|
435 |
|
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
|
436 |
def doxygen(): |
1855
ee15fef0cb62
print-trace-sources.cc -> print-introspected-doxygen.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1804
diff
changeset
|
437 |
if not os.path.exists('doc/introspected-doxygen.h'): |
ee15fef0cb62
print-trace-sources.cc -> print-introspected-doxygen.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1804
diff
changeset
|
438 |
Params.warning("doc/introspected-doxygen.h does not exist; run waf check to generate it.") |
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
|
439 |
|
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
|
440 |
## run doxygen |
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
|
441 |
doxygen_config = os.path.join('doc', 'doxygen.conf') |
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
|
442 |
if subprocess.Popen(['doxygen', doxygen_config]).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
|
443 |
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
|
444 |
|
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
|
445 |
def lcov_report(): |
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
|
446 |
env = Params.g_build.env_of_name('default') |
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
|
447 |
variant_name = env['NS3_ACTIVE_VARIANT'] |
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
|
448 |
|
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
|
449 |
if 'gcov' not in variant_name: |
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
|
450 |
Params.fatal("project not configured for code coverage;" |
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
|
451 |
" reconfigure with --enable-gcov") |
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
|
452 |
|
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
|
453 |
os.chdir(blddir) |
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
|
454 |
try: |
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
|
455 |
lcov_report_dir = os.path.join(variant_name, 'lcov-report') |
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
|
456 |
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
|
457 |
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
|
458 |
|
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
|
459 |
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
|
460 |
raise SystemExit(1) |
e8a4183dfe00
Add support for building with WAF
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
diff
changeset
|
461 |
|
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
|
462 |
info_file = os.path.join(lcov_report_dir, variant_name + '.info') |
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
|
463 |
lcov_command = "../utils/lcov/lcov -c -d . -o " + 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
|
464 |
lcov_command += " --source-dirs=" + os.getcwd() |
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
|
465 |
lcov_command += ":" + os.path.join( |
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
|
466 |
os.getcwd(), variant_name, 'include') |
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
|
467 |
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
|
468 |
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
|
469 |
|
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
|
470 |
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
|
471 |
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
|
472 |
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
|
473 |
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
|
474 |
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
|
475 |
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
|
476 |
|
2622
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
477 |
|
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
478 |
|
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
479 |
|
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
480 |
## |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
481 |
## The default WAF DistDir implementation is rather slow, because it |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
482 |
## first copies everything and only later removes unwanted files and |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
483 |
## directories; this means that it needless copies the full build dir |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
484 |
## and the .hg repository tree. Here we provide a replacement DistDir |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
485 |
## implementation that is more efficient. |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
486 |
## |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
487 |
import Scripting |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
488 |
from Scripting import g_dist_exts, g_excludes, BLDDIR |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
489 |
import Utils |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
490 |
import os |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
491 |
|
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
492 |
def copytree(src, dst, symlinks=False, excludes=(), build_dir=None): |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
493 |
"""Recursively copy a directory tree using copy2(). |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
494 |
|
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
495 |
The destination directory must not already exist. |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
496 |
If exception(s) occur, an Error is raised with a list of reasons. |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
497 |
|
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
498 |
If the optional symlinks flag is true, symbolic links in the |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
499 |
source tree result in symbolic links in the destination tree; if |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
500 |
it is false, the contents of the files pointed to by symbolic |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
501 |
links are copied. |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
502 |
|
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
503 |
XXX Consider this example code rather than the ultimate tool. |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
504 |
|
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
505 |
Note: this is a modified version of shutil.copytree from python |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
506 |
2.5.2 library; modified for WAF purposes to exclude dot dirs and |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
507 |
another list of files. |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
508 |
""" |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
509 |
names = os.listdir(src) |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
510 |
os.makedirs(dst) |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
511 |
errors = [] |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
512 |
for name in names: |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
513 |
srcname = os.path.join(src, name) |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
514 |
dstname = os.path.join(dst, name) |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
515 |
try: |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
516 |
if symlinks and os.path.islink(srcname): |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
517 |
linkto = os.readlink(srcname) |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
518 |
os.symlink(linkto, dstname) |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
519 |
elif os.path.isdir(srcname): |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
520 |
if name in excludes: |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
521 |
continue |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
522 |
elif name.startswith('.') or name.startswith(',,') or name.startswith('++'): |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
523 |
continue |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
524 |
elif name == build_dir: |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
525 |
continue |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
526 |
else: |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
527 |
## build_dir is not passed into the recursive |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
528 |
## copytree, but that is intentional; it is a |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
529 |
## directory name valid only at the top level. |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
530 |
copytree(srcname, dstname, symlinks, excludes) |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
531 |
else: |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
532 |
ends = name.endswith |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
533 |
to_remove = False |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
534 |
if name.startswith('.') or name.startswith('++'): |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
535 |
to_remove = True |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
536 |
else: |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
537 |
for x in g_dist_exts: |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
538 |
if ends(x): |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
539 |
to_remove = True |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
540 |
break |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
541 |
if not to_remove: |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
542 |
shutil.copy2(srcname, dstname) |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
543 |
# XXX What about devices, sockets etc.? |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
544 |
except (IOError, os.error), why: |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
545 |
errors.append((srcname, dstname, str(why))) |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
546 |
# catch the Error from the recursive copytree so that we can |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
547 |
# continue with other files |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
548 |
except shutil.Error, err: |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
549 |
errors.extend(err.args[0]) |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
550 |
try: |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
551 |
shutil.copystat(src, dst) |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
552 |
except WindowsError: |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
553 |
# can't copy file access times on Windows |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
554 |
pass |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
555 |
except OSError, why: |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
556 |
errors.extend((src, dst, str(why))) |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
557 |
if errors: |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
558 |
raise shutil.Error, errors |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
559 |
|
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
560 |
|
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
561 |
def DistDir(appname, version): |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
562 |
"make a distribution directory with all the sources in it" |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
563 |
import shutil |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
564 |
|
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
565 |
# Our temporary folder where to put our files |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
566 |
TMPFOLDER=appname+'-'+version |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
567 |
|
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
568 |
# Remove an old package directory |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
569 |
if os.path.exists(TMPFOLDER): shutil.rmtree(TMPFOLDER) |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
570 |
|
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
571 |
global g_dist_exts, g_excludes |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
572 |
|
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
573 |
# Remove the Build dir |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
574 |
build_dir = getattr(Utils.g_module, BLDDIR, None) |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
575 |
|
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
576 |
# Copy everything into the new folder |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
577 |
copytree('.', TMPFOLDER, excludes=g_excludes, build_dir=build_dir) |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
578 |
|
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
579 |
# TODO undocumented hook |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
580 |
dist_hook = getattr(Utils.g_module, 'dist_hook', None) |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
581 |
if dist_hook: |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
582 |
os.chdir(TMPFOLDER) |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
583 |
try: |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
584 |
dist_hook() |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
585 |
finally: |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
586 |
# go back to the root directory |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
587 |
os.chdir('..') |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
588 |
return TMPFOLDER |
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
589 |
|
6440851b111a
Make waf dist much more efficient.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
2345
diff
changeset
|
590 |
Scripting.DistDir = DistDir |