[MLIR] Add support for libMLIR.so

Putting this up mainly for discussion on
how this should be done. I am interested in MLIR from
the Julia side and we currently have a strong preference
to dynamically linking against the LLVM shared library,
and would like to have a MLIR shared library.

This patch adds a new cmake function add_mlir_library()
which accumulates a list of targets to be compiled into
libMLIR.so.  Note that not all libraries make sense to
be compiled into libMLIR.so.  In particular, we want
to avoid libraries which primarily exist to support
certain tools (such as mlir-opt and mlir-cpu-runner).

Note that the resulting libMLIR.so depends on LLVM, but
does not contain any LLVM components.  As a result, it
is necessary to link with libLLVM.so to avoid linkage
errors. So, libMLIR.so requires LLVM_BUILD_LLVM_DYLIB=on

FYI, Currently it appears that LLVM_LINK_LLVM_DYLIB is broken
because mlir-tblgen is linked against libLLVM.so and
and independent LLVM components

(updated by Stephen Neuendorffer)

Differential Revision: https://reviews.llvm.org/D73130

GitOrigin-RevId: 1246e867164b06fc3f0de6bfaaa0922d99cb5ce9
19 files changed
tree: d07872c0f31b323034a0ad55d56d70c92e294e6b
  1. cmake/
  2. docs/
  3. examples/
  4. include/
  5. lib/
  6. test/
  7. tools/
  8. unittests/
  9. utils/
  10. .clang-format
  11. .clang-tidy
  12. CMakeLists.txt
  13. LICENSE.TXT
  14. README.md
README.md

Multi-Level Intermediate Representation

See https://mlir.llvm.org/ for more information.