Skip to content
Snippets Groups Projects
wscript 5.54 KiB
Newer Older
#!/usr/bin/env python
import os
from os.path import join
Yannik Stradmann's avatar
Yannik Stradmann committed
from waflib.extras.test_base import summary
from waflib.extras.symwaf2ic import get_toplevel_path
Yannik Stradmann's avatar
Yannik Stradmann committed
def depends(dep):
    dep('lib-rcf')
    dep('code-format')
Philipp Spilger's avatar
Philipp Spilger committed
    dep('logger')
    dep.recurse('pyflange')
Yannik Stradmann's avatar
Yannik Stradmann committed
def options(opt):
    opt.load('compiler_c')
    opt.load('compiler_cxx')
    opt.load('boost')
Yannik Stradmann's avatar
Yannik Stradmann committed
    opt.load("test_base")
    opt.load("gtest")
    opt.load("doxygen")
    opt.recurse('pyflange')
Philipp Spilger's avatar
Philipp Spilger committed
    opt.add_option("--hxcomm-loglevel",
                   choices=["trace", "debug", "info", "warning", "error", "fatal"],
                   default="info",
                   help="Maximal loglevel to compile in.")
def configure(conf):
    conf.load('compiler_c')
    conf.load('compiler_cxx')
    conf.load('boost')
    conf.check_boost(lib='coroutine context', uselib_store='BOOST4HXCOMM')
    conf.check_boost(lib='program_options', uselib_store='BOOST4HXCOMMTOOLS')
    conf.load("test_base")
    conf.load("gtest")
    conf.check_cxx(mandatory=True, header_name='cereal/cereal.hpp')
    conf.check_cxx(lib='tbb', uselib_store="TBB")
    conf.load("doxygen")
    conf.recurse('pyflange')
Philipp Spilger's avatar
Philipp Spilger committed
    conf.define(
        "HXCOMM_LOG_THRESHOLD",
        {'trace':   0,
         'debug':   1,
         'info':    2,
         'warning': 3,
         'error':   4,
         'fatal':   5}[conf.options.hxcomm_loglevel]
    )
def build(bld):
    bld.env.DLSvx_HARDWARE_AVAILABLE = "cube" == os.environ.get("SLURM_JOB_PARTITION")

        export_includes = 'include'
    )

        features     = 'use',
        use          = ['hxcomm_inc', 'arqstream_obj', 'BOOST4HXCOMM', 'rcf-sf-only',
Philipp Spilger's avatar
Philipp Spilger committed
                        'flange', 'hate_inc', 'halco_hicann_dls_vx', 'TBB', 'logger_obj'],
        install_path = '${PREFIX}/lib',
    bld.shlib(
        features     = 'cxx',
        source       = bld.path.ant_glob('src/flange/*.cpp'),
        use          = ['hxcomm_inc', 'rcf-sf-only'],
        install_path = '${PREFIX}/lib',
        features     = 'cxx cxxprogram',
        source       = ['example/hxcomm_arq.cpp'],
        use          = ['hxcomm', 'BOOST4HXCOMMTOOLS'],
        features     = 'cxx cxxprogram',
        source       = ['example/hxcomm_sim.cpp'],
        use          = ['hxcomm', 'BOOST4HXCOMMTOOLS'],
        install_path = '${PREFIX}/bin',
    )
        target       = 'hxcomm_example_loopback_throughput',
        features     = 'cxx cxxprogram',
        source       = ['example/hxcomm_loopback_throughput.cpp'],
        use          = ['hxcomm', 'BOOST4HXCOMMTOOLS'],
        export_includes = 'tests/common'
    )

    bld.shlib(
        features     = 'cxx',
        source       = bld.path.ant_glob('tests/common/test-helper.cpp'),
        use          = ['hxcomm', 'hxcomm_tests_inc'],
        features     = 'gtest cxx cxxprogram',
        source       = bld.path.ant_glob('tests/sw/hxcomm/test-*.cpp',
                           excl='tests/sw/hxcomm/test-*_throughput.cpp'),
        use          = ['hxcomm', 'hxcomm_tests_helper'],
        target       = 'hxcomm_throughputtests',
        features     = 'gtest cxx cxxprogram',
        source       = bld.path.ant_glob('tests/sw/hxcomm/test-*_throughput.cpp'),
        use          = ['hxcomm', 'hxcomm_tests_helper'],
        cxxflags     = ['-O2'],
    bld(target          = 'hxcomm_hwtests_inc',
        export_includes = 'tests/hw/hxcomm/connection_hw'
    )

    bld(
        features     = 'gtest cxx cxxprogram',
        source       = bld.path.ant_glob('tests/hw/hxcomm/test-*.cpp'),
        skip_run     = not bld.env.DLSvx_HARDWARE_AVAILABLE,
        test_main    = 'tests/hw/hxcomm/main.cpp',
        use          = ['hxcomm', 'hxcomm_tests_helper', 'hxcomm_hwtests_inc', 'BOOST4HXCOMMTOOLS'],
    bld(target          = 'hxcomm_simtests_inc',
        export_includes = 'tests/hw/hxcomm/connection_sim'
    )

        features     = 'gtest cxx cxxprogram',
        source       = bld.path.ant_glob('tests/hw/hxcomm/test-*.cpp'),
        test_main    = 'tests/hw/hxcomm/main.cpp',
        use          = ['hxcomm', 'hxcomm_tests_helper', 'hxcomm_simtests_inc', 'BOOST4HXCOMMTOOLS'],
    bld(
        target       = 'flange_swtests',
        features     = 'gtest cxx cxxprogram',
        source       = bld.path.ant_glob('tests/sw/flange/test-*.cpp'),
    bld.recurse('pyflange')

    bld(
        features = 'doxygen',
        name = 'hxcomm_documentation',
        doxyfile = bld.root.make_node(join(get_toplevel_path(), "code-format", "doxyfile")),
        install_path = 'doc/hxcomm',
        pars = {
            "PROJECT_NAME": "\"HX Communication\"",
            "INPUT": join(get_toplevel_path(), "hxcomm", "include"),
            "PREDEFINED": "GENPYBIND()= GENPYBIND_TAG_FLANGE=",
            "OUTPUT_DIRECTORY": join(get_toplevel_path(), "build", "hxcomm", "doc")
        },
    )

    # Create test summary (to stdout and XML file)
    bld.add_post_fun(summary)