1# This library is shared by both MLIRSparseTensorDialect and 2# MLIRSparseTensorRuntime, so it must not depend on any of the MLIR/LLVM 3# internals or else mlir_c_runner_utils will inherit that dependency. 4# 5# Because this is a header-only (`INTERFACE`) library, we cannot use 6# the `add_mlir_library` function. So we do our best to replicate the 7# relevant portions below. If doing so becomes too complicated, then 8# we should adjust the `add_mlir_library` function to also work for 9# `INTERFACE` libraries. 10set(MLIRSparseTensorEnums_hdrs 11 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 INTERFACE 21 $<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" target 28endif() 29 30add_mlir_dialect_library(MLIRSparseTensorDialect 31 SparseTensorDialect.cpp 32 SparseTensorInterfaces.cpp 33 Detail/Var.cpp 34 Detail/DimLvlMap.cpp 35 Detail/LvlTypeParser.cpp 36 Detail/DimLvlMapParser.cpp 37 38 ADDITIONAL_HEADER_DIRS 39 ${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/SparseTensor 40 41 DEPENDS 42 MLIRSparseTensorAttrDefsIncGen 43 MLIRSparseTensorOpsIncGen 44 MLIRSparseTensorTypesIncGen 45 46 LINK_LIBS PUBLIC 47 MLIRArithDialect 48 MLIRControlFlowInterfaces 49 MLIRComplexDialect 50 MLIRDialect 51 MLIRDialectUtils 52 MLIRIR 53 MLIRInferTypeOpInterface 54 MLIRLoopLikeInterface 55 MLIRSupport 56 MLIRSparseTensorEnums 57 ) 58