File tree 4 files changed +25
-4
lines changed
4 files changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -207,6 +207,7 @@ include_directories(BEFORE
207
207
# Adding tools/mlir-tblgen here as calling add_tablegen sets some variables like
208
208
# MLIR_TABLEGEN_EXE in PARENT_SCOPE which gets lost if that folder is included
209
209
# from another directory like tools
210
+ add_subdirectory (tools/mlir-irdl-to-cpp)
210
211
add_subdirectory (tools/mlir-linalg-ods-gen)
211
212
add_subdirectory (tools/mlir-pdll)
212
213
add_subdirectory (tools/mlir-tblgen)
Original file line number Diff line number Diff line change 1
1
function (add_irdl_to_cpp_target target irdl_file)
2
2
add_custom_command (
3
3
OUTPUT ${CMAKE_CURRENT_BINARY_DIR} /${irdl_file} .cpp.inc
4
- COMMAND $<TARGET_FILE:mlir-irdl-to-cpp> ${CMAKE_CURRENT_SOURCE_DIR} /${irdl_file} -o ${CMAKE_CURRENT_BINARY_DIR} /${irdl_file} .cpp.inc
5
- DEPENDS mlir-irdl-to-cpp ${irdl_file}
4
+ COMMAND ${MLIR_IRDL_TO_CPP_EXE} ${CMAKE_CURRENT_SOURCE_DIR} /${irdl_file} -o ${CMAKE_CURRENT_BINARY_DIR} /${irdl_file} .cpp.inc
5
+ DEPENDS ${MLIR_IRDL_TO_CPP_TARGET} ${irdl_file}
6
6
COMMENT "Building ${irdl_file} ..."
7
7
)
8
8
add_custom_target (${target} ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR} /${irdl_file} .cpp.inc)
Original file line number Diff line number Diff line change 1
- add_subdirectory (mlir-irdl-to-cpp)
2
1
add_subdirectory (mlir-lsp-server)
3
2
add_subdirectory (mlir-opt)
4
3
add_subdirectory (mlir-parser-fuzzer)
Original file line number Diff line number Diff line change 1
- add_mlir_tool (mlir-irdl-to-cpp
1
+ add_llvm_executable (mlir-irdl-to-cpp
2
2
mlir-irdl-to-cpp.cpp
3
3
)
4
4
mlir_target_link_libraries(mlir-irdl-to-cpp
5
5
PRIVATE
6
6
MLIRTargetIRDLToCpp
7
7
)
8
+
9
+ # Set up a native build when cross-compiling.
10
+ if (LLVM_USE_HOST_TOOLS)
11
+ build_native_tool(
12
+ mlir-irdl-to-cpp
13
+ MLIR_IRDL_TO_CPP_EXE
14
+
15
+ # Native tool must depend on target tool so that the native tool gets
16
+ # properly rebuilt when the target tool changes.
17
+ DEPENDS mlir-irdl-to-cpp
18
+ )
19
+ add_custom_target (mlir-irdl-to-cpp-host DEPENDS ${MLIR_IRDL_TO_CPP_EXE} )
20
+ set (MLIR_IRDL_TO_CPP_TARGET mlir-irdl-to-cpp-host)
21
+ else ()
22
+ set (MLIR_IRDL_TO_CPP_EXE $<TARGET_FILE:mlir-irdl-to-cpp>)
23
+ set (MLIR_IRDL_TO_CPP_TARGET mlir-irdl-to-cpp)
24
+ endif ()
25
+
26
+ # Save the executable path and target name to the cache to expose it globally.
27
+ set (MLIR_IRDL_TO_CPP_EXE "${MLIR_IRDL_TO_CPP_EXE} " CACHE INTERNAL "" )
28
+ set (MLIR_IRDL_TO_CPP_TARGET "${MLIR_IRDL_TO_CPP_TARGET} " CACHE INTERNAL "" )
You can’t perform that action at this time.
0 commit comments