diff --git a/src/test/ns3tcp/wscript b/src/test/ns3tcp/wscript index 681ae1e0f..4988870ed 100644 --- a/src/test/ns3tcp/wscript +++ b/src/test/ns3tcp/wscript @@ -1,9 +1,18 @@ ## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- def configure(conf): - pass + # Add the ns3tcp module to the list of enabled modules that + # should not be built if this is a static build on Darwin. They + # don't work there for the ns3tcp module, and this is probably + # because the ns3tcp module has no source files. + if conf.env['ENABLE_STATIC_NS3'] and sys.platform == 'darwin': + conf.env['MODULES_NOT_BUILT'].append('ns3tcp') def build(bld): + # Don't do anything for this module if it should not be built. + if 'ns3tcp' in bld.env['MODULES_NOT_BUILT']: + return + ns3tcp = bld.create_ns3_module('ns3tcp', ['internet', 'point-to-point', 'csma', 'applications']) headers = bld.new_task_gen('ns3header') headers.module = 'ns3tcp' diff --git a/src/test/ns3wifi/wscript b/src/test/ns3wifi/wscript index 79b2846ac..508f3abb3 100644 --- a/src/test/ns3wifi/wscript +++ b/src/test/ns3wifi/wscript @@ -1,9 +1,18 @@ ## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- def configure(conf): - pass + # Add the ns3wifi module to the list of enabled modules that + # should not be built if this is a static build on Darwin. They + # don't work there for the ns3wifi module, and this is probably + # because the ns3wifi module has no source files. + if conf.env['ENABLE_STATIC_NS3'] and sys.platform == 'darwin': + conf.env['MODULES_NOT_BUILT'].append('ns3wifi') def build(bld): + # Don't do anything for this module if it should not be built. + if 'ns3wifi' in bld.env['MODULES_NOT_BUILT']: + return + ns3wifi = bld.create_ns3_module('ns3wifi', ['internet', 'mobility', 'propagation', 'wifi', 'applications']) headers = bld.new_task_gen('ns3header') headers.module = 'ns3wifi' diff --git a/src/visualizer/model/dummy-file-for-static-builds.cc b/src/visualizer/model/dummy-file-for-static-builds.cc new file mode 100644 index 000000000..0866b725e --- /dev/null +++ b/src/visualizer/model/dummy-file-for-static-builds.cc @@ -0,0 +1,21 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright 2011 University of Washington + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Mitch Watrous (watrous@u.washington.edu) + */ + +// This file does nothing. diff --git a/src/visualizer/wscript b/src/visualizer/wscript index a6f943569..9dea2216e 100644 --- a/src/visualizer/wscript +++ b/src/visualizer/wscript @@ -1,12 +1,37 @@ ## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- +import Options + +def configure(conf): + # If Python was explicitly disabled, then add this module to the + # list of modules that won't be built if they are enabled. + if Options.options.python_disable: + conf.env['MODULES_NOT_BUILT'].append('visualizer') def build(bld): + # Don't do anything for this module if Python was explicitly + # disabled. + if 'visualizer' in bld.env['MODULES_NOT_BUILT']: + return + headers = bld.new_task_gen('ns3header') headers.module = 'visualizer' headers.source = [ ] - module = bld.create_ns3_module('visualizer', ['network', 'wifi']) + module = bld.create_ns3_module('visualizer', ['internet', 'wifi', 'point-to-point']) + + # XXX This file was added so that static builds would work on + # Darwin, which doesn't like modules with no source files. It + # would have been better to add this module to the list + # conf.env['MODULES_NOT_BUILT'] if Python bindings were not + # enabled, but it's not possible for this module to determine in + # its configure() function if Python bindings will be enabled + # because that is done by the wscript file in bindings/python that + # is parsed after this module's wscript file is parsed. + module.source = [ + 'model/dummy-file-for-static-builds.cc', + ] + if not bld.env['ENABLE_PYTHON_BINDINGS']: return @@ -14,14 +39,10 @@ def build(bld): module.env.append_value('CXXFLAGS', module.env['shlib_CXXFLAGS']) module.includes = '.' - if bld.env['ENABLE_PYTHON_BINDINGS']: - module.source = [ - 'model/pyviz.cc', - 'model/visual-simulator-impl.cc', - ] - headers.source.append('model/pyviz.h') - else: - module.source = [ - ] + module.source.extend([ + 'model/pyviz.cc', + 'model/visual-simulator-impl.cc', + ]) + headers.source.append('model/pyviz.h') bld.ns3_python_bindings() diff --git a/src/wscript b/src/wscript index 705b321a7..f3548f543 100644 --- a/src/wscript +++ b/src/wscript @@ -90,6 +90,7 @@ def configure(conf): conf.sub_config('click') conf.sub_config('openflow') conf.sub_config('stats') + conf.sub_config('visualizer') blddir = os.path.abspath(os.path.join(conf.blddir, conf.env.variant())) conf.env.append_value('NS3_MODULE_PATH', blddir)