[Openmp-commits] [PATCH] D117977: WIP: [cmake] Don't export `LLVM_TOOLS_INSTALL_DIR` anymore

John Ericson via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Sat Jan 22 22:10:06 PST 2022


Ericson2314 created this revision.
Ericson2314 added reviewers: beanz, compnerd, phosek.
Herald added subscribers: ayermolo, sdasgup3, wenzhicui, wrengr, Chia-hungDuan, dcaballe, cota, teijeong, rdzhabarov, tatianashp, msifontes, jurahul, Kayjukh, grosul1, Joonsoo, liufengdb, aartbik, lucyrfox, mgester, arpith-jacob, antiagainst, shauheen, mravishankar, rriddle, mehdi_amini, mgorny.
Herald added a reviewer: antiagainst.
Herald added a reviewer: sscalpone.
Herald added a reviewer: rafauler.
Herald added a reviewer: Amir.
Herald added a reviewer: maksfb.
Herald added a project: Flang.
Ericson2314 requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: llvm-commits, openmp-commits, cfe-commits, yota9, sstefan1, stephenneuendorffer, nicolasvasilache, jdoerfert.
Herald added projects: clang, OpenMP, MLIR, LLVM.

First of all, `LLVM_TOOLS_INSTALL_DIR` put there breaks our NixOS
builds, because `LLVM_TOOLS_INSTALL_DIR` defined the same as
`CMAKE_INSTALL_BINDIR` becomes an *absolute* path, and then when
downstream projects try to install there too this breaks because our
builds always install to fresh directories for isolation's sake.

Second of all, note that `LLVM_TOOLS_INSTALL_DIR` stands out against the
other specially crafted `LLVM_CONFIG_*` variables substituted in
`llvm/cmake/modules/LLVMConfig.cmake.in`.

@beanz added it in d0e1c2a550ef348aae036d0fe78cab6f038c420c to fix a
dangling reference in `AddLLVM`, but I am suspicious of how this
variable doesn't follow the pattern.

Those other ones are carefully made to be build-time vs install-time
variables depending on which `LLVMConfig.cmake` is being generated, are
carefully made relative as appropriate, etc. etc. For my NixOS use-case
they are also fine because they are never used as downstream install
variables, only for reading not writing.

To avoid the problems I face, and restore symmetry, I deleted the
exported and arranged to have many `${project}_TOOLS_INSTALL_DIR`s.
`AddLLVM` now instead expects each project to define its own, and they
do so based on `CMAKE_INSTALL_BINDIR`. `LLVMConfig` still exports
`LLVM_TOOLS_BINARY_DIR` which is the location for the tools defined in
the usual way, matching the other remaining exported variables.

For the `AddLLVM` changes, I tried to copy the existing pattern of
internal vs non-internal or for LLVM vs for downstream function/macro
names, but it would good to confirm I did that correctly.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D117977

Files:
  bolt/tools/CMakeLists.txt
  bolt/tools/driver/CMakeLists.txt
  bolt/tools/merge-fdata/CMakeLists.txt
  clang/CMakeLists.txt
  clang/cmake/modules/AddClang.cmake
  flang/CMakeLists.txt
  flang/cmake/modules/AddFlang.cmake
  lld/CMakeLists.txt
  lld/cmake/modules/AddLLD.cmake
  llvm/cmake/modules/AddLLVM.cmake
  llvm/cmake/modules/CMakeLists.txt
  llvm/cmake/modules/LLVMConfig.cmake.in
  llvm/cmake/modules/TableGen.cmake
  mlir/CMakeLists.txt
  mlir/cmake/modules/AddMLIR.cmake
  mlir/tools/mlir-cpu-runner/CMakeLists.txt
  mlir/tools/mlir-linalg-ods-gen/CMakeLists.txt
  mlir/tools/mlir-lsp-server/CMakeLists.txt
  mlir/tools/mlir-opt/CMakeLists.txt
  mlir/tools/mlir-pdll/CMakeLists.txt
  mlir/tools/mlir-reduce/CMakeLists.txt
  mlir/tools/mlir-spirv-cpu-runner/CMakeLists.txt
  mlir/tools/mlir-translate/CMakeLists.txt
  mlir/tools/mlir-vulkan-runner/CMakeLists.txt
  openmp/libomptarget/tools/deviceinfo/CMakeLists.txt
  openmp/tools/CMakeLists.txt

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117977.402289.patch
Type: text/x-patch
Size: 15069 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20220123/00054de4/attachment-0001.bin>


More information about the Openmp-commits mailing list