1# LLVM_TARGET_DEFINITIONS must contain the name of the .td file to process. 2# Extra parameters for `tblgen' may come after `ofn' parameter. 3# Adds the name of the generated file to TABLEGEN_OUTPUT. 4 5macro(tablegen ofn) 6 file(GLOB all_tds "*.td") 7 8 add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn}.tmp 9 COMMAND ${LLVM_TABLEGEN_EXE} ${ARGN} -I ${CMAKE_CURRENT_SOURCE_DIR} 10 -I ${LLVM_MAIN_SRC_DIR}/lib/Target -I ${LLVM_MAIN_INCLUDE_DIR} 11 ${CMAKE_CURRENT_SOURCE_DIR}/${LLVM_TARGET_DEFINITIONS} 12 -o ${CMAKE_CURRENT_BINARY_DIR}/${ofn}.tmp 13 DEPENDS tblgen ${all_tds} 14 COMMENT "Building ${ofn}.tmp..." 15 ) 16 add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn} 17 COMMAND ${CMAKE_COMMAND} -E copy_if_different 18 ${CMAKE_CURRENT_BINARY_DIR}/${ofn}.tmp ${CMAKE_CURRENT_BINARY_DIR}/${ofn} 19 DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${ofn}.tmp 20 COMMENT "Building ${ofn}..." 21 ) 22 set(TABLEGEN_OUTPUT ${TABLEGEN_OUTPUT} ${CMAKE_CURRENT_BINARY_DIR}/${ofn}) 23endmacro(tablegen) 24