View | Details | Raw Unified | Return to bug 1562
Collapse All | Expand All

(-)a/bindings/python/wscript (-27 / +15 lines)
 Lines 6-30    Link Here 
6
import shutil
6
import shutil
7
import sys
7
import sys
8
8
9
import Task
9
from waflib import Task, Options, Configure, TaskGen, Logs, Build, Utils, Errors
10
import Options
10
from waflib.Errors import WafError
11
import Configure
12
import TaskGen
13
import Logs
14
import Build
15
import Utils
16
11
17
from waflib.Errors import WafError
12
feature  = TaskGen.feature
13
after = TaskGen.after
18
14
19
## https://launchpad.net/pybindgen/
15
## https://launchpad.net/pybindgen/
20
REQUIRED_PYBINDGEN_VERSION = (0, 15, 0, 809)
16
REQUIRED_PYBINDGEN_VERSION = (0, 15, 0, 809)
21
REQUIRED_PYGCCXML_VERSION = (0, 9, 5)
17
REQUIRED_PYGCCXML_VERSION = (0, 9, 5)
22
18
23
19
24
from TaskGen import feature, after
25
import Task
26
27
28
20
29
def add_to_python_path(path):
21
def add_to_python_path(path):
30
    if os.environ.get('PYTHONPATH', ''):
22
    if os.environ.get('PYTHONPATH', ''):
 Lines 38-44    Link Here 
38
30
39
31
40
def options(opt):
32
def options(opt):
41
    opt.tool_options('python')
33
    opt.load('python')
42
    opt.add_option('--disable-python',
34
    opt.add_option('--disable-python',
43
                   help=("Don't build Python bindings."),
35
                   help=("Don't build Python bindings."),
44
                   action="store_true", default=False,
36
                   action="store_true", default=False,
 Lines 76-82    Link Here 
76
    available_modules.sort()
68
    available_modules.sort()
77
    all_modules_enabled = (enabled_modules == available_modules)
69
    all_modules_enabled = (enabled_modules == available_modules)
78
70
79
    conf.check_tool('misc', tooldir=['waf-tools'])
71
    conf.load('misc', tooldir=['waf-tools'])
80
72
81
    if sys.platform == 'cygwin':
73
    if sys.platform == 'cygwin':
82
        conf.report_optional_feature("python", "Python Bindings", False,
74
        conf.report_optional_feature("python", "Python Bindings", False,
 Lines 91-110    Link Here 
91
        conf.env.PYTHON = Options.options.with_python
83
        conf.env.PYTHON = Options.options.with_python
92
84
93
    try:
85
    try:
94
        conf.check_tool('python')
86
        conf.load('python')
95
    except Configure.ConfigurationError, ex:
87
    except Errors.ConfigurationError, ex:
96
        conf.report_optional_feature("python", "Python Bindings", False,
88
        conf.report_optional_feature("python", "Python Bindings", False,
97
                                     "The python interpreter was not found")
89
                                     "The python interpreter was not found")
98
        return
90
        return
99
    try:
91
    try:
100
        conf.check_python_version((2,3))
92
        conf.check_python_version((2,3))
101
    except Configure.ConfigurationError, ex:
93
    except Errors.ConfigurationError, ex:
102
        conf.report_optional_feature("python", "Python Bindings", False,
94
        conf.report_optional_feature("python", "Python Bindings", False,
103
                                     "The python found version is too low (2.3 required)")
95
                                     "The python found version is too low (2.3 required)")
104
        return
96
        return
105
    try:
97
    try:
106
        conf.check_python_headers()
98
        conf.check_python_headers()
107
    except Configure.ConfigurationError, ex:
99
    except Errors.ConfigurationError, ex:
108
        conf.report_optional_feature("python", "Python Bindings", False,
100
        conf.report_optional_feature("python", "Python Bindings", False,
109
                                     "Python library or headers missing")
101
                                     "Python library or headers missing")
110
        return
102
        return
 Lines 161-167    Link Here 
161
153
162
    try:
154
    try:
163
        conf.check_python_module('pybindgen')
155
        conf.check_python_module('pybindgen')
164
    except Configure.ConfigurationError:
156
    except Errors.ConfigurationError:
165
        Logs.warn("pybindgen missing => no python bindings")
157
        Logs.warn("pybindgen missing => no python bindings")
166
        conf.report_optional_feature("python", "Python Bindings", False,
158
        conf.report_optional_feature("python", "Python Bindings", False,
167
                                     "PyBindGen missing")
159
                                     "PyBindGen missing")
 Lines 197-205    Link Here 
197
189
198
        try:
190
        try:
199
            ret = conf.run_c_code(code=test_program,
191
            ret = conf.run_c_code(code=test_program,
200
                                  env=conf.env.copy(), compile_filename='test.cc',
192
                                  env=conf.env.derive(), compile_filename='test.cc',
201
                                  features='cxx cprogram', execute=False)
193
                                  features='cxx cprogram', execute=False)
202
        except Configure.ConfigurationError:
194
        except Errors.ConfigurationError:
203
            ret = 1
195
            ret = 1
204
        conf.msg('Checking for types %s and %s equivalence' % (t1, t2), (ret and 'no' or 'yes'))
196
        conf.msg('Checking for types %s and %s equivalence' % (t1, t2), (ret and 'no' or 'yes'))
205
        return not ret
197
        return not ret
 Lines 250-256    Link Here 
250
    ## Check for pygccxml
242
    ## Check for pygccxml
251
    try:
243
    try:
252
        conf.check_python_module('pygccxml')
244
        conf.check_python_module('pygccxml')
253
    except Configure.ConfigurationError:
245
    except Errors.ConfigurationError:
254
        conf.report_optional_feature("pygccxml", "Python API Scanning Support", False,
246
        conf.report_optional_feature("pygccxml", "Python API Scanning Support", False,
255
                                     "Missing 'pygccxml' Python module")
247
                                     "Missing 'pygccxml' Python module")
256
        return
248
        return
 Lines 437-444    Link Here 
437
        return
429
        return
438
430
439
    env = bld.env
431
    env = bld.env
440
    curdir = bld.path.abspath()
441
442
    set_pybindgen_pythonpath(env)
432
    set_pybindgen_pythonpath(env)
443
433
444
    if Options.options.apiscan:
434
    if Options.options.apiscan:
 Lines 489-497    Link Here 
489
        grp = bld.get_group(bld.current_group)
479
        grp = bld.get_group(bld.current_group)
490
        grp.append(task)
480
        grp.append(task)
491
481
492
        bld.new_task_gen(features='copy',
482
        bld(features='copy', source="ns__init__.py", target='ns/__init__.py')
493
                         source="ns__init__.py",
494
                         target='ns/__init__.py')
495
        bld.install_as('${PYTHONARCHDIR}/ns/__init__.py', 'ns__init__.py')
483
        bld.install_as('${PYTHONARCHDIR}/ns/__init__.py', 'ns__init__.py')
496
484
497
485
(-)a/src/antenna/wscript (-1 / +1 lines)
 Lines 21-27    Link Here 
21
        'test/test-parabolic-antenna.cc',
21
        'test/test-parabolic-antenna.cc',
22
        ]
22
        ]
23
    
23
    
24
    headers = bld.new_task_gen(features=['ns3header'])
24
    headers = bld(features='ns3header')
25
    headers.module = 'antenna'
25
    headers.module = 'antenna'
26
    headers.source = [
26
    headers.source = [
27
        'model/angles.h',
27
        'model/angles.h',
(-)a/src/aodv/wscript (-2 / +2 lines)
 Lines 23-29    Link Here 
23
        'test/loopback.cc',
23
        'test/loopback.cc',
24
        ]
24
        ]
25
25
26
    headers = bld.new_task_gen(features=['ns3header'])
26
    headers = bld(features='ns3header')
27
    headers.module = 'aodv'
27
    headers.module = 'aodv'
28
    headers.source = [
28
    headers.source = [
29
        'model/aodv-id-cache.h',
29
        'model/aodv-id-cache.h',
 Lines 37-42    Link Here 
37
        ]
37
        ]
38
38
39
    if bld.env['ENABLE_EXAMPLES']:
39
    if bld.env['ENABLE_EXAMPLES']:
40
        bld.add_subdirs('examples')
40
        bld.recurse('examples')
41
41
42
    bld.ns3_python_bindings()
42
    bld.ns3_python_bindings()
(-)a/src/applications/wscript (-1 / +1 lines)
 Lines 32-38    Link Here 
32
        'test/udp-client-server-test.cc',
32
        'test/udp-client-server-test.cc',
33
        ]
33
        ]
34
34
35
    headers = bld.new_task_gen(features=['ns3header'])
35
    headers = bld(features='ns3header')
36
    headers.module = 'applications'
36
    headers.module = 'applications'
37
    headers.source = [
37
    headers.source = [
38
        'model/bulk-send-application.h',
38
        'model/bulk-send-application.h',
(-)a/src/bridge/wscript (-2 / +2 lines)
 Lines 7-13    Link Here 
7
        'model/bridge-channel.cc',
7
        'model/bridge-channel.cc',
8
        'helper/bridge-helper.cc',
8
        'helper/bridge-helper.cc',
9
        ]
9
        ]
10
    headers = bld.new_task_gen(features=['ns3header'])
10
    headers = bld(features='ns3header')
11
    headers.module = 'bridge'
11
    headers.module = 'bridge'
12
    headers.source = [
12
    headers.source = [
13
        'model/bridge-net-device.h',
13
        'model/bridge-net-device.h',
 Lines 16-21    Link Here 
16
        ]
16
        ]
17
17
18
    if bld.env['ENABLE_EXAMPLES']:
18
    if bld.env['ENABLE_EXAMPLES']:
19
        bld.add_subdirs('examples')
19
        bld.recurse('examples')
20
20
21
    bld.ns3_python_bindings()
21
    bld.ns3_python_bindings()
(-)a/src/brite/wscript (-3 / +5 lines)
 Lines 1-6    Link Here 
1
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
1
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
2
2
import os
3
import os
3
import Options
4
5
from waflib import Options
4
6
5
7
6
def options(opt):
8
def options(opt):
 Lines 89-95    Link Here 
89
    if bld.env['BRITE'] and bld.env['DL']:
91
    if bld.env['BRITE'] and bld.env['DL']:
90
        module.uselib = 'BRITE DL'
92
        module.uselib = 'BRITE DL'
91
93
92
    headers = bld.new_task_gen(features=['ns3header'])
94
    headers = bld.new_task_gen(features='ns3header')
93
    headers.module = 'brite'
95
    headers.module = 'brite'
94
    headers.source = [
96
    headers.source = [
95
        ]
97
        ]
 Lines 100-103    Link Here 
100
        module_test.source.append('test/brite-test-topology.cc')
102
        module_test.source.append('test/brite-test-topology.cc')
101
103
102
    if bld.env['ENABLE_EXAMPLES'] and bld.env['ENABLE_BRITE']:
104
    if bld.env['ENABLE_EXAMPLES'] and bld.env['ENABLE_BRITE']:
103
      bld.add_subdirs('examples')
105
      bld.recurse('examples')
(-)a/src/buildings/wscript (-2 / +2 lines)
 Lines 25-31    Link Here 
25
        'test/buildings-shadowing-test.cc',
25
        'test/buildings-shadowing-test.cc',
26
        ]
26
        ]
27
    
27
    
28
    headers = bld.new_task_gen(features=['ns3header'])
28
    headers = bld(features='ns3header')
29
    headers.module = 'buildings'
29
    headers.module = 'buildings'
30
    headers.source = [
30
    headers.source = [
31
        'model/building.h',
31
        'model/building.h',
 Lines 42-48    Link Here 
42
        ]
42
        ]
43
43
44
    if (bld.env['ENABLE_EXAMPLES']):
44
    if (bld.env['ENABLE_EXAMPLES']):
45
        bld.add_subdirs('examples')
45
        bld.recurse('examples')
46
46
47
47
48
    bld.ns3_python_bindings()
48
    bld.ns3_python_bindings()
(-)a/src/click/wscript (-3 / +4 lines)
 Lines 1-7    Link Here 
1
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
1
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
2
2
3
import os
3
import os
4
import Options
4
5
from waflib import Options
5
6
6
7
7
def options(opt):
8
def options(opt):
 Lines 107-113    Link Here 
107
        module.use.extend(['NSCLICK', 'DL'])
108
        module.use.extend(['NSCLICK', 'DL'])
108
        module_test.use.extend(['NSCLICK', 'DL'])
109
        module_test.use.extend(['NSCLICK', 'DL'])
109
110
110
    headers = bld.new_task_gen(features=['ns3header'])
111
    headers = bld(features='ns3header')
111
    headers.module = 'click'
112
    headers.module = 'click'
112
    headers.source = [
113
    headers.source = [
113
        'model/ipv4-click-routing.h',
114
        'model/ipv4-click-routing.h',
 Lines 116-121    Link Here 
116
        ]
117
        ]
117
118
118
    if bld.env['ENABLE_EXAMPLES']:
119
    if bld.env['ENABLE_EXAMPLES']:
119
        bld.add_subdirs('examples')
120
        bld.recurse('examples')
120
121
121
    bld.ns3_python_bindings()
122
    bld.ns3_python_bindings()
(-)a/src/config-store/wscript (-12 / +16 lines)
 Lines 11-35    Link Here 
11
11
12
def configure(conf):
12
def configure(conf):
13
    if Options.options.disable_gtk:
13
    if Options.options.disable_gtk:
14
        conf.env['ENABLE_GTK_CONFIG_STORE'] = False
14
        conf.env['ENABLE_GTK2'] = False
15
        conf.report_optional_feature("GtkConfigStore", "GtkConfigStore",
15
        conf.report_optional_feature("GtkConfigStore", "GtkConfigStore",
16
                                     conf.env['ENABLE_GTK_CONFIG_STORE'],
16
                                     conf.env['ENABLE_GTK2'],
17
                                     "--disable-gtk option given")
17
                                     "--disable-gtk option given")
18
    else:
18
    else:
19
        have_gtk = conf.pkg_check_modules('GTK_CONFIG_STORE', 'gtk+-2.0 >= 2.12', mandatory=False)
19
        have_gtk2 = conf.check_cfg(package='gtk+-2.0', atleast_version='2.12', 
20
        conf.env['ENABLE_GTK_CONFIG_STORE'] = have_gtk
20
                                   args=['--cflags', '--libs'], uselib_store='GTK2',
21
                                   mandatory=False)
22
23
        conf.env['ENABLE_GTK2'] = have_gtk2
