src/mpi/wscript
author Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
Thu, 08 Sep 2011 16:13:40 +0100
changeset 7487 82cd20da9650
parent 7086 d5eb93047270
child 7498 643cfe62eabf
permissions -rw-r--r--
Upgrade to waf-1.6.7, work in progress
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6113
0ce37bf4f1c1 Merge distributed simulation code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
     1
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
0ce37bf4f1c1 Merge distributed simulation code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
     2
import sys
7019
23bec5444c05 The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6905
diff changeset
     3
import subprocess
23bec5444c05 The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6905
diff changeset
     4
import Options
6113
0ce37bf4f1c1 Merge distributed simulation code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
     5
7019
23bec5444c05 The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6905
diff changeset
     6
23bec5444c05 The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6905
diff changeset
     7
def configure(conf):
23bec5444c05 The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6905
diff changeset
     8
    env = conf.env
23bec5444c05 The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6905
diff changeset
     9
    conf.find_program('mpic++', var='MPI')
23bec5444c05 The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6905
diff changeset
    10
    if Options.options.enable_mpi and conf.env['MPI']:
23bec5444c05 The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6905
diff changeset
    11
        p = subprocess.Popen([conf.env['MPI'], '-showme:compile'], stdout=subprocess.PIPE)
23bec5444c05 The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6905
diff changeset
    12
        flags = p.stdout.read().rstrip().split()
23bec5444c05 The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6905
diff changeset
    13
        p.wait()
23bec5444c05 The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6905
diff changeset
    14
        env.append_value("CXXFLAGS_MPI", flags)
23bec5444c05 The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6905
diff changeset
    15
23bec5444c05 The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6905
diff changeset
    16
        p = subprocess.Popen([conf.env['MPI'], '-showme:link'], stdout=subprocess.PIPE)
23bec5444c05 The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6905
diff changeset
    17
        flags = p.stdout.read().rstrip().split()
23bec5444c05 The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6905
diff changeset
    18
        p.wait()
23bec5444c05 The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6905
diff changeset
    19
        env.append_value("LINKFLAGS_MPI", flags)
23bec5444c05 The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6905
diff changeset
    20
23bec5444c05 The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6905
diff changeset
    21
        env.append_value('CXXDEFINES', 'NS3_MPI')
23bec5444c05 The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6905
diff changeset
    22
        conf.report_optional_feature("mpi", "MPI Support", True, '')
23bec5444c05 The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6905
diff changeset
    23
        conf.env['ENABLE_MPI'] = True
23bec5444c05 The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6905
diff changeset
    24
    else:
23bec5444c05 The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6905
diff changeset
    25
        if Options.options.enable_mpi:
23bec5444c05 The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6905
diff changeset
    26
            conf.report_optional_feature("mpi", "MPI Support", False, 'mpic++ not found')
23bec5444c05 The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6905
diff changeset
    27
        else:
23bec5444c05 The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6905
diff changeset
    28
            conf.report_optional_feature("mpi", "MPI Support", False, 'option --enable-mpi not selected')
6113
0ce37bf4f1c1 Merge distributed simulation code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    29
0ce37bf4f1c1 Merge distributed simulation code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    30
0ce37bf4f1c1 Merge distributed simulation code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    31
def build(bld):
7487
82cd20da9650 Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7086
diff changeset
    32
    env = bld.env
7019
23bec5444c05 The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6905
diff changeset
    33
    sim = bld.create_ns3_module('mpi', ['core', 'network'])
23bec5444c05 The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6905
diff changeset
    34
    sim.source = [
23bec5444c05 The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6905
diff changeset
    35
        'model/distributed-simulator-impl.cc',
23bec5444c05 The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6905
diff changeset
    36
        'model/mpi-interface.cc',
7085
5feb5c87d56f fix mpi
Tom Henderson <tomh@tomh.org>
parents: 7019
diff changeset
    37
        'model/mpi-receiver.cc',
7019
23bec5444c05 The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6905
diff changeset
    38
        ]
6113
0ce37bf4f1c1 Merge distributed simulation code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    39
7487
82cd20da9650 Upgrade to waf-1.6.7, work in progress
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 7086
diff changeset
    40
    headers = bld.new_task_gen(features=['ns3header'])
7019
23bec5444c05 The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6905
diff changeset
    41
    headers.module = 'mpi'
23bec5444c05 The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6905
diff changeset
    42
    headers.source = [
23bec5444c05 The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6905
diff changeset
    43
        'model/distributed-simulator-impl.h',
23bec5444c05 The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6905
diff changeset
    44
        'model/mpi-interface.h',
7085
5feb5c87d56f fix mpi
Tom Henderson <tomh@tomh.org>
parents: 7019
diff changeset
    45
        'model/mpi-receiver.h',
7019
23bec5444c05 The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6905
diff changeset
    46
        ]
6113
0ce37bf4f1c1 Merge distributed simulation code
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    47
7019
23bec5444c05 The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6905
diff changeset
    48
    if env['ENABLE_MPI']:
23bec5444c05 The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6905
diff changeset
    49
        sim.uselib = 'MPI'
7086
d5eb93047270 move MPI examples over
Josh Pelkey <jpelkey@gatech.edu>
parents: 7085
diff changeset
    50
d5eb93047270 move MPI examples over
Josh Pelkey <jpelkey@gatech.edu>
parents: 7085
diff changeset
    51
    if bld.env['ENABLE_EXAMPLES']:
d5eb93047270 move MPI examples over
Josh Pelkey <jpelkey@gatech.edu>
parents: 7085
diff changeset
    52
        bld.add_subdirs('examples')
6905
355d6562399e Modular bindings: scan the applications, contrib, mpi, flow-monitor, and point-to-point modules.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6833
diff changeset
    53
      
7019
23bec5444c05 The mpi waf configuration code belongs in src/mpi/wscript, not toplevel wscript
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 6905
diff changeset
    54
    bld.ns3_python_bindings()