diff --git a/mlir/cmake/modules/AddMLIR.cmake b/mlir/cmake/modules/AddMLIR.cmake --- a/mlir/cmake/modules/AddMLIR.cmake +++ b/mlir/cmake/modules/AddMLIR.cmake @@ -46,3 +46,9 @@ set_property(GLOBAL APPEND PROPERTY MLIR_CONVERSION_LIBS ${name}) add_mlir_library(${ARGV}) endfunction(add_mlir_conversion_library) + +# Declare the library associated with a translation. +function(add_mlir_translation_library name) + set_property(GLOBAL APPEND PROPERTY MLIR_TRANSLATION_LIBS ${name}) + add_mlir_library(${ARGV}) +endfunction(add_mlir_translation_library) diff --git a/mlir/lib/Target/CMakeLists.txt b/mlir/lib/Target/CMakeLists.txt --- a/mlir/lib/Target/CMakeLists.txt +++ b/mlir/lib/Target/CMakeLists.txt @@ -1,4 +1,4 @@ -add_mlir_library(MLIRTargetLLVMIRModuleTranslation +add_mlir_translation_library(MLIRTargetLLVMIRModuleTranslation LLVMIR/DebugTranslation.cpp LLVMIR/ModuleTranslation.cpp @@ -18,7 +18,7 @@ MLIRTranslation ) -add_mlir_library(MLIRTargetAVX512 +add_mlir_translation_library(MLIRTargetAVX512 LLVMIR/LLVMAVX512Intr.cpp ADDITIONAL_HEADER_DIRS @@ -34,7 +34,7 @@ MLIRTargetLLVMIRModuleTranslation ) -add_mlir_library(MLIRTargetLLVMIR +add_mlir_translation_library(MLIRTargetLLVMIR LLVMIR/ConvertFromLLVMIR.cpp LLVMIR/ConvertToLLVMIR.cpp @@ -46,7 +46,7 @@ MLIRTargetLLVMIRModuleTranslation ) -add_mlir_library(MLIRTargetNVVMIR +add_mlir_translation_library(MLIRTargetNVVMIR LLVMIR/ConvertToNVVMIR.cpp ADDITIONAL_HEADER_DIRS @@ -63,7 +63,7 @@ MLIRTargetLLVMIRModuleTranslation ) -add_mlir_library(MLIRTargetROCDLIR +add_mlir_translation_library(MLIRTargetROCDLIR LLVMIR/ConvertToROCDLIR.cpp ADDITIONAL_HEADER_DIRS diff --git a/mlir/tools/mlir-translate/CMakeLists.txt b/mlir/tools/mlir-translate/CMakeLists.txt --- a/mlir/tools/mlir-translate/CMakeLists.txt +++ b/mlir/tools/mlir-translate/CMakeLists.txt @@ -1,14 +1,11 @@ get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS) +get_property(translation_libs GLOBAL PROPERTY MLIR_TRANSLATION_LIBS) set(LIBS ${dialect_libs} + ${translation_libs} MLIRParser MLIRPass MLIRSPIRV - MLIRSPIRVSerialization - MLIRTargetAVX512 - MLIRTargetLLVMIR - MLIRTargetNVVMIR - MLIRTargetROCDLIR MLIRTranslation MLIRSupport )