[PATCH] D85140: [RFC] Factor out repetitive cmake patterns for llvm-style projects

Stephen Neuendorffer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 3 09:46:34 PDT 2020


stephenneuendorffer created this revision.
Herald added subscribers: llvm-commits, msifontes, jurahul, Kayjukh, grosul1, Joonsoo, liufengdb, aartbik, lucyrfox, mgester, arpith-jacob, antiagainst, shauheen, jpienaar, rriddle, mehdi_amini, mgorny.
Herald added projects: MLIR, LLVM.
stephenneuendorffer requested review of this revision.
Herald added a subscriber: nicolasvasilache.

New projects (particularly out of tree) have a tendency to hijack the existing
llvm configuration options and build targets (add_llvm_library,
add_llvm_tool).  This can lead to some confusion.

1. When querying a configuration variable, do we care about how LLVM was

configured, or how these options were configured for the out of tree project?

2. LLVM has lots of defaults, which are easy to miss

(e.g. LLVM_BUILD_TOOLS=ON).  These options all need to be duplicated in the
CMakeLists.txt for the project.

In addition, with LLVM Incubators coming online, we need better ways for these
incubators to do things the "LLVM way" without alot of futzing.  Ideally, this
would happen in a way that eases importing into the LLVM monorepo when
projects mature.

This patch creates some generic infrastructure in llvm/cmake/modules and
refactors MLIR to use this infrastructure.  This should expand to include
add_xxx_library, which is by far the most complicated bit of building a
project correctly, since it has to deal with lots of shared library
configuration bits.  (MLIR currently hijacks the LLVM infrastructure for
building libMLIR.so, so this needs to get refactored anyway.)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85140

Files:
  llvm/cmake/modules/LLVMProjectOptions.cmake
  llvm/cmake/modules/LLVMProjectTargets.cmake
  mlir/CMakeLists.txt
  mlir/cmake/modules/AddMLIR.cmake
  mlir/examples/standalone/CMakeLists.txt
  mlir/examples/standalone/standalone-opt/CMakeLists.txt
  mlir/examples/standalone/standalone-translate/CMakeLists.txt
  mlir/examples/toy/CMakeLists.txt
  mlir/tools/mlir-cpu-runner/CMakeLists.txt
  mlir/tools/mlir-cuda-runner/CMakeLists.txt
  mlir/tools/mlir-linalg-ods-gen/CMakeLists.txt
  mlir/tools/mlir-opt/CMakeLists.txt
  mlir/tools/mlir-reduce/CMakeLists.txt
  mlir/tools/mlir-rocm-runner/CMakeLists.txt
  mlir/tools/mlir-translate/CMakeLists.txt
  mlir/tools/mlir-vulkan-runner/CMakeLists.txt

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85140.282654.patch
Type: text/x-patch
Size: 15639 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200803/86db50e6/attachment.bin>


More information about the llvm-commits mailing list