[Mlir-commits] [mlir] ab1ca6e - Revert "[MLIR] Adjust libMLIR building to more closely follow libClang"
Stephen Neuendorffer
llvmlistbot at llvm.org
Mon May 4 12:40:30 PDT 2020
Author: Stephen Neuendorffer
Date: 2020-05-04T12:40:12-07:00
New Revision: ab1ca6e60fc58b857cc5030ca6e024d20d919cb9
URL: https://github.com/llvm/llvm-project/commit/ab1ca6e60fc58b857cc5030ca6e024d20d919cb9
DIFF: https://github.com/llvm/llvm-project/commit/ab1ca6e60fc58b857cc5030ca6e024d20d919cb9.diff
LOG: Revert "[MLIR] Adjust libMLIR building to more closely follow libClang"
This reverts commit 4f0f436749c264c16eb226c9b9b132e07e3650a6.
This seems to show some compile dependence problems, and also breaks flang.
Added:
Modified:
mlir/cmake/modules/AddMLIR.cmake
mlir/cmake/modules/MLIRConfig.cmake.in
mlir/examples/toy/Ch6/CMakeLists.txt
mlir/examples/toy/Ch7/CMakeLists.txt
mlir/lib/Analysis/CMakeLists.txt
mlir/lib/Conversion/AVX512ToLLVM/CMakeLists.txt
mlir/lib/Conversion/AffineToStandard/CMakeLists.txt
mlir/lib/Conversion/GPUToCUDA/CMakeLists.txt
mlir/lib/Conversion/GPUToNVVM/CMakeLists.txt
mlir/lib/Conversion/GPUToROCDL/CMakeLists.txt
mlir/lib/Conversion/GPUToVulkan/CMakeLists.txt
mlir/lib/Conversion/LinalgToLLVM/CMakeLists.txt
mlir/lib/Conversion/LoopToStandard/CMakeLists.txt
mlir/lib/Conversion/LoopsToGPU/CMakeLists.txt
mlir/lib/Conversion/StandardToLLVM/CMakeLists.txt
mlir/lib/Conversion/VectorToLLVM/CMakeLists.txt
mlir/lib/Conversion/VectorToLoops/CMakeLists.txt
mlir/lib/Dialect/AVX512/CMakeLists.txt
mlir/lib/Dialect/Affine/EDSC/CMakeLists.txt
mlir/lib/Dialect/Affine/IR/CMakeLists.txt
mlir/lib/Dialect/Affine/Transforms/CMakeLists.txt
mlir/lib/Dialect/Affine/Utils/CMakeLists.txt
mlir/lib/Dialect/GPU/CMakeLists.txt
mlir/lib/Dialect/LLVMIR/CMakeLists.txt
mlir/lib/Dialect/LLVMIR/Transforms/CMakeLists.txt
mlir/lib/Dialect/Linalg/Analysis/CMakeLists.txt
mlir/lib/Dialect/Linalg/EDSC/CMakeLists.txt
mlir/lib/Dialect/Linalg/Transforms/CMakeLists.txt
mlir/lib/Dialect/Linalg/Utils/CMakeLists.txt
mlir/lib/Dialect/LoopOps/CMakeLists.txt
mlir/lib/Dialect/LoopOps/Transforms/CMakeLists.txt
mlir/lib/Dialect/OpenMP/CMakeLists.txt
mlir/lib/Dialect/Quant/CMakeLists.txt
mlir/lib/Dialect/SDBM/CMakeLists.txt
mlir/lib/Dialect/SPIRV/CMakeLists.txt
mlir/lib/Dialect/SPIRV/Serialization/CMakeLists.txt
mlir/lib/Dialect/SPIRV/Transforms/CMakeLists.txt
mlir/lib/Dialect/Shape/CMakeLists.txt
mlir/lib/Dialect/StandardOps/CMakeLists.txt
mlir/lib/Dialect/Vector/CMakeLists.txt
mlir/lib/EDSC/CMakeLists.txt
mlir/lib/ExecutionEngine/CMakeLists.txt
mlir/lib/IR/CMakeLists.txt
mlir/lib/Interfaces/CMakeLists.txt
mlir/lib/Parser/CMakeLists.txt
mlir/lib/Pass/CMakeLists.txt
mlir/lib/Support/CMakeLists.txt
mlir/lib/TableGen/CMakeLists.txt
mlir/lib/Target/CMakeLists.txt
mlir/lib/Transforms/CMakeLists.txt
mlir/lib/Transforms/Utils/CMakeLists.txt
mlir/lib/Translation/CMakeLists.txt
mlir/test/EDSC/CMakeLists.txt
mlir/test/SDBM/CMakeLists.txt
mlir/test/lib/Dialect/Affine/CMakeLists.txt
mlir/test/lib/Dialect/SPIRV/CMakeLists.txt
mlir/test/lib/Dialect/Test/CMakeLists.txt
mlir/test/lib/IR/CMakeLists.txt
mlir/test/lib/Pass/CMakeLists.txt
mlir/test/lib/Transforms/CMakeLists.txt
mlir/tools/mlir-cpu-runner/CMakeLists.txt
mlir/tools/mlir-linalg-ods-gen/CMakeLists.txt
mlir/tools/mlir-opt/CMakeLists.txt
mlir/tools/mlir-shlib/CMakeLists.txt
mlir/tools/mlir-tblgen/CMakeLists.txt
mlir/tools/mlir-translate/CMakeLists.txt
Removed:
################################################################################
diff --git a/mlir/cmake/modules/AddMLIR.cmake b/mlir/cmake/modules/AddMLIR.cmake
index 6c1ec381a675..6a2856b7f987 100644
--- a/mlir/cmake/modules/AddMLIR.cmake
+++ b/mlir/cmake/modules/AddMLIR.cmake
@@ -29,111 +29,11 @@ function(add_mlir_doc doc_filename command output_file output_directory)
add_dependencies(mlir-doc ${output_file}DocGen)
endfunction()
-# Declare an mlir library which can be compiled in libMLIR.so
-# In addition to everything that llvm_add_librar accepts, this
-# also has the following option:
-# EXCLUDE_FROM_LIBMLIR
-# Don't include this library in libMLIR.so. This option should be used
-# for test libraries, executable-specific libraries, or rarely used libraries
-# with large dependencies.
-function(add_mlir_library name)
- cmake_parse_arguments(ARG
- "SHARED;INSTALL_WITH_TOOLCHAIN;EXCLUDE_FROM_LIBMLIR"
- ""
- "ADDITIONAL_HEADERS;DEPENDS;LINK_COMPONENTS;LINK_LIBS"
- ${ARGN})
- set(srcs)
- if(MSVC_IDE OR XCODE)
- # Add public headers
- file(RELATIVE_PATH lib_path
- ${MLIR_SOURCE_DIR}/lib/
- ${CMAKE_CURRENT_SOURCE_DIR}
- )
- if(NOT lib_path MATCHES "^[.][.]")
- file( GLOB_RECURSE headers
- ${MLIR_SOURCE_DIR}/include/mlir/${lib_path}/*.h
- ${MLIR_SOURCE_DIR}/include/mlir/${lib_path}/*.def
- )
- set_source_files_properties(${headers} PROPERTIES HEADER_FILE_ONLY ON)
-
- file( GLOB_RECURSE tds
- ${MLIR_SOURCE_DIR}/include/mlir/${lib_path}/*.td
- )
- source_group("TableGen descriptions" FILES ${tds})
- set_source_files_properties(${tds}} PROPERTIES HEADER_FILE_ONLY ON)
-
- if(headers OR tds)
- set(srcs ${headers} ${tds})
- endif()
- endif()
- endif(MSVC_IDE OR XCODE)
- if(srcs OR ARG_ADDITIONAL_HEADERS)
- set(srcs
- ADDITIONAL_HEADERS
- ${srcs}
- ${ARG_ADDITIONAL_HEADERS} # It may contain unparsed unknown args.
- )
- endif()
- if(ARG_SHARED)
- set(LIBTYPE SHARED)
- else()
- # llvm_add_library ignores BUILD_SHARED_LIBS if STATIC is explicitly set,
- # so we need to handle it here.
- if(BUILD_SHARED_LIBS)
- set(LIBTYPE SHARED)
- else()
- set(LIBTYPE STATIC)
- endif()
- if(NOT XCODE)
- # The Xcode generator doesn't handle object libraries correctly.
- list(APPEND LIBTYPE OBJECT)
- endif()
- # Test libraries and such shouldn't be include in libMLIR.so
- if(NOT ARG_EXCLUDE_FROM_LIBMLIR)
- set_property(GLOBAL APPEND PROPERTY MLIR_STATIC_LIBS ${name})
- set_property(GLOBAL APPEND PROPERTY MLIR_LLVM_LINK_COMPONENTS ${ARG_LINK_COMPONENTS})
- set_property(GLOBAL APPEND PROPERTY MLIR_LLVM_LINK_COMPONENTS ${LLVM_LINK_COMPONENTS})
- endif()
- endif()
-
- # MLIR libraries uniformly depend on LLVMSupport. Just specify it once here.
- list(APPEND ARG_LINK_COMPONENTS Support)
- list(APPEND ARG_DEPENDS mlir-generic-headers)
- llvm_add_library(${name} ${LIBTYPE} ${ARG_UNPARSED_ARGUMENTS} ${srcs} DEPENDS ${ARG_DEPENDS} LINK_COMPONENTS ${ARG_LINK_COMPONENTS} LINK_LIBS ${ARG_LINK_LIBS})
-
- if(TARGET ${name})
- target_link_libraries(${name} INTERFACE ${LLVM_COMMON_LIBS})
-
- if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
- set(export_to_mlirtargets)
- if (${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
- "mlir-libraries" IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
- NOT LLVM_DISTRIBUTION_COMPONENTS)
- set(export_to_mlirtargets EXPORT MLIRTargets)
- set_property(GLOBAL PROPERTY MLIR_HAS_EXPORTS True)
- endif()
-
- install(TARGETS ${name}
- COMPONENT ${name}
- ${export_to_mlirtargets}
- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
- RUNTIME DESTINATION bin)
-
- if (NOT LLVM_ENABLE_IDE)
- add_llvm_install_targets(install-${name}
- DEPENDS ${name}
- COMPONENT ${name})
- endif()
- set_property(GLOBAL APPEND PROPERTY MLIR_ALL_LIBS ${name})
- endif()
- set_property(GLOBAL APPEND PROPERTY MLIR_EXPORTS ${name})
- else()
- # Add empty "phony" target
- add_custom_target(${name})
- endif()
- set_target_properties(${name} PROPERTIES FOLDER "MLIR libraries")
-endfunction(add_mlir_library)
+# Declare a library which can be compiled in libMLIR.so
+macro(add_mlir_library name)
+ set_property(GLOBAL APPEND PROPERTY MLIR_ALL_LIBS ${name})
+ add_llvm_library(${ARGV})
+endmacro(add_mlir_library)
# Declare the library associated with a dialect.
function(add_mlir_dialect_library name)
@@ -152,37 +52,3 @@ function(add_mlir_translation_library name)
set_property(GLOBAL APPEND PROPERTY MLIR_TRANSLATION_LIBS ${name})
add_mlir_library(${ARGV} DEPENDS mlir-headers)
endfunction(add_mlir_translation_library)
-
-# Verification tools to aid debugging.
-function(mlir_check_link_libraries name)
- if(TARGET ${name})
- get_target_property(libs ${name} LINK_LIBRARIES)
- # message("${name} libs are: ${libs}")
- set(linking_llvm 0)
- foreach(lib ${libs})
- if(lib)
- if(${lib} MATCHES "^LLVM$")
- set(linking_llvm 1)
- endif()
- if((${lib} MATCHES "^LLVM.+") AND ${linking_llvm})
- # This will almost always cause execution problems, since the
- # same symbol might be loaded from 2 separate libraries. This
- # often comes from referring to an LLVM library target
- # explicitly in target_link_libraries()
- message("WARNING: ${l} links LLVM and ${lib}!")
- endif()
- endif()
- endforeach()
- endif()
-endfunction(mlir_check_link_libraries)
-
-function(mlir_check_all_link_libraries name)
- mlir_check_link_libraries(${name})
- if(TARGET ${name})
- get_target_property(libs ${name} LINK_LIBRARIES)
- # message("${name} libs are: ${libs}")
- foreach(lib ${libs})
- mlir_check_link_libraries(${lib})
- endforeach()
- endif()
-endfunction(mlir_check_all_link_libraries)
diff --git a/mlir/cmake/modules/MLIRConfig.cmake.in b/mlir/cmake/modules/MLIRConfig.cmake.in
index de38f94add75..e8822e50ad55 100644
--- a/mlir/cmake/modules/MLIRConfig.cmake.in
+++ b/mlir/cmake/modules/MLIRConfig.cmake.in
@@ -19,7 +19,9 @@ set_property(GLOBAL PROPERTY MLIR_DIALECT_LIBS "@MLIR_DIALECT_LIBS@")
set_property(GLOBAL PROPERTY MLIR_CONVERSION_LIBS "@MLIR_CONVERSION_LIBS@")
# Provide all our library targets to users.
-include("@MLIR_CONFIG_EXPORTS_FILE@")
+if(EXISTS @MLIR_CONFIG_EXPORTS_FILE@)
+ include("@MLIR_CONFIG_EXPORTS_FILE@")
+endif()
# By creating these targets here, subprojects that depend on MLIR's
# tablegen-generated headers can always depend on these targets whether building
diff --git a/mlir/examples/toy/Ch6/CMakeLists.txt b/mlir/examples/toy/Ch6/CMakeLists.txt
index c821c77f461c..be797c6c1e96 100644
--- a/mlir/examples/toy/Ch6/CMakeLists.txt
+++ b/mlir/examples/toy/Ch6/CMakeLists.txt
@@ -4,8 +4,6 @@ add_subdirectory(include)
set(LLVM_LINK_COMPONENTS
Core
Support
- nativecodegen
- OrcJIT
)
set(LLVM_TARGET_DEFINITIONS mlir/ToyCombine.td)
diff --git a/mlir/examples/toy/Ch7/CMakeLists.txt b/mlir/examples/toy/Ch7/CMakeLists.txt
index f622bf5ac527..9a9f335d3a92 100644
--- a/mlir/examples/toy/Ch7/CMakeLists.txt
+++ b/mlir/examples/toy/Ch7/CMakeLists.txt
@@ -4,8 +4,6 @@ add_subdirectory(include)
set(LLVM_LINK_COMPONENTS
Core
Support
- nativecodegen
- OrcJIT
)
set(LLVM_TARGET_DEFINITIONS mlir/ToyCombine.td)
diff --git a/mlir/lib/Analysis/CMakeLists.txt b/mlir/lib/Analysis/CMakeLists.txt
index 63ddcdaee3d3..2fa57c510fdf 100644
--- a/mlir/lib/Analysis/CMakeLists.txt
+++ b/mlir/lib/Analysis/CMakeLists.txt
@@ -17,7 +17,12 @@ add_mlir_library(MLIRAnalysis
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Analysis
- LINK_LIBS PUBLIC
+ DEPENDS
+ mlir-generic-headers
+ )
+
+target_link_libraries(MLIRAnalysis
+ PUBLIC
MLIRAffineOps
MLIRCallInterfaces
MLIRControlFlowInterfaces
@@ -35,10 +40,14 @@ add_mlir_library(MLIRLoopAnalysis
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Analysis
- LINK_LIBS PUBLIC
+ DEPENDS
+ mlir-generic-headers
+ )
+
+target_link_libraries(MLIRLoopAnalysis
+ PUBLIC
MLIRAffineOps
MLIRCallInterfaces
MLIRControlFlowInterfaces
MLIRInferTypeOpInterface
- MLIRLoopOps
- )
+ MLIRLoopOps)
diff --git a/mlir/lib/Conversion/AVX512ToLLVM/CMakeLists.txt b/mlir/lib/Conversion/AVX512ToLLVM/CMakeLists.txt
index cf94a0670f3a..11397b9e105e 100644
--- a/mlir/lib/Conversion/AVX512ToLLVM/CMakeLists.txt
+++ b/mlir/lib/Conversion/AVX512ToLLVM/CMakeLists.txt
@@ -6,10 +6,7 @@ add_mlir_conversion_library(MLIRAVX512ToLLVM
DEPENDS
MLIRConversionPassIncGen
-
- LINK_COMPONENTS
- Core
- )
+)
target_link_libraries(MLIRAVX512ToLLVM
PUBLIC
@@ -18,4 +15,6 @@ target_link_libraries(MLIRAVX512ToLLVM
MLIRLLVMIR
MLIRStandardToLLVM
MLIRTransforms
+ LLVMCore
+ LLVMSupport
)
diff --git a/mlir/lib/Conversion/AffineToStandard/CMakeLists.txt b/mlir/lib/Conversion/AffineToStandard/CMakeLists.txt
index f08c2a5fd787..9324f7b21c80 100644
--- a/mlir/lib/Conversion/AffineToStandard/CMakeLists.txt
+++ b/mlir/lib/Conversion/AffineToStandard/CMakeLists.txt
@@ -6,10 +6,7 @@ add_mlir_conversion_library(MLIRAffineToStandard
DEPENDS
MLIRConversionPassIncGen
-
- LINK_COMPONENTS
- Core
- )
+)
target_link_libraries(
MLIRAffineToStandard
PUBLIC
@@ -19,4 +16,6 @@ target_link_libraries(
MLIRStandardOps
MLIRTransforms
MLIRIR
+ LLVMCore
+ LLVMSupport
)
diff --git a/mlir/lib/Conversion/GPUToCUDA/CMakeLists.txt b/mlir/lib/Conversion/GPUToCUDA/CMakeLists.txt
index 30a6b2c24bd8..a4c98e555322 100644
--- a/mlir/lib/Conversion/GPUToCUDA/CMakeLists.txt
+++ b/mlir/lib/Conversion/GPUToCUDA/CMakeLists.txt
@@ -9,9 +9,9 @@ set(SOURCES
if (MLIR_CUDA_CONVERSIONS_ENABLED)
list(APPEND SOURCES "ConvertKernelFuncToCubin.cpp")
set(NVPTX_LIBS
- NVPTXCodeGen
- NVPTXDesc
- NVPTXInfo
+ LLVMNVPTXCodeGen
+ LLVMNVPTXDesc
+ LLVMNVPTXInfo
)
endif()
@@ -20,14 +20,13 @@ add_mlir_conversion_library(MLIRGPUtoCUDATransforms
DEPENDS
MLIRConversionPassIncGen
-
- LINK_COMPONENTS
- Core
- MC
- ${NVPTX_LIBS}
- )
+)
target_link_libraries(MLIRGPUtoCUDATransforms
PUBLIC
+ ${NVPTX_LIBS}
+ LLVMCore
+ LLVMMC
+ LLVMSupport
MLIRGPU
MLIRIR
MLIRLLVMIR
diff --git a/mlir/lib/Conversion/GPUToNVVM/CMakeLists.txt b/mlir/lib/Conversion/GPUToNVVM/CMakeLists.txt
index 8e0b691a056d..b7c583d57169 100644
--- a/mlir/lib/Conversion/GPUToNVVM/CMakeLists.txt
+++ b/mlir/lib/Conversion/GPUToNVVM/CMakeLists.txt
@@ -12,6 +12,7 @@ add_mlir_conversion_library(MLIRGPUtoNVVMTransforms
target_link_libraries(MLIRGPUtoNVVMTransforms
PUBLIC
+ LLVMSupport
MLIRGPU
MLIRLLVMIR
MLIRNVVMIR
diff --git a/mlir/lib/Conversion/GPUToROCDL/CMakeLists.txt b/mlir/lib/Conversion/GPUToROCDL/CMakeLists.txt
index 64e2eff5ae82..2161abd37541 100644
--- a/mlir/lib/Conversion/GPUToROCDL/CMakeLists.txt
+++ b/mlir/lib/Conversion/GPUToROCDL/CMakeLists.txt
@@ -12,6 +12,7 @@ add_mlir_conversion_library(MLIRGPUtoROCDLTransforms
target_link_libraries(MLIRGPUtoROCDLTransforms
PUBLIC
+ LLVMSupport
MLIRGPU
MLIRLLVMIR
MLIRROCDLIR
diff --git a/mlir/lib/Conversion/GPUToVulkan/CMakeLists.txt b/mlir/lib/Conversion/GPUToVulkan/CMakeLists.txt
index 5fdfd07bda39..ecfc2d75d5f3 100644
--- a/mlir/lib/Conversion/GPUToVulkan/CMakeLists.txt
+++ b/mlir/lib/Conversion/GPUToVulkan/CMakeLists.txt
@@ -18,4 +18,5 @@ target_link_libraries(MLIRGPUtoVulkanTransforms
MLIRSupport
MLIRTransforms
MLIRTranslation
+ LLVMSupport
)
diff --git a/mlir/lib/Conversion/LinalgToLLVM/CMakeLists.txt b/mlir/lib/Conversion/LinalgToLLVM/CMakeLists.txt
index 28619e4c57e1..9fd15670382b 100644
--- a/mlir/lib/Conversion/LinalgToLLVM/CMakeLists.txt
+++ b/mlir/lib/Conversion/LinalgToLLVM/CMakeLists.txt
@@ -6,10 +6,7 @@ add_mlir_conversion_library(MLIRLinalgToLLVM
DEPENDS
MLIRConversionPassIncGen
-
- LINK_COMPONENTS
- Core
- )
+)
target_link_libraries(MLIRLinalgToLLVM
PUBLIC
@@ -23,4 +20,6 @@ target_link_libraries(MLIRLinalgToLLVM
MLIRVectorToLLVM
MLIRVectorToLoops
MLIRTransforms
+ LLVMCore
+ LLVMSupport
)
diff --git a/mlir/lib/Conversion/LoopToStandard/CMakeLists.txt b/mlir/lib/Conversion/LoopToStandard/CMakeLists.txt
index f0c75b1de9e8..d4c752847583 100644
--- a/mlir/lib/Conversion/LoopToStandard/CMakeLists.txt
+++ b/mlir/lib/Conversion/LoopToStandard/CMakeLists.txt
@@ -6,13 +6,12 @@ add_mlir_conversion_library(MLIRLoopToStandard
DEPENDS
MLIRConversionPassIncGen
-
- LINK_COMPONENTS
- Core
- )
+)
target_link_libraries(
MLIRLoopToStandard
PUBLIC
MLIRLoopOps
MLIRTransforms
+ LLVMCore
+ LLVMSupport
)
diff --git a/mlir/lib/Conversion/LoopsToGPU/CMakeLists.txt b/mlir/lib/Conversion/LoopsToGPU/CMakeLists.txt
index 22416091ad09..5b31429a0d0c 100644
--- a/mlir/lib/Conversion/LoopsToGPU/CMakeLists.txt
+++ b/mlir/lib/Conversion/LoopsToGPU/CMakeLists.txt
@@ -19,4 +19,5 @@ target_link_libraries(MLIRLoopsToGPU
MLIRStandardOps
MLIRSupport
MLIRTransforms
+ LLVMSupport
)
diff --git a/mlir/lib/Conversion/StandardToLLVM/CMakeLists.txt b/mlir/lib/Conversion/StandardToLLVM/CMakeLists.txt
index 445088c52c86..ef7ad11d93ef 100644
--- a/mlir/lib/Conversion/StandardToLLVM/CMakeLists.txt
+++ b/mlir/lib/Conversion/StandardToLLVM/CMakeLists.txt
@@ -6,13 +6,12 @@ add_mlir_conversion_library(MLIRStandardToLLVM
DEPENDS
MLIRConversionPassIncGen
-
- LINK_COMPONENTS
- Core
- )
+)
target_link_libraries(
MLIRStandardToLLVM
PUBLIC
MLIRLLVMIR
MLIRTransforms
+ LLVMCore
+ LLVMSupport
)
diff --git a/mlir/lib/Conversion/VectorToLLVM/CMakeLists.txt b/mlir/lib/Conversion/VectorToLLVM/CMakeLists.txt
index cc1f52eab261..6d6b3b87c073 100644
--- a/mlir/lib/Conversion/VectorToLLVM/CMakeLists.txt
+++ b/mlir/lib/Conversion/VectorToLLVM/CMakeLists.txt
@@ -6,10 +6,7 @@ add_mlir_conversion_library(MLIRVectorToLLVM
DEPENDS
MLIRConversionPassIncGen
-
- LINK_COMPONENTS
- Core
- )
+)
target_link_libraries(MLIRVectorToLLVM
PUBLIC
@@ -17,4 +14,6 @@ target_link_libraries(MLIRVectorToLLVM
MLIRStandardToLLVM
MLIRVector
MLIRTransforms
+ LLVMCore
+ LLVMSupport
)
diff --git a/mlir/lib/Conversion/VectorToLoops/CMakeLists.txt b/mlir/lib/Conversion/VectorToLoops/CMakeLists.txt
index c28ce5175186..515c0e2d0344 100644
--- a/mlir/lib/Conversion/VectorToLoops/CMakeLists.txt
+++ b/mlir/lib/Conversion/VectorToLoops/CMakeLists.txt
@@ -3,10 +3,7 @@ add_mlir_conversion_library(MLIRVectorToLoops
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/VectorToLoops
-
- LINK_COMPONENTS
- Core
- )
+)
target_link_libraries(MLIRVectorToLoops
PUBLIC
@@ -14,4 +11,6 @@ target_link_libraries(MLIRVectorToLoops
MLIRAffineEDSC
MLIRLLVMIR
MLIRTransforms
+ LLVMCore
+ LLVMSupport
)
diff --git a/mlir/lib/Dialect/AVX512/CMakeLists.txt b/mlir/lib/Dialect/AVX512/CMakeLists.txt
index 6b15bf21c2d9..eb1e7dc5c4b5 100644
--- a/mlir/lib/Dialect/AVX512/CMakeLists.txt
+++ b/mlir/lib/Dialect/AVX512/CMakeLists.txt
@@ -6,9 +6,11 @@ add_mlir_dialect_library(MLIRAVX512
DEPENDS
MLIRAVX512IncGen
-
- LINK_LIBS PUBLIC
+ )
+target_link_libraries(MLIRAVX512
+ PUBLIC
MLIRIR
MLIRSideEffects
MLIRVectorToLLVM
+ LLVMSupport
)
diff --git a/mlir/lib/Dialect/Affine/EDSC/CMakeLists.txt b/mlir/lib/Dialect/Affine/EDSC/CMakeLists.txt
index e00986584676..a07905b71fbc 100644
--- a/mlir/lib/Dialect/Affine/EDSC/CMakeLists.txt
+++ b/mlir/lib/Dialect/Affine/EDSC/CMakeLists.txt
@@ -6,8 +6,9 @@ add_mlir_dialect_library(MLIRAffineEDSC
DEPENDS
MLIRAffineOpsIncGen
-
- LINK_LIBS PUBLIC
+ )
+target_link_libraries(MLIRAffineEDSC
+ PUBLIC
MLIRAffineOps
MLIREDSC
MLIRIR
diff --git a/mlir/lib/Dialect/Affine/IR/CMakeLists.txt b/mlir/lib/Dialect/Affine/IR/CMakeLists.txt
index d34065e3b952..8d186ae03b54 100644
--- a/mlir/lib/Dialect/Affine/IR/CMakeLists.txt
+++ b/mlir/lib/Dialect/Affine/IR/CMakeLists.txt
@@ -7,8 +7,9 @@ add_mlir_dialect_library(MLIRAffineOps
DEPENDS
MLIRAffineOpsIncGen
-
- LINK_LIBS PUBLIC
+ )
+target_link_libraries(MLIRAffineOps
+ PUBLIC
MLIREDSC
MLIRIR
MLIRLoopLikeInterface
diff --git a/mlir/lib/Dialect/Affine/Transforms/CMakeLists.txt b/mlir/lib/Dialect/Affine/Transforms/CMakeLists.txt
index 89c72ae1ddab..bcad44d72497 100644
--- a/mlir/lib/Dialect/Affine/Transforms/CMakeLists.txt
+++ b/mlir/lib/Dialect/Affine/Transforms/CMakeLists.txt
@@ -14,8 +14,9 @@ add_mlir_dialect_library(MLIRAffineTransforms
MLIRAffineOpsIncGen
MLIRAffinePassIncGen
MLIRLoopLikeInterfaceIncGen
-
- LINK_LIBS PUBLIC
+ )
+target_link_libraries(MLIRAffineTransforms
+ PUBLIC
MLIRAffineOps
MLIREDSC
MLIRIR
diff --git a/mlir/lib/Dialect/Affine/Utils/CMakeLists.txt b/mlir/lib/Dialect/Affine/Utils/CMakeLists.txt
index 59ae13dcabcf..ed3b5b8b1723 100644
--- a/mlir/lib/Dialect/Affine/Utils/CMakeLists.txt
+++ b/mlir/lib/Dialect/Affine/Utils/CMakeLists.txt
@@ -4,7 +4,9 @@ add_mlir_dialect_library(MLIRAffineUtils
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/Affine
- LINK_LIBS PUBLIC
+ )
+target_link_libraries(MLIRAffineUtils
+ PUBLIC
MLIRAffineOps
MLIRTransformUtils
)
diff --git a/mlir/lib/Dialect/GPU/CMakeLists.txt b/mlir/lib/Dialect/GPU/CMakeLists.txt
index 01863d4a3d56..ad63b3669409 100644
--- a/mlir/lib/Dialect/GPU/CMakeLists.txt
+++ b/mlir/lib/Dialect/GPU/CMakeLists.txt
@@ -13,8 +13,9 @@ add_mlir_dialect_library(MLIRGPU
MLIRGPUPassIncGen
MLIRParallelLoopMapperAttrGen
MLIRParallelLoopMapperEnumsGen
-
- LINK_LIBS PUBLIC
+ )
+target_link_libraries(MLIRGPU
+ PUBLIC
MLIREDSC
MLIRIR
MLIRLLVMIR
@@ -24,4 +25,5 @@ add_mlir_dialect_library(MLIRGPU
MLIRStandardOps
MLIRSupport
MLIRTransformUtils
+ LLVMSupport
)
diff --git a/mlir/lib/Dialect/LLVMIR/CMakeLists.txt b/mlir/lib/Dialect/LLVMIR/CMakeLists.txt
index 6404fe263d4b..bd1f25c9f355 100644
--- a/mlir/lib/Dialect/LLVMIR/CMakeLists.txt
+++ b/mlir/lib/Dialect/LLVMIR/CMakeLists.txt
@@ -9,15 +9,15 @@ add_mlir_dialect_library(MLIRLLVMIR
DEPENDS
MLIRLLVMOpsIncGen
MLIRLLVMConversionsIncGen
-
- LINK_COMPONENTS
- AsmParser
- BitReader
- BitWriter
- Core
- FrontendOpenMP
-
- LINK_LIBS PUBLIC
+ )
+target_link_libraries(MLIRLLVMIR
+ PUBLIC
+ LLVMAsmParser
+ LLVMBitReader
+ LLVMBitWriter
+ LLVMCore
+ LLVMSupport
+ LLVMFrontendOpenMP
MLIRCallInterfaces
MLIRControlFlowInterfaces
MLIROpenMP
@@ -35,15 +35,15 @@ add_mlir_dialect_library(MLIRLLVMAVX512
DEPENDS
MLIRLLVMAVX512IncGen
MLIRLLVMAVX512ConversionsIncGen
-
- LINK_COMPONENTS
- AsmParser
- Core
-
- LINK_LIBS PUBLIC
+ )
+target_link_libraries(MLIRLLVMAVX512
+ PUBLIC
+ LLVMAsmParser
MLIRIR
MLIRLLVMIR
MLIRSideEffects
+ LLVMSupport
+ LLVMCore
)
add_mlir_dialect_library(MLIRNVVMIR
@@ -55,15 +55,15 @@ add_mlir_dialect_library(MLIRNVVMIR
DEPENDS
MLIRNVVMOpsIncGen
MLIRNVVMConversionsIncGen
-
- LINK_COMPONENTS
- AsmParser
- Core
-
- LINK_LIBS PUBLIC
+ )
+target_link_libraries(MLIRNVVMIR
+ PUBLIC
+ LLVMAsmParser
MLIRIR
MLIRLLVMIR
MLIRSideEffects
+ LLVMSupport
+ LLVMCore
)
add_mlir_dialect_library(MLIRROCDLIR
@@ -75,12 +75,12 @@ add_mlir_dialect_library(MLIRROCDLIR
DEPENDS
MLIRROCDLOpsIncGen
MLIRROCDLConversionsIncGen
-
- LINK_COMPONENTS
- AsmParser
- Core
-
- LINK_LIBS PUBLIC
+ )
+target_link_libraries(MLIRROCDLIR
+ PUBLIC
+ LLVMAsmParser
+ LLVMCore
+ LLVMSupport
MLIRIR
MLIRSideEffects
MLIRVectorToLLVM
diff --git a/mlir/lib/Dialect/LLVMIR/Transforms/CMakeLists.txt b/mlir/lib/Dialect/LLVMIR/Transforms/CMakeLists.txt
index 3e1342dcf2c9..216586e6242d 100644
--- a/mlir/lib/Dialect/LLVMIR/Transforms/CMakeLists.txt
+++ b/mlir/lib/Dialect/LLVMIR/Transforms/CMakeLists.txt
@@ -3,8 +3,10 @@ add_mlir_dialect_library(MLIRLLVMIRTransforms
DEPENDS
MLIRLLVMPassIncGen
+ )
- LINK_LIBS PUBLIC
+target_link_libraries(MLIRLLVMIRTransforms
+ PUBLIC
MLIRIR
MLIRLLVMIR
MLIRPass
diff --git a/mlir/lib/Dialect/Linalg/Analysis/CMakeLists.txt b/mlir/lib/Dialect/Linalg/Analysis/CMakeLists.txt
index 07cf5b357ab7..acb2ab6d91d7 100644
--- a/mlir/lib/Dialect/Linalg/Analysis/CMakeLists.txt
+++ b/mlir/lib/Dialect/Linalg/Analysis/CMakeLists.txt
@@ -6,9 +6,12 @@ add_mlir_dialect_library(MLIRLinalgAnalysis
DEPENDS
intrinsics_gen
+ )
- LINK_LIBS PUBLIC
+target_link_libraries(MLIRLinalgAnalysis
+ PUBLIC
MLIRIR
MLIRLinalgOps
MLIRStandardOps
+ LLVMSupport
)
diff --git a/mlir/lib/Dialect/Linalg/EDSC/CMakeLists.txt b/mlir/lib/Dialect/Linalg/EDSC/CMakeLists.txt
index be1d459daa91..8ec3c6dd7d22 100644
--- a/mlir/lib/Dialect/Linalg/EDSC/CMakeLists.txt
+++ b/mlir/lib/Dialect/Linalg/EDSC/CMakeLists.txt
@@ -6,8 +6,10 @@ add_mlir_dialect_library(MLIRLinalgEDSC
DEPENDS
intrinsics_gen
+ )
- LINK_LIBS PUBLIC
+target_link_libraries(MLIRLinalgEDSC
+ PUBLIC
MLIREDSC
MLIRIR
MLIRAffineOps
@@ -15,4 +17,5 @@ add_mlir_dialect_library(MLIRLinalgEDSC
MLIRLinalgOps
MLIRLoopOps
MLIRStandardOps
+ LLVMSupport
)
diff --git a/mlir/lib/Dialect/Linalg/Transforms/CMakeLists.txt b/mlir/lib/Dialect/Linalg/Transforms/CMakeLists.txt
index 8f3d44ba1b53..c8464e277cbb 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/CMakeLists.txt
+++ b/mlir/lib/Dialect/Linalg/Transforms/CMakeLists.txt
@@ -13,8 +13,9 @@ add_mlir_dialect_library(MLIRLinalgTransforms
DEPENDS
intrinsics_gen
MLIRLinalgPassIncGen
-
- LINK_LIBS PUBLIC
+ )
+target_link_libraries(MLIRLinalgTransforms
+ PUBLIC
MLIRAffineOps
MLIRAnalysis
MLIREDSC
diff --git a/mlir/lib/Dialect/Linalg/Utils/CMakeLists.txt b/mlir/lib/Dialect/Linalg/Utils/CMakeLists.txt
index 12bf47cdc9b1..681a47d31271 100644
--- a/mlir/lib/Dialect/Linalg/Utils/CMakeLists.txt
+++ b/mlir/lib/Dialect/Linalg/Utils/CMakeLists.txt
@@ -3,11 +3,12 @@ add_mlir_dialect_library(MLIRLinalgUtils
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/Linalg
-
DEPENDS
intrinsics_gen
+ )
- LINK_LIBS PUBLIC
+target_link_libraries(MLIRLinalgUtils
+ PUBLIC
MLIRAffineOps
MLIREDSC
MLIRIR
diff --git a/mlir/lib/Dialect/LoopOps/CMakeLists.txt b/mlir/lib/Dialect/LoopOps/CMakeLists.txt
index ea72f25a303a..44de8ada2150 100644
--- a/mlir/lib/Dialect/LoopOps/CMakeLists.txt
+++ b/mlir/lib/Dialect/LoopOps/CMakeLists.txt
@@ -8,13 +8,15 @@ add_mlir_dialect_library(MLIRLoopOps
DEPENDS
MLIRLoopOpsIncGen
-
- LINK_LIBS PUBLIC
+ )
+target_link_libraries(MLIRLoopOps
+ PUBLIC
MLIREDSC
MLIRIR
MLIRLoopLikeInterface
MLIRSideEffects
MLIRStandardOps
+ LLVMSupport
)
add_subdirectory(Transforms)
diff --git a/mlir/lib/Dialect/LoopOps/Transforms/CMakeLists.txt b/mlir/lib/Dialect/LoopOps/Transforms/CMakeLists.txt
index 0339d15f1fdc..13a6aa6f288a 100644
--- a/mlir/lib/Dialect/LoopOps/Transforms/CMakeLists.txt
+++ b/mlir/lib/Dialect/LoopOps/Transforms/CMakeLists.txt
@@ -8,12 +8,14 @@ add_mlir_dialect_library(MLIRLoopOpsTransforms
DEPENDS
MLIRLoopPassIncGen
-
- LINK_LIBS PUBLIC
+ )
+target_link_libraries(MLIRLoopOpsTransforms
+ PUBLIC
MLIRAffineOps
MLIRIR
MLIRPass
MLIRLoopOps
MLIRStandardOps
MLIRSupport
+ LLVMSupport
)
diff --git a/mlir/lib/Dialect/OpenMP/CMakeLists.txt b/mlir/lib/Dialect/OpenMP/CMakeLists.txt
index 23f8cd4058f7..68a939ed4299 100644
--- a/mlir/lib/Dialect/OpenMP/CMakeLists.txt
+++ b/mlir/lib/Dialect/OpenMP/CMakeLists.txt
@@ -6,7 +6,8 @@ add_mlir_dialect_library(MLIROpenMP
DEPENDS
MLIROpenMPOpsIncGen
-
- LINK_LIBS PUBLIC
+ )
+target_link_libraries(MLIROpenMP
+ PUBLIC
MLIRIR
)
diff --git a/mlir/lib/Dialect/Quant/CMakeLists.txt b/mlir/lib/Dialect/Quant/CMakeLists.txt
index 19ac787de027..4f8382962206 100644
--- a/mlir/lib/Dialect/Quant/CMakeLists.txt
+++ b/mlir/lib/Dialect/Quant/CMakeLists.txt
@@ -15,8 +15,9 @@ add_mlir_dialect_library(MLIRQuant
DEPENDS
MLIRQuantOpsIncGen
MLIRQuantPassIncGen
-
- LINK_LIBS PUBLIC
+ )
+target_link_libraries(MLIRQuant
+ PUBLIC
MLIRIR
MLIRPass
MLIRSideEffects
diff --git a/mlir/lib/Dialect/SDBM/CMakeLists.txt b/mlir/lib/Dialect/SDBM/CMakeLists.txt
index db2b9ac85472..6f5a119408cf 100644
--- a/mlir/lib/Dialect/SDBM/CMakeLists.txt
+++ b/mlir/lib/Dialect/SDBM/CMakeLists.txt
@@ -5,7 +5,8 @@ add_mlir_dialect_library(MLIRSDBM
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/SDBM
-
- LINK_LIBS PUBLIC
+)
+target_link_libraries(MLIRSDBM
+ PUBLIC
MLIRIR
)
diff --git a/mlir/lib/Dialect/SPIRV/CMakeLists.txt b/mlir/lib/Dialect/SPIRV/CMakeLists.txt
index 8fe368aa04e6..e6834ca2ef3e 100644
--- a/mlir/lib/Dialect/SPIRV/CMakeLists.txt
+++ b/mlir/lib/Dialect/SPIRV/CMakeLists.txt
@@ -27,8 +27,9 @@ add_mlir_dialect_library(MLIRSPIRV
MLIRSPIRVOpsIncGen
MLIRSPIRVOpUtilsGen
MLIRSPIRVTargetAndABIIncGen
-
- LINK_LIBS PUBLIC
+ )
+target_link_libraries(MLIRSPIRV
+ PUBLIC
MLIRControlFlowInterfaces
MLIRIR
MLIRParser
diff --git a/mlir/lib/Dialect/SPIRV/Serialization/CMakeLists.txt b/mlir/lib/Dialect/SPIRV/Serialization/CMakeLists.txt
index c04f801321ea..8f24491f4715 100644
--- a/mlir/lib/Dialect/SPIRV/Serialization/CMakeLists.txt
+++ b/mlir/lib/Dialect/SPIRV/Serialization/CMakeLists.txt
@@ -9,8 +9,9 @@ add_mlir_dialect_library(MLIRSPIRVSerialization
DEPENDS
MLIRSPIRVSerializationGen
-
- LINK_LIBS PUBLIC
+ )
+target_link_libraries(MLIRSPIRVSerialization
+ PUBLIC
MLIRIR
MLIRSPIRV
MLIRSupport
diff --git a/mlir/lib/Dialect/SPIRV/Transforms/CMakeLists.txt b/mlir/lib/Dialect/SPIRV/Transforms/CMakeLists.txt
index 632194f213d6..e388069d52ee 100644
--- a/mlir/lib/Dialect/SPIRV/Transforms/CMakeLists.txt
+++ b/mlir/lib/Dialect/SPIRV/Transforms/CMakeLists.txt
@@ -8,8 +8,10 @@ add_mlir_dialect_library(MLIRSPIRVTransforms
DEPENDS
MLIRSPIRVPassIncGen
+ )
- LINK_LIBS PUBLIC
+target_link_libraries(MLIRSPIRVTransforms
+ PUBLIC
MLIRPass
MLIRSPIRV
)
diff --git a/mlir/lib/Dialect/Shape/CMakeLists.txt b/mlir/lib/Dialect/Shape/CMakeLists.txt
index 1f198f7b8148..4ed02acc3d46 100644
--- a/mlir/lib/Dialect/Shape/CMakeLists.txt
+++ b/mlir/lib/Dialect/Shape/CMakeLists.txt
@@ -6,10 +6,12 @@ add_mlir_dialect_library(MLIRShape
DEPENDS
MLIRShapeOpsIncGen
-
- LINK_LIBS PUBLIC
+ )
+target_link_libraries(MLIRShape
+ PUBLIC
MLIRDialect
MLIRInferTypeOpInterface
MLIRIR
MLIRSideEffects
+ LLVMSupport
)
diff --git a/mlir/lib/Dialect/StandardOps/CMakeLists.txt b/mlir/lib/Dialect/StandardOps/CMakeLists.txt
index 6d83cbb375ae..471674c0ca76 100644
--- a/mlir/lib/Dialect/StandardOps/CMakeLists.txt
+++ b/mlir/lib/Dialect/StandardOps/CMakeLists.txt
@@ -8,12 +8,14 @@ add_mlir_dialect_library(MLIRStandardOps
DEPENDS
MLIRStandardOpsIncGen
-
- LINK_LIBS PUBLIC
+ )
+target_link_libraries(MLIRStandardOps
+ PUBLIC
MLIRCallInterfaces
MLIRControlFlowInterfaces
MLIREDSC
MLIRIR
MLIRSideEffects
MLIRViewLikeInterface
+ LLVMSupport
)
diff --git a/mlir/lib/Dialect/Vector/CMakeLists.txt b/mlir/lib/Dialect/Vector/CMakeLists.txt
index 9ccbb76b7bd2..3e1d8de0d3ba 100644
--- a/mlir/lib/Dialect/Vector/CMakeLists.txt
+++ b/mlir/lib/Dialect/Vector/CMakeLists.txt
@@ -10,8 +10,9 @@ add_mlir_dialect_library(MLIRVector
DEPENDS
MLIRVectorOpsIncGen
MLIRVectorTransformPatternsIncGen
-
- LINK_LIBS PUBLIC
+ )
+target_link_libraries(MLIRVector
+ PUBLIC
MLIREDSC
MLIRIR
MLIRStandardOps
diff --git a/mlir/lib/EDSC/CMakeLists.txt b/mlir/lib/EDSC/CMakeLists.txt
index 6d56f263f271..1435dbb22926 100644
--- a/mlir/lib/EDSC/CMakeLists.txt
+++ b/mlir/lib/EDSC/CMakeLists.txt
@@ -8,8 +8,10 @@ add_mlir_library(MLIREDSC
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/EDSC
+ )
+target_link_libraries(MLIREDSC
+ PUBLIC
- LINK_LIBS PUBLIC
MLIRIR
MLIRSupport
)
@@ -19,8 +21,9 @@ add_mlir_library(MLIREDSCInterface
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/EDSC
-
- LINK_LIBS PUBLIC
+ )
+target_link_libraries(MLIREDSCInterface
+ PUBLIC
MLIRIR
MLIRSupport
MLIRParser
diff --git a/mlir/lib/ExecutionEngine/CMakeLists.txt b/mlir/lib/ExecutionEngine/CMakeLists.txt
index e4cea32f4fc4..df3268a49d59 100644
--- a/mlir/lib/ExecutionEngine/CMakeLists.txt
+++ b/mlir/lib/ExecutionEngine/CMakeLists.txt
@@ -1,6 +1,3 @@
-# Exclude these from libMLIR.so because the JIT infrastructure
-# is a big dependency which most don't need.
-
set(LLVM_OPTIONAL_SOURCES
CRunnerUtils.cpp
ExecutionEngine.cpp
@@ -8,60 +5,41 @@ set(LLVM_OPTIONAL_SOURCES
OptUtils.cpp
)
+llvm_map_components_to_libnames(outlibs "nativecodegen" "IPO")
add_mlir_library(MLIRExecutionEngine
ExecutionEngine.cpp
OptUtils.cpp
- EXCLUDE_FROM_LIBMLIR
-
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/ExecutionEngine
-
- LINK_COMPONENTS
- Core
- ExecutionEngine
- Object
- OrcJIT
- JITLink
- Analysis
- AggressiveInstCombine
- InstCombine
- MC
- ScalarOpts
- Target
- Vectorize
- TransformUtils
- nativecodegen
- IPO
)
target_link_libraries(MLIRExecutionEngine
PUBLIC
MLIRLLVMIR
MLIRTargetLLVMIR
- )
-
-add_mlir_library(mlir_c_runner_utils
- SHARED
- CRunnerUtils.cpp
-
- EXCLUDE_FROM_LIBMLIR
- )
+ LLVMExecutionEngine
+ LLVMObject
+ LLVMOrcJIT
+ LLVMJITLink
+ LLVMSupport
+ LLVMAnalysis
+ LLVMAggressiveInstCombine
+ LLVMInstCombine
+ LLVMMC
+ LLVMScalarOpts
+ LLVMTarget
+ LLVMVectorize
+ LLVMTransformUtils
+
+ ${outlibs})
+
+add_llvm_library(mlir_c_runner_utils SHARED CRunnerUtils.cpp)
set_property(TARGET mlir_c_runner_utils PROPERTY CXX_STANDARD 11)
-
-add_mlir_library(mlir_c_runner_utils_static
- CRunnerUtils.cpp
-
- EXCLUDE_FROM_LIBMLIR
- )
+add_llvm_library(mlir_c_runner_utils_static CRunnerUtils.cpp)
set_property(TARGET mlir_c_runner_utils_static PROPERTY CXX_STANDARD 11)
target_compile_definitions(mlir_c_runner_utils PRIVATE mlir_c_runner_utils_EXPORTS)
-add_mlir_library(mlir_runner_utils
- SHARED
- RunnerUtils.cpp
-
- EXCLUDE_FROM_LIBMLIR
- )
+add_llvm_library(mlir_runner_utils SHARED RunnerUtils.cpp)
target_link_libraries(mlir_runner_utils
PUBLIC
mlir_c_runner_utils_static
diff --git a/mlir/lib/IR/CMakeLists.txt b/mlir/lib/IR/CMakeLists.txt
index 2d5f5cb9e2b4..88c36eee4c77 100644
--- a/mlir/lib/IR/CMakeLists.txt
+++ b/mlir/lib/IR/CMakeLists.txt
@@ -9,8 +9,9 @@ add_mlir_library(MLIRIR
MLIRCallInterfacesIncGen
MLIROpAsmInterfacesIncGen
MLIRSymbolInterfacesIncGen
-
- LINK_LIBS PUBLIC
+ )
+target_link_libraries(MLIRIR
+ PUBLIC
MLIRSupport
LLVMSupport
)
diff --git a/mlir/lib/Interfaces/CMakeLists.txt b/mlir/lib/Interfaces/CMakeLists.txt
index 61b64148db41..093b4faf3613 100644
--- a/mlir/lib/Interfaces/CMakeLists.txt
+++ b/mlir/lib/Interfaces/CMakeLists.txt
@@ -16,8 +16,9 @@ add_mlir_library(MLIRCallInterfaces
DEPENDS
MLIRCallInterfacesIncGen
-
- LINK_LIBS PUBLIC
+ )
+target_link_libraries(MLIRCallInterfaces
+ PUBLIC
MLIRIR
)
@@ -29,8 +30,9 @@ add_mlir_library(MLIRControlFlowInterfaces
DEPENDS
MLIRControlFlowInterfacesIncGen
-
- LINK_LIBS PUBLIC
+ )
+target_link_libraries(MLIRControlFlowInterfaces
+ PUBLIC
MLIRIR
)
@@ -42,8 +44,9 @@ add_mlir_library(MLIRDerivedAttributeOpInterface
DEPENDS
MLIRDerivedAttributeOpInterfaceIncGen
-
- LINK_LIBS PUBLIC
+ )
+target_link_libraries(MLIRDerivedAttributeOpInterface
+ PUBLIC
MLIRIR
)
@@ -55,8 +58,9 @@ add_mlir_library(MLIRInferTypeOpInterface
DEPENDS
MLIRInferTypeOpInterfaceIncGen
-
- LINK_LIBS PUBLIC
+ )
+target_link_libraries(MLIRInferTypeOpInterface
+ PUBLIC
MLIRIR
)
@@ -68,8 +72,9 @@ add_mlir_library(MLIRLoopLikeInterface
DEPENDS
MLIRLoopLikeInterfaceIncGen
-
- LINK_LIBS PUBLIC
+ )
+target_link_libraries(MLIRLoopLikeInterface
+ PUBLIC
MLIRIR
)
@@ -81,8 +86,9 @@ add_mlir_library(MLIRSideEffects
DEPENDS
MLIRSideEffectOpInterfacesIncGen
-
- LINK_LIBS PUBLIC
+ )
+target_link_libraries(MLIRSideEffects
+ PUBLIC
MLIRIR
)
@@ -94,7 +100,8 @@ add_mlir_library(MLIRViewLikeInterface
DEPENDS
MLIRViewLikeInterfaceIncGen
-
- LINK_LIBS PUBLIC
+ )
+target_link_libraries(MLIRViewLikeInterface
+ PUBLIC
MLIRIR
)
diff --git a/mlir/lib/Parser/CMakeLists.txt b/mlir/lib/Parser/CMakeLists.txt
index b9ab3f33ba20..fe2e03030880 100644
--- a/mlir/lib/Parser/CMakeLists.txt
+++ b/mlir/lib/Parser/CMakeLists.txt
@@ -6,6 +6,10 @@ add_mlir_library(MLIRParser
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Parser
- LINK_LIBS PUBLIC
+ DEPENDS
+ mlir-generic-headers
+ )
+target_link_libraries(MLIRParser
+ PUBLIC
MLIRIR
)
diff --git a/mlir/lib/Pass/CMakeLists.txt b/mlir/lib/Pass/CMakeLists.txt
index c012b056dba3..7e86864cf6c4 100644
--- a/mlir/lib/Pass/CMakeLists.txt
+++ b/mlir/lib/Pass/CMakeLists.txt
@@ -4,11 +4,9 @@ add_mlir_library(MLIRPass
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Pass
-
- DEPENDS
- mlir-generic-headers
-
- LINK_LIBS PUBLIC
+ )
+target_link_libraries(MLIRPass
+ PUBLIC
MLIRAnalysis
MLIRIR
- )
+ LLVMSupport)
diff --git a/mlir/lib/Support/CMakeLists.txt b/mlir/lib/Support/CMakeLists.txt
index 507ea41c8e50..a21a8cc29e0f 100644
--- a/mlir/lib/Support/CMakeLists.txt
+++ b/mlir/lib/Support/CMakeLists.txt
@@ -13,11 +13,10 @@ add_mlir_library(MLIRSupport
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Support
-
- LINK_COMPONENTS
- Support
-
- LINK_LIBS PUBLIC
+ )
+target_link_libraries(MLIRSupport
+ PUBLIC
+ LLVMSupport
${LLVM_PTHREAD_LIB})
add_mlir_library(MLIROptLib
@@ -25,30 +24,20 @@ add_mlir_library(MLIROptLib
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Support
-
- LINK_COMPONENTS
- Support
-
- LINK_LIBS PUBLIC
+ )
+target_link_libraries(MLIROptLib
+ PUBLIC
MLIRPass
MLIRParser
+ LLVMSupport
MLIRSupport
)
-# Exclude from libMLIR.so because the JIT infrastructure
-# is a big dependency which most don't need.
-add_mlir_library(MLIRJitRunner
+add_llvm_library(MLIRJitRunner
JitRunner.cpp
-
- EXCLUDE_FROM_LIBMLIR
-
- LINK_COMPONENTS
- Core
- OrcJIT
- JITLink
- Support
-
- LINK_LIBS PUBLIC
+)
+target_link_libraries(MLIRJitRunner
+ PUBLIC
MLIRExecutionEngine
MLIRIR
MLIRParser
@@ -57,4 +46,6 @@ add_mlir_library(MLIRJitRunner
MLIRTransforms
MLIRStandardToLLVM
MLIRSupport
+ LLVMCore
+ LLVMSupport
)
diff --git a/mlir/lib/TableGen/CMakeLists.txt b/mlir/lib/TableGen/CMakeLists.txt
index 780c98a5660d..a395fdb14a7a 100644
--- a/mlir/lib/TableGen/CMakeLists.txt
+++ b/mlir/lib/TableGen/CMakeLists.txt
@@ -1,8 +1,4 @@
-# This library is unusual, since mlir-tblgen depends on it.
-# For non-obvious reasons, linking mlir-tblgen fails with
-# LLVM_BUILD_LLVM_DYLIB and LLVM_LINK_LLVM_DYLIB unless
-# DISABLE_LLVM_LINK_LLVM_DYLIB is set.
-llvm_add_library(LLVMMLIRTableGen STATIC
+add_llvm_library(LLVMMLIRTableGen
Argument.cpp
Attribute.cpp
Constraint.cpp
@@ -20,14 +16,10 @@ llvm_add_library(LLVMMLIRTableGen STATIC
Successor.cpp
Type.cpp
- DISABLE_LLVM_LINK_LLVM_DYLIB
-
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/TableGen
-
- LINK_COMPONENTS
- TableGen
- Demangle
)
-
-mlir_check_all_link_libraries(LLVMMLIRTableGen)
+target_link_libraries(LLVMMLIRTableGen
+ PUBLIC
+ LLVMSupport
+ LLVMTableGen)
diff --git a/mlir/lib/Target/CMakeLists.txt b/mlir/lib/Target/CMakeLists.txt
index 4a0af66a04b1..ab4008a717a6 100644
--- a/mlir/lib/Target/CMakeLists.txt
+++ b/mlir/lib/Target/CMakeLists.txt
@@ -4,18 +4,17 @@ add_mlir_translation_library(MLIRTargetLLVMIRModuleTranslation
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Target/LLVMIR
-
DEPENDS
intrinsics_gen
-
- LINK_COMPONENTS
- Core
- FrontendOpenMP
- TransformUtils
-
- LINK_LIBS PUBLIC
+ )
+target_link_libraries(MLIRTargetLLVMIRModuleTranslation
+ PUBLIC
MLIRLLVMIR
MLIRLLVMIRTransforms
+ LLVMCore
+ LLVMIRReader
+ LLVMSupport
+ LLVMTransformUtils
MLIRTranslation
)
@@ -24,14 +23,11 @@ add_mlir_translation_library(MLIRTargetAVX512
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Target/LLVMIR
-
DEPENDS
MLIRLLVMAVX512ConversionsIncGen
-
- LINK_COMPONENTS
- Core
-
- LINK_LIBS PUBLIC
+ )
+target_link_libraries(MLIRTargetAVX512
+ PUBLIC
MLIRIR
MLIRLLVMAVX512
MLIRLLVMIR
@@ -44,12 +40,9 @@ add_mlir_translation_library(MLIRTargetLLVMIR
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Target/LLVMIR
-
- LINK_COMPONENTS
- Core
- IRReader
-
- LINK_LIBS PUBLIC
+ )
+target_link_libraries(MLIRTargetLLVMIR
+ PUBLIC
MLIRTargetLLVMIRModuleTranslation
)
@@ -58,14 +51,11 @@ add_mlir_translation_library(MLIRTargetNVVMIR
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Target/LLVMIR
-
DEPENDS
intrinsics_gen
-
- LINK_COMPONENTS
- Core
-
- LINK_LIBS PUBLIC
+ )
+target_link_libraries(MLIRTargetNVVMIR
+ PUBLIC
MLIRGPU
MLIRIR
MLIRLLVMIR
@@ -78,14 +68,11 @@ add_mlir_translation_library(MLIRTargetROCDLIR
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Target/LLVMIR
-
DEPENDS
intrinsics_gen
-
- LINK_COMPONENTS
- Core
-
- LINK_LIBS PUBLIC
+ )
+target_link_libraries(MLIRTargetROCDLIR
+ PUBLIC
MLIRGPU
MLIRIR
MLIRLLVMIR
diff --git a/mlir/lib/Transforms/CMakeLists.txt b/mlir/lib/Transforms/CMakeLists.txt
index 97e71a578070..531813575849 100644
--- a/mlir/lib/Transforms/CMakeLists.txt
+++ b/mlir/lib/Transforms/CMakeLists.txt
@@ -26,8 +26,10 @@ add_mlir_library(MLIRTransforms
DEPENDS
MLIRStandardOpsIncGen
MLIRTransformsPassIncGen
+ )
- LINK_LIBS PUBLIC
+target_link_libraries(MLIRTransforms
+ PUBLIC
MLIRAffineOps
MLIRAnalysis
MLIRLoopLikeInterface
diff --git a/mlir/lib/Transforms/Utils/CMakeLists.txt b/mlir/lib/Transforms/Utils/CMakeLists.txt
index a06523ed4aaa..1e0442179bf4 100644
--- a/mlir/lib/Transforms/Utils/CMakeLists.txt
+++ b/mlir/lib/Transforms/Utils/CMakeLists.txt
@@ -12,8 +12,10 @@ add_mlir_library(MLIRTransformUtils
DEPENDS
MLIRStandardOpsIncGen
+ )
- LINK_LIBS PUBLIC
+target_link_libraries(MLIRTransformUtils
+ PUBLIC
MLIRAffineOps
MLIRAnalysis
MLIRLoopAnalysis
diff --git a/mlir/lib/Translation/CMakeLists.txt b/mlir/lib/Translation/CMakeLists.txt
index 579de292fdb2..2cd1a7c9ee3e 100644
--- a/mlir/lib/Translation/CMakeLists.txt
+++ b/mlir/lib/Translation/CMakeLists.txt
@@ -3,8 +3,10 @@ add_mlir_library(MLIRTranslation
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Translation
-
- LINK_LIBS PUBLIC
+ )
+target_link_libraries(MLIRTranslation
+ PUBLIC
+ LLVMSupport
MLIRIR
MLIRParser
)
diff --git a/mlir/test/EDSC/CMakeLists.txt b/mlir/test/EDSC/CMakeLists.txt
index dda2a25fdb04..d8e3be8f2079 100644
--- a/mlir/test/EDSC/CMakeLists.txt
+++ b/mlir/test/EDSC/CMakeLists.txt
@@ -1,7 +1,3 @@
-set(LLVM_LINK_COMPONENTS
- Core
- Support
- )
add_llvm_executable(mlir-edsc-builder-api-test
builder-api-test.cpp
)
@@ -20,6 +16,8 @@ target_link_libraries(mlir-edsc-builder-api-test
MLIRStandardOps
MLIRTransforms
MLIRVector
- )
+ LLVMCore
+ LLVMSupport
+)
target_include_directories(mlir-edsc-builder-api-test PRIVATE ..)
diff --git a/mlir/test/SDBM/CMakeLists.txt b/mlir/test/SDBM/CMakeLists.txt
index 633fae707c85..9e0023750e68 100644
--- a/mlir/test/SDBM/CMakeLists.txt
+++ b/mlir/test/SDBM/CMakeLists.txt
@@ -1,8 +1,3 @@
-set(LLVM_LINK_COMPONENTS
- Core
- Support
- )
-
add_llvm_executable(mlir-sdbm-api-test
sdbm-api-test.cpp
)
@@ -14,6 +9,8 @@ target_link_libraries(mlir-sdbm-api-test
MLIRIR
MLIRSDBM
MLIRSupport
+ LLVMCore
+ LLVMSupport
)
target_include_directories(mlir-sdbm-api-test PRIVATE ..)
diff --git a/mlir/test/lib/Dialect/Affine/CMakeLists.txt b/mlir/test/lib/Dialect/Affine/CMakeLists.txt
index 68a0b06e0e31..56195ba2e875 100644
--- a/mlir/test/lib/Dialect/Affine/CMakeLists.txt
+++ b/mlir/test/lib/Dialect/Affine/CMakeLists.txt
@@ -1,21 +1,16 @@
-# Exclude tests from libMLIR.so
-add_mlir_library(MLIRAffineTransformsTestPasses
+add_llvm_library(MLIRAffineTransformsTestPasses
TestAffineDataCopy.cpp
TestAffineLoopUnswitching.cpp
TestLoopPermutation.cpp
TestParallelismDetection.cpp
TestVectorizationUtils.cpp
- EXCLUDE_FROM_LIBMLIR
-
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/Affine
${MLIR_MAIN_INCLUDE_DIR}/mlir/IR
+ )
- LINK_COMPONENTS
- Core
-
- LINK_LIBS PUBLIC
+target_link_libraries(MLIRAffineTransformsTestPasses PRIVATE
MLIRIR
MLIRPass
MLIRAffineTransforms
diff --git a/mlir/test/lib/Dialect/SPIRV/CMakeLists.txt b/mlir/test/lib/Dialect/SPIRV/CMakeLists.txt
index 15d4673f381f..5035c9cc8d49 100644
--- a/mlir/test/lib/Dialect/SPIRV/CMakeLists.txt
+++ b/mlir/test/lib/Dialect/SPIRV/CMakeLists.txt
@@ -1,14 +1,12 @@
-# Exclude tests from libMLIR.so
-add_mlir_library(MLIRSPIRVTestPasses
+add_llvm_library(MLIRSPIRVTestPasses
TestAvailability.cpp
- EXCLUDE_FROM_LIBMLIR
-
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/SPIRV
${MLIR_MAIN_INCLUDE_DIR}/mlir/IR
+ )
- LINK_LIBS PUBLIC
+target_link_libraries(MLIRSPIRVTestPasses PRIVATE
MLIRIR
MLIRPass
MLIRSPIRV
diff --git a/mlir/test/lib/Dialect/Test/CMakeLists.txt b/mlir/test/lib/Dialect/Test/CMakeLists.txt
index 542be7b6ac9c..ae62fb04f98a 100644
--- a/mlir/test/lib/Dialect/Test/CMakeLists.txt
+++ b/mlir/test/lib/Dialect/Test/CMakeLists.txt
@@ -14,17 +14,16 @@ mlir_tablegen(TestOpStructs.cpp.inc -gen-struct-attr-defs)
mlir_tablegen(TestPatterns.inc -gen-rewriters)
add_public_tablegen_target(MLIRTestOpsIncGen)
-# Exclude tests from libMLIR.so
-add_mlir_library(MLIRTestDialect
+add_llvm_library(MLIRTestDialect
TestDialect.cpp
TestPatterns.cpp
- EXCLUDE_FROM_LIBMLIR
-
DEPENDS
MLIRTestOpsIncGen
-
- LINK_LIBS PUBLIC
+)
+target_link_libraries(MLIRTestDialect
+ PUBLIC
+ LLVMSupport
MLIRControlFlowInterfaces
MLIRDerivedAttributeOpInterface
MLIRDialect
diff --git a/mlir/test/lib/IR/CMakeLists.txt b/mlir/test/lib/IR/CMakeLists.txt
index 0a55a82b1c3d..c4e4ebc9b88e 100644
--- a/mlir/test/lib/IR/CMakeLists.txt
+++ b/mlir/test/lib/IR/CMakeLists.txt
@@ -1,15 +1,16 @@
-# Exclude tests from libMLIR.so
-add_mlir_library(MLIRTestIR
+add_llvm_library(MLIRTestIR
TestFunc.cpp
TestMatchers.cpp
TestSideEffects.cpp
TestSymbolUses.cpp
- EXCLUDE_FROM_LIBMLIR
+ ADDITIONAL_HEADER_DIRS
+ )
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../Dialect/Test)
+include_directories(${CMAKE_CURRENT_BINARY_DIR}/../Dialect/Test)
- LINK_LIBS PUBLIC
+target_link_libraries(MLIRTestIR
+ PUBLIC
MLIRPass
MLIRTestDialect
)
-include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../Dialect/Test)
-include_directories(${CMAKE_CURRENT_BINARY_DIR}/../Dialect/Test)
diff --git a/mlir/test/lib/Pass/CMakeLists.txt b/mlir/test/lib/Pass/CMakeLists.txt
index 608141e349d1..7d79e1137f40 100644
--- a/mlir/test/lib/Pass/CMakeLists.txt
+++ b/mlir/test/lib/Pass/CMakeLists.txt
@@ -1,13 +1,11 @@
-# Exclude tests from libMLIR.so
-add_mlir_library(MLIRTestPass
+add_llvm_library(MLIRTestPass
TestPassManager.cpp
- EXCLUDE_FROM_LIBMLIR
-
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Pass
-
- LINK_LIBS PUBLIC
+ )
+target_link_libraries(MLIRTestPass
+ PUBLIC
MLIRIR
MLIRPass
)
diff --git a/mlir/test/lib/Transforms/CMakeLists.txt b/mlir/test/lib/Transforms/CMakeLists.txt
index 248da51bcec7..33129a9a9e0b 100644
--- a/mlir/test/lib/Transforms/CMakeLists.txt
+++ b/mlir/test/lib/Transforms/CMakeLists.txt
@@ -1,5 +1,4 @@
-# Exclude tests from libMLIR.so
-add_mlir_library(MLIRTestTransforms
+add_llvm_library(MLIRTestTransforms
TestAllReduceLowering.cpp
TestBufferPlacement.cpp
TestCallGraph.cpp
@@ -21,16 +20,21 @@ add_mlir_library(MLIRTestTransforms
TestVectorToLoopsConversion.cpp
TestVectorTransforms.cpp
- EXCLUDE_FROM_LIBMLIR
-
ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Transforms
DEPENDS
MLIRStandardOpsIncGen
MLIRTestVectorTransformPatternsIncGen
+)
+
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../Dialect/Test)
+include_directories(${CMAKE_CURRENT_BINARY_DIR}/../Dialect/Test)
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../DeclarativeTransforms)
+include_directories(${CMAKE_CURRENT_BINARY_DIR}/../DeclarativeTransforms)
- LINK_LIBS PUBLIC
+target_link_libraries(MLIRTestTransforms
+ PUBLIC
MLIRAffineOps
MLIRAnalysis
MLIREDSC
@@ -47,8 +51,3 @@ add_mlir_library(MLIRTestTransforms
MLIRVectorToLoops
MLIRVector
)
-
-include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../Dialect/Test)
-include_directories(${CMAKE_CURRENT_BINARY_DIR}/../Dialect/Test)
-include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../DeclarativeTransforms)
-include_directories(${CMAKE_CURRENT_BINARY_DIR}/../DeclarativeTransforms)
diff --git a/mlir/tools/mlir-cpu-runner/CMakeLists.txt b/mlir/tools/mlir-cpu-runner/CMakeLists.txt
index 596012c88228..9903e8d86e7e 100644
--- a/mlir/tools/mlir-cpu-runner/CMakeLists.txt
+++ b/mlir/tools/mlir-cpu-runner/CMakeLists.txt
@@ -1,12 +1,6 @@
-set(LLVM_LINK_COMPONENTS
- Core
- Support
- nativecodegen
- )
-
add_llvm_tool(mlir-cpu-runner
mlir-cpu-runner.cpp
- )
+)
llvm_update_compile_flags(mlir-cpu-runner)
get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
target_link_libraries(mlir-cpu-runner PRIVATE
@@ -20,4 +14,6 @@ target_link_libraries(mlir-cpu-runner PRIVATE
MLIRParser
MLIRTargetLLVMIR
MLIRSupport
+ LLVMCore
+ LLVMSupport
)
diff --git a/mlir/tools/mlir-linalg-ods-gen/CMakeLists.txt b/mlir/tools/mlir-linalg-ods-gen/CMakeLists.txt
index 3736a18b2009..b4fa6e35fc9a 100644
--- a/mlir/tools/mlir-linalg-ods-gen/CMakeLists.txt
+++ b/mlir/tools/mlir-linalg-ods-gen/CMakeLists.txt
@@ -1,7 +1,3 @@
-set(LLVM_LINK_COMPONENTS
- Core
- Support
- )
add_llvm_tool(mlir-linalg-ods-gen
mlir-linalg-ods-gen.cpp
)
@@ -9,4 +5,6 @@ llvm_update_compile_flags(mlir-linalg-ods-gen)
target_link_libraries(mlir-linalg-ods-gen PRIVATE
MLIRParser
MLIRSupport
+ LLVMCore
+ LLVMSupport
)
diff --git a/mlir/tools/mlir-opt/CMakeLists.txt b/mlir/tools/mlir-opt/CMakeLists.txt
index 2504b04420b7..55b5762923c3 100644
--- a/mlir/tools/mlir-opt/CMakeLists.txt
+++ b/mlir/tools/mlir-opt/CMakeLists.txt
@@ -4,12 +4,6 @@ set(LLVM_OPTIONAL_SOURCES
get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS)
-set(LLVM_LINK_COMPONENTS
- Core
- Support
- AsmParser
- )
-
set(LIBS
${dialect_libs}
${conversion_libs}
@@ -31,26 +25,22 @@ set(LIBS
MLIRSupport
MLIRIR
MLIROptLib
+ LLVMSupport
+ LLVMCore
+ LLVMAsmParser
)
-# Exclude from libMLIR.so because this has static options intended for
-# opt-like tools only.
-add_mlir_library(MLIRMlirOptMain
+add_llvm_library(MLIRMlirOptMain
mlir-opt.cpp
-
- EXCLUDE_FROM_LIBMLIR
-
- LINK_LIBS
+)
+target_link_libraries(MLIRMlirOptMain
+ PUBLIC
${LIBS}
- )
+)
add_llvm_tool(mlir-opt
- mlir-opt.cpp
+ mlir-opt.cpp
+)
- DEPENDS
- ${LIBS}
- )
-target_link_libraries(mlir-opt PRIVATE ${LIBS})
llvm_update_compile_flags(mlir-opt)
-
-mlir_check_link_libraries(mlir-opt)
+target_link_libraries(mlir-opt PRIVATE ${LIBS} ${targets_to_link})
diff --git a/mlir/tools/mlir-shlib/CMakeLists.txt b/mlir/tools/mlir-shlib/CMakeLists.txt
index 32fe833cee4e..d0e2e959652f 100644
--- a/mlir/tools/mlir-shlib/CMakeLists.txt
+++ b/mlir/tools/mlir-shlib/CMakeLists.txt
@@ -8,10 +8,8 @@ if (MSVC)
return()
endif()
-get_property(mlir_libs GLOBAL PROPERTY MLIR_STATIC_LIBS)
-get_property(mlir_llvm_link_components GLOBAL PROPERTY MLIR_LLVM_LINK_COMPONENTS)
+get_property(mlir_libs GLOBAL PROPERTY MLIR_ALL_LIBS)
list(REMOVE_DUPLICATES mlir_libs)
-list(REMOVE_DUPLICATES mlir_llvm_link_components)
foreach (lib ${mlir_libs})
if(XCODE)
@@ -21,32 +19,23 @@ foreach (lib ${mlir_libs})
else()
list(APPEND _OBJECTS $<TARGET_OBJECTS:obj.${lib}>)
endif()
- # libClang needs this, but it causes problems for MLIR (probably
- # because we use public library dependencies within MLIR.)
- # list(APPEND _DEPS $<TARGET_PROPERTY:${lib},LINK_LIBRARIES>)
+ list(APPEND _DEPS $<TARGET_PROPERTY:${lib},LINK_LIBRARIES>)
endforeach ()
if(MLIR_LINK_MLIR_DYLIB)
set(INSTALL_WITH_TOOLCHAIN INSTALL_WITH_TOOLCHAIN)
endif()
+# libMLIR.so depends on LLVM components. To avoid multiple
+# copies of those LLVM components, libMLIR.so depends on libLLVM.so.
+# This probably won't work if some LLVM components are not included
+# in libLLVM.so.
if(LLVM_BUILD_LLVM_DYLIB)
- add_mlir_library(
- MLIR
+ add_llvm_library(MLIR
SHARED
${INSTALL_WITH_TOOLCHAIN}
- mlir-shlib.cpp
- ${_OBJECTS}
- LINK_LIBS
- ${_DEPS}
- LINK_COMPONENTS
- ${mlir_llvm_link_components}
- )
- target_link_libraries(MLIR PRIVATE ${LLVM_PTHREAD_LIB})
+ mlir-shlib.cpp
+ )
+ target_link_libraries(MLIR PRIVATE LLVM ${LLVM_PTHREAD_LIB})
endif()
-
-#message("Libraries included in libMLIR.so: ${mlir_libs}")
-#message("LLVM Components included in libMLIR.so: ${mlir_llvm_link_components}")
-
-mlir_check_all_link_libraries(MLIR)
diff --git a/mlir/tools/mlir-tblgen/CMakeLists.txt b/mlir/tools/mlir-tblgen/CMakeLists.txt
index 4c54e250f2c5..19e6230e54ac 100644
--- a/mlir/tools/mlir-tblgen/CMakeLists.txt
+++ b/mlir/tools/mlir-tblgen/CMakeLists.txt
@@ -1,7 +1,6 @@
set(LLVM_LINK_COMPONENTS
- Demangle
+ MLIRTableGen
Support
- TableGen
)
add_tablegen(mlir-tblgen MLIR
@@ -20,10 +19,4 @@ add_tablegen(mlir-tblgen MLIR
SPIRVUtilsGen.cpp
StructsGen.cpp
)
-
set_target_properties(mlir-tblgen PROPERTIES FOLDER "Tablegenning")
-target_link_libraries(mlir-tblgen
- PRIVATE
- LLVMMLIRTableGen)
-
-mlir_check_all_link_libraries(mlir-tblgen)
diff --git a/mlir/tools/mlir-translate/CMakeLists.txt b/mlir/tools/mlir-translate/CMakeLists.txt
index 897e7adc03bd..9dc5971703ab 100644
--- a/mlir/tools/mlir-translate/CMakeLists.txt
+++ b/mlir/tools/mlir-translate/CMakeLists.txt
@@ -1,24 +1,16 @@
-set(LLVM_LINK_COMPONENTS
- Support
- )
-
get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
get_property(translation_libs GLOBAL PROPERTY MLIR_TRANSLATION_LIBS)
-
-add_llvm_tool(mlir-translate
- mlir-translate.cpp
- )
-llvm_update_compile_flags(mlir-translate)
-target_link_libraries(mlir-translate
- PRIVATE
+set(LIBS
${dialect_libs}
${translation_libs}
- MLIRIR
MLIRParser
MLIRPass
MLIRSPIRV
MLIRTranslation
MLIRSupport
- )
-
-mlir_check_link_libraries(mlir-translate)
+)
+add_llvm_tool(mlir-translate
+ mlir-translate.cpp
+)
+llvm_update_compile_flags(mlir-translate)
+target_link_libraries(mlir-translate PRIVATE MLIRIR MLIRTranslation ${LIBS} LLVMSupport)
More information about the Mlir-commits
mailing list