From 88368a19aa5b13b9a08f187a99ed0d04d17be653 Mon Sep 17 00:00:00 2001 From: Eric Schweitz Date: Tue, 19 Nov 2019 21:04:45 -0800 Subject: [PATCH] Add some CMake rules for installing headers, mlir-tblgen, and mlir-opt Closes tensorflow/mlir#246 PiperOrigin-RevId: 281442685 --- mlir/CMakeLists.txt | 28 ++++++++++++++++++++++++++++ mlir/tools/mlir-opt/CMakeLists.txt | 2 +- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/mlir/CMakeLists.txt b/mlir/CMakeLists.txt index 5329de4e8935..c8ffa759376f 100644 --- a/mlir/CMakeLists.txt +++ b/mlir/CMakeLists.txt @@ -56,3 +56,31 @@ add_subdirectory(test) if( LLVM_INCLUDE_EXAMPLES ) add_subdirectory(examples) endif() + +if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) + install(DIRECTORY include/mlir include/mlir-c + DESTINATION include + COMPONENT mlir-headers + FILES_MATCHING + PATTERN "*.h" + PATTERN "*.inc" + PATTERN "LICENSE.TXT" + ) + + install(DIRECTORY ${MLIR_INCLUDE_DIR}/mlir ${MLIR_INCLUDE_DIR}/mlir-c + DESTINATION include + COMPONENT mlir-headers + FILES_MATCHING + PATTERN "*.h" + PATTERN "*.gen" + PATTERN "*.inc" + PATTERN "CMakeFiles" EXCLUDE + PATTERN "config.h" EXCLUDE + ) + + if (NOT LLVM_ENABLE_IDE) + add_llvm_install_targets(install-mlir-headers + DEPENDS mlir-headers + COMPONENT mlir-headers) + endif() +endif() diff --git a/mlir/tools/mlir-opt/CMakeLists.txt b/mlir/tools/mlir-opt/CMakeLists.txt index 9eb3f53f91e9..628557dae8c5 100644 --- a/mlir/tools/mlir-opt/CMakeLists.txt +++ b/mlir/tools/mlir-opt/CMakeLists.txt @@ -56,7 +56,7 @@ if(MLIR_CUDA_CONVERSIONS_ENABLED) MLIRGPUtoCUDATransforms ) endif() -add_llvm_executable(mlir-opt +add_llvm_tool(mlir-opt mlir-opt.cpp ) llvm_update_compile_flags(mlir-opt)