21
        conf.report_optional_feature("GtkConfigStore", "GtkConfigStore",
24
        conf.report_optional_feature("GtkConfigStore", "GtkConfigStore",
22
                                     conf.env['ENABLE_GTK_CONFIG_STORE'],
25
                                     conf.env['ENABLE_GTK2'],
23
                                     "library 'gtk+-2.0 >= 2.12' not found")
26
                                     "library 'gtk+-2.0 >= 2.12' not found")
24
27
25
    have_libxml2 = conf.pkg_check_modules('LIBXML2', 'libxml-2.0 >= 2.6', mandatory=False)
28
    have_libxml2 = conf.check_cfg(package='libxml-2.0', atleast_version='2.7',
26
    if have_libxml2:
29
                                  args=['--cflags', '--libs'], uselib_store='LIBXML2',
27
        conf.define('HAVE_LIBXML2', 1)
30
                                  mandatory=False)
28
31
29
    conf.env['ENABLE_LIBXML2'] = have_libxml2
32
    conf.env['ENABLE_LIBXML2'] = have_libxml2
30
    conf.report_optional_feature("XmlIo", "XmlIo",
33
    conf.report_optional_feature("XmlIo", "XmlIo",
31
                                 conf.env['ENABLE_LIBXML2'],
34
                                 conf.env['ENABLE_LIBXML2'],
32
                                 "library 'libxml-2.0 >= 2.7' not found")
35
                                 "library 'libxml-2.0 >= 2.7' not found")
36
33
    conf.write_config_header('ns3/config-store-config.h', top=True)
37
    conf.write_config_header('ns3/config-store-config.h', top=True)
34
38
35
39
 Lines 45-71    Link Here 
45
        'model/raw-text-config.cc',
49
        'model/raw-text-config.cc',
46
        ]
50
        ]
47
51
48
    headers = bld.new_task_gen(features=['ns3header'])
52
    headers = bld(features='ns3header')
49
    headers.module = 'config-store'
53
    headers.module = 'config-store'
50
    headers.source = [
54
    headers.source = [
51
        'model/file-config.h',
55
        'model/file-config.h',
52
        'model/config-store.h',
56
        'model/config-store.h',
53
        ]
57
        ]
54
58
55
    if bld.env['ENABLE_GTK_CONFIG_STORE']:
59
    if bld.env['ENABLE_GTK2']:
56
        headers.source.append ('model/gtk-config-store.h')
60
        headers.source.append ('model/gtk-config-store.h')
57
        module.source.extend (['model/gtk-config-store.cc',
61
        module.source.extend (['model/gtk-config-store.cc',
58
                               'model/model-node-creator.cc',
62
                               'model/model-node-creator.cc',
59
                               'model/model-typeid-creator.cc',
63
                               'model/model-typeid-creator.cc',
60
                               'model/display-functions.cc',
64
                               'model/display-functions.cc',
61
                               ])
65
                               ])
62
        module.use.append('GTK_CONFIG_STORE')
66
        module.use.append('GTK2')
63
67
64
    if bld.env['ENABLE_LIBXML2']:
68
    if bld.env['ENABLE_LIBXML2']:
65
        module.source.append ('model/xml-config.cc')
69
        module.source.append ('model/xml-config.cc')
66
        module.use.append('LIBXML2')
70
        module.use.append('LIBXML2')
67
71
68
    if bld.env['ENABLE_EXAMPLES']:
72
    if bld.env['ENABLE_EXAMPLES']:
69
        bld.add_subdirs('examples')
73
        bld.recurse('examples')
70
74
71
    bld.ns3_python_bindings()
75
    bld.ns3_python_bindings()
(-)a/src/core/wscript (-5 / +4 lines)
 Lines 1-8    Link Here 
1
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
1
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
2
import sys
2
import sys
3
3
4
import Options
4
from waflib import Options
5
6
import wutils
5
import wutils
7
6
8
def options(opt):
7
def options(opt):
 Lines 49-55    Link Here 
49
    conf.check_nonfatal(header_name='signal.h', define_name='HAVE_SIGNAL_H')
48
    conf.check_nonfatal(header_name='signal.h', define_name='HAVE_SIGNAL_H')
50
49
51
    # Check for POSIX threads
50
    # Check for POSIX threads
52
    test_env = conf.env.copy()
51
    test_env = conf.env.derive()
53
    if Options.platform != 'darwin' and Options.platform != 'cygwin':
52
    if Options.platform != 'darwin' and Options.platform != 'cygwin':
54
        test_env.append_value('LINKFLAGS', '-pthread')
53
        test_env.append_value('LINKFLAGS', '-pthread')
55
        test_env.append_value('CXXFLAGS', '-pthread')
54
        test_env.append_value('CXXFLAGS', '-pthread')
 Lines 173-179    Link Here 
173
        'test/watchdog-test-suite.cc',
172
        'test/watchdog-test-suite.cc',
174
        ]
173
        ]
175
174
176
    headers = bld.new_task_gen(features=['ns3header'])
175
    headers = bld(features='ns3header')
177
    headers.module = 'core'
176
    headers.module = 'core'
178
    headers.source = [
177
    headers.source = [
179
        'model/nstime.h',
178
        'model/nstime.h',
 Lines 309-315    Link Here 
309
        core_test.source.extend(['test/rng-test-suite.cc'])
308
        core_test.source.extend(['test/rng-test-suite.cc'])
310
309
311
    if (bld.env['ENABLE_EXAMPLES']):
310
    if (bld.env['ENABLE_EXAMPLES']):
312
        bld.add_subdirs('examples')
311
        bld.recurse('examples')
313
312
314
    pymod = bld.ns3_python_bindings()
313
    pymod = bld.ns3_python_bindings()
315
    if pymod is not None:
314
    if pymod is not None:
(-)a/src/csma-layout/wscript (-2 / +2 lines)
 Lines 5-18    Link Here 
5
    obj.source = [
5
    obj.source = [
6
        'model/csma-star-helper.cc',
6
        'model/csma-star-helper.cc',
7
        ]
7
        ]
8
    headers = bld.new_task_gen(features=['ns3header'])
8
    headers = bld(features='ns3header')
9
    headers.module = 'csma-layout'
9
    headers.module = 'csma-layout'
10
    headers.source = [
10
    headers.source = [
11
        'model/csma-star-helper.h',
11
        'model/csma-star-helper.h',
12
        ]
12
        ]
13
13
14
    if bld.env['ENABLE_EXAMPLES']:
14
    if bld.env['ENABLE_EXAMPLES']:
15
        bld.add_subdirs('examples')
15
        bld.recurse('examples')
16
16
17
    bld.ns3_python_bindings()
17
    bld.ns3_python_bindings()
18
18
(-)a/src/csma/wscript (-2 / +2 lines)
 Lines 8-14    Link Here 
8
        'model/csma-channel.cc',
8
        'model/csma-channel.cc',
9
        'helper/csma-helper.cc',
9
        'helper/csma-helper.cc',
10
        ]
10
        ]
11
    headers = bld.new_task_gen(features=['ns3header'])
11
    headers = bld(features='ns3header')
12
    headers.module = 'csma'
12
    headers.module = 'csma'
13
    headers.source = [
13
    headers.source = [
14
        'model/backoff.h',
14
        'model/backoff.h',
 Lines 18-23    Link Here 
18
        ]
18
        ]
19
19
20
    if bld.env['ENABLE_EXAMPLES']:
20
    if bld.env['ENABLE_EXAMPLES']:
21
        bld.add_subdirs('examples')
21
        bld.recurse('examples')
22
22
23
    bld.ns3_python_bindings()
23
    bld.ns3_python_bindings()
(-)a/src/dsdv/wscript (-2 / +2 lines)
 Lines 16-22    Link Here 
16
        'test/dsdv-testcase.cc',
16
        'test/dsdv-testcase.cc',
17
        ]
17
        ]
18
18
19
    headers = bld.new_task_gen(features=['ns3header'])
19
    headers = bld(features='ns3header')
20
    headers.module = 'dsdv'
20
    headers.module = 'dsdv'
21
    headers.source = [
21
    headers.source = [
22
        'model/dsdv-rtable.h',
22
        'model/dsdv-rtable.h',
 Lines 26-31    Link Here 
26
        'helper/dsdv-helper.h',
26
        'helper/dsdv-helper.h',
27
        ]
27
        ]
28
    if (bld.env['ENABLE_EXAMPLES']):
28
    if (bld.env['ENABLE_EXAMPLES']):
29
      bld.add_subdirs('examples')
29
      bld.recurse('examples')
30
30
31
    bld.ns3_python_bindings()
31
    bld.ns3_python_bindings()
(-)a/src/dsr/wscript (-2 / +2 lines)
 Lines 24-30    Link Here 
24
        'test/dsr-test-suite.cc',
24
        'test/dsr-test-suite.cc',
25
        ]
25
        ]
26
        
26
        
27
    headers = bld.new_task_gen(features=['ns3header'])
27
    headers = bld(features='ns3header')
28
    headers.module = 'dsr'
28
    headers.module = 'dsr'
29
    headers.source = [
29
    headers.source = [
30
        'model/dsr-routing.h',
30
        'model/dsr-routing.h',
 Lines 43-48    Link Here 
43
        ]
43
        ]
44
44
45
    if (bld.env['ENABLE_EXAMPLES']):
45
    if (bld.env['ENABLE_EXAMPLES']):
46
      bld.add_subdirs('examples')
46
      bld.recurse('examples')
47
47
48
    bld.ns3_python_bindings()
48
    bld.ns3_python_bindings()
(-)a/src/emu/wscript (-2 / +2 lines)
 Lines 36-42    Link Here 
36
            'helper/emu-helper.cc',
36
            'helper/emu-helper.cc',
37
        ]
37
        ]
38
38
39
    headers = bld.new_task_gen(features=['ns3header'])
39
    headers = bld(features='ns3header')
40
    headers.module = 'emu'
40
    headers.module = 'emu'
41
    headers.source = [
41
    headers.source = [
42
            'model/emu-net-device.h',
42
            'model/emu-net-device.h',
 Lines 52-57    Link Here 
52
    module.env.append_value("DEFINES", "EMU_SOCK_CREATOR=\"%s\"" % (creator.target,))
52
    module.env.append_value("DEFINES", "EMU_SOCK_CREATOR=\"%s\"" % (creator.target,))
53
53
54
    if bld.env['ENABLE_EXAMPLES']:
54
    if bld.env['ENABLE_EXAMPLES']:
55
        bld.add_subdirs('examples')
55
        bld.recurse('examples')
56
56
57
    bld.ns3_python_bindings()
57
    bld.ns3_python_bindings()
(-)a/src/energy/wscript (-2 / +2 lines)
 Lines 25-31    Link Here 
25
        'test/li-ion-energy-source-test.cc',
25
        'test/li-ion-energy-source-test.cc',
26
        ]
26
        ]
27
27
28
    headers = bld.new_task_gen(features=['ns3header'])
28
    headers = bld(features='ns3header')
29
    headers.module = 'energy'
29
    headers.module = 'energy'
30
    headers.source = [
30
    headers.source = [
31
        'model/wifi-radio-energy-model.h',
31
        'model/wifi-radio-energy-model.h',
 Lines 44-49    Link Here 
44
        ]
44
        ]
45
45
46
    if (bld.env['ENABLE_EXAMPLES']):
46
    if (bld.env['ENABLE_EXAMPLES']):
47
      bld.add_subdirs('examples')
47
      bld.recurse('examples')
48
48
49
    bld.ns3_python_bindings()
49
    bld.ns3_python_bindings()
(-)a/src/flow-monitor/wscript (-2 / +2 lines)
 Lines 17-23    Link Here 
17
        'test/histogram-test-suite.cc',
17
        'test/histogram-test-suite.cc',
18
        ]
18
        ]
19
19
20
    headers = bld.new_task_gen(features=['ns3header'])
20
    headers = bld(features='ns3header')
21
    headers.module = 'flow-monitor'
21
    headers.module = 'flow-monitor'
22
    headers.source = ["model/%s" % s for s in [
22
    headers.source = ["model/%s" % s for s in [
23
       'flow-monitor.h',
23
       'flow-monitor.h',
 Lines 30-35    Link Here 
30
    headers.source.append("helper/flow-monitor-helper.h")
30
    headers.source.append("helper/flow-monitor-helper.h")
31
31
32
    if bld.env['ENABLE_EXAMPLES']:
32
    if bld.env['ENABLE_EXAMPLES']:
33
        bld.add_subdirs('examples')
33
        bld.recurse('examples')
34
34
35
    bld.ns3_python_bindings()
35
    bld.ns3_python_bindings()
(-)a/src/internet/wscript (-6 / +4 lines)
 Lines 2-11    Link Here 
2
import os
2
import os
3
import sys
3
import sys
4
4
5
import Options
5
from waflib import Options, Logs, Utils, Task
6
import Logs
6
7
import Utils
8
import Task
9
7
10
# Required NSC version
8
# Required NSC version
11
NSC_RELEASE_NAME = "nsc-0.5.3"
9
NSC_RELEASE_NAME = "nsc-0.5.3"
 Lines 210-216    Link Here 
210
        'test/ipv6-address-helper-test-suite.cc',
208
        'test/ipv6-address-helper-test-suite.cc',
211
        ]
209
        ]
212
210
213
    headers = bld.new_task_gen(features=['ns3header'])
211
    headers = bld(features='ns3header')
214
    headers.module = 'internet'
212
    headers.module = 'internet'
215
    headers.source = [
213
    headers.source = [
216
        'model/udp-header.h',
214
        'model/udp-header.h',
 Lines 294-300    Link Here 
294
        internet_test.use.append('DL')
292
        internet_test.use.append('DL')
295
293
296
    if (bld.env['ENABLE_EXAMPLES']):
294
    if (bld.env['ENABLE_EXAMPLES']):
297
        bld.add_subdirs('examples')
295
        bld.recurse('examples')
298
296
299
    bld.ns3_python_bindings()
297
    bld.ns3_python_bindings()
300
298
(-)a/src/lte/wscript (-2 / +2 lines)
 Lines 114-120    Link Here 
114
        'test/lte-test-mimo.cc'
114
        'test/lte-test-mimo.cc'
115
        ]
115
        ]
116
116
117
    headers = bld.new_task_gen(features=['ns3header'])
117
    headers = bld(features='ns3header')
118
    headers.module = 'lte'
118
    headers.module = 'lte'
119
    headers.source = [
119
    headers.source = [
120
        'model/lte-common.h',
120
        'model/lte-common.h',
 Lines 190-195    Link Here 
190
        ]
190
        ]
191
191
192
    if (bld.env['ENABLE_EXAMPLES']):
192
    if (bld.env['ENABLE_EXAMPLES']):
193
      bld.add_subdirs('examples')
193
      bld.recurse('examples')
194
194
195
    bld.ns3_python_bindings()
195
    bld.ns3_python_bindings()
(-)a/src/mesh/wscript (-2 / +2 lines)
 Lines 53-59    Link Here 
53
        'test/flame/regression.cc',
53
        'test/flame/regression.cc',
54
        ]
54
        ]
