## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
import os.path

def configure(conf):
    check = conf.create_pkgconfig_configurator()
    check.name = 'goocanvas gthread-2.0'
    check.uselib = 'MOBILITY_VISUALIZER'
    check.mandatory = False
    conf.env['ENABLE_MOBILITY_VISUALIZER'] = check.run()
    

def build(bld):
    env = bld.env_of_name('default')

    unit_tests = bld.create_ns3_program('run-tests', ['common'])
    unit_tests.inst_var  = 0 # do not install
    unit_tests.source = 'run-tests.cc'
    ## link unit test program with all ns3 modules
    unit_tests.uselib_local = 'ns3'
    
    obj = bld.create_ns3_program('bench-simulator', ['simulator'])
    obj.source = 'bench-simulator.cc'

    obj = bld.create_ns3_program('bench-packets', ['common'])
    obj.source = 'bench-packets.cc'

    obj = bld.create_ns3_program('replay-simulation', ['simulator'])
    obj.source = 'replay-simulation.cc'

    obj = bld.create_ns3_program('print-introspected-doxygen',
                                 ['internet-node', 'csma-cd', 'point-to-point'])
    obj.source = 'print-introspected-doxygen.cc'

# XXX: disable mobility visualizer code temporarily.
    env['ENABLE_MOBILITY_VISUALIZER'] = ''
    if env['ENABLE_MOBILITY_VISUALIZER']:
        obj = bld.create_ns3_program('mobility-visualizer',
                                     ['internet-node', 'mobility'])
        obj.source = ['mobility-visualizer-model.cc', 'mobility-visualizer-view.cc']
        obj.uselib = 'MOBILITY_VISUALIZER'
        if os.path.basename(obj.env['CXX']).startswith("g++"):
            obj.env.append_value('CXXFLAGS', '-fno-strict-aliasing')

