You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

CMakeLists.txt 1.1 kB

123456789101112131415161718192021
  1. # mgb tablegen executable
  2. set(TABLE_TARGET mgb-mlir-autogen)
  3. file(GLOB_RECURSE SRCS ${CMAKE_CURRENT_SOURCE_DIR}/*.h
  4. ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
  5. add_executable(${TABLE_TARGET} ${SRCS})
  6. target_include_directories(${TABLE_TARGET} PRIVATE ${MLIR_LLVM_INCLUDE_DIR})
  7. target_link_libraries(${TABLE_TARGET} PRIVATE LLVMTableGen MLIRTableGen LLVMSupport)
  8. set(MGB_TABLEGEN_EXE ${TABLE_TARGET})
  9. # generate megbrain opdef c header and python bindings
  10. set(LLVM_TARGET_DEFINITIONS ${MGE_IR_DIR}/ops.td)
  11. tablegen(MGB opdef.h.inl ${MGE_IR_INCLUDE_DIRS} "--gen-cpp-header")
  12. tablegen(MGB opdef.cpp.inl ${MGE_IR_INCLUDE_DIRS} "--gen-cpp-body")
  13. tablegen(MGB opdef.py.inl ${MGE_IR_INCLUDE_DIRS} "--gen-python-binding")
  14. tablegen(MGB opdef.cpy.inl ${MGE_IR_INCLUDE_DIRS} "--gen-python-c-extension")
  15. tablegen(MGB enum_macro.h ${MGE_IR_INCLUDE_DIRS} "--gen-enum-list-macro")
  16. add_custom_target(mgb_opdef ALL DEPENDS opdef.h.inl opdef.cpp.inl opdef.py.inl
  17. opdef.cpy.inl enum_macro.h param_defs_tblgen)
  18. set(MGB_OPDEF_OUT_DIR
  19. ${CMAKE_CURRENT_BINARY_DIR}
  20. PARENT_SCOPE)