aboutsummaryrefslogtreecommitdiff
path: root/configure.py
blob: fd4ce922635c51a688881224ea4289c105860fa8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python


import confu
parser = confu.standard_parser("pthreadpool configuration script")


def main(args):
    options = parser.parse_args(args)
    build = confu.Build.from_options(options)

    build.export_cpath("include", ["pthreadpool.h"])

    with build.options(source_dir="src", extra_include_dirs="src", deps=build.deps.fxdiv):
        sources = ["threadpool-legacy.c"]
        if build.target.is_emscripten:
            sources.append("threadpool-shim.c")
        else:
            sources.append("threadpool-pthreads.c")
        build.static_library("pthreadpool", [build.cc(src) for src in sources])

    with build.options(source_dir="test", deps=[build, build.deps.googletest]):
        build.unittest("pthreadpool-test", build.cxx("pthreadpool.cc"))

    with build.options(source_dir="bench", deps=[build, build.deps.googlebenchmark]):
        build.benchmark("latency-bench", build.cxx("latency.cc"))
        build.benchmark("throughput-bench", build.cxx("throughput.cc"))

    return build


if __name__ == "__main__":
    import sys
    main(sys.argv[1:]).generate()