## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- import sys import subprocess from waflib import Options from waflib.Errors import WafError def configure(conf): if Options.options.enable_mpi: # try to detect openmpi installation mpi = conf.check_cfg(path='mpic++', args='-showme', package='', uselib_store='MPI', mandatory=False) if mpi: conf.env.append_value('DEFINES_MPI', 'NS3_OPENMPI') else: # try the MPICH2 flags mpi = conf.check_cfg(path='mpic++', args='-compile-info -link-info', package='', uselib_store='MPI', mandatory=False) if mpi: conf.env.append_value('DEFINES_MPI', 'NS3_MPICH') if mpi: conf.env.append_value('DEFINES_MPI', 'NS3_MPI') conf.env['ENABLE_MPI'] = True for libpath in conf.env.LIBPATH_MPI: if 'mpi' in libpath: conf.env.append_value('LINKFLAGS_MPI', '-Wl,-rpath,'+libpath) conf.report_optional_feature("mpi", "MPI Support", True, '') else: conf.report_optional_feature("mpi", "MPI Support", False, 'mpic++ not found') else: conf.report_optional_feature("mpi", "MPI Support", False, 'option --enable-mpi not selected') def build(bld): env = bld.env sim = bld.create_ns3_module('mpi', ['core', 'network']) sim.source = [ 'model/distributed-simulator-impl.cc', 'model/granted-time-window-mpi-interface.cc', 'model/mpi-receiver.cc', 'model/null-message-simulator-impl.cc', 'model/null-message-mpi-interface.cc', 'model/remote-channel-bundle.cc', 'model/remote-channel-bundle-manager.cc', 'model/mpi-interface.cc', ] headers = bld(features='ns3header') headers.module = 'mpi' headers.source = [ 'model/mpi-receiver.h', 'model/mpi-interface.h', 'model/parallel-communication-interface.h', ] if env['ENABLE_MPI']: sim.use.append('MPI') if bld.env['ENABLE_EXAMPLES']: bld.recurse('examples') bld.ns3_python_bindings()