55
55
56
    headers = bld.new_task_gen(features=['ns3header'])
56
    headers = bld(features='ns3header')
57
    headers.module = 'mesh'
57
    headers.module = 'mesh'
58
    headers.source = [
58
    headers.source = [
59
        'model/mesh-information-element.h',
59
        'model/mesh-information-element.h',
 Lines 90-95    Link Here 
90
        ]
90
        ]
91
91
92
    if bld.env['ENABLE_EXAMPLES']:
92
    if bld.env['ENABLE_EXAMPLES']:
93
        bld.add_subdirs('examples')
93
        bld.recurse('examples')
94
94
95
    bld.ns3_python_bindings()
95
    bld.ns3_python_bindings()
(-)a/src/mobility/wscript (-2 / +2 lines)
 Lines 31-37    Link Here 
31
        'test/waypoint-mobility-model-test.cc',
31
        'test/waypoint-mobility-model-test.cc',
32
        ]
32
        ]
33
33
34
    headers = bld.new_task_gen(features=['ns3header'])
34
    headers = bld(features='ns3header')
35
    headers.module = 'mobility'
35
    headers.module = 'mobility'
36
    headers.source = [
36
    headers.source = [
37
        'model/box.h',
37
        'model/box.h',
 Lines 55-60    Link Here 
55
        ]
55
        ]
56
56
57
    if (bld.env['ENABLE_EXAMPLES']):
57
    if (bld.env['ENABLE_EXAMPLES']):
58
        bld.add_subdirs('examples')
58
        bld.recurse('examples')
59
59
60
    bld.ns3_python_bindings()
60
    bld.ns3_python_bindings()
(-)a/src/mpi/wscript (-3 / +4 lines)
 Lines 1-7    Link Here 
1
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
1
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
2
import sys
2
import sys
3
import subprocess
3
import subprocess
4
import Options
4
5
from waflib import Options
5
from waflib.Errors import WafError
6
from waflib.Errors import WafError
6
7
7
def configure(conf):
8
def configure(conf):
 Lines 39-45    Link Here 
39
        'model/mpi-receiver.cc',
40
        'model/mpi-receiver.cc',
40
        ]
41
        ]
41
42
42
    headers = bld.new_task_gen(features=['ns3header'])
43
    headers = bld(features='ns3header')
43
    headers.module = 'mpi'
44
    headers.module = 'mpi'
44
    headers.source = [
45
    headers.source = [
45
        'model/distributed-simulator-impl.h',
46
        'model/distributed-simulator-impl.h',
 Lines 51-56    Link Here 
51
        sim.use.append('MPI')
52
        sim.use.append('MPI')
52
53
53
    if bld.env['ENABLE_EXAMPLES']:
54
    if bld.env['ENABLE_EXAMPLES']:
54
        bld.add_subdirs('examples')
55
        bld.recurse('examples')
55
      
56
      
56
    bld.ns3_python_bindings()
57
    bld.ns3_python_bindings()
(-)a/src/netanim/wscript (-2 / +2 lines)
 Lines 18-24    Link Here 
18
        	'test/netanim-test.cc',
18
        	'test/netanim-test.cc',
19
        ]
19
        ]
20
20
21
	headers = bld.new_task_gen (features=['ns3header'])
21
	headers = bld(features='ns3header')
22
	headers.module = 'netanim'
22
	headers.module = 'netanim'
23
	headers.source = [
23
	headers.source = [
24
			  'model/animation-interface.h',
24
			  'model/animation-interface.h',
 Lines 26-30    Link Here 
26
  			 ]
26
  			 ]
27
27
28
	if (bld.env['ENABLE_EXAMPLES']) :
28
	if (bld.env['ENABLE_EXAMPLES']) :
29
		bld.add_subdirs ('examples')
29
		bld.recurse('examples')
30
30
(-)a/src/network/wscript (-2 / +2 lines)
 Lines 71-77    Link Here 
71
        'test/sequence-number-test-suite.cc',
71
        'test/sequence-number-test-suite.cc',
72
        ]
72
        ]
73
73
74
    headers = bld.new_task_gen(features=['ns3header'])
74
    headers = bld(features='ns3header')
75
    headers.module = 'network'
75
    headers.module = 'network'
76
    headers.source = [
76
    headers.source = [
77
        'model/address.h',
77
        'model/address.h',
 Lines 135-140    Link Here 
135
        ]
135
        ]
136
136
137
    if (bld.env['ENABLE_EXAMPLES']):
137
    if (bld.env['ENABLE_EXAMPLES']):
138
        bld.add_subdirs('examples')
138
        bld.recurse('examples')
139
139
140
    bld.ns3_python_bindings()
140
    bld.ns3_python_bindings()
(-)a/src/nix-vector-routing/wscript (-2 / +2 lines)
 Lines 8-14    Link Here 
8
	'helper/ipv4-nix-vector-helper.cc',
8
	'helper/ipv4-nix-vector-helper.cc',
9
        ]
9
        ]
10
10
11
    headers = bld.new_task_gen(features=['ns3header'])
11
    headers = bld(features='ns3header')
12
    headers.module = 'nix-vector-routing'
12
    headers.module = 'nix-vector-routing'
13
    headers.source = [
13
    headers.source = [
14
        'model/ipv4-nix-vector-routing.h',
14
        'model/ipv4-nix-vector-routing.h',
 Lines 16-21    Link Here 
16
        ]
16
        ]
17
17
18
    if bld.env['ENABLE_EXAMPLES']:
18
    if bld.env['ENABLE_EXAMPLES']:
19
        bld.add_subdirs('examples')
19
        bld.recurse('examples')
20
20
21
    bld.ns3_python_bindings()
21
    bld.ns3_python_bindings()
(-)a/src/olsr/wscript (-2 / +2 lines)
 Lines 20-26    Link Here 
20
        'test/tc-regression-test.cc',
20
        'test/tc-regression-test.cc',
21
        ]
21
        ]
22
22
23
    headers = bld.new_task_gen(features=['ns3header'])
23
    headers = bld(features='ns3header')
24
    headers.module = 'olsr'
24
    headers.module = 'olsr'
25
    headers.source = [
25
    headers.source = [
26
        'model/olsr-routing-protocol.h',
26
        'model/olsr-routing-protocol.h',
 Lines 32-37    Link Here 
32
32
33
33
34
    if bld.env['ENABLE_EXAMPLES']:
34
    if bld.env['ENABLE_EXAMPLES']:
35
        bld.add_subdirs('examples')
35
        bld.recurse('examples')
36
36
37
    bld.ns3_python_bindings()
37
    bld.ns3_python_bindings()
(-)a/src/openflow/wscript (-12 / +12 lines)
 Lines 1-27    Link Here 
1
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
1
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
2
2
3
import os
3
import os
4
import Options
4
5
from waflib import Options
5
from waflib.Errors import WafError
6
from waflib.Errors import WafError
6
7
7
def options(opt):
8
def options(opt):
8
    opt.add_option('--with-openflow',
9
    opt.add_option('--with-openflow',
9
		   help=('Path to OFSID source for NS-3 OpenFlow Integration support'),
10
		   help=('Path to OFSID source for NS-3 OpenFlow Integration support'),
10
		   default='', dest='with_openflow')
11
		   default='', dest='with_openflow')
11
    opt.tool_options('boost', tooldir=["waf-tools"])
12
    opt.load('boost', tooldir=["waf-tools"])
12
13
13
def configure(conf):
14
def configure(conf):
15
    conf.load('boost', tooldir=["waf-tools"])
14
    try:
16
    try:
15
        conf.check_tool('boost')
17
        conf.check_boost(lib='signals filesystem system')
16
        conf.check_boost(lib='signals filesystem')
18
    except:
17
        if not conf.env.LIB_BOOST:
18
            conf.check_boost(lib='signals filesystem', libpath="/usr/lib64")
19
    except WafError:
20
        conf.env['LIB_BOOST'] = []
19
        conf.env['LIB_BOOST'] = []
21
20
22
    if not conf.env.LIB_BOOST:
21
    if not conf.env['LIB_BOOST']:
23
	conf.report_optional_feature("openflow", "NS-3 OpenFlow Integration", False,
22
        conf.report_optional_feature("openflow", "NS-3 OpenFlow Integration", False,
24
				     "Required boost libraries not found")
23
                                     "Required boost libraries signals and filesystem not found")
25
24
26
        # Add this module to the list of modules that won't be built
25
        # Add this module to the list of modules that won't be built
27
        # if they are enabled.
26
        # if they are enabled.
 Lines 29-34    Link Here 
29
28
30
	return 
29
	return 
31
30
31
32
    if Options.options.with_openflow:
32
    if Options.options.with_openflow:
33
	if os.path.isdir(Options.options.with_openflow):
33
	if os.path.isdir(Options.options.with_openflow):
34
	    conf.msg("Checking for OpenFlow location", ("%s (given)" % Options.options.with_openflow))
34
	    conf.msg("Checking for OpenFlow location", ("%s (given)" % Options.options.with_openflow))
 Lines 142-148    Link Here 
142
	obj.use.extend('OPENFLOW DL XML2'.split())
142
	obj.use.extend('OPENFLOW DL XML2'.split())
143
	obj_test.use.extend('OPENFLOW DL XML2'.split())
143
	obj_test.use.extend('OPENFLOW DL XML2'.split())
144
144
145
    headers = bld.new_task_gen(features=['ns3header'])
145
    headers = bld(features='ns3header')
146
    headers.module = 'openflow'
146
    headers.module = 'openflow'
147
    headers.source = [
147
    headers.source = [
148
        ]
148
        ]
 Lines 160-163    Link Here 
160
	headers.source.append('helper/openflow-switch-helper.h')
160
	headers.source.append('helper/openflow-switch-helper.h')
161
161
162
    if bld.env['ENABLE_EXAMPLES'] and bld.env['ENABLE_OPENFLOW']:
162
    if bld.env['ENABLE_EXAMPLES'] and bld.env['ENABLE_OPENFLOW']:
163
        bld.add_subdirs('examples')
163
        bld.recurse('examples')
(-)a/src/point-to-point-layout/wscript (-1 / +1 lines)
 Lines 9-15    Link Here 
9
        'model/point-to-point-star.cc',
9
        'model/point-to-point-star.cc',
10
        ]
10
        ]
11
11
12
    headers = bld.new_task_gen(features=['ns3header'])
12
    headers = bld(features='ns3header')
13
    headers.module = 'point-to-point-layout'
13
    headers.module = 'point-to-point-layout'
14
    headers.source = [
14
    headers.source = [
15
        'model/point-to-point-dumbbell.h',
15
        'model/point-to-point-dumbbell.h',
(-)a/src/point-to-point/wscript (-2 / +2 lines)
 Lines 16-22    Link Here 
16
        'test/point-to-point-test.cc',
16
        'test/point-to-point-test.cc',
17
        ]
17
        ]
18
18
19
    headers = bld.new_task_gen(features=['ns3header'])
19
    headers = bld(features='ns3header')
20
    headers.module = 'point-to-point'
20
    headers.module = 'point-to-point'
21
    headers.source = [
21
    headers.source = [
22
        'model/point-to-point-net-device.h',
22
        'model/point-to-point-net-device.h',
 Lines 27-32    Link Here 
27
        ]
27
        ]
28
28
29
    if (bld.env['ENABLE_EXAMPLES']):
29
    if (bld.env['ENABLE_EXAMPLES']):
30
        bld.add_subdirs('examples')
30
        bld.recurse('examples')
31
31
32
    bld.ns3_python_bindings()
32
    bld.ns3_python_bindings()
(-)a/src/propagation/wscript (-2 / +2 lines)
 Lines 24-30    Link Here 
24
        'test/itu-r-1411-nlos-over-rooftop-test-suite.cc',
24
        'test/itu-r-1411-nlos-over-rooftop-test-suite.cc',
25
        ]
25
        ]
26
26
27
    headers = bld.new_task_gen(features=['ns3header'])
27
    headers = bld(features='ns3header')
28
    headers.module = 'propagation'
28
    headers.module = 'propagation'
29
    headers.source = [
29
    headers.source = [
30
        'model/propagation-delay-model.h',
30
        'model/propagation-delay-model.h',
 Lines 41-46    Link Here 
41
        ]
41
        ]
42
42
43
    if (bld.env['ENABLE_EXAMPLES']):
43
    if (bld.env['ENABLE_EXAMPLES']):
44
        bld.add_subdirs('examples')
44
        bld.recurse('examples')
45
45
46
    bld.ns3_python_bindings()
46
    bld.ns3_python_bindings()
(-)a/src/spectrum/wscript (-2 / +2 lines)
 Lines 41-47    Link Here 
41
        'test/spectrum-ideal-phy-test.cc',
41
        'test/spectrum-ideal-phy-test.cc',
42
        ]
42
        ]
43
    
43
    
44
    headers = bld.new_task_gen(features=['ns3header'])
44
    headers = bld(features='ns3header')
45
    headers.module = 'spectrum'
45
    headers.module = 'spectrum'
46
    headers.source = [
46
    headers.source = [
47
        'model/spectrum-model.h',
47
        'model/spectrum-model.h',
 Lines 76-82    Link Here 
76
        ]
76
        ]
77
77
78
    if (bld.env['ENABLE_EXAMPLES']):
78
    if (bld.env['ENABLE_EXAMPLES']):
79
        bld.add_subdirs('examples')
79
        bld.recurse('examples')
80
80
81
81
82
    bld.ns3_python_bindings()
82
    bld.ns3_python_bindings()
(-)a/src/stats/wscript (-7 / +8 lines)
 Lines 1-13    Link Here 
1
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
1
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
2
2
3
def configure(conf):
3
def configure(conf):
4
   conf.env['SQLITE_STATS'] = conf.check_nonfatal(lib='sqlite3', define_name='SQLITE3', uselib_store='SQLITE3')
4
    have_sqlite3 = conf.check_cfg(package='sqlite3', uselib_store='SQLITE3',
5
   if not conf.env['SQLITE_STATS']:
5
                                  args=['--cflags', '--libs'],
6
      conf.env['SQLITE_STATS'] = conf.pkg_check_modules('SQLITE3', 'sqlite3', mandatory=False)
6
                                  mandatory=False)
7
   conf.report_optional_feature("SqliteDataOutput", "SQlite stats data output",
8
                                conf.env['SQLITE_STATS'],
9
                                "library 'sqlite3' not found")
10
7
8
    conf.env['SQLITE_STATS'] = have_sqlite3
9
    conf.report_optional_feature("SqliteDataOutput", "SQlite stats data output",
10
                                 conf.env['SQLITE_STATS'],
11
                                 "library 'sqlite3' not found")
11
12
12
def build(bld):
13
def build(bld):
13
    obj = bld.create_ns3_module('stats', ['network'])
14
    obj = bld.create_ns3_module('stats', ['network'])
 Lines 25-31    Link Here 
25
        'test/basic-data-calculators-test-suite.cc',
26
        'test/basic-data-calculators-test-suite.cc',
26
        ]
27
        ]
27
28
28
    headers = bld.new_task_gen(features=['ns3header'])
29
    headers = bld(features='ns3header')
29
    headers.module = 'stats'
30
    headers.module = 'stats'
30
    headers.source = [
31
    headers.source = [
31
        'model/data-calculator.h',
32
        'model/data-calculator.h',
(-)a/src/tap-bridge/wscript (-2 / +2 lines)
 Lines 34-40    Link Here 
34
        'model/tap-encode-decode.cc',
34
        'model/tap-encode-decode.cc',
35
        'helper/tap-bridge-helper.cc',
35
        'helper/tap-bridge-helper.cc',
36
        ]
36
        ]
37
    headers = bld.new_task_gen(features=['ns3header'])
37
    headers = bld(features='ns3header')
38
    headers.module = 'tap-bridge'
38
    headers.module = 'tap-bridge'
39
    headers.source = [
39
    headers.source = [
40
        'model/tap-bridge.h',
40
        'model/tap-bridge.h',
 Lines 52-57    Link Here 
52
    module.env.append_value("DEFINES", "TAP_CREATOR=\"%s\"" % (tap_creator.target,))
52
    module.env.append_value("DEFINES", "TAP_CREATOR=\"%s\"" % (tap_creator.target,))
53
53
54
    if bld.env['ENABLE_EXAMPLES']:
54
    if bld.env['ENABLE_EXAMPLES']:
55
        bld.add_subdirs('examples')
55
        bld.recurse('examples')
56
56
57
    bld.ns3_python_bindings()
57
    bld.ns3_python_bindings()
(-)a/src/test/wscript (-1 / +1 lines)
 Lines 16-22    Link Here 
16
        return
16
        return
17
17
18
    test = bld.create_ns3_module('test', ['internet', 'mobility', 'applications', 'csma', 'bridge', 'config-store', 'tools', 'point-to-point', 'csma-layout', 'flow-monitor', 'wifi'])
18
    test = bld.create_ns3_module('test', ['internet', 'mobility', 'applications', 'csma', 'bridge', 'config-store', 'tools', 'point-to-point', 'csma-layout', 'flow-monitor', 'wifi'])
19
    headers = bld.new_task_gen(features=['ns3header'])
19
    headers = bld(features='ns3header')
20
    headers.module = 'test'
20
    headers.module = 'test'
21
21
22
    test_test = bld.create_ns3_module_test_library('test')
22
    test_test = bld.create_ns3_module_test_library('test')
(-)a/src/tools/wscript (-2 / +2 lines)
 Lines 15-21    Link Here 
15
        'test/event-garbage-collector-test-suite.cc',
15
        'test/event-garbage-collector-test-suite.cc',
16
        ]
16
        ]
17
    
17
    
18
    headers = bld.new_task_gen(features=['ns3header'])
18
    headers = bld(features='ns3header')
19
    headers.module = 'tools'
19
    headers.module = 'tools'
20
    headers.source = [
20
    headers.source = [
21
        'model/average.h',
21
        'model/average.h',
 Lines 25-30    Link Here 
25
        ]
25
        ]
26
26
27
    if (bld.env['ENABLE_EXAMPLES']):
27
    if (bld.env['ENABLE_EXAMPLES']):
28
        bld.add_subdirs('examples')
28
        bld.recurse('examples')
29
29
30
    bld.ns3_python_bindings()
30
    bld.ns3_python_bindings()
(-)a/src/topology-read/wscript (-2 / +2 lines)
 Lines 15-21    Link Here 
15
        'test/rocketfuel-topology-reader-test-suite.cc',
15
        'test/rocketfuel-topology-reader-test-suite.cc',
16
        ]
16
        ]
17
17
18
    headers = bld.new_task_gen(features=['ns3header'])
18
    headers = bld(features='ns3header')
19
    headers.module = 'topology-read'
19
    headers.module = 'topology-read'
20
    headers.source = [
20
    headers.source = [
21
       'model/topology-reader.h',
21
       'model/topology-reader.h',
 Lines 26-31    Link Here 
26
        ]
26
        ]
27
27
28
    if bld.env['ENABLE_EXAMPLES']:
28
    if bld.env['ENABLE_EXAMPLES']:
29
        bld.add_subdirs('examples')
29
        bld.recurse('examples')
30
30
31
    bld.ns3_python_bindings()
31
    bld.ns3_python_bindings()
(-)a/src/uan/wscript (-2 / +2 lines)
 Lines 34-40    Link Here 
34
        'test/uan-test.cc',
34
        'test/uan-test.cc',
35
        'test/uan-energy-model-test.cc',
35
        'test/uan-energy-model-test.cc',
36
        ]
36
        ]
37
    headers = bld.new_task_gen(features=['ns3header'])
37
    headers = bld(features='ns3header')
38
    headers.module = 'uan'
38
    headers.module = 'uan'
39
    headers.source = [
39
    headers.source = [
40
        'model/uan-channel.h',
40
        'model/uan-channel.h',
 Lines 64-69    Link Here 
64
        ]
64
        ]
65
65
66
    if (bld.env['ENABLE_EXAMPLES']):
66
    if (bld.env['ENABLE_EXAMPLES']):
67
      bld.add_subdirs('examples')
67
      bld.recurse('examples')
68
68
69
    bld.ns3_python_bindings()
69
    bld.ns3_python_bindings()
(-)a/src/virtual-net-device/wscript (-2 / +2 lines)
 Lines 6-18    Link Here 
6
    module.source = [
6
    module.source = [
7
        'model/virtual-net-device.cc',
7
        'model/virtual-net-device.cc',
8
        ]
8
        ]
9
    headers = bld.new_task_gen(features=['ns3header'])
9
    headers = bld(features='ns3header')
10
    headers.module = 'virtual-net-device'
10
    headers.module = 'virtual-net-device'
11
    headers.source = [
11
    headers.source = [
12
        'model/virtual-net-device.h',
12
        'model/virtual-net-device.h',
13
        ]
13
        ]
14
14
15
    if bld.env['ENABLE_EXAMPLES']:
15
    if bld.env['ENABLE_EXAMPLES']:
16
        bld.add_subdirs('examples')
16
        bld.recurse('examples')
17
17
18
    bld.ns3_python_bindings()
18
    bld.ns3_python_bindings()
(-)a/src/visualizer/wscript (-3 / +3 lines)
 Lines 1-5    Link Here 
1
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
1
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
2
import Options
2
from waflib import Options
3
3
4
required_python_modules = [
4
required_python_modules = [
5
    'gtk',
5
    'gtk',
 Lines 38-44    Link Here 
38
def build(bld):
38
def build(bld):
39
39
40
    module = bld.create_ns3_module('visualizer', ['internet', 'wifi', 'point-to-point'])
40
    module = bld.create_ns3_module('visualizer', ['internet', 'wifi', 'point-to-point'])
41
    headers = bld.new_task_gen(features=['ns3header'])
41
    headers = bld(features='ns3header')
42
    headers.module = 'visualizer'
42
    headers.module = 'visualizer'
43
43
44
    # Don't do anything more for this module if Python was explicitly
44
    # Don't do anything more for this module if Python was explicitly
 Lines 61-67    Link Here 
61
        'model/dummy-file-for-static-builds.cc',
61
        'model/dummy-file-for-static-builds.cc',
62
        ]
62
        ]
63
63
64
    module.features.append('pyembed')
64
    module.features += ' pyembed'
65
    #module.env.append_value('CXXFLAGS', module.env['shlib_CXXFLAGS'])
65
    #module.env.append_value('CXXFLAGS', module.env['shlib_CXXFLAGS'])
66
    #module.includes = '.'
66
    #module.includes = '.'
67
67
(-)a/src/wifi/wscript (-2 / +2 lines)
 Lines 75-81    Link Here 
75
        'test/wifi-test.cc',
75
        'test/wifi-test.cc',
76
        ]
76
        ]
77
77
78
    headers = bld.new_task_gen(features=['ns3header'])
78
    headers = bld(features='ns3header')
79
    headers.module = 'wifi'
79
    headers.module = 'wifi'
80
    headers.source = [
80
    headers.source = [
81
        'model/wifi-information-element.h',
81
        'model/wifi-information-element.h',
 Lines 144-150    Link Here 
144
        obj_test.use.extend(['GSL', 'GSLCBLAS', 'M'])
144
        obj_test.use.extend(['GSL', 'GSLCBLAS', 'M'])
145
145
146
    if (bld.env['ENABLE_EXAMPLES']):
146
    if (bld.env['ENABLE_EXAMPLES']):
147
        bld.add_subdirs('examples')
147
        bld.recurse('examples')
148
148
149
    bld.ns3_python_bindings()
149
    bld.ns3_python_bindings()
150
150
(-)a/src/wimax/wscript (-2 / +2 lines)
 Lines 63-69    Link Here 
63
            'test/wimax-fragmentation-test.cc',
63
            'test/wimax-fragmentation-test.cc',
64
            ]
64
            ]
65
		            
65
		            
66
    headers = bld.new_task_gen(features=['ns3header'])
66
    headers = bld(features='ns3header')
67
    headers.module = 'wimax'
67
    headers.module = 'wimax'
68
    headers.source = [
68
    headers.source = [
69
            'model/wimax-channel.h',
69
            'model/wimax-channel.h',
 Lines 113-118    Link Here 
113
		            ]
113
		            ]
114
114
115
    if bld.env['ENABLE_EXAMPLES']:
115
    if bld.env['ENABLE_EXAMPLES']:
116
        bld.add_subdirs('examples')
116
        bld.recurse('examples')
117
117
118
    bld.ns3_python_bindings()
118
    bld.ns3_python_bindings()
(-)a/src/wscript (-26 / +19 lines)
 Lines 6-19    Link Here 
6
import types
6
import types
7
import warnings
7
import warnings
8
8
9
from waflib import TaskGen, Task, Options, Build, Utils
9
from waflib.Errors import WafError
10
from waflib.Errors import WafError
10
11
import TaskGen
12
import Task
13
import Options
14
import Build
15
import Utils
16
17
import wutils
11
import wutils
18
12
19
try:
13
try:
 Lines 48-59    Link Here 
48
                   dest='enable_modules')
42
                   dest='enable_modules')
49
43
50
    for module in all_modules:
44
    for module in all_modules:
51
        opt.sub_options(module, mandatory=False)
45
        opt.recurse(module, mandatory=False)
52
46
53
47
54
def configure(conf):
48
def configure(conf):
55
    for module in all_modules:
49
    for module in all_modules:
56
        conf.sub_config(module, mandatory=False)
50
        conf.recurse(module, mandatory=False)
57
51
58
    blddir = os.path.abspath(os.path.join(conf.bldnode.abspath(), conf.variant))
52
    blddir = os.path.abspath(os.path.join(conf.bldnode.abspath(), conf.variant))
59
    conf.env.append_value('NS3_MODULE_PATH', blddir)
53
    conf.env.append_value('NS3_MODULE_PATH', blddir)
 Lines 75-84    Link Here 
75
    static = bool(bld.env.ENABLE_STATIC_NS3)
69
    static = bool(bld.env.ENABLE_STATIC_NS3)
76
    # Create a separate library for this module.
70
    # Create a separate library for this module.
77
    if static:
71
    if static:
78
        module = bld.new_task_gen(features=['cxx', 'cxxstlib', 'ns3module'])
72
        module = bld(features='cxx cxxstlib ns3module')
79
    else:
73
    else:
80
        module = bld.new_task_gen(features=['cxx', 'cxxshlib', 'ns3module'])
74
        module = bld(features='cxx cxxshlib ns3module')
81
    module.target = '%s/ns%s-%s%s' % (bld.srcnode.relpath_gen(module.path), wutils.VERSION,
75
    module.target = '%s/ns%s-%s%s' % (bld.srcnode.path_from(module.path), wutils.VERSION,
82
                                       name, bld.env.BUILD_SUFFIX)
76
                                       name, bld.env.BUILD_SUFFIX)
83
    linkflags = []
77
    linkflags = []
84
    cxxflags = []
78
    cxxflags = []
 Lines 119-125    Link Here 
119
    module.use = ['ns3-' + dep for dep in dependencies]
113
    module.use = ['ns3-' + dep for dep in dependencies]
120
    module.test = test
114
    module.test = test
121
    module.is_ns3_module = True
115
    module.is_ns3_module = True
122
    module.ns3_dir_location = bld.path.relpath_gen(bld.srcnode)
116
    module.ns3_dir_location = bld.path.path_from(bld.srcnode)
123
117
124
    module.env.append_value("INCLUDES", '#')
118
    module.env.append_value("INCLUDES", '#')
125
119
 Lines 133-139    Link Here 
133
def apply_incpaths_ns3testlib(self):
127
def apply_incpaths_ns3testlib(self):
134
    if not self.source:
128
    if not self.source:
135
        return
129
        return
136
    testdir = self.source[-1].parent.relpath_gen(self.bld.srcnode)
130
    testdir = self.source[-1].parent.path_from(self.bld.srcnode)
137
    self.env.append_value("DEFINES", 'NS_TEST_SOURCEDIR="%s"' % (testdir,))
131
    self.env.append_value("DEFINES", 'NS_TEST_SOURCEDIR="%s"' % (testdir,))
138
132
139
133
 Lines 142-148    Link Here 
142
    # the module being tested.
136
    # the module being tested.
143
    library_name = name + "-test"
137
    library_name = name + "-test"
144
    library = bld.create_ns3_module(library_name, [name], test=True)
138
    library = bld.create_ns3_module(library_name, [name], test=True)
145
    library.features.append("ns3testlib")
139
    library.features += " ns3testlib"
146
140
147
    # Modify attributes for the test library that are different from a
141
    # Modify attributes for the test library that are different from a
148
    # normal module.
142
    # normal module.
 Lines 154-160    Link Here 
154
    bld.env.append_value('NS3_MODULES_WITH_TEST_LIBRARIES', [(library.module_name, library.name)])
148
    bld.env.append_value('NS3_MODULES_WITH_TEST_LIBRARIES', [(library.module_name, library.name)])
155
149
156
    # Set the include path from the build directory to modules. 
150
    # Set the include path from the build directory to modules. 
157
    relative_path_from_build_to_here = bld.path.relpath_gen(bld.bldnode)
151
    relative_path_from_build_to_here = bld.path.path_from(bld.bldnode)
158
    include_flag = '-I' + relative_path_from_build_to_here
152
    include_flag = '-I' + relative_path_from_build_to_here
159
    library.env.append_value('CXXFLAGS', include_flag)
153
    library.env.append_value('CXXFLAGS', include_flag)
160
    library.env.append_value('CCFLAGS',  include_flag)
154
    library.env.append_value('CCFLAGS',  include_flag)
 Lines 162-170    Link Here 
162
    return library
156
    return library
163
157
164
def create_obj(bld, *args):
158
def create_obj(bld, *args):
165
    warnings.warn("(in %s) Use bld.new_task_gen(...) now, instead of bld.create_obj(...)" % str(bld.path),
159
    warnings.warn("(in %s) Use bld(...) call now, instead of bld.create_obj(...)" % str(bld.path),
166
                  DeprecationWarning, stacklevel=2)
160
                  DeprecationWarning, stacklevel=2)
167
    return bld.new_task_gen(*args)
161
    return bld(*args)
168
162
169
163
170
def ns3_python_bindings(bld):
164
def ns3_python_bindings(bld):
 Lines 197-203    Link Here 
197
191
198
    #debug = ('PYBINDGEN_DEBUG' in os.environ)
192
    #debug = ('PYBINDGEN_DEBUG' in os.environ)
199
    debug = True # XXX
193
    debug = True # XXX
200
    source = [bld.srcnode.find_resource('bindings/python/ns3modulegen-modular.py').relpath_gen(bld.path),
194
    source = [bld.srcnode.find_resource('bindings/python/ns3modulegen-modular.py').path_from(bld.path),
201
              "bindings/modulegen__%s.py" % apidefs]
195
              "bindings/modulegen__%s.py" % apidefs]
202
196
203
    if bindings_dir.find_resource("modulegen_customizations.py") is not None:
197
    if bindings_dir.find_resource("modulegen_customizations.py") is not None:
 Lines 208-219    Link Here 
208
        source.append("bindings/modulegen_local.py")
202
        source.append("bindings/modulegen_local.py")
209
203
210
    module_py_name = module.replace('-', '_')
204
    module_py_name = module.replace('-', '_')
211
    module_target_dir = bld.srcnode.find_dir("bindings/python/ns").relpath_gen(bld.path)
205
    module_target_dir = bld.srcnode.find_dir("bindings/python/ns").path_from(bld.path)
212
206
213
    # if bindings/<module>.py exists, it becomes the module frontend, and the C extension befomes _<module>
207
    # if bindings/<module>.py exists, it becomes the module frontend, and the C extension befomes _<module>
214
    if bld.path.find_resource("bindings/%s.py" % (module_py_name,)) is not None:
208
    if bld.path.find_resource("bindings/%s.py" % (module_py_name,)) is not None:
215
        bld.new_task_gen(
209
        bld(features='copy',
216
            features='copy',
217
            source=("bindings/%s.py" % (module_py_name,)),
210
            source=("bindings/%s.py" % (module_py_name,)),
218
            target=('%s/%s.py' % (module_target_dir, module_py_name)))
211
            target=('%s/%s.py' % (module_target_dir, module_py_name)))
219
        extension_name = '_%s' % (module_py_name,)
212
        extension_name = '_%s' % (module_py_name,)
 Lines 240-246    Link Here 
240
        if was_enabled:
233
        if was_enabled:
241
            features.append(name)
234
            features.append(name)
242
235
243
    bindgen = bld.new_task_gen(features=['command'], source=source, target=target, command=argv)
236
    bindgen = bld(features='command', source=source, target=target, command=argv)
244
    bindgen.env['FEATURES'] = ','.join(features)
237
    bindgen.env['FEATURES'] = ','.join(features)
245
    bindgen.dep_vars = ['FEATURES', "GCC_RTTI_ABI_COMPLETE"]
238
    bindgen.dep_vars = ['FEATURES', "GCC_RTTI_ABI_COMPLETE"]
246
    bindgen.before = 'cxx'
239
    bindgen.before = 'cxx'
 Lines 249-255    Link Here 
249
    bindgen.install_path = None
242
    bindgen.install_path = None
250
243
251
    # generate the extension module
244
    # generate the extension module
252
    pymod = bld.new_task_gen(features='cxx cxxshlib pyext')
245
    pymod = bld(features='cxx cxxshlib pyext')
253
    pymod.source = ['bindings/ns3module.cc']
246
    pymod.source = ['bindings/ns3module.cc']
254
    pymod.target = '%s/%s' % (module_target_dir, extension_name)
247
    pymod.target = '%s/%s' % (module_target_dir, extension_name)
255
    pymod.name = 'ns3module_%s' % module
248
    pymod.name = 'ns3module_%s' % module
 Lines 305-314    Link Here 
305
        if not_built in all_modules:
298
        if not_built in all_modules:
306
            all_modules.remove(not_built)
299
            all_modules.remove(not_built)
307
300
308
    bld.add_subdirs(list(all_modules))
301
    bld.recurse(list(all_modules))
309
302
310
    for module in all_modules:
303
    for module in all_modules:
311
        modheader = bld.new_task_gen(features=['ns3moduleheader'])
304
        modheader = bld(features='ns3moduleheader')
312
        modheader.module = module.split('/')[-1]
305
        modheader.module = module.split('/')[-1]
313
306
314
class ns3pcfile_task(Task.Task):
307
class ns3pcfile_task(Task.Task):
(-)a/waf-tools/boost.py (-278 / +360 lines)
 Lines 1-278    Link Here 
1
#!/usr/bin/env python
1
#!/usr/bin/env python
2
# encoding: utf-8
2
# encoding: utf-8
3
#
3
#
4
# partially based on boost.py written by Gernot Vormayr
4
# partially based on boost.py written by Gernot Vormayr
5
# written by Ruediger Sonderfeld <ruediger@c-plusplus.de>, 2008
5
# written by Ruediger Sonderfeld <ruediger@c-plusplus.de>, 2008
6
# modified by Bjoern Michaelsen, 2008
6
# modified by Bjoern Michaelsen, 2008
7
# modified by Luca Fossati, 2008
7
# modified by Luca Fossati, 2008
8
# rewritten for waf 1.5.1, Thomas Nagy, 2008
8
# rewritten for waf 1.5.1, Thomas Nagy, 2008
9
# rewritten for waf 1.6.2, Sylvain Rouquette, 2011
9
# rewritten for waf 1.6.2, Sylvain Rouquette, 2011
10
10
11
'''
11
'''
12
To add the boost tool to the waf file:
12
13
$ ./waf-light --tools=compat15,boost
13
This is an extra tool, not bundled with the default waf binary.
14
	or, if you have waf >= 1.6.2
14
To add the boost tool to the waf file:
15
$ ./waf update --files=boost
15
$ ./waf-light --tools=compat15,boost
16
16
	or, if you have waf >= 1.6.2
17
The wscript will look like:
17
$ ./waf update --files=boost
18
18
19
def options(opt):
19
When using this tool, the wscript will look like:
20
	opt.load('compiler_cxx boost')
20
21
21
	def options(opt):
22
def configure(conf):
22
		opt.load('compiler_cxx boost')
23
	conf.load('compiler_cxx boost')
23
24
	conf.check_boost(lib='system filesystem', mt=True, static=True)
24
	def configure(conf):
25
25
		conf.load('compiler_cxx boost')
26
def build(bld):
26
		conf.check_boost(lib='system filesystem')
27
	bld(source='main.cpp', target='app', use='BOOST')
27
28
'''
28
	def build(bld):
29
29
		bld(source='main.cpp', target='app', use='BOOST')
30
import sys
30
31
import re
31
Options are generated, in order to specify the location of boost includes/libraries.
32
from waflib import Utils, Logs
32
The `check_boost` configuration function allows to specify the used boost libraries.
33
from waflib.Configure import conf
33
It can also provide default arguments to the --boost-static and --boost-mt command-line arguments.
34
from waflib.Errors import WafError
34
Everything will be packaged together in a BOOST component that you can use.
35
35
36
BOOST_LIBS = ('/usr/lib', '/usr/local/lib',
36
When using MSVC, a lot of compilation flags need to match your BOOST build configuration:
37
			  '/opt/local/lib', '/sw/lib', '/lib')
37
 - you may have to add /EHsc to your CXXFLAGS or define boost::throw_exception if BOOST_NO_EXCEPTIONS is defined.
38
BOOST_INCLUDES = ('/usr/include', '/usr/local/include',
38
   Errors: C4530
39
				  '/opt/local/include', '/sw/include')
39
 - boost libraries will try to be smart and use the (pretty but often not useful) auto-linking feature of MSVC
40
BOOST_VERSION_FILE = 'boost/version.hpp'
40
   So before calling `conf.check_boost` you might want to disabling by adding:
41
BOOST_VERSION_CODE = '''
41
   	conf.env.DEFINES_BOOST += ['BOOST_ALL_NO_LIB']
42
#include <iostream>
42
   Errors: 
43
#include <boost/version.hpp>
43
 - boost might also be compiled with /MT, which links the runtime statically.
44
int main() { std::cout << BOOST_LIB_VERSION << std::endl; }
44
   If you have problems with redefined symbols, 
45
'''
45
		self.env['DEFINES_%s' % var] += ['BOOST_ALL_NO_LIB']
46
46
		self.env['CXXFLAGS_%s' % var] += ['/MD', '/EHsc']
47
# toolsets from {boost_dir}/tools/build/v2/tools/common.jam
47
Passing `--boost-linkage_autodetect` might help ensuring having a correct linkage in some basic cases.
48
PLATFORM = Utils.unversioned_sys_platform()
48
49
detect_intel = lambda env: (PLATFORM == 'win32') and 'iw' or 'il'
49
'''
50
detect_clang = lambda env: (PLATFORM == 'darwin') and 'clang-darwin' or 'clang'
50
51
detect_mingw = lambda env: (re.search('MinGW', env.CXX[0])) and 'mgw' or 'gcc'
51
import sys
52
BOOST_TOOLSETS = {
52
import re
53
	'borland':  'bcb',
53
from waflib import Utils, Logs, Errors
54
	'clang':	detect_clang,
54
from waflib.Configure import conf
55
	'como':	 'como',
55
56
	'cw':	   'cw',
56
BOOST_LIBS = ['/usr/lib', '/usr/local/lib', '/opt/local/lib', '/sw/lib', '/lib']
57
	'darwin':   'xgcc',
57
BOOST_INCLUDES = ['/usr/include', '/usr/local/include', '/opt/local/include', '/sw/include']
58
	'edg':	  'edg',
58
BOOST_VERSION_FILE = 'boost/version.hpp'
59
	'g++':	  detect_mingw,
59
BOOST_VERSION_CODE = '''
60
	'gcc':	  detect_mingw,
60
#include <iostream>
61
	'icpc':	 detect_intel,
61
#include <boost/version.hpp>
62
	'intel':	detect_intel,
62
int main() { std::cout << BOOST_LIB_VERSION << std::endl; }
63
	'kcc':	  'kcc',
63
'''
64
	'kylix':	'bck',
64
65
	'mipspro':  'mp',
65
# toolsets from {boost_dir}/tools/build/v2/tools/common.jam
66
	'mingw':	'mgw',
66
PLATFORM = Utils.unversioned_sys_platform()
67
	'msvc':	 'vc',
67
detect_intel = lambda env: (PLATFORM == 'win32') and 'iw' or 'il'
68
	'qcc':	  'qcc',
68
detect_clang = lambda env: (PLATFORM == 'darwin') and 'clang-darwin' or 'clang'
69
	'sun':	  'sw',
69
detect_mingw = lambda env: (re.search('MinGW', env.CXX[0])) and 'mgw' or 'gcc'
70
	'sunc++':   'sw',
70
BOOST_TOOLSETS = {
71
	'tru64cxx': 'tru',
71
	'borland':  'bcb',
72
	'vacpp':	'xlc'
72
	'clang':	detect_clang,
73
}
73
	'como':	 'como',
74
74
	'cw':	   'cw',
75
75
	'darwin':   'xgcc',
76
def options(opt):
76
	'edg':	  'edg',
77
	opt.add_option('--boost-includes', type='string',
77
	'g++':	  detect_mingw,
78
				   default='', dest='boost_includes',
78
	'gcc':	  detect_mingw,
79
				   help='''path to the boost directory where the includes are
79
	'icpc':	 detect_intel,
80
				   e.g. /boost_1_45_0/include''')
80
	'intel':	detect_intel,
81
	opt.add_option('--boost-libs', type='string',
81
	'kcc':	  'kcc',
82
				   default='', dest='boost_libs',
82
	'kylix':	'bck',
83
				   help='''path to the directory where the boost libs are
83
	'mipspro':  'mp',
84
				   e.g. /boost_1_45_0/stage/lib''')
84
	'mingw':	'mgw',
85
	opt.add_option('--boost-static', action='store_true',
85
	'msvc':	 'vc',
86
				   default=False, dest='boost_static',
86
	'qcc':	  'qcc',
87
				   help='link static libraries')
87
	'sun':	  'sw',
88
	opt.add_option('--boost-mt', action='store_true',
88
	'sunc++':   'sw',
89
				   default=False, dest='boost_mt',
89
	'tru64cxx': 'tru',
90
				   help='select multi-threaded libraries')
90
	'vacpp':	'xlc'
91
	opt.add_option('--boost-abi', type='string', default='', dest='boost_abi',
91
}
92
				   help='''select libraries with tags (dgsyp, d for debug),
92
93
				   see doc Boost, Getting Started, chapter 6.1''')
93
94
	opt.add_option('--boost-toolset', type='string',
94
def options(opt):
95
				   default='', dest='boost_toolset',
95
	opt.add_option('--boost-includes', type='string',
96
				   help='force a toolset e.g. msvc, vc90, \
96
				   default='', dest='boost_includes',
97
						gcc, mingw, mgw45 (default: auto)')
97
				   help='''path to the boost includes root (~boost root)
98
	py_version = '%d%d' % (sys.version_info[0], sys.version_info[1])
98
				   e.g. /path/to/boost_1_47_0''')
99
	opt.add_option('--boost-python', type='string',
99
	opt.add_option('--boost-libs', type='string',
100
				   default=py_version, dest='boost_python',
100
				   default='', dest='boost_libs',
101
				   help='select the lib python with this version \
101
				   help='''path to the directory where the boost libs are
102
						(default: %s)' % py_version)
102
				   e.g. /path/to/boost_1_47_0/stage/lib''')
103
103
	opt.add_option('--boost-static', action='store_true',
104
104
				   default=False, dest='boost_static',
105
@conf
105
				   help='link with static boost libraries (.lib/.a)')
106
def __boost_get_version_file(self, dir):
106
	opt.add_option('--boost-mt', action='store_true',
107
	try:
107
				   default=False, dest='boost_mt',
108
		return self.root.find_dir(dir).find_node(BOOST_VERSION_FILE)
108
				   help='select multi-threaded libraries')
109
	except:
109
	opt.add_option('--boost-abi', type='string', default='', dest='boost_abi',
110
		return None
110
				   help='''select libraries with tags (dgsyp, d for debug),
111
111
				   see doc Boost, Getting Started, chapter 6.1''')
112
112
	opt.add_option('--boost-linkage_autodetect', action="store_true", dest='boost_linkage_autodetect',
113
@conf
113
				   help="auto-detect boost linkage options (don't get used to it / might break other stuff)")
114
def boost_get_version(self, dir):
114
	opt.add_option('--boost-toolset', type='string',
115
	"""silently retrieve the boost version number"""
115
				   default='', dest='boost_toolset',
116
	re_but = re.compile('^#define\\s+BOOST_LIB_VERSION\\s+"(.*)"$', re.M)
116
				   help='force a toolset e.g. msvc, vc90, \
117
	try:
117
						gcc, mingw, mgw45 (default: auto)')
118
		val = re_but.search(self.__boost_get_version_file(dir).read()).group(1)
118
	py_version = '%d%d' % (sys.version_info[0], sys.version_info[1])
119
	except:
119
	opt.add_option('--boost-python', type='string',
120
		val = self.check_cxx(fragment=BOOST_VERSION_CODE, includes=[dir],
120
				   default=py_version, dest='boost_python',
121
							 execute=True, define_ret=True)
121
				   help='select the lib python with this version \
122
	return val
122
						(default: %s)' % py_version)
123
123
124
124
125
@conf
125
@conf
126
def boost_get_includes(self, *k, **kw):
126
def __boost_get_version_file(self, dir):
127
	includes = k and k[0] or kw.get('includes', None)
127
	try:
128
	if includes and self.__boost_get_version_file(includes):
128
		return self.root.find_dir(dir).find_node(BOOST_VERSION_FILE)
129
		return includes
129
	except:
130
	for dir in BOOST_INCLUDES:
130
		return None
131
		if self.__boost_get_version_file(dir):
131
132
			return dir
132
133
	if includes:
133
@conf
134
		self.fatal('headers not found in %s' % includes)
134
def boost_get_version(self, dir):
135
	else:
135
	"""silently retrieve the boost version number"""
136
		self.fatal('headers not found, use --boost-includes=/path/to/boost')
136
	re_but = re.compile('^#define\\s+BOOST_LIB_VERSION\\s+"(.*)"$', re.M)
137
137
	try:
138
138
		val = re_but.search(self.__boost_get_version_file(dir).read()).group(1)
139
@conf
139
	except:
140
def boost_get_toolset(self, cc):
140
		val = self.check_cxx(fragment=BOOST_VERSION_CODE, includes=[dir], execute=False, define_ret=True)
141
	toolset = cc
141
	return val
142
	if not cc:
142
143
		build_platform = Utils.unversioned_sys_platform()
143
144
		if build_platform in BOOST_TOOLSETS:
144
@conf
145
			cc = build_platform
145
def boost_get_includes(self, *k, **kw):
146
		else:
146
	includes = k and k[0] or kw.get('includes', None)
147
			cc = self.env.CXX_NAME
147
	if includes and self.__boost_get_version_file(includes):
148
	if cc in BOOST_TOOLSETS:
148
		return includes
149
		toolset = BOOST_TOOLSETS[cc]
149
	for dir in BOOST_INCLUDES:
150
	return isinstance(toolset, str) and toolset or toolset(self.env)
150
		if self.__boost_get_version_file(dir):
151
151
			return dir
152
152
	if includes:
153
@conf
153
		self.fatal('headers not found in %s' % includes)
154
def __boost_get_libs_path(self, *k, **kw):
154
	else:
155
	''' return the lib path and all the files in it '''
155
		self.fatal('headers not found, please provide a --boost-includes argument (see help)')
156
	if 'files' in kw:
156
157
		return self.root.find_dir('.'), Utils.to_list(kw['files'])
157
158
	libs = k and k[0] or kw.get('libs', None)
158
@conf
159
	if libs:
159
def boost_get_toolset(self, cc):
160
		path = self.root.find_dir(libs)
160
	toolset = cc
161
		files = path.ant_glob('*boost_*')
161
	if not cc:
162
	if not libs or not files:
162
		build_platform = Utils.unversioned_sys_platform()
163
		for dir in BOOST_LIBS:
163
		if build_platform in BOOST_TOOLSETS:
164
			try:
164
			cc = build_platform
165
				path = self.root.find_dir(dir)
165
		else:
166
				files = path.ant_glob('*boost_*')
166
			cc = self.env.CXX_NAME
167
				if files:
167
	if cc in BOOST_TOOLSETS:
168
					break
168
		toolset = BOOST_TOOLSETS[cc]
169
				path = self.root.find_dir(dir + '64')
169
	return isinstance(toolset, str) and toolset or toolset(self.env)
170
				files = path.ant_glob('*boost_*')
170
171
				if files:
171
172
					break
172
@conf
173
			except:
173
def __boost_get_libs_path(self, *k, **kw):
174
				path = None
174
	''' return the lib path and all the files in it '''
175
	if not path:
175
	if 'files' in kw:
176
		if libs:
176
		return self.root.find_dir('.'), Utils.to_list(kw['files'])
177
			self.fatal('libs not found in %s' % libs)
177
	libs = k and k[0] or kw.get('libs', None)
178
		else:
178
	if libs:
179
			self.fatal('libs not found, \
179
		path = self.root.find_dir(libs)
180
					   use --boost-includes=/path/to/boost/lib')
180
		files = path.ant_glob('*boost_*')
181
	return path, files
181
	if not libs or not files:
182
182
		for dir in BOOST_LIBS:
183
183
			try:
184
@conf
184
				path = self.root.find_dir(dir)
185
def boost_get_libs(self, *k, **kw):
185
				files = path.ant_glob('*boost_*')
186
	'''
186
				if files:
187
	return the lib path and the required libs
187
					break
188
	according to the parameters
188
				path = self.root.find_dir(dir + '64')
189
	'''
189
				files = path.ant_glob('*boost_*')
190
	path, files = self.__boost_get_libs_path(**kw)
190
				if files:
191
	t = []
191
					break
192
	if kw.get('mt', False):
192
			except:
193
		t.append('mt')
193
				path = None
194
	if kw.get('abi', None):
194
	if not path:
195
		t.append(kw['abi'])
195
		if libs:
196
	tags = t and '(-%s)+' % '-'.join(t) or ''
196
			self.fatal('libs not found in %s' % libs)
197
	toolset = '(-%s[0-9]{0,3})+' % self.boost_get_toolset(kw.get('toolset', ''))
197
		else:
198
	version = '(-%s)+' % self.env.BOOST_VERSION
198
			self.fatal('libs not found, please provide a --boost-libs argument (see help)')
199
199
200
	def find_lib(re_lib, files):
200
	self.to_log('Found the boost path in %r with the libraries:' % path)
201
		for file in files:
201
	for x in files:
202
			if re_lib.search(file.name):
202
		self.to_log('    %r' % x)
203
				return file
203
	return path, files
204
		return None
204
205
205
@conf
206
	def format_lib_name(name):
206
def boost_get_libs(self, *k, **kw):
207
		if name.startswith('lib'):
207
	'''
208
			name = name[3:]
208
	return the lib path and the required libs
209
		return name.split('.')[0]
209
	according to the parameters
210
210
	'''
211
	libs = []
211
	path, files = self.__boost_get_libs_path(**kw)
212
	for lib in Utils.to_list(k and k[0] or kw.get('lib', None)):
212
	t = []
213
		py = (lib == 'python') and '(-py%s)+' % kw['python'] or ''
213
	if kw.get('mt', False):
214
		# Trying libraries, from most strict match to least one
214
		t.append('mt')
215
		for pattern in ['boost_%s%s%s%s%s' % (lib, toolset, tags, py, version),
215
	if kw.get('abi', None):
216
						'boost_%s%s%s%s' % (lib, tags, py, version),
216
		t.append(kw['abi'])
217
						'boost_%s%s%s' % (lib, tags, version),
217
	tags = t and '(-%s)+' % '-'.join(t) or ''
218
						# Give up trying to find the right version
218
	toolset = self.boost_get_toolset(kw.get('toolset', ''))
219
						'boost_%s%s%s%s' % (lib, toolset, tags, py),
219
	toolset_pat = '(-%s[0-9]{0,3})+' % toolset
220
						'boost_%s%s%s' % (lib, tags, py),
220
	version = '(-%s)+' % self.env.BOOST_VERSION
221
						'boost_%s%s' % (lib, tags)]:
221
222
			file = find_lib(re.compile(pattern), files)
222
	def find_lib(re_lib, files):
223
			if file:
223
		for file in files:
224
				libs.append(format_lib_name(file.name))
224
			if re_lib.search(file.name):
225
				break
225
				self.to_log('Found boost lib %s' % file)
226
		else:
226
				return file
227
			self.fatal('lib %s not found in %s' % (lib, path))
227
		return None
228
228
229
	return path.abspath(), libs
229
	def format_lib_name(name):
230
230
		if name.startswith('lib') and self.env.CC_NAME != 'msvc':
231
231
			name = name[3:]
232
@conf
232
		return name[:name.rfind('.')]
233
def check_boost(self, *k, **kw):
233
234
	"""
234
	libs = []
235
	initialize boost
235
	for lib in Utils.to_list(k and k[0] or kw.get('lib', None)):
236
236
		py = (lib == 'python') and '(-py%s)+' % kw['python'] or ''
237
	You can pass the same parameters as the command line (without "--boost-"),
237
		# Trying libraries, from most strict match to least one
238
	but the command line has the priority.
238
		for pattern in ['boost_%s%s%s%s%s' % (lib, toolset_pat, tags, py, version),
239
	"""
239
						'boost_%s%s%s%s' % (lib, tags, py, version),
240
	if not self.env['CXX']:
240
						'boost_%s%s%s' % (lib, tags, version),
241
		self.fatal('load a c++ compiler first, conf.load("compiler_cxx")')
241
						# Give up trying to find the right version
242
242
						'boost_%s%s%s%s' % (lib, toolset_pat, tags, py),
243
	params = {'lib': k and k[0] or kw.get('lib', None)}
243
						'boost_%s%s%s' % (lib, tags, py),
244
	for key, value in self.options.__dict__.items():
244
						'boost_%s%s' % (lib, tags)]:
245
		if not key.startswith('boost_'):
245
			self.to_log('Trying pattern %s' % pattern)
246
			continue
246
			file = find_lib(re.compile(pattern), files)
247
		key = key[len('boost_'):]
247
			if file:
248
		params[key] = value and value or kw.get(key, '')
248
				libs.append(format_lib_name(file.name))
249
249
				break
250
	var = kw.get('uselib_store', 'BOOST')
250
		else:
251
251
			self.fatal('lib %s not found in %s' % (lib, path.abspath()))
252
	self.start_msg('Checking boost includes')
252
253
	try:
253
	return path.abspath(), libs
254
		self.env['INCLUDES_%s' % var] = self.boost_get_includes(**params)
254
255
		self.env.BOOST_VERSION = self.boost_get_version(self.env['INCLUDES_%s' % var])
255
256
	except WafError:
256
@conf
257
		self.end_msg("not found", 'YELLOW')
257
def check_boost(self, *k, **kw):
258
		raise
258
	"""
259
	self.end_msg(self.env.BOOST_VERSION)
259
	Initialize boost libraries to be used.
260
	if Logs.verbose:
260
261
		Logs.pprint('CYAN', '	path : %s' % self.env['INCLUDES_%s' % var])
261
	Keywords: you can pass the same parameters as with the command line (without "--boost-").
262
262
	Note that the command line has the priority, and should preferably be used.
263
	if not params['lib']:
263
	"""
264
		return
264
	if not self.env['CXX']:
265
	self.start_msg('Checking boost libs')
265
		self.fatal('load a c++ compiler first, conf.load("compiler_cxx")')
266
	try:
266
267
		suffix = params.get('static', 'ST') or ''
267
	params = {'lib': k and k[0] or kw.get('lib', None)}
268
		path, libs = self.boost_get_libs(**params)
268
	for key, value in self.options.__dict__.items():
269
	except WafError:
269
		if not key.startswith('boost_'):
270
		self.end_msg("not found", 'YELLOW')
270
			continue
271
		raise
271
		key = key[len('boost_'):]
272
	self.env['%sLIBPATH_%s' % (suffix, var)] = [path]
272
		params[key] = value and value or kw.get(key, '')
273
	self.env['%sLIB_%s' % (suffix, var)] = libs
273
274
	self.end_msg('ok')
274
	var = kw.get('uselib_store', 'BOOST')
275
	if Logs.verbose:
275
276
		Logs.pprint('CYAN', '	path : %s' % path)
276
	self.start_msg('Checking boost includes')
277
		Logs.pprint('CYAN', '	libs : %s' % libs)
277
	self.env['INCLUDES_%s' % var] = inc = self.boost_get_includes(**params)
278
278
	self.env.BOOST_VERSION = self.boost_get_version(inc)
279
	self.end_msg(self.env.BOOST_VERSION)
280
	if Logs.verbose:
281
		Logs.pprint('CYAN', '	path : %s' % self.env['INCLUDES_%s' % var])
282
283
	if not params['lib']:
284
		return
285
	self.start_msg('Checking boost libs')
286
	suffix = params.get('static', None) and 'ST' or ''
287
	path, libs = self.boost_get_libs(**params)
288
	self.env['%sLIBPATH_%s' % (suffix, var)] = [path]
289
	self.env['%sLIB_%s' % (suffix, var)] = libs
290
	self.end_msg('ok')
291
	if Logs.verbose:
292
		Logs.pprint('CYAN', '	path : %s' % path)
293
		Logs.pprint('CYAN', '	libs : %s' % libs)
294
295
296
	def try_link():
297
		if 'system' in params['lib']:
298
			self.check_cxx(
299
			 fragment="\n".join([
300
			  '#include <boost/system/error_code.hpp>',
301
			  'int main() { boost::system::error_code c; }',
302
			 ]),
303
			 use=var,
304
			 execute=False,
305
			)
306
		if 'thread' in params['lib']:
307
			self.check_cxx(
308
			 fragment="\n".join([
309
			  '#include <boost/thread.hpp>',
310
			  'int main() { boost::thread t; }',
311
			 ]),
312
			 use=var,
313
			 execute=False,
314
			)
315
316
	if params.get('linkage_autodetect', False):
317
		self.start_msg("Attempting to detect boost linkage flags")
318
		toolset = self.boost_get_toolset(kw.get('toolset', ''))
319
		if toolset in ['vc']:
320
			# disable auto-linking feature, causing error LNK1181
321
			# because the code wants to be linked against
322
			self.env['DEFINES_%s' % var] += ['BOOST_ALL_NO_LIB']
323
324
			# if no dlls are present, we guess the .lib files are not stubs
325
			has_dlls = False
326
			for x in Utils.listdir(path):
327
				if x.endswith(self.env.cxxshlib_PATTERN % ''):
328
					has_dlls = True
329
					break
330
			if not has_dlls:
331
				self.env['STLIBPATH_%s' % var] = [path]
332
				self.env['STLIB_%s' % var] = libs
333
				del self.env['LIB_%s' % var]
334
				del self.env['LIBPATH_%s' % var]
335
336
			# we attempt to play with some known-to-work CXXFLAGS combinations
337
			for cxxflags in (['/MD', '/EHsc'], []):
338
				self.env.stash()
339
				self.env["CXXFLAGS_%s" % var] += cxxflags
340
				try:
341
					try_link()
342
					self.end_msg("ok: winning cxxflags combination: %s" % (self.env["CXXFLAGS_%s" % var]))
343
					e = None
344
					break
345
				except Errors.ConfigurationError as exc:
346
					self.env.revert()
347
					e = exc
348
349
			if e is not None:
350
				self.fatal("Could not auto-detect boost linking flags combination, you may report it to boost.py author", ex=e)
351
		else:
352
			self.fatal("Boost linkage flags auto-detection not implemented (needed ?) for this toolchain")
353
	else:
354
		self.start_msg('Checking for boost linkage')
355
		try:
356
			try_link()
357
		except Errors.ConfigurationError as e:
358
			self.fatal("Could not link against boost libraries using supplied options")
359
		self.end_msg('ok')
360
(-)a/waf-tools/cflags.py (-3 / +1 lines)
 Lines 1-6    Link Here 
1
import Logs
1
from waflib import Logs, Options, Utils
2
import Options
3
import Utils
4
2
5
3
6
class CompilerTraits(object):
4
class CompilerTraits(object):
(-)a/waf-tools/command.py (-9 / +6 lines)
 Lines 1-18    Link Here 
1
import TaskGen# import feature, taskgen_method, before_method, task_gen
1
import re
2
import Node, Task, Utils, Build
3
import subprocess
2
import subprocess
4
import Options
3
4
# import feature, taskgen_method, before_method, task_gen
5
from waflib import TaskGen, Node, Task, Utils, Build, Options, Logs, Task
6
debug = Logs.debug
7
error = Logs.error
5
8
6
import shellcmd
9
import shellcmd
7
#shellcmd.subprocess = pproc # the WAF version of the subprocess module is supposedly less buggy
10
#shellcmd.subprocess = pproc # the WAF version of the subprocess module is supposedly less buggy
8
9
from Logs import debug, error
10
shellcmd.debug = debug
11
shellcmd.debug = debug
11
12
12
import Task
13
14
import re
15
16
13
17
arg_rx = re.compile(r"(?P<dollar>\$\$)|(?P<subst>\$\{(?P<var>\w+)(?P<code>.*?)\})", re.M)
14
arg_rx = re.compile(r"(?P<dollar>\$\$)|(?P<subst>\$\{(?P<var>\w+)(?P<code>.*?)\})", re.M)
18
15
(-)a/waf-tools/misc.py (-3 lines)
 Lines 322-330    Link Here 
322
322
323
	if self.cwd is None:
323
	if self.cwd is None:
324
		cwd = None
324
		cwd = None
325
	else:
326
		assert isinstance(cwd, CmdDirArg)
327
		self.cwd.find_node(self.path)
328
325
329
	args = []
326
	args = []
330
	inputs = []
327
	inputs = []
(-)a/waf-tools/pkgconfig.py (-78 lines)
 Lines 1-78    Link Here 
1
# -*- mode: python; encoding: utf-8 -*-
2
# Gustavo Carneiro (gjamc) 2008
3
4
import Options
5
import Configure
6
import subprocess
7
import config_c
8
import sys
9
10
def configure(conf):
11
	pkg_config = conf.find_program('pkg-config', var='PKG_CONFIG')
12
	if not pkg_config: return
13
14
@Configure.conf
15
def pkg_check_modules(conf, uselib_name, expression, mandatory=True):
16
	pkg_config = conf.env['PKG_CONFIG']
17
	if not pkg_config:
18
		if mandatory:
19
			conf.fatal("pkg-config is not available")
20
		else:
21
			return False
22
23
	if Options.options.verbose:
24
		extra_msg = ' (%s)' % expression
25
	else:
26
		extra_msg = ''
27
28
	conf.start_msg('Checking for pkg-config flags for %s%s' % (uselib_name, extra_msg))
29
30
	argv = [pkg_config, '--cflags', '--libs', expression]
31
	cmd = subprocess.Popen(argv, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
32
	out, err = cmd.communicate()
33
	retval = cmd.wait()
34
35
	conf.to_log('%r: %r (exit code %i)\n%s' % (argv, out, retval, err))
36
37
	if retval != 0:
38
		conf.end_msg(False)
39
		sys.stderr.write(err)
40
	else:
41
		if Options.options.verbose:
42
			conf.end_msg(out)
43
		else:
44
			conf.end_msg(True)
45
46
	if retval == 0:
47
		conf.parse_flags(out, uselib_name, conf.env)
48
		conf.env[uselib_name] = True
49
		return True
50
51
	else:
52
53
		conf.env[uselib_name] = False
54
		if mandatory:
55
			raise Configure.ConfigurationError('pkg-config check failed')
56
		else:
57
			return False
58
59
@Configure.conf
60
def pkg_check_module_variable(conf, module, variable):
61
	pkg_config = conf.env['PKG_CONFIG']
62
	if not pkg_config:
63
		conf.fatal("pkg-config is not available")
64
65
	argv = [pkg_config, '--variable', variable, module]
66
	cmd = subprocess.Popen(argv, stdout=subprocess.PIPE)
67
	out, dummy = cmd.communicate()
68
	retval = cmd.wait()
69
	out = out.rstrip() # strip the trailing newline
70
71
	msg_checking = ("Checking for pkg-config variable %r in %s" % (variable, module,))
72
	conf.check_message_custom(msg_checking, '', out)
73
	conf.log.write('%r: %r (exit code %i)\n' % (argv, out, retval))
74
75
	if retval == 0:
76
		return out
77
	else:
78
		raise Configure.ConfigurationError('pkg-config check failed')
(-)a/waf-tools/relocation.py (-2 / +2 lines)
 Lines 64-70    Link Here 
64
	try:
64
	try:
65
		return self.uid_
65
		return self.uid_
66
	except AttributeError:
66
	except AttributeError:
67
		# this is not a real hot zone, but we want to avoid surprizes here
67
		# this is not a real hot zone, but we want to avoid surprises here
68
		m = Utils.md5()
68
		m = Utils.md5()
69
		up = m.update
69
		up = m.update
70
		up(self.__class__.__name__.encode())
70
		up(self.__class__.__name__.encode())
 Lines 80-85    Link Here 
80
	lst = self.to_incnodes(self.to_list(getattr(self, 'includes', [])) + self.env['INCLUDES'])
80
	lst = self.to_incnodes(self.to_list(getattr(self, 'includes', [])) + self.env['INCLUDES'])
81
	self.includes_nodes = lst
81
	self.includes_nodes = lst
82
	bld = self.bld
82
	bld = self.bld
83
	self.env['INCPATHS'] = [x.is_child_of(bld.srcnode) and x.path_from(bld.srcnode) or x.abspath() for x in lst]
83
	self.env['INCPATHS'] = [x.is_child_of(bld.srcnode) and x.path_from(bld.bldnode) or x.abspath() for x in lst]
84
84
85
85
(-)a/wscript (-64 / +43 lines)
 Lines 8-32    Link Here 
8
import os.path
8
import os.path
9
import re
9
import re
10
import shlex
10
import shlex
11
import subprocess
11
import textwrap
12
import textwrap
12
13
14
from utils import read_config_file
15
16
13
# WAF modules
17
# WAF modules
14
import subprocess
18
from waflib import Utils, Scripting, Configure, Build, Options, TaskGen, Context, Task, Logs, Errors
15
import Options
16
17
import Logs
18
import TaskGen
19
20
import Task
21
22
import Utils
23
import Build
24
import Configure
25
import Scripting
26
27
from waflib.Errors import WafError
19
from waflib.Errors import WafError
28
20
29
from utils import read_config_file
21
22
# local modules
23
import wutils
24
30
25
31
# By default, all modules will be enabled, examples will be disabled,
26
# By default, all modules will be enabled, examples will be disabled,
32
# and tests will be disabled.
27
# and tests will be disabled.
 Lines 52-60    Link Here 
52
	}
47
	}
53
cflags.default_profile = 'debug'
48
cflags.default_profile = 'debug'
54
49
55
# local modules
56
import wutils
57
58
Configure.autoconfig = 0
50
Configure.autoconfig = 0
59
51
60
# the following two variables are used by the target "waf dist"
52
# the following two variables are used by the target "waf dist"
 Lines 214-222    Link Here 
214
                   dest='doxygen_no_build')
206
                   dest='doxygen_no_build')
215
207
216
    # options provided in subdirectories
208
    # options provided in subdirectories
217
    opt.sub_options('src')
209
    opt.recurse('src')
218
    opt.sub_options('bindings/python')
210
    opt.recurse('bindings/python')
219
    opt.sub_options('src/internet')
211
    opt.recurse('src/internet')
220
212
221
213
222
def _check_compilation_flag(conf, flag, mode='cxx', linkflags=None):
214
def _check_compilation_flag(conf, flag, mode='cxx', linkflags=None):
 Lines 240-246    Link Here 
240
        flag_str = flag_str[:28] + "..."
232
        flag_str = flag_str[:28] + "..."
241
233
242
    conf.start_msg('Checking for compilation %s support' % (flag_str,))
234
    conf.start_msg('Checking for compilation %s support' % (flag_str,))
243
    env = conf.env.copy()
235
    env = conf.env.derive()
244
236
245
    if mode == 'cc':
237
    if mode == 'cc':
246
        mode = 'c'
238
        mode = 'c'
 Lines 259-265    Link Here 
259
        retval = conf.run_c_code(code='#include <stdio.h>\nint main() { return 0; }\n',
251
        retval = conf.run_c_code(code='#include <stdio.h>\nint main() { return 0; }\n',
260
                                 env=env, compile_filename=fname,
252
                                 env=env, compile_filename=fname,
261
                                 features=[mode, mode+'program'], execute=False)
253
                                 features=[mode, mode+'program'], execute=False)
262
    except Configure.ConfigurationError:
254
    except Errors.ConfigurationError:
263
        ok = False
255
        ok = False
264
    else:
256
    else:
265
        ok = (retval == 0)
257
        ok = (retval == 0)
 Lines 286-292    Link Here 
286
        return None
278
        return None
287
279
288
def configure(conf):
280
def configure(conf):
289
    conf.check_tool("relocation", ["waf-tools"])
281
    conf.load('relocation', tooldir=['waf-tools'])
290
282
291
    # attach some extra methods
283
    # attach some extra methods
292
    conf.check_nonfatal = types.MethodType(_check_nonfatal, conf)
284
    conf.check_nonfatal = types.MethodType(_check_nonfatal, conf)
 Lines 295-309    Link Here 
295
    conf.check_optional_feature = types.MethodType(check_optional_feature, conf)
287
    conf.check_optional_feature = types.MethodType(check_optional_feature, conf)
296
    conf.env['NS3_OPTIONAL_FEATURES'] = []
288
    conf.env['NS3_OPTIONAL_FEATURES'] = []
297
289
298
    conf.check_tool('compiler_c')
290
    conf.load('compiler_c')
299
    conf.check_tool('compiler_cxx')
291
    conf.load('compiler_cxx')
300
    conf.check_tool('cflags', ['waf-tools'])
292
    conf.load('cflags', tooldir=['waf-tools'])
301
    try:
293
    conf.load('command', tooldir=['waf-tools'])
302
        conf.check_tool('pkgconfig', ['waf-tools'])
294
    conf.load('gnu_dirs')
303
    except Configure.ConfigurationError:
304
        pass
305
    conf.check_tool('command', ['waf-tools'])
306
    conf.check_tool('gnu_dirs')
307
295
308
    env = conf.env
296
    env = conf.env
309
297
 Lines 376-384    Link Here 
376
364
377
    conf.env['MODULES_NOT_BUILT'] = []
365
    conf.env['MODULES_NOT_BUILT'] = []
378
366
379
    conf.sub_config('bindings/python')
367
    conf.recurse('bindings/python')
380
368
381
    conf.sub_config('src')
369
    conf.recurse('src')
382
370
383
    # Set the list of enabled modules.
371
    # Set the list of enabled modules.
384
    if Options.options.enable_modules:
372
    if Options.options.enable_modules:
 Lines 410-416    Link Here 
410
            if not conf.env['NS3_ENABLED_MODULES']:
398
            if not conf.env['NS3_ENABLED_MODULES']:
411
                raise WafError('Exiting because the ' + not_built + ' module can not be built and it was the only one enabled.')
399
                raise WafError('Exiting because the ' + not_built + ' module can not be built and it was the only one enabled.')
412
400
413
    conf.sub_config('src/mpi')
401
    conf.recurse('src/mpi')
414
402
415
    # for suid bits
403
    # for suid bits
416
    try:
404
    try:
 Lines 488-506    Link Here 
488
    # These flags are used for the implicitly dependent modules.
476
    # These flags are used for the implicitly dependent modules.
489
    if env['ENABLE_STATIC_NS3']:
477
    if env['ENABLE_STATIC_NS3']:
490
        if sys.platform == 'darwin':
478
        if sys.platform == 'darwin':
491
            env.STATICLIB_MARKER = '-Wl,-all_load'
479
            env.STLIB_MARKER = '-Wl,-all_load'
492
        else:
480
        else:
493
            env.STATICLIB_MARKER = '-Wl,--whole-archive,-Bstatic'
481
            env.STLIB_MARKER = '-Wl,--whole-archive,-Bstatic'
494
            env.SHLIB_MARKER = '-Wl,-Bdynamic,--no-whole-archive'
482
            env.SHLIB_MARKER = '-Wl,-Bdynamic,--no-whole-archive'
495
483
496
    have_gsl = conf.pkg_check_modules('GSL', 'gsl', mandatory=False)
484
485
    have_gsl = conf.check_cfg(package='gsl', args=['--cflags', '--libs'],
486
                              uselib_store='GSL', mandatory=False)
497
    conf.env['ENABLE_GSL'] = have_gsl
487
    conf.env['ENABLE_GSL'] = have_gsl
498
499
    conf.report_optional_feature("GSL", "GNU Scientific Library (GSL)",
488
    conf.report_optional_feature("GSL", "GNU Scientific Library (GSL)",
500
                                 conf.env['ENABLE_GSL'],
489
                                 conf.env['ENABLE_GSL'],
501
                                 "GSL not found")
490
                                 "GSL not found")
502
    if have_gsl:
503
        conf.env.append_value('DEFINES', "ENABLE_GSL")
504
491
505
    # for compiling C code, copy over the CXX* flags
492
    # for compiling C code, copy over the CXX* flags
506
    conf.env.append_value('CCFLAGS', conf.env['CXXFLAGS'])
493
    conf.env.append_value('CCFLAGS', conf.env['CXXFLAGS'])
 Lines 555-561    Link Here 
555
        except ValueError, ex:
542
        except ValueError, ex:
556
            raise WafError(str(ex))
543
            raise WafError(str(ex))
557
        program_node = program_obj.path.find_or_declare(program_obj.target)
544
        program_node = program_obj.path.find_or_declare(program_obj.target)
558
        self.filename = program_node.abspath()
545
        self.filename = program_node.get_bld().abspath()
559
546
560
547
561
    def run(self):
548
    def run(self):
 Lines 580-586    Link Here 
580
def create_suid_program(bld, name):
567
def create_suid_program(bld, name):
581
    grp = bld.current_group
568
    grp = bld.current_group
582
    bld.add_group() # this to make sure no two sudo tasks run at the same time
569
    bld.add_group() # this to make sure no two sudo tasks run at the same time
583
    program = bld.new_task_gen(features=['cxx', 'cxxprogram'])
570
    program = bld(features='cxx cxxprogram')
584
    program.is_ns3_program = True
571
    program.is_ns3_program = True
585
    program.module_deps = list()
572
    program.module_deps = list()
586
    program.name = name
573
    program.name = name
 Lines 594-600    Link Here 
594
    return program
581
    return program
595
582
596
def create_ns3_program(bld, name, dependencies=('core',)):
583
def create_ns3_program(bld, name, dependencies=('core',)):
597
    program = bld.new_task_gen(features=['cxx', 'cxxprogram'])
584
    program = bld(features='cxx cxxprogram')
598
585
599
    program.is_ns3_program = True
586
    program.is_ns3_program = True
600
    program.name = name
587
    program.name = name
 Lines 607-613    Link Here 
607
        if sys.platform == 'darwin':
594
        if sys.platform == 'darwin':
608
            program.env.STLIB_MARKER = '-Wl,-all_load'
595
            program.env.STLIB_MARKER = '-Wl,-all_load'
609
        else:
596
        else:
610
            program.env.STLIB_MARKER = '-Wl,--whole-archive,-Bstatic'
597
            program.env.STLIB_MARKER = '-Wl,-Bstatic,--whole-archive'
611
            program.env.SHLIB_MARKER = '-Wl,-Bdynamic,--no-whole-archive'
598
            program.env.SHLIB_MARKER = '-Wl,-Bdynamic,--no-whole-archive'
612
    else:
599
    else:
613
        if program.env.DEST_BINFMT == 'elf':
600
        if program.env.DEST_BINFMT == 'elf':
 Lines 628-635    Link Here 
628
            if dir.startswith('.') or dir == 'CVS':
615
            if dir.startswith('.') or dir == 'CVS':
629
                continue
616
                continue
630
            if os.path.isdir(os.path.join('examples', dir)):
617
            if os.path.isdir(os.path.join('examples', dir)):
631
                bld.add_subdirs(os.path.join('examples', dir))
618
                bld.recurse(os.path.join('examples', dir))
632
633
619
634
def add_scratch_programs(bld):
620
def add_scratch_programs(bld):
635
    all_modules = [mod[len("ns3-"):] for mod in bld.env['NS3_ENABLED_MODULES']]
621
    all_modules = [mod[len("ns3-"):] for mod in bld.env['NS3_ENABLED_MODULES']]
 Lines 639-645    Link Here 
639
        if os.path.isdir(os.path.join("scratch", filename)):
625
        if os.path.isdir(os.path.join("scratch", filename)):
640
            obj = bld.create_ns3_program(filename, all_modules)
626
            obj = bld.create_ns3_program(filename, all_modules)
641
            obj.path = obj.path.find_dir('scratch').find_dir(filename)
627
            obj.path = obj.path.find_dir('scratch').find_dir(filename)
642
            obj.source = obj.path.ant_glob('*.cc')
628
            obj.source = obj.path.get_bld().ant_glob('*.cc')
643
            obj.target = filename
629
            obj.target = filename
644
            obj.name = obj.target
630
            obj.name = obj.target
645
            obj.install_path = None
631
            obj.install_path = None
 Lines 652-658    Link Here 
652
            obj.name = obj.target
638
            obj.name = obj.target
653
            obj.install_path = None
639
            obj.install_path = None
654
640
655
656
def _get_all_task_gen(self):
641
def _get_all_task_gen(self):
657
    for group in self.groups:
642
    for group in self.groups:
658
        for taskgen in group:
643
        for taskgen in group:
 Lines 699-710    Link Here 
699
684
700
    wutils.bld = bld
685
    wutils.bld = bld
701
    if Options.options.no_task_lines:
686
    if Options.options.no_task_lines:
702
        import Runner
687
        from waflib import Runner
703
        def null_printout(s):
688
        def null_printout(s):
704
            pass
689
            pass
705
        Runner.printout = null_printout
690
        Runner.printout = null_printout
706
691
707
    Options.cwd_launch = bld.path.abspath()
692
    Options.cwd_launch = bld.path.get_bld().abspath()
708
    bld.create_ns3_program = types.MethodType(create_ns3_program, bld)
693
    bld.create_ns3_program = types.MethodType(create_ns3_program, bld)
709
    bld.register_ns3_script = types.MethodType(register_ns3_script, bld)
694
    bld.register_ns3_script = types.MethodType(register_ns3_script, bld)
710
    bld.create_suid_program = types.MethodType(create_suid_program, bld)
695
    bld.create_suid_program = types.MethodType(create_suid_program, bld)
 Lines 713-719    Link Here 
713
    bld.find_ns3_module = types.MethodType(_find_ns3_module, bld)
698
    bld.find_ns3_module = types.MethodType(_find_ns3_module, bld)
714
699
715
    # process subfolders from here
700
    # process subfolders from here
716
    bld.add_subdirs('src')
701
    bld.recurse('src')
717
702
718
    # If modules have been enabled, then set lists of enabled modules
703
    # If modules have been enabled, then set lists of enabled modules
719
    # and enabled module test libraries.
704
    # and enabled module test libraries.
 Lines 747-753    Link Here 
747
                    bld.env.append_value('NS3_ENABLED_MODULE_TEST_LIBRARIES', testlib)
732
                    bld.env.append_value('NS3_ENABLED_MODULE_TEST_LIBRARIES', testlib)
748
733
749
    add_examples_programs(bld)
734
    add_examples_programs(bld)
750
    add_scratch_programs(bld)
735
    #add_scratch_programs(bld)
751
736
752
    if env['NS3_ENABLED_MODULES']:
737
    if env['NS3_ENABLED_MODULES']:
753
        modules = env['NS3_ENABLED_MODULES']
738
        modules = env['NS3_ENABLED_MODULES']
 Lines 780-786    Link Here 
780
                    # launch directory.
765
                    # launch directory.
781
                    launch_dir = os.path.abspath(Context.launch_dir)
766
                    launch_dir = os.path.abspath(Context.launch_dir)
782
                    object_relative_path = os.path.join(
767
                    object_relative_path = os.path.join(
783
                        wutils.relpath(obj.path.abspath(), launch_dir),
768
                        wutils.relpath(obj.path.get_bld().abspath(), launch_dir),
784
                        object_name)
769
                        object_name)
785
770
786
                    bld.env.append_value('NS3_RUNNABLE_PROGRAMS', object_relative_path)
771
                    bld.env.append_value('NS3_RUNNABLE_PROGRAMS', object_relative_path)
 Lines 821-831    Link Here 
821
        if script_runnable:
806
        if script_runnable:
822
            bld.env.append_value('NS3_RUNNABLE_SCRIPTS', script)
807
            bld.env.append_value('NS3_RUNNABLE_SCRIPTS', script)
823
808
824
    bld.add_subdirs('bindings/python')
809
    bld.recurse('bindings/python')
825
810
826
    # Process this subfolder here after the lists of enabled modules
811
    # Process this subfolder here after the lists of enabled modules
827
    # and module test libraries have been set.
812
    # and module test libraries have been set.
828
    bld.add_subdirs('utils')
813
    bld.recurse('utils')
829
814
830
    # Set this so that the lists will be printed at the end of this
815
    # Set this so that the lists will be printed at the end of this
831
    # build command.
816
    # build command.
 Lines 920-926    Link Here 
920
905
921
906
922
907
923
from waflib import Context, Build
924
class CheckContext(Context.Context):
908
class CheckContext(Context.Context):
925
    """run the equivalent of the old ns-3 unit tests using test.py"""
909
    """run the equivalent of the old ns-3 unit tests using test.py"""
926
    cmd = 'check'
910
    cmd = 'check'
 Lines 962-968    Link Here 
962
                           # --enable-modules=xxx
946
                           # --enable-modules=xxx
963
            pass
947
            pass
964
        else:
948
        else:
965
            prog = program_obj.path.find_or_declare(ccroot.get_target_name(program_obj)).abspath(env)
949
            prog = program_obj.path.find_or_declare(ccroot.get_target_name(program_obj)).get_bld().abspath(env)
966
950
967
            # Create a header file with the introspected information.
951
            # Create a header file with the introspected information.
968
            doxygen_out = open(os.path.join('doc', 'introspected-doxygen.h'), 'w')
952
            doxygen_out = open(os.path.join('doc', 'introspected-doxygen.h'), 'w')
 Lines 1016-1022    Link Here 
1016
        raise WafError(msg)
1000
        raise WafError(msg)
1017
1001
1018
1002
1019
from waflib import Context, Build
1020
class Ns3ShellContext(Context.Context):
1003
class Ns3ShellContext(Context.Context):
1021
    """run a shell with an environment suitably modified to run locally built programs"""
1004
    """run a shell with an environment suitably modified to run locally built programs"""
1022
    cmd = 'shell'
1005
    cmd = 'shell'
 Lines 1062-1068    Link Here 
1062
        raise SystemExit(1)
1045
        raise SystemExit(1)
1063
        return
1046
        return
1064
1047
1065
    prog = program_obj.path.find_or_declare(program_obj.target).abspath()
1048
    prog = program_obj.path.find_or_declare(program_obj.target).get_bld().abspath()
1066
1049
1067
    if not os.path.exists(prog):
1050
    if not os.path.exists(prog):
1068
        Logs.error("print-introspected-doxygen has not been built yet."
1051
        Logs.error("print-introspected-doxygen has not been built yet."
 Lines 1089-1096    Link Here 
1089
        raise SystemExit(1)
1072
        raise SystemExit(1)
1090
1073
1091
1074
1092
from waflib import Context, Build
1093
1094
def _getVersion():
1075
def _getVersion():
1095
    """update the ns3_version.js file, when building documentation"""
1076
    """update the ns3_version.js file, when building documentation"""
1096
1077
 Lines 1110-1116    Link Here 
1110
	bld.execute()
1091
	bld.execute()
1111
        _doxygen(bld)
1092
        _doxygen(bld)
1112
1093
1113
from waflib import Context, Build
1114
class Ns3SphinxContext(Context.Context):
1094
class Ns3SphinxContext(Context.Context):
1115
    """build the Sphinx documentation: manual, tutorial, models"""
1095
    """build the Sphinx documentation: manual, tutorial, models"""
1116
    
1096
    
 Lines 1131-1137    Link Here 
1131
            self.sphinx_build(os.path.join("doc", sphinxdir))
1111
            self.sphinx_build(os.path.join("doc", sphinxdir))
1132
     
1112
     
1133
1113
1134
from waflib import Context, Build
1135
class Ns3DocContext(Context.Context):
1114
class Ns3DocContext(Context.Context):
1136
    """build all the documentation: doxygen, manual, tutorial, models"""
1115
    """build all the documentation: doxygen, manual, tutorial, models"""
1137
    
1116
    
(-)a/wutils.py (-7 / +3 lines)
 Lines 1-16    Link Here 
1
import os
1
import os
2
import os.path
2
import os.path
3
import re
3
import sys
4
import sys
4
import subprocess
5
import subprocess
5
import shlex
6
import shlex
6
7
7
# WAF modules
8
# WAF modules
8
import Options
9
from waflib import Options, Utils, Logs, TaskGen, Build, Context
9
import Utils
10
import Logs
11
import TaskGen
12
import Build
13
import re
14
from waflib.Errors import WafError
10
from waflib.Errors import WafError
15
11
16
# these are set from the main wscript file
12
# these are set from the main wscript file
 Lines 47-53    Link Here 
47
            return os.path.curdir
43
            return os.path.curdir
48
        return os.path.join(*rel_list)
44
        return os.path.join(*rel_list)
49
45
50
from waflib import Context
46
51
def find_program(program_name, env):
47
def find_program(program_name, env):
52
    launch_dir = os.path.abspath(Context.launch_dir)
48
    launch_dir = os.path.abspath(Context.launch_dir)
53
    #top_dir = os.path.abspath(Options.cwd_launch)
49
    #top_dir = os.path.abspath(Options.cwd_launch)

Return to bug 1562