summaryrefslogtreecommitdiffstats
path: root/BUILD.bazel
diff options
context:
space:
mode:
Diffstat (limited to 'BUILD.bazel')
-rw-r--r--BUILD.bazel41
1 files changed, 41 insertions, 0 deletions
diff --git a/BUILD.bazel b/BUILD.bazel
new file mode 100644
index 0000000..c57dc9f
--- /dev/null
+++ b/BUILD.bazel
@@ -0,0 +1,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
+ """,
+)