Fix bazel build for https://reviews.llvm.org/D144552
authorSterling Augustine <saugustine@google.com>
Wed, 24 May 2023 16:35:53 +0000 (09:35 -0700)
committerSterling Augustine <saugustine@google.com>
Wed, 24 May 2023 16:39:53 +0000 (09:39 -0700)
Differential Revision: https://reviews.llvm.org/D151346

utils/bazel/llvm-project-overlay/mlir/BUILD.bazel

index b36bdf9..8091200 100644 (file)
@@ -5,6 +5,7 @@
 # Description:
 #   The MLIR "Multi-Level Intermediate Representation" Compiler Infrastructure
 
+load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
 load("@bazel_skylib//rules:write_file.bzl", "write_file")
 load(":tblgen.bzl", "gentbl_cc_library", "td_library")
 load(":linalggen.bzl", "genlinalg")
@@ -28,6 +29,23 @@ exports_files([
     "utils/textmate/mlir.json",
 ])
 
+expand_template(
+    name = "mlir_config_h_gen",
+    out = "include/mlir/Config/mlir-config.h",
+    substitutions = {
+        "#cmakedefine01 MLIR_ENABLE_EXPENSIVE_PATTERN_API_CHECKS": "#define MLIR_ENABLE_EXPENSIVE_PATTERN_API_CHECKS 1"
+        },
+    template = "include/mlir/Config/mlir-config.h.cmake",
+    visibility = ["//visibility:private"],
+)
+
+cc_library(
+    name = "config",
+    hdrs = [
+        "include/mlir/Config/mlir-config.h",
+    ],
+)
+
 filegroup(
     name = "c_headers",
     srcs = glob(["include/mlir-c/**/*"]),  # <== i.e. match the entire tree
@@ -5992,6 +6010,7 @@ cc_library(
     ),
     includes = ["include"],
     deps = [
+        ":config",
         ":ControlFlowInterfaces",
         ":IR",
         ":LoopLikeInterface",