2007-05-07 12:01:51 +01:00
|
|
|
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
|
2007-05-17 17:02:03 +01:00
|
|
|
import sys
|
2007-05-23 19:20:54 +01:00
|
|
|
import shlex
|
2007-05-24 19:21:50 +01:00
|
|
|
import shutil
|
2007-08-08 15:10:36 +01:00
|
|
|
import types
|
|
|
|
|
import optparse
|
|
|
|
|
import os.path
|
2007-05-07 12:01:51 +01:00
|
|
|
|
|
|
|
|
import Params
|
|
|
|
|
import Object
|
2007-05-17 18:22:10 +01:00
|
|
|
import pproc as subprocess
|
2007-05-07 12:01:51 +01:00
|
|
|
|
|
|
|
|
Params.g_autoconfig = 1
|
|
|
|
|
|
|
|
|
|
# the following two variables are used by the target "waf dist"
|
2007-05-24 17:59:30 +01:00
|
|
|
VERSION = file("VERSION").read().strip()
|
|
|
|
|
APPNAME = 'ns'
|
2007-05-07 12:01:51 +01:00
|
|
|
|
|
|
|
|
# these variables are mandatory ('/' are converted automatically)
|
|
|
|
|
srcdir = '.'
|
|
|
|
|
blddir = 'build'
|
|
|
|
|
|
2007-09-27 12:40:01 +01:00
|
|
|
def dist_hook():
|
2007-07-09 14:36:40 +01:00
|
|
|
shutil.rmtree("doc/html", True)
|
|
|
|
|
shutil.rmtree("doc/latex", True)
|
2007-05-07 12:01:51 +01:00
|
|
|
|
|
|
|
|
def set_options(opt):
|
2007-06-21 12:26:46 +01:00
|
|
|
|
|
|
|
|
def debug_option_callback(option, opt, value, parser):
|
|
|
|
|
if value == 'debug':
|
|
|
|
|
setattr(parser.values, option.dest, 'ultradebug')
|
|
|
|
|
elif value == 'optimized':
|
|
|
|
|
setattr(parser.values, option.dest, 'optimized')
|
|
|
|
|
else:
|
|
|
|
|
raise optparse.OptionValueError("allowed --debug-level values"
|
|
|
|
|
" are debug, optimized.")
|
|
|
|
|
|
|
|
|
|
opt.add_option('-d', '--debug-level',
|
|
|
|
|
action='callback',
|
2007-09-11 13:37:23 +01:00
|
|
|
type="string", dest='debug_level', default='ultradebug',
|
2007-06-21 12:26:46 +01:00
|
|
|
help=('Specify the debug level, does nothing if CFLAGS is set'
|
|
|
|
|
' in the environment. [Allowed Values: debug, optimized].'
|
|
|
|
|
' WARNING: this option only has effect '
|
|
|
|
|
'with the configure command.'),
|
|
|
|
|
callback=debug_option_callback)
|
|
|
|
|
|
2007-05-07 12:01:51 +01:00
|
|
|
# options provided by the modules
|
2007-05-17 14:22:27 +01:00
|
|
|
opt.tool_options('compiler_cxx')
|
2007-05-07 12:01:51 +01:00
|
|
|
|
|
|
|
|
opt.add_option('--enable-gcov',
|
2007-06-21 12:26:46 +01:00
|
|
|
help=('Enable code coverage analysis.'
|
|
|
|
|
' WARNING: this option only has effect '
|
|
|
|
|
'with the configure command.'),
|
2007-05-07 12:01:51 +01:00
|
|
|
action="store_true", default=False,
|
|
|
|
|
dest='enable_gcov')
|
|
|
|
|
|
|
|
|
|
opt.add_option('--lcov-report',
|
|
|
|
|
help=('Generate a code coverage report '
|
|
|
|
|
'(use this option at build time, not in configure)'),
|
|
|
|
|
action="store_true", default=False,
|
|
|
|
|
dest='lcov_report')
|
|
|
|
|
|
|
|
|
|
opt.add_option('--doxygen',
|
|
|
|
|
help=('Run doxygen to generate html documentation from source comments'),
|
|
|
|
|
action="store_true", default=False,
|
|
|
|
|
dest='doxygen')
|
|
|
|
|
|
2007-05-23 19:20:54 +01:00
|
|
|
opt.add_option('--run',
|
2007-07-18 12:20:31 +01:00
|
|
|
help=('Run a locally built program; argument can be a program name,'
|
|
|
|
|
' or a command starting with the program name.'),
|
2007-05-23 19:20:54 +01:00
|
|
|
type="string", default='', dest='run')
|
2007-07-18 12:20:31 +01:00
|
|
|
opt.add_option('--command-template',
|
|
|
|
|
help=('Template of the command used to run the program given by --run;'
|
|
|
|
|
' It should be a shell command string containing %s inside,'
|
|
|
|
|
' which will be replaced by the actual program.'),
|
|
|
|
|
type="string", default=None, dest='command_template')
|
2007-05-23 19:20:54 +01:00
|
|
|
|
|
|
|
|
opt.add_option('--shell',
|
|
|
|
|
help=('Run a shell with an environment suitably modified to run locally built programs'),
|
|
|
|
|
action="store_true", default=False,
|
|
|
|
|
dest='shell')
|
|
|
|
|
|
2007-05-07 12:01:51 +01:00
|
|
|
# options provided in a script in a subdirectory named "src"
|
|
|
|
|
opt.sub_options('src')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def configure(conf):
|
2007-09-27 12:40:01 +01:00
|
|
|
conf.check_tool('compiler_cxx')
|
2007-05-07 12:01:51 +01:00
|
|
|
|
|
|
|
|
# create the second environment, set the variant and set its name
|
|
|
|
|
variant_env = conf.env.copy()
|
2007-06-21 12:26:46 +01:00
|
|
|
debug_level = Params.g_options.debug_level.lower()
|
|
|
|
|
if debug_level == 'ultradebug':
|
|
|
|
|
variant_name = 'debug'
|
|
|
|
|
else:
|
|
|
|
|
variant_name = debug_level
|
2007-05-07 12:01:51 +01:00
|
|
|
|
2007-09-27 12:44:29 +01:00
|
|
|
variant_env['INCLUDEDIR'] = os.path.join(variant_env['PREFIX'], 'include')
|
|
|
|
|
|
2007-05-07 12:01:51 +01:00
|
|
|
if Params.g_options.enable_gcov:
|
|
|
|
|
variant_name += '-gcov'
|
|
|
|
|
variant_env.append_value('CCFLAGS', '-fprofile-arcs')
|
|
|
|
|
variant_env.append_value('CCFLAGS', '-ftest-coverage')
|
|
|
|
|
variant_env.append_value('CXXFLAGS', '-fprofile-arcs')
|
|
|
|
|
variant_env.append_value('CXXFLAGS', '-ftest-coverage')
|
|
|
|
|
variant_env.append_value('LINKFLAGS', '-fprofile-arcs')
|
|
|
|
|
|
|
|
|
|
conf.env['NS3_ACTIVE_VARIANT'] = variant_name
|
|
|
|
|
variant_env['NS3_ACTIVE_VARIANT'] = variant_name
|
|
|
|
|
variant_env.set_variant(variant_name)
|
|
|
|
|
conf.set_env_name(variant_name, variant_env)
|
|
|
|
|
conf.setenv(variant_name)
|
|
|
|
|
|
|
|
|
|
variant_env.append_value('CXXDEFINES', 'RUN_SELF_TESTS')
|
2007-06-21 11:59:55 +01:00
|
|
|
|
2007-07-10 13:42:23 +01:00
|
|
|
if (os.path.basename(conf.env['CXX']).startswith("g++")
|
|
|
|
|
and 'CXXFLAGS' not in os.environ):
|
2007-09-11 13:33:06 +01:00
|
|
|
variant_env.append_value('CXXFLAGS', ['-Werror'])
|
2007-06-21 11:59:55 +01:00
|
|
|
|
2007-05-07 12:01:51 +01:00
|
|
|
if 'debug' in Params.g_options.debug_level.lower():
|
|
|
|
|
variant_env.append_value('CXXDEFINES', 'NS3_DEBUG_ENABLE')
|
|
|
|
|
variant_env.append_value('CXXDEFINES', 'NS3_ASSERT_ENABLE')
|
2007-09-13 22:17:29 -07:00
|
|
|
variant_env.append_value('CXXDEFINES', 'NS3_LOG_ENABLE')
|
2007-05-07 12:01:51 +01:00
|
|
|
|
2007-07-10 13:37:17 +01:00
|
|
|
## In optimized builds we still want debugging symbols, e.g. for
|
|
|
|
|
## profiling, and at least partially usable stack traces.
|
2007-07-10 13:42:23 +01:00
|
|
|
if ('optimized' in Params.g_options.debug_level.lower()
|
|
|
|
|
and 'CXXFLAGS' not in os.environ):
|
2007-07-10 13:37:17 +01:00
|
|
|
for flag in variant_env['CXXFLAGS_DEBUG']:
|
|
|
|
|
## this probably doesn't work for MSVC
|
|
|
|
|
if flag.startswith('-g'):
|
|
|
|
|
variant_env.append_value('CXXFLAGS', flag)
|
|
|
|
|
|
2007-09-11 14:44:23 +01:00
|
|
|
## in optimized builds, replace -O2 with -O3
|
|
|
|
|
if 'optimized' in Params.g_options.debug_level.lower():
|
|
|
|
|
lst = variant_env['CXXFLAGS']
|
|
|
|
|
for i, flag in enumerate(lst):
|
|
|
|
|
if flag == '-O2':
|
|
|
|
|
lst[i] = '-O3'
|
|
|
|
|
|
2007-05-17 17:02:03 +01:00
|
|
|
if sys.platform == 'win32':
|
2007-06-21 11:59:55 +01:00
|
|
|
if os.path.basename(conf.env['CXX']).startswith("g++"):
|
|
|
|
|
variant_env.append_value("LINKFLAGS", "-Wl,--enable-runtime-pseudo-reloc")
|
2007-05-17 17:02:03 +01:00
|
|
|
|
2007-05-07 12:01:51 +01:00
|
|
|
conf.sub_config('src')
|
2007-10-03 16:38:17 +01:00
|
|
|
conf.sub_config('utils')
|
2007-05-07 12:01:51 +01:00
|
|
|
|
|
|
|
|
|
2007-08-08 15:10:36 +01:00
|
|
|
def create_ns3_program(bld, name, dependencies=('simulator',)):
|
|
|
|
|
program = bld.create_obj('cpp', 'program')
|
|
|
|
|
program.name = name
|
|
|
|
|
program.target = program.name
|
2007-08-08 21:07:52 +01:00
|
|
|
program.uselib_local = 'ns3'
|
2007-08-08 15:10:36 +01:00
|
|
|
return program
|
|
|
|
|
|
|
|
|
|
|
2007-05-07 12:01:51 +01:00
|
|
|
def build(bld):
|
2007-08-28 16:54:07 +01:00
|
|
|
print "Entering directory `%s/build'" % Params.g_build.m_curdirnode.abspath()
|
|
|
|
|
Params.g_cwd_launch = Params.g_build.m_curdirnode.abspath()
|
|
|
|
|
|
2007-08-08 15:10:36 +01:00
|
|
|
bld.create_ns3_program = types.MethodType(create_ns3_program, bld)
|
|
|
|
|
|
2007-05-07 12:01:51 +01:00
|
|
|
variant_name = bld.env_of_name('default')['NS3_ACTIVE_VARIANT']
|
|
|
|
|
variant_env = bld.env_of_name(variant_name)
|
|
|
|
|
bld.m_allenvs['default'] = variant_env # switch to the active variant
|
2007-06-12 19:04:38 +01:00
|
|
|
|
2007-07-05 14:38:39 +01:00
|
|
|
if Params.g_options.shell:
|
2007-06-12 19:04:38 +01:00
|
|
|
run_shell()
|
2007-08-01 21:35:34 +01:00
|
|
|
raise SystemExit(0)
|
|
|
|
|
|
2007-08-08 12:36:59 +01:00
|
|
|
if Params.g_options.doxygen:
|
|
|
|
|
doxygen()
|
|
|
|
|
raise SystemExit(0)
|
|
|
|
|
|
2007-08-01 21:35:34 +01:00
|
|
|
check_shell()
|
2007-06-12 19:04:38 +01:00
|
|
|
|
2007-07-27 15:04:25 +01:00
|
|
|
if Params.g_options.doxygen:
|
|
|
|
|
doxygen()
|
|
|
|
|
raise SystemExit(0)
|
|
|
|
|
|
2007-05-07 12:01:51 +01:00
|
|
|
# process subfolders from here
|
|
|
|
|
bld.add_subdirs('src')
|
2007-09-13 11:04:47 -07:00
|
|
|
bld.add_subdirs('samples utils examples tutorial')
|
2007-05-07 12:01:51 +01:00
|
|
|
|
2007-08-28 16:53:01 +01:00
|
|
|
## Create a single ns3 library containing all modules
|
|
|
|
|
lib = bld.create_obj('cpp', 'shlib')
|
|
|
|
|
lib.name = 'ns3'
|
|
|
|
|
lib.target = 'ns3'
|
|
|
|
|
lib.add_objects = list(bld.env_of_name('default')['NS3_MODULES'])
|
2007-05-07 12:01:51 +01:00
|
|
|
|
2007-10-02 11:10:31 +01:00
|
|
|
|
2007-05-07 12:01:51 +01:00
|
|
|
def shutdown():
|
2007-05-23 19:20:54 +01:00
|
|
|
#import UnitTest
|
|
|
|
|
#ut = UnitTest.unit_test()
|
|
|
|
|
#ut.change_to_testfile_dir = True
|
|
|
|
|
#ut.want_to_see_test_output = True
|
|
|
|
|
#ut.want_to_see_test_error = True
|
|
|
|
|
#ut.run()
|
2007-05-07 12:01:51 +01:00
|
|
|
#ut.print_results()
|
|
|
|
|
|
2007-05-23 19:20:54 +01:00
|
|
|
if Params.g_commands['check']:
|
2007-10-03 13:58:01 +01:00
|
|
|
_run_waf_check()
|
2007-05-23 19:20:54 +01:00
|
|
|
|
2007-05-07 12:01:51 +01:00
|
|
|
if Params.g_options.lcov_report:
|
2007-05-23 17:32:32 +01:00
|
|
|
lcov_report()
|
2007-05-07 12:01:51 +01:00
|
|
|
|
2007-07-05 14:38:39 +01:00
|
|
|
if Params.g_options.run:
|
2007-07-18 12:20:31 +01:00
|
|
|
run_program(Params.g_options.run, Params.g_options.command_template)
|
|
|
|
|
raise SystemExit(0)
|
|
|
|
|
|
|
|
|
|
if Params.g_options.command_template:
|
|
|
|
|
Params.fatal("Option --command-template requires the option --run to be given")
|
2007-07-05 14:38:39 +01:00
|
|
|
|
2007-10-03 13:58:01 +01:00
|
|
|
def _run_waf_check():
|
|
|
|
|
## generate the trace sources list docs
|
|
|
|
|
env = Params.g_build.env_of_name('default')
|
|
|
|
|
proc_env = _get_proc_env()
|
|
|
|
|
prog = _find_program('print-trace-sources', env).m_linktask.m_outputs[0].abspath(env)
|
|
|
|
|
out = open('doc/trace-source-list.h', 'w')
|
|
|
|
|
if subprocess.Popen([prog], stdout=out, env=proc_env).wait():
|
|
|
|
|
raise SystemExit(1)
|
|
|
|
|
out.close()
|
|
|
|
|
|
|
|
|
|
run_program('run-tests')
|
2007-10-02 11:10:31 +01:00
|
|
|
|
|
|
|
|
|
2007-07-07 18:10:54 +01:00
|
|
|
def _find_program(program_name, env):
|
|
|
|
|
launch_dir = os.path.abspath(Params.g_cwd_launch)
|
2007-07-05 14:44:00 +01:00
|
|
|
found_programs = []
|
2007-05-23 19:20:54 +01:00
|
|
|
for obj in Object.g_allobjs:
|
2007-07-05 14:44:00 +01:00
|
|
|
if obj.m_type != 'program' or not obj.target:
|
|
|
|
|
continue
|
2007-07-07 18:10:54 +01:00
|
|
|
|
|
|
|
|
## filter out programs not in the subtree starting at the launch dir
|
|
|
|
|
if not (obj.path.abspath().startswith(launch_dir)
|
|
|
|
|
or obj.path.abspath(env).startswith(launch_dir)):
|
|
|
|
|
continue
|
|
|
|
|
|
2007-07-05 14:44:00 +01:00
|
|
|
found_programs.append(obj.target)
|
2007-05-23 19:20:54 +01:00
|
|
|
if obj.target == program_name:
|
|
|
|
|
return obj
|
2007-07-05 14:48:21 +01:00
|
|
|
raise ValueError("program '%s' not found; available programs are: %r"
|
2007-07-05 14:44:00 +01:00
|
|
|
% (program_name, found_programs))
|
2007-05-23 19:20:54 +01:00
|
|
|
|
2007-10-02 11:10:31 +01:00
|
|
|
def _get_proc_env(os_env=None):
|
2007-05-23 19:20:54 +01:00
|
|
|
env = Params.g_build.env_of_name('default')
|
|
|
|
|
if sys.platform == 'linux2':
|
|
|
|
|
pathvar = 'LD_LIBRARY_PATH'
|
|
|
|
|
elif sys.platform == 'darwin':
|
|
|
|
|
pathvar = 'DYLD_LIBRARY_PATH'
|
|
|
|
|
elif sys.platform == 'win32':
|
|
|
|
|
pathvar = 'PATH'
|
2007-06-21 00:38:58 +01:00
|
|
|
elif sys.platform == 'cygwin':
|
|
|
|
|
pathvar = 'PATH'
|
2007-05-23 19:20:54 +01:00
|
|
|
else:
|
|
|
|
|
Params.warning(("Don't know how to configure "
|
|
|
|
|
"dynamic library path for the platform '%s'") % (sys.platform,))
|
|
|
|
|
pathvar = None
|
|
|
|
|
|
2007-08-01 21:35:34 +01:00
|
|
|
proc_env = dict(os.environ)
|
|
|
|
|
if os_env is not None:
|
|
|
|
|
proc_env.update(os_env)
|
|
|
|
|
|
2007-05-23 19:20:54 +01:00
|
|
|
if pathvar is not None:
|
2007-08-01 21:35:34 +01:00
|
|
|
if pathvar in proc_env:
|
|
|
|
|
proc_env[pathvar] = os.pathsep.join(list(env['NS3_MODULE_PATH']) + [proc_env[pathvar]])
|
2007-05-23 19:20:54 +01:00
|
|
|
else:
|
2007-08-01 21:35:34 +01:00
|
|
|
proc_env[pathvar] = os.pathsep.join(list(env['NS3_MODULE_PATH']))
|
2007-10-02 11:10:31 +01:00
|
|
|
return proc_env
|
2007-05-23 19:20:54 +01:00
|
|
|
|
2007-10-02 11:10:31 +01:00
|
|
|
def _run_argv(argv, os_env=None):
|
|
|
|
|
proc_env = _get_proc_env(os_env)
|
2007-08-01 21:35:34 +01:00
|
|
|
retval = subprocess.Popen(argv, env=proc_env).wait()
|
2007-05-23 19:20:54 +01:00
|
|
|
if retval:
|
2007-07-18 12:20:31 +01:00
|
|
|
Params.fatal("Command %s exited with code %i" % (argv, retval))
|
2007-05-23 19:20:54 +01:00
|
|
|
|
|
|
|
|
|
2007-07-18 12:20:31 +01:00
|
|
|
def run_program(program_string, command_template=None):
|
|
|
|
|
"""
|
|
|
|
|
if command_template is not None, then program_string == program
|
|
|
|
|
name and argv is given by command_template with %s replaced by the
|
|
|
|
|
full path to the program. Else, program_string is interpreted as
|
|
|
|
|
a shell command with first name being the program name.
|
|
|
|
|
"""
|
2007-05-23 19:20:54 +01:00
|
|
|
env = Params.g_build.env_of_name('default')
|
|
|
|
|
|
2007-07-18 12:20:31 +01:00
|
|
|
if command_template is None:
|
|
|
|
|
argv = shlex.split(program_string)
|
|
|
|
|
program_name = argv[0]
|
2007-07-18 11:43:39 +01:00
|
|
|
|
2007-07-18 12:20:31 +01:00
|
|
|
try:
|
|
|
|
|
program_obj = _find_program(program_name, env)
|
|
|
|
|
except ValueError, ex:
|
|
|
|
|
Params.fatal(str(ex))
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
program_node, = program_obj.m_linktask.m_outputs
|
|
|
|
|
except AttributeError:
|
|
|
|
|
Params.fatal("%s does not appear to be a program" % (program_name,))
|
|
|
|
|
|
|
|
|
|
execvec = [program_node.abspath(env)] + argv[1:]
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
|
|
program_name = program_string
|
|
|
|
|
try:
|
|
|
|
|
program_obj = _find_program(program_name, env)
|
|
|
|
|
except ValueError, ex:
|
|
|
|
|
Params.fatal(str(ex))
|
|
|
|
|
try:
|
|
|
|
|
program_node, = program_obj.m_linktask.m_outputs
|
|
|
|
|
except AttributeError:
|
|
|
|
|
Params.fatal("%s does not appear to be a program" % (program_name,))
|
|
|
|
|
|
|
|
|
|
execvec = shlex.split(command_template % (program_node.abspath(env),))
|
2007-05-23 19:20:54 +01:00
|
|
|
|
2007-07-08 12:24:22 +01:00
|
|
|
|
|
|
|
|
former_cwd = os.getcwd()
|
|
|
|
|
os.chdir(Params.g_cwd_launch)
|
|
|
|
|
try:
|
2007-07-18 12:20:31 +01:00
|
|
|
retval = _run_argv(execvec)
|
2007-07-08 12:24:22 +01:00
|
|
|
finally:
|
|
|
|
|
os.chdir(former_cwd)
|
2007-05-23 19:20:54 +01:00
|
|
|
|
2007-07-18 12:20:31 +01:00
|
|
|
return retval
|
|
|
|
|
|
2007-08-01 21:35:34 +01:00
|
|
|
def check_shell():
|
|
|
|
|
if 'NS3_MODULE_PATH' not in os.environ:
|
|
|
|
|
return
|
|
|
|
|
env = Params.g_build.env_of_name('default')
|
|
|
|
|
correct_modpath = os.pathsep.join(env['NS3_MODULE_PATH'])
|
|
|
|
|
found_modpath = os.environ['NS3_MODULE_PATH']
|
|
|
|
|
if found_modpath != correct_modpath:
|
|
|
|
|
msg = ("Detected shell (waf --shell) with incorrect configuration\n"
|
|
|
|
|
"=========================================================\n"
|
|
|
|
|
"Possible reasons for this problem:\n"
|
|
|
|
|
" 1. You switched to another ns-3 tree from inside this shell\n"
|
|
|
|
|
" 2. You switched ns-3 debug level (waf configure --debug)\n"
|
|
|
|
|
" 3. You modified the list of built ns-3 modules\n"
|
|
|
|
|
"You should correct this situation before running any program. Possible solutions:\n"
|
|
|
|
|
" 1. Exit this shell, and start a new one\n"
|
|
|
|
|
" 2. Run a new nested shell")
|
|
|
|
|
Params.fatal(msg)
|
|
|
|
|
|
2007-05-23 19:20:54 +01:00
|
|
|
|
|
|
|
|
def run_shell():
|
|
|
|
|
if sys.platform == 'win32':
|
|
|
|
|
shell = os.environ.get("COMSPEC", "cmd.exe")
|
|
|
|
|
else:
|
|
|
|
|
shell = os.environ.get("SHELL", "/bin/sh")
|
2007-08-01 21:35:34 +01:00
|
|
|
|
|
|
|
|
env = Params.g_build.env_of_name('default')
|
|
|
|
|
_run_argv([shell], {'NS3_MODULE_PATH': os.pathsep.join(env['NS3_MODULE_PATH'])})
|
2007-05-23 19:20:54 +01:00
|
|
|
|
2007-05-23 17:32:32 +01:00
|
|
|
|
|
|
|
|
def doxygen():
|
2007-10-03 13:58:01 +01:00
|
|
|
if not os.path.exists('doc/trace-source-list.h'):
|
|
|
|
|
Params.warning("doc/trace-source-list.h does not exist; run waf check to generate it.")
|
2007-10-02 11:10:31 +01:00
|
|
|
|
|
|
|
|
## run doxygen
|
2007-05-23 17:32:32 +01:00
|
|
|
doxygen_config = os.path.join('doc', 'doxygen.conf')
|
|
|
|
|
if subprocess.Popen(['doxygen', doxygen_config]).wait():
|
|
|
|
|
raise SystemExit(1)
|
|
|
|
|
|
|
|
|
|
def lcov_report():
|
|
|
|
|
env = Params.g_build.env_of_name('default')
|
|
|
|
|
variant_name = env['NS3_ACTIVE_VARIANT']
|
|
|
|
|
|
|
|
|
|
if 'gcov' not in variant_name:
|
|
|
|
|
Params.fatal("project not configured for code coverage;"
|
|
|
|
|
" reconfigure with --enable-gcov")
|
|
|
|
|
|
|
|
|
|
os.chdir(blddir)
|
|
|
|
|
try:
|
|
|
|
|
lcov_report_dir = os.path.join(variant_name, 'lcov-report')
|
|
|
|
|
create_dir_command = "rm -rf " + lcov_report_dir
|
|
|
|
|
create_dir_command += " && mkdir " + lcov_report_dir + ";"
|
|
|
|
|
|
|
|
|
|
if subprocess.Popen(create_dir_command, shell=True).wait():
|
|
|
|
|
raise SystemExit(1)
|
|
|
|
|
|
|
|
|
|
info_file = os.path.join(lcov_report_dir, variant_name + '.info')
|
|
|
|
|
lcov_command = "../utils/lcov/lcov -c -d . -o " + info_file
|
|
|
|
|
lcov_command += " --source-dirs=" + os.getcwd()
|
|
|
|
|
lcov_command += ":" + os.path.join(
|
|
|
|
|
os.getcwd(), variant_name, 'include')
|
|
|
|
|
if subprocess.Popen(lcov_command, shell=True).wait():
|
|
|
|
|
raise SystemExit(1)
|
|
|
|
|
|
|
|
|
|
genhtml_command = "../utils/lcov/genhtml -o " + lcov_report_dir
|
|
|
|
|
genhtml_command += " " + info_file
|
|
|
|
|
if subprocess.Popen(genhtml_command, shell=True).wait():
|
2007-05-07 12:01:51 +01:00
|
|
|
raise SystemExit(1)
|
2007-05-23 17:32:32 +01:00
|
|
|
finally:
|
|
|
|
|
os.chdir("..")
|
2007-05-07 12:01:51 +01:00
|
|
|
|