58 lines · plain
1# This library is shared by both MLIRSparseTensorDialect and2# MLIRSparseTensorRuntime, so it must not depend on any of the MLIR/LLVM3# internals or else mlir_c_runner_utils will inherit that dependency.4#5# Because this is a header-only (`INTERFACE`) library, we cannot use6# the `add_mlir_library` function. So we do our best to replicate the7# relevant portions below. If doing so becomes too complicated, then8# we should adjust the `add_mlir_library` function to also work for9# `INTERFACE` libraries.10set(MLIRSparseTensorEnums_hdrs11 mlir/Dialect/SparseTensor/IR/Enums.h)12if(MSVC_IDE OR XCODE)13 foreach(hdr ${MLIRSparseTensorEnums_hdrs})14 set_source_files_properties(${MLIR_MAIN_INCLUDE_DIR}/${hdr}15 PROPERTIES HEADER_FILE_ONLY ON)16 endforeach()17endif()18add_library(MLIRSparseTensorEnums INTERFACE)19foreach(hdr ${MLIRSparseTensorEnums_hdrs})20 target_sources(MLIRSparseTensorEnums INTERFACE21 $<BUILD_INTERFACE:${MLIR_MAIN_INCLUDE_DIR}/${hdr}>22 $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${hdr}>)23endforeach()24if(TARGET MLIRSparseTensorEnums)25 add_mlir_library_install(MLIRSparseTensorEnums)26else()27 add_custom_target(MLIRSparseTensorEnums) # empty "phony" target28endif()29 30add_mlir_dialect_library(MLIRSparseTensorDialect31 SparseTensorDialect.cpp32 SparseTensorInterfaces.cpp33 Detail/Var.cpp34 Detail/DimLvlMap.cpp35 Detail/LvlTypeParser.cpp36 Detail/DimLvlMapParser.cpp37 38 ADDITIONAL_HEADER_DIRS39 ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/SparseTensor40 41 DEPENDS42 MLIRSparseTensorAttrDefsIncGen43 MLIRSparseTensorOpsIncGen44 MLIRSparseTensorTypesIncGen45 46 LINK_LIBS PUBLIC47 MLIRArithDialect48 MLIRControlFlowInterfaces49 MLIRComplexDialect50 MLIRDialect51 MLIRDialectUtils52 MLIRIR53 MLIRInferTypeOpInterface54 MLIRLoopLikeInterface55 MLIRSupport56 MLIRSparseTensorEnums57 )58