Add some CMake rules for installing headers, mlir-tblgen, and mlir-opt
authorEric Schweitz <eric.schweitz@pgroup.com>
Wed, 20 Nov 2019 05:04:45 +0000 (21:04 -0800)
committerA. Unique TensorFlower <gardener@tensorflow.org>
Wed, 20 Nov 2019 05:05:16 +0000 (21:05 -0800)
Closes tensorflow/mlir#246

PiperOrigin-RevId: 281442685

mlir/CMakeLists.txt
mlir/tools/mlir-opt/CMakeLists.txt

index 5329de4..c8ffa75 100644 (file)
@@ -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()
index 9eb3f53..628557d 100644 (file)
@@ -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)