Skip to content

Commit

Permalink
Try to pacify Bazel
Browse files Browse the repository at this point in the history
Signed-off-by: Anton Korobeynikov <[email protected]>
  • Loading branch information
asl committed Jan 16, 2025
1 parent dee3a29 commit 19d7fb3
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,17 @@ genrule(
outs = ["config.h"],
# TODO: We should actually check these properly instead of just #undefing them.
# Maybe select() can help here?
# CONFIG_PKGDATADIR is where p4c should look for p4include at runtime.
# This will work only if the binary is executed by Bazel. For a general
# solution, we would need to make p4c aware of Bazel, specifically:
# https://github.com/bazelbuild/bazel/blob/master/tools/cpp/runfiles/runfiles_src.h
cmd = "sed -e 's|cmakedefine|define|g' \
-e 's|define HAVE_LIBGC 1|undef HAVE_LIBGC|g' \
-e 's|define HAVE_LIBBACKTRACE 1|undef HAVE_LIBBACKTRACE|g' \
-e 's|define HAVE_MM_MALLOC_H 1|undef HAVE_MM_MALLOC_H|g' \
< $(SRCS) > $(OUTS)",
-e 's|@MAX_LOGGING_LEVEL@|10|g' \
-e 's|@CONFIG_PKGDATADIR@|external/%s|g' \
< $(SRCS) > $(OUTS)" % repository_name(),
visibility = ["//visibility:private"],
)

Expand Down Expand Up @@ -215,13 +221,6 @@ cc_library(
"backends/dpdk/dbprint-dpdk.cpp",
"backends/dpdk/printUtils.cpp",
],
copts = [
# Where p4c should look for p4include at runtime.
("-DCONFIG_PKGDATADIR=\\\"external/%s\\\"" % repository_name()),
# This will work only if the binary is executed by Bazel. For a general
# solution, we would need to make p4c aware of Bazel, specifically:
# https://github.com/bazelbuild/bazel/blob/master/tools/cpp/runfiles/runfiles_src.h
],
textual_hdrs = glob([
"ir/**/*.h",
"frontends/**/*.h",
Expand Down

0 comments on commit 19d7fb3

Please sign in to comment.