2020-05-05 03:41:43 +08:00
|
|
|
set(LLVM_LINK_COMPONENTS
|
|
|
|
Support
|
|
|
|
)
|
|
|
|
|
2020-02-27 03:50:03 +08:00
|
|
|
get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
|
2020-04-11 07:58:39 +08:00
|
|
|
get_property(translation_libs GLOBAL PROPERTY MLIR_TRANSLATION_LIBS)
|
2020-05-05 03:41:43 +08:00
|
|
|
|
[cmake] Don't export `LLVM_TOOLS_INSTALL_DIR` anymore
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.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D117977
2022-06-11 14:11:59 +08:00
|
|
|
add_mlir_tool(mlir-translate
|
2020-05-05 03:41:43 +08:00
|
|
|
mlir-translate.cpp
|
|
|
|
)
|
|
|
|
llvm_update_compile_flags(mlir-translate)
|
|
|
|
target_link_libraries(mlir-translate
|
|
|
|
PRIVATE
|
2020-02-27 03:50:03 +08:00
|
|
|
${dialect_libs}
|
2020-04-11 07:58:39 +08:00
|
|
|
${translation_libs}
|
2020-08-04 17:37:25 +08:00
|
|
|
${test_libs}
|
2020-05-05 03:41:43 +08:00
|
|
|
MLIRIR
|
2019-03-30 13:10:12 +08:00
|
|
|
MLIRParser
|
|
|
|
MLIRPass
|
2022-06-13 14:50:55 +08:00
|
|
|
MLIRSPIRVDialect
|
2022-03-06 04:27:00 +08:00
|
|
|
MLIRTranslateLib
|
2019-03-30 13:10:12 +08:00
|
|
|
MLIRSupport
|
2020-05-05 03:41:43 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
mlir_check_link_libraries(mlir-translate)
|