diff --git a/.bazelrc b/.bazelrc new file mode 100644 index 00000000..13fc03e8 --- /dev/null +++ b/.bazelrc @@ -0,0 +1,7 @@ +common --announce_rc +common --verbose_failures +common --sandbox_debug + +common --cxxopt=-std=c++20 + +test --test_output=streamed diff --git a/.gitignore b/.gitignore index a4efc556..05259505 100644 --- a/.gitignore +++ b/.gitignore @@ -59,3 +59,6 @@ test/data/*.pprof test/self_unwind/data/BadBoggleSolver_run.json cpp-security-quality.sarif test/data/ipc_test_data_Positive.txt + +MODULE.bazel.lock +bazel-* diff --git a/BUILD.bazel b/BUILD.bazel new file mode 100644 index 00000000..70b269b8 --- /dev/null +++ b/BUILD.bazel @@ -0,0 +1,39 @@ +load("@rules_bison//bison:bison.bzl", "bison") +load("@rules_cc//cc:defs.bzl", "cc_library") +load("@rules_flex//flex:flex.bzl", "flex") + +cc_library( + name = "hdrs", + hdrs = glob(["include/*.hpp"]) + [ + ":event_parser_lex", + ":event_parser_yacc", + ], + includes = ["include"], +) + +cc_library( + name = "ddprof", + srcs = glob([ + "src/*.cc", + ]) + [ + ":event_parser_lex", + ":event_parser_yacc", + ], + copts = ["-fPIC"], + deps = [ + ":hdrs", + "@abseil-cpp//absl/strings", + "@jemalloc", + "@libcap", + ], +) + +bison( + name = "event_parser_yacc", + src = "src/event_parser/event_parser.y", +) + +flex( + name = "event_parser_lex", + src = "src/event_parser/event_parser.l", +) diff --git a/MODULE.bazel b/MODULE.bazel new file mode 100644 index 00000000..7d519660 --- /dev/null +++ b/MODULE.bazel @@ -0,0 +1,16 @@ +module( + name = "ddprof", + version = "0.19.0", + bazel_compatibility = [">=7.2.1"], # need support for "overlay" directory + compatibility_level = 0, +) + +bazel_dep(name = "abseil-cpp", version = "20250512.1") +bazel_dep(name = "jemalloc", version = "5.3.0-bcr.alpha.4") +bazel_dep(name = "libcap", version = "2.27") +bazel_dep(name = "rules_bison", version = "0.4") +bazel_dep(name = "rules_cc", version = "0.1.2") +bazel_dep(name = "rules_flex", version = "0.4") + +# For tests. +bazel_dep(name = "googletest", version = "1.17.0", dev_dependency = True)