[llvm] e9b87f4 - [RFC] Factor out repetitive cmake patterns for llvm-style projects

Stephen Neuendorffer via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 3 17:50:55 PDT 2020


Author: Stephen Neuendorffer
Date: 2020-10-03T17:12:35-07:00
New Revision: e9b87f43bde8b5f0d8a79c5884fdce639b12e0ca

URL: https://github.com/llvm/llvm-project/commit/e9b87f43bde8b5f0d8a79c5884fdce639b12e0ca
DIFF: https://github.com/llvm/llvm-project/commit/e9b87f43bde8b5f0d8a79c5884fdce639b12e0ca.diff

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

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.)

Differential Revision: https://reviews.llvm.org/D85140

Added: 
    llvm/cmake/modules/LLVMProjectOptions.cmake
    llvm/cmake/modules/LLVMProjectTargets.cmake

Modified: 
    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/test/Examples/standalone/test.toy
    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

Removed: 
    


################################################################################
diff  --git a/llvm/cmake/modules/LLVMProjectOptions.cmake b/llvm/cmake/modules/LLVMProjectOptions.cmake
new file mode 100644
index 000000000000..ce466953280e
--- /dev/null
+++ b/llvm/cmake/modules/LLVMProjectOptions.cmake
@@ -0,0 +1,68 @@
+# LLVM-style projects generally have the same directory structure.  This file
+# provides some bolierplate cmake support for projects that supports this
+# directory structure.  Note that generally speaking, projects should prefer
+# to use their own rules for these rather than relying on the core llvm build
+# targets.
+
+# Generally name should be lower case.
+function(add_llvm_project_options name)
+  string(TOUPPER "${name}" uppername)
+
+  # Define options to control the inclusion and default build behavior for
+  # components which may not strictly be necessary (tools, examples, and tests).
+  #
+  # This is primarily to support building smaller or faster project files.
+  option(${uppername}_INCLUDE_TOOLS
+    "Generate build targets for the ${uppername} tools."
+    ${LLVM_INCLUDE_TOOLS})
+  option(${uppername}_BUILD_TOOLS
+    "Build the ${uppername} tools. If OFF, just generate build targets."
+    ${LLVM_BUILD_TOOLS})
+
+  option(${uppername}_INCLUDE_UTILS
+    "Generate build targets for the ${uppername} utils."
+    ${LLVM_INCLUDE_UTILS})
+  option(${uppername}_BUILD_UTILS
+    "Build ${uppername} utility binaries. If OFF, just generate build targets."
+    ${LLVM_BUILD_UTILS})
+  option(${uppername}_INSTALL_UTILS
+    "Include utility binaries in the 'install' target."
+    ${LLVM_INSTALL_UTILS})
+
+  # i.e. Don't install headers, for instance.
+  option(${uppername}_INSTALL_TOOLCHAIN_ONLY
+    "Only include toolchain files in the 'install' target."
+    ${LLVM_INSTALL_TOOLCHAIN_ONLY})
+
+  option(${uppername}_BUILD_EXAMPLES
+    "Build the ${uppername} example programs. If OFF, just generate build targets."
+    ${LLVM_BUILD_EXAMPLES})
+  option(${uppername}_INCLUDE_EXAMPLES
+    "Generate build targets for the ${uppername} examples"
+    ${LLVM_INCLUDE_EXAMPLES})
+  if(${uppername}_BUILD_EXAMPLES)
+    add_definitions(-DBUILD_EXAMPLES)
+  endif(${uppername}_BUILD_EXAMPLES)
+
+  option(${uppername}_BUILD_TESTS
+    "Build ${uppername} unit tests. If OFF, just generate build targets."
+    ${LLVM_BUILD_TESTS})
+  option(${uppername}_INCLUDE_TESTS
+    "Generate build targets for the ${uppername} unit tests."
+    ${LLVM_INCLUDE_TESTS})
+  if (${uppername}_INCLUDE_TESTS)
+    add_definitions(-D${uppername}_INCLUDE_TESTS)
+  endif()
+
+  option(${uppername}_INCLUDE_INTEGRATION_TESTS
+    "Generate build targets for the ${uppername} integration tests."
+    ${LLVM_INCLUDE_INTEGRATION_TESTS})
+  if (${uppername}_INCLUDE_INTEGRATION_TESTS)
+    add_definitions(-D${uppername}_INCLUDE_INTEGRATION_TESTS)
+  endif()
+
+  option(${uppername}_INCLUDE_DOCS
+    "Generate build targets for the ${uppername} docs."
+    ${LLVM_INCLUDE_DOCS})
+
+endfunction(add_llvm_project_options)

diff  --git a/llvm/cmake/modules/LLVMProjectTargets.cmake b/llvm/cmake/modules/LLVMProjectTargets.cmake
new file mode 100644
index 000000000000..4e73706d1477
--- /dev/null
+++ b/llvm/cmake/modules/LLVMProjectTargets.cmake
@@ -0,0 +1,109 @@
+# For project foo, this function generates:
+# add_foo_tool(name)     (An executable installed by default)
+# add_foo_utility(name)  (An executable *not* installed by default)
+# add_foo_example(name)  (An executable which is built, but never installed)
+# add_foo_example_library(name)  (A library to go along with an example)
+
+# It also assumes the following configuration environment variables
+# (see LLVMProjectOptions.cmake)
+# FOO_TOOLS_INSTALL_DIR
+# FOO_BUILD_TOOLS
+# FOO_BUILD_UTILS
+# FOO_INSTALL_UTILS
+# FOO_BUILD_EXAMPLES
+# FOO_HAS_EXPORTS
+# FOO_INSTALL_TOOLCHAIN_ONLY
+
+function(add_llvm_project_targets projectname)
+  string(TOUPPER "${name}" upperprojectname)
+
+  macro(add_${projectname}_tool name)
+    if( NOT ${upperprojectname}_BUILD_TOOLS )
+      set(EXCLUDE_FROM_ALL ON)
+    endif()
+    add_llvm_executable(${name} ${ARGN})
+
+    if ( ${name} IN_LIST LLVM_TOOLCHAIN_TOOLS OR NOT ${upperprojectname}_INSTALL_TOOLCHAIN_ONLY)
+      if( ${upperprojectname}_BUILD_TOOLS )
+        set(export_to_${projectname}exports)
+        if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
+            NOT LLVM_DISTRIBUTION_COMPONENTS)
+          set(export_to_${projectname}exports EXPORT ${upperprojectname}Exports)
+          set_property(GLOBAL PROPERTY ${upperprojectname}_HAS_EXPORTS True)
+        endif()
+
+        install(TARGETS ${name}
+          ${export_to_${projectname}exports}
+          RUNTIME DESTINATION ${${upperprojectname}_TOOLS_INSTALL_DIR}
+          COMPONENT ${name})
+
+        if (NOT LLVM_ENABLE_IDE)
+          add_llvm_install_targets(install-${name}
+            DEPENDS ${name}
+            COMPONENT ${name})
+        endif()
+      endif()
+    endif()
+    if( ${upperprojectname}_BUILD_TOOLS )
+      set_property(GLOBAL APPEND PROPERTY ${upperprojectname}_EXPORTS ${name})
+    endif()
+    set_target_properties(${name} PROPERTIES FOLDER "Tools")
+  endmacro(add_${projectname}_tool name)
+
+  macro(add_${projectname}_example name)
+    if( NOT ${upperprojectname}_BUILD_EXAMPLES )
+      set(EXCLUDE_FROM_ALL ON)
+    endif()
+    add_llvm_executable(${name} ${ARGN})
+    if( ${upperprojectname}_BUILD_EXAMPLES )
+      install(TARGETS ${name} RUNTIME DESTINATION examples)
+    endif()
+    set_target_properties(${name} PROPERTIES FOLDER "Examples")
+  endmacro(add_${projectname}_example name)
+
+  macro(add_${projectname}_example_library name)
+    if( NOT ${upperprojectname}_BUILD_EXAMPLES )
+      set(EXCLUDE_FROM_ALL ON)
+      add_llvm_library(${name} BUILDTREE_ONLY ${ARGN})
+    else()
+      add_llvm_library(${name} ${ARGN})
+    endif()
+
+    set_target_properties(${name} PROPERTIES FOLDER "Examples")
+  endmacro(add_${projectname}_example_library name)
+
+  # This is a macro that is used to create targets for executables that are needed
+  # for development, but that are not intended to be installed by default.
+  macro(add_${projectname}_utility name)
+    if ( NOT ${upperprojectname}_BUILD_UTILS )
+      set(EXCLUDE_FROM_ALL ON)
+    endif()
+
+    add_llvm_executable(${name} DISABLE_LLVM_LINK_LLVM_DYLIB ${ARGN})
+    set_target_properties(${name} PROPERTIES FOLDER "Utils")
+    if (NOT ${upperprojectname}_INSTALL_TOOLCHAIN_ONLY)
+      if (${upperprojectname}_INSTALL_UTILS AND ${upperprojectname}_BUILD_UTILS)
+        set(export_to_${projectname}exports)
+        if (${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
+            NOT LLVM_DISTRIBUTION_COMPONENTS)
+          set(export_to_${projectname}exports EXPORT ${upperprojectname}Exports)
+          set_property(GLOBAL PROPERTY ${upperprojectname}_HAS_EXPORTS True)
+        endif()
+
+        install(TARGETS ${name}
+          ${export_to_${projectname}exports}
+          RUNTIME DESTINATION ${LLVM_UTILS_INSTALL_DIR}
+          COMPONENT ${name})
+
+        if (NOT LLVM_ENABLE_IDE)
+          add_llvm_install_targets(install-${name}
+            DEPENDS ${name}
+            COMPONENT ${name})
+        endif()
+        set_property(GLOBAL APPEND PROPERTY ${upperprojectname}_EXPORTS ${name})
+      elseif(${upperprojectname}_BUILD_UTILS)
+        set_property(GLOBAL APPEND PROPERTY ${upperprojectname}_EXPORTS_BUILDTREE_ONLY ${name})
+      endif()
+    endif()
+  endmacro(add_${projectname}_utility name)
+endfunction(add_llvm_project_targets)

diff  --git a/mlir/CMakeLists.txt b/mlir/CMakeLists.txt
index 50511fd2aef9..ffba3bea224e 100644
--- a/mlir/CMakeLists.txt
+++ b/mlir/CMakeLists.txt
@@ -21,6 +21,10 @@ set_target_properties(mlir-headers PROPERTIES FOLDER "Misc")
 add_dependencies(mlir-headers mlir-generic-headers)
 add_custom_target(mlir-doc)
 
+# Get a bunch of LLVM-style default options.
+include(LLVMProjectOptions)
+add_llvm_project_options(mlir)
+
 # Build the CUDA conversions and run according tests if the NVPTX backend
 # is available
 if ("NVPTX" IN_LIST LLVM_TARGETS_TO_BUILD)
@@ -44,13 +48,6 @@ set(MLIR_CUDA_RUNNER_ENABLED 0 CACHE BOOL "Enable building the mlir CUDA runner"
 set(MLIR_ROCM_RUNNER_ENABLED 0 CACHE BOOL "Enable building the mlir ROCm runner")
 set(MLIR_VULKAN_RUNNER_ENABLED 0 CACHE BOOL "Enable building the mlir Vulkan runner")
 
-option(MLIR_INCLUDE_TESTS
-       "Generate build targets for the MLIR unit tests."
-       ${LLVM_INCLUDE_TESTS})
-
-option(MLIR_INCLUDE_INTEGRATION_TESTS
-       "Generate build targets for the MLIR integration tests.")
-
 #-------------------------------------------------------------------------------
 # Python Bindings Configuration
 # Requires:
@@ -83,42 +80,46 @@ if(MLIR_BINDINGS_PYTHON_ENABLED)
                  "extension = '${PYTHON_MODULE_EXTENSION}")
 endif()
 
+# Get a bunch of default targets
+include(LLVMProjectTargets)
+add_llvm_project_targets(mlir)
+
 include_directories( "include")
 include_directories( ${MLIR_INCLUDE_DIR})
 
 # Adding tools/mlir-tblgen here as calling add_tablegen sets some variables like
 # MLIR_TABLEGEN_EXE in PARENT_SCOPE which gets lost if that folder is included
 # from another directory like tools
-add_subdirectory(tools/mlir-tblgen)
+if (MLIR_INCLUDE_TOOLS)
+  add_subdirectory(tools/mlir-tblgen)
+endif()
 
 add_subdirectory(include/mlir)
 add_subdirectory(lib)
 # C API needs all dialects for registration, but should be built before tests.
 add_subdirectory(lib/CAPI)
 if (MLIR_INCLUDE_TESTS)
-  add_definitions(-DMLIR_INCLUDE_TESTS)
   add_subdirectory(unittests)
   add_subdirectory(test)
 endif()
 if (MLIR_INCLUDE_INTEGRATION_TESTS)
-  add_definitions(-DMLIR_INCLUDE_INTEGRATION_TESTS)
   add_subdirectory(integration_test)
 endif()
 # Tools needs to come late to ensure that MLIR_ALL_LIBS is populated.
 # Generally things after this point may depend on MLIR_ALL_LIBS or libMLIR.so.
-add_subdirectory(tools)
+if (MLIR_INCLUDE_TOOLS)
+  add_subdirectory(tools)
+endif()
 
-if( LLVM_INCLUDE_EXAMPLES )
+if (MLIR_INCLUDE_EXAMPLES)
   add_subdirectory(examples)
 endif()
 
-option(MLIR_INCLUDE_DOCS "Generate build targets for the MLIR docs."
-  ${LLVM_INCLUDE_DOCS})
 if (MLIR_INCLUDE_DOCS)
   add_subdirectory(docs)
 endif()
 
-if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+if (NOT MLIR_INSTALL_TOOLCHAIN_ONLY)
   install(DIRECTORY include/mlir include/mlir-c
     DESTINATION include
     COMPONENT mlir-headers

diff  --git a/mlir/cmake/modules/AddMLIR.cmake b/mlir/cmake/modules/AddMLIR.cmake
index 8394c056c1db..56742db33ee1 100644
--- a/mlir/cmake/modules/AddMLIR.cmake
+++ b/mlir/cmake/modules/AddMLIR.cmake
@@ -24,7 +24,12 @@ function(add_mlir_interface interface)
 endfunction()
 
 
-# Generate Documentation
+# Generate Documentation using the mlir-doc rule
+#   doc_filename: the basename of a .td tablegen file
+#   command: the tablegen command to run, typically "-gen-op-doc",
+#            "-gen-pass-doc", or "-gen-dialect-doc"
+#   output_file: the basename of a .md markdown file to be output
+#   output_directory: the directory to place the output
 function(add_mlir_doc doc_filename command output_file output_directory)
   set(LLVM_TARGET_DEFINITIONS ${doc_filename}.td)
   tablegen(MLIR ${output_file}.md ${command} "-I${MLIR_MAIN_INCLUDE_DIR}" "-I${MLIR_INCLUDE_DIR}")
@@ -40,7 +45,7 @@ function(add_mlir_doc doc_filename command output_file output_directory)
 endfunction()
 
 # Declare an mlir library which can be compiled in libMLIR.so
-# In addition to everything that llvm_add_librar accepts, this
+# In addition to everything that llvm_add_library accepts, this
 # also has the following option:
 # EXCLUDE_FROM_LIBMLIR
 #   Don't include this library in libMLIR.so.  This option should be used

diff  --git a/mlir/examples/standalone/CMakeLists.txt b/mlir/examples/standalone/CMakeLists.txt
index 45dc80804aa9..721efae0388b 100644
--- a/mlir/examples/standalone/CMakeLists.txt
+++ b/mlir/examples/standalone/CMakeLists.txt
@@ -31,8 +31,17 @@ list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}")
 include(TableGen)
 include(AddLLVM)
 include(AddMLIR)
+
+# Get a bunch of LLVM-style default options.
+include(LLVMProjectOptions)
+add_llvm_project_options(standalone)
+
 include(HandleLLVMOptions)
 
+# Get a bunch of default targets
+include(LLVMProjectTargets)
+add_llvm_project_targets(standalone)
+
 include_directories(${LLVM_INCLUDE_DIRS})
 include_directories(${MLIR_INCLUDE_DIRS})
 include_directories(${PROJECT_SOURCE_DIR}/include)

diff  --git a/mlir/examples/standalone/standalone-opt/CMakeLists.txt b/mlir/examples/standalone/standalone-opt/CMakeLists.txt
index 06bbb4712645..e4b12e01228a 100644
--- a/mlir/examples/standalone/standalone-opt/CMakeLists.txt
+++ b/mlir/examples/standalone/standalone-opt/CMakeLists.txt
@@ -6,7 +6,7 @@ set(LIBS
         MLIROptLib
         MLIRStandalone
         )
-add_llvm_executable(standalone-opt standalone-opt.cpp)
+add_standalone_tool(standalone-opt standalone-opt.cpp)
 
 llvm_update_compile_flags(standalone-opt)
 target_link_libraries(standalone-opt PRIVATE ${LIBS})

diff  --git a/mlir/examples/standalone/standalone-translate/CMakeLists.txt b/mlir/examples/standalone/standalone-translate/CMakeLists.txt
index 137f7947cfac..15aa237fd18e 100644
--- a/mlir/examples/standalone/standalone-translate/CMakeLists.txt
+++ b/mlir/examples/standalone/standalone-translate/CMakeLists.txt
@@ -5,7 +5,7 @@ set(LLVM_LINK_COMPONENTS
 get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
 get_property(translation_libs GLOBAL PROPERTY MLIR_TRANSLATION_LIBS)
 
-add_llvm_executable(standalone-translate
+add_standalone_tool(standalone-translate
   standalone-translate.cpp
   )
 llvm_update_compile_flags(standalone-translate)

diff  --git a/mlir/examples/toy/CMakeLists.txt b/mlir/examples/toy/CMakeLists.txt
index 56002b1ad2e2..39f6bd09a75c 100644
--- a/mlir/examples/toy/CMakeLists.txt
+++ b/mlir/examples/toy/CMakeLists.txt
@@ -3,7 +3,7 @@ set_target_properties(Toy PROPERTIES FOLDER Examples)
 
 macro(add_toy_chapter name)
   add_dependencies(Toy ${name})
-  add_llvm_example(${name} ${ARGN})
+  add_mlir_example(${name} ${ARGN})
 endmacro(add_toy_chapter name)
 
 add_subdirectory(Ch1)

diff  --git a/mlir/test/Examples/standalone/test.toy b/mlir/test/Examples/standalone/test.toy
index 7b4a9c23906e..cd183c9f2fd0 100644
--- a/mlir/test/Examples/standalone/test.toy
+++ b/mlir/test/Examples/standalone/test.toy
@@ -1,4 +1,5 @@
 # RUN: %cmake %mlir_src_root/examples/standalone -DCMAKE_CXX_COMPILER=%host_cxx -DCMAKE_C_COMPILER=%host_cc -DMLIR_DIR=%llvm_lib_dir/cmake/mlir ; %cmake --build . --target check-standalone | tee %t | FileCheck %s
+# RUN: %cmake --build . --target mlir-doc
 
 # CHECK: Passed: 3
 # UNSUPPORTED: windows, android

diff  --git a/mlir/tools/mlir-cpu-runner/CMakeLists.txt b/mlir/tools/mlir-cpu-runner/CMakeLists.txt
index 596012c88228..7cd81128758d 100644
--- a/mlir/tools/mlir-cpu-runner/CMakeLists.txt
+++ b/mlir/tools/mlir-cpu-runner/CMakeLists.txt
@@ -4,7 +4,7 @@ set(LLVM_LINK_COMPONENTS
   nativecodegen
   )
 
-add_llvm_tool(mlir-cpu-runner
+add_mlir_tool(mlir-cpu-runner
   mlir-cpu-runner.cpp
   )
 llvm_update_compile_flags(mlir-cpu-runner)

diff  --git a/mlir/tools/mlir-cuda-runner/CMakeLists.txt b/mlir/tools/mlir-cuda-runner/CMakeLists.txt
index 5488262d7ee7..16daca88bc98 100644
--- a/mlir/tools/mlir-cuda-runner/CMakeLists.txt
+++ b/mlir/tools/mlir-cuda-runner/CMakeLists.txt
@@ -68,7 +68,7 @@ if(MLIR_CUDA_RUNNER_ENABLED)
     LIST(APPEND targets_to_link "LLVM${t}")
   ENDFOREACH(t)
 
-  add_llvm_tool(mlir-cuda-runner
+  add_mlir_tool(mlir-cuda-runner
     mlir-cuda-runner.cpp
 
     DEPENDS

diff  --git a/mlir/tools/mlir-linalg-ods-gen/CMakeLists.txt b/mlir/tools/mlir-linalg-ods-gen/CMakeLists.txt
index bc9a0c1f310a..c27857b3b7ca 100644
--- a/mlir/tools/mlir-linalg-ods-gen/CMakeLists.txt
+++ b/mlir/tools/mlir-linalg-ods-gen/CMakeLists.txt
@@ -2,7 +2,7 @@ set(LLVM_LINK_COMPONENTS
   Core
   Support
   )
-add_llvm_tool(mlir-linalg-ods-gen
+add_mlir_tool(mlir-linalg-ods-gen
   mlir-linalg-ods-gen.cpp
 )
 llvm_update_compile_flags(mlir-linalg-ods-gen)

diff  --git a/mlir/tools/mlir-opt/CMakeLists.txt b/mlir/tools/mlir-opt/CMakeLists.txt
index 483dcfec0c0f..65a328fa141e 100644
--- a/mlir/tools/mlir-opt/CMakeLists.txt
+++ b/mlir/tools/mlir-opt/CMakeLists.txt
@@ -50,7 +50,7 @@ add_mlir_library(MLIRMlirOptMain
   ${LIBS}
   )
 
-add_llvm_tool(mlir-opt
+add_mlir_tool(mlir-opt
   mlir-opt.cpp
 
   DEPENDS

diff  --git a/mlir/tools/mlir-reduce/CMakeLists.txt b/mlir/tools/mlir-reduce/CMakeLists.txt
index 958c2c94cc68..8e4a42f5882b 100644
--- a/mlir/tools/mlir-reduce/CMakeLists.txt
+++ b/mlir/tools/mlir-reduce/CMakeLists.txt
@@ -43,7 +43,7 @@ set(LIBS
   MLIRTransformUtils
   )
 
-add_llvm_tool(mlir-reduce
+add_mlir_tool(mlir-reduce
   OptReductionPass.cpp
   Passes/OpReducer.cpp
   ReductionNode.cpp

diff  --git a/mlir/tools/mlir-rocm-runner/CMakeLists.txt b/mlir/tools/mlir-rocm-runner/CMakeLists.txt
index 2c0791d7a5c1..3c90beac0b57 100644
--- a/mlir/tools/mlir-rocm-runner/CMakeLists.txt
+++ b/mlir/tools/mlir-rocm-runner/CMakeLists.txt
@@ -104,7 +104,7 @@ if(MLIR_ROCM_RUNNER_ENABLED)
     LIST(APPEND targets_to_link "LLVM${t}")
   ENDFOREACH(t)
 
-  add_llvm_tool(mlir-rocm-runner
+  add_mlir_tool(mlir-rocm-runner
     mlir-rocm-runner.cpp
 
     DEPENDS

diff  --git a/mlir/tools/mlir-translate/CMakeLists.txt b/mlir/tools/mlir-translate/CMakeLists.txt
index 99b98f9288b9..cc7ff64da42e 100644
--- a/mlir/tools/mlir-translate/CMakeLists.txt
+++ b/mlir/tools/mlir-translate/CMakeLists.txt
@@ -5,7 +5,7 @@ set(LLVM_LINK_COMPONENTS
 get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
 get_property(translation_libs GLOBAL PROPERTY MLIR_TRANSLATION_LIBS)
 
-add_llvm_tool(mlir-translate
+add_mlir_tool(mlir-translate
   mlir-translate.cpp
   )
 llvm_update_compile_flags(mlir-translate)

diff  --git a/mlir/tools/mlir-vulkan-runner/CMakeLists.txt b/mlir/tools/mlir-vulkan-runner/CMakeLists.txt
index c7a03259bb83..c11b4ef7c9f2 100644
--- a/mlir/tools/mlir-vulkan-runner/CMakeLists.txt
+++ b/mlir/tools/mlir-vulkan-runner/CMakeLists.txt
@@ -85,7 +85,7 @@ if (MLIR_VULKAN_RUNNER_ENABLED)
     LIST(APPEND targets_to_link "LLVM${t}")
   ENDFOREACH(t)
 
-  add_llvm_tool(mlir-vulkan-runner
+  add_mlir_tool(mlir-vulkan-runner
     mlir-vulkan-runner.cpp
   )
   add_dependencies(mlir-vulkan-runner vulkan-runtime-wrappers)


        


More information about the llvm-commits mailing list