Support for Bazel Build System

Hi everyone, I am new to the LLVM/MLIR ecosystem.
Are there any plans to add Bazel build support to CIRCT? I am currently working on a project that uses Bazel to manage my LLVM and MLIR dependencies, and want to register the FIRRTL dialect for a custom pass I am working on. This is an out-of-tree build and I am unsure how to proceed with using a dialect from CIRCT for my project, since this requires treating CIRCT as a dependency.

Anybody have any ideas for how I can proceed?

As far as I know, no one has used CIRCT with Bazel. I think other MLIR projects that support Bazel have Bazel rules that are maintained as best effort (i.e., not checked by normal CI, and it is up to the people who care about Bazel to make sure they work). Perhaps CIRCT could consider adopting a similar approach, if people are committed to Bazel and able to maintain the rules.

For your immediate need, I would see if there is something you can set up in your project that allows you to build against CIRCT’s libraries. I don’t know enough about Bazel to make a concrete suggestion here, but if there’s an answer besides “add Bazel rules to CIRCT”, that might be easier to get started with.

Thanks for the quick reply! It seems integrating foreign build systems with Bazel is non-trivial (at least for CIRCT, since it depends on LLVM itself).
I’m guessing the easiest solution is to migrate my project to a CIRCT in-tree build.

If that helps with the Bazel setup, that makes sense to me. It can quickly become untenable to build multiple projects in-tree that all depend on MLIR, if those projects don’t track close to LLVM’s main branch. But if you just want LLVM/MLIR + CIRCT, you should be fine.