summaryrefslogtreecommitdiffstats
path: root/BUILD.bazel
blob: c57dc9fe646728fd451d5ff1a66243adfae0f9cd (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
35
36
37
38
39
40
41
cc_library(
    name = "opentracing",
    srcs = glob(["src/**/*.cpp"], exclude=["src/dynamic_load_unsupported.cpp", "src/dynamic_load_windows.cpp"]),
    hdrs = glob(["include/opentracing/**/*.h"]) + [
        ":include/opentracing/config.h",
        ":include/opentracing/version.h",
    ],
    strip_include_prefix = "include",
    visibility = ["//visibility:public"],
    deps = [
      "//3rd_party:expected",
      "//3rd_party:variant",
    ],
    linkopts = [
      "-ldl",
    ],
)

genrule(
    name = "generate_version_h",
    srcs = glob([
        "*",
        "cmake/*",
        "src/**/*.cpp",
    ]),
    outs = [
      "include/opentracing/config.h",
      "include/opentracing/version.h"
    ],
    cmd = """
    TEMP_DIR=$$(mktemp -d)
    CONFIG_H_OUT=$${PWD}/$(location :include/opentracing/config.h)
    VERSION_H_OUT=$${PWD}/$(location :include/opentracing/version.h)
    OPENTRACING_ROOT=$$(dirname $${PWD}/$(location :CMakeLists.txt))
    cd $$TEMP_DIR
    cmake -DBUILD_TESTING=OFF -DBUILD_MOCKTRACER=OFF -L $$OPENTRACING_ROOT
    mv include/opentracing/config.h $$CONFIG_H_OUT
    mv include/opentracing/version.h $$VERSION_H_OUT
    rm -rf $$TEMP_DIR
    """,
)