160e89e1创建于 2025年11月24日历史提交
set(LLVM_LINK_COMPONENTS
  Support
  )
 
get_property(mindspore_translation_libs GLOBAL PROPERTY MINDSPORE_TRANSLATION_LIBS)
 
get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
get_property(translation_libs GLOBAL PROPERTY MLIR_TRANSLATION_LIBS)
 
set(LIBS
  ${dialect_libs}
  ${mindspore_translation_libs}
  ${translation_libs}
  MLIRIR
  MLIRBufferizationTransforms
  MLIRTosaDialect
  MLIRLinalgDialect
  )
 
link_directories(${AKG_BIN_LIB_DIR})
add_executable(mindspore-translate mindspore-translate.cpp)
add_dependencies(mindspore-translate ${LIBS})
 
 
# Code from mlir-cuda-runner for retrieving LLVM target libs
 
# Manually expand the target library, since our MLIR libraries
# aren't plugged into the LLVM dependency tracking. If we don't
# do this then we can't insert the CodeGen library after ourselves
llvm_expand_pseudo_components(TARGET_LIBS AllTargetsCodeGens)
# Prepend LLVM in front of every target, this is how the library
# are named with CMake
SET(targets_to_link)
FOREACH(t ${TARGET_LIBS})
  LIST(APPEND targets_to_link "LLVM${t}")
ENDFOREACH(t)
 
llvm_update_compile_flags(mindspore-translate)
target_link_libraries(mindspore-translate PRIVATE ${LIBS} ${targets_to_link})
 
mlir_check_all_link_libraries(mindspore-translate)