2020-08-28 03:46:27 +08:00
|
|
|
find_package(Python 3 REQUIRED COMPONENTS Interpreter)
|
|
|
|
|
2020-05-21 01:48:45 +08:00
|
|
|
# Invoke gen_onnx_mlir.py to obtain ONNXOps.td.inc, OpBuildTable.inc.
|
2020-04-08 15:00:34 +08:00
|
|
|
add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/ONNXOps.td.inc
|
2020-08-28 03:46:27 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/OpBuildTable.inc
|
|
|
|
COMMAND Python::Interpreter ${CMAKE_CURRENT_SOURCE_DIR}/gen_onnx_mlir.py
|
2020-05-21 01:48:45 +08:00
|
|
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/gen_onnx_mlir.py)
|
2020-04-08 15:00:34 +08:00
|
|
|
|
2020-05-18 21:44:31 +08:00
|
|
|
# Move the generated files to respective destinations:
|
2020-04-08 15:00:34 +08:00
|
|
|
# ONNXOps.td.inc -> src/Dialect/ONNX/ONNXOps.td.inc
|
2020-04-11 16:03:41 +08:00
|
|
|
add_custom_target(OMONNXOpsTableGenIncGen
|
2020-05-18 21:44:31 +08:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E rename
|
2020-08-28 03:46:27 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/ONNXOps.td.inc
|
|
|
|
${ONNX_MLIR_SRC_ROOT}/src/Dialect/ONNX/ONNXOps.td.inc
|
2020-04-08 15:00:34 +08:00
|
|
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ONNXOps.td.inc)
|
|
|
|
|
|
|
|
# OpBuildTable.inc -> src/Builder/OpBuildTable.inc
|
2020-04-11 16:03:41 +08:00
|
|
|
add_custom_target(OMONNXOpsBuildTableIncGen
|
2020-05-18 21:44:31 +08:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E rename
|
2020-04-08 15:00:34 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/OpBuildTable.inc
|
|
|
|
${ONNX_MLIR_SRC_ROOT}/src/Builder/OpBuildTable.inc
|
|
|
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/OpBuildTable.inc)
|
|
|
|
|
|
|
|
add_custom_target(OMONNXOpsIncTranslation
|
|
|
|
DEPENDS OMONNXOpsTableGenIncGen
|
2020-08-28 03:46:27 +08:00
|
|
|
OMONNXOpsBuildTableIncGen)
|
2020-05-13 06:43:44 +08:00
|
|
|
|
2020-05-21 01:48:45 +08:00
|
|
|
add_custom_target(OMONNXCheckVersion
|
2020-08-28 03:46:27 +08:00
|
|
|
COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/gen_onnx_mlir.py --check-operation-version)
|