Mercurial > hg > CbC > CbC_llvm
comparison mlir/CMakeLists.txt @ 150:1d019706d866
LLVM10
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 15:10:13 +0900 |
parents | |
children | 0572611fdcc8 |
comparison
equal
deleted
inserted
replaced
147:c2174574ed3a | 150:1d019706d866 |
---|---|
1 # MLIR project. | |
2 set(MLIR_MAIN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include ) # --src-root | |
3 set(MLIR_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/include ) # --includedir | |
4 set(MLIR_TABLEGEN_EXE mlir-tblgen) | |
5 | |
6 set(MLIR_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) | |
7 set(MLIR_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) | |
8 | |
9 list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") | |
10 | |
11 function(add_mlir_dialect dialect dialect_doc_filename) | |
12 set(LLVM_TARGET_DEFINITIONS ${dialect}.td) | |
13 mlir_tablegen(${dialect}.h.inc -gen-op-decls) | |
14 mlir_tablegen(${dialect}.cpp.inc -gen-op-defs) | |
15 add_public_tablegen_target(MLIR${dialect}IncGen) | |
16 add_dependencies(mlir-headers MLIR${dialect}IncGen) | |
17 | |
18 # Generate Dialect Documentation | |
19 set(LLVM_TARGET_DEFINITIONS ${dialect_doc_filename}.td) | |
20 tablegen(MLIR ${dialect_doc_filename}.md -gen-op-doc "-I${MLIR_MAIN_SRC_DIR}" "-I${MLIR_INCLUDE_DIR}") | |
21 set(GEN_DOC_FILE ${MLIR_BINARY_DIR}/docs/Dialects/${dialect_doc_filename}.md) | |
22 add_custom_command( | |
23 OUTPUT ${GEN_DOC_FILE} | |
24 COMMAND ${CMAKE_COMMAND} -E copy | |
25 ${CMAKE_CURRENT_BINARY_DIR}/${dialect_doc_filename}.md | |
26 ${GEN_DOC_FILE} | |
27 DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${dialect_doc_filename}.md) | |
28 add_custom_target(${dialect_doc_filename}DocGen DEPENDS ${GEN_DOC_FILE}) | |
29 add_dependencies(mlir-doc ${dialect_doc_filename}DocGen) | |
30 endfunction() | |
31 | |
32 include(AddMLIR) | |
33 | |
34 # Installing the headers and docs needs to depend on generating any public | |
35 # tablegen'd targets. | |
36 add_custom_target(mlir-headers) | |
37 set_target_properties(mlir-headers PROPERTIES FOLDER "Misc") | |
38 add_custom_target(mlir-doc) | |
39 | |
40 # Build the CUDA conversions and run according tests if the NVPTX backend | |
41 # is available | |
42 if ("NVPTX" IN_LIST LLVM_TARGETS_TO_BUILD) | |
43 set(MLIR_CUDA_CONVERSIONS_ENABLED 1) | |
44 else() | |
45 set(MLIR_CUDA_CONVERSIONS_ENABLED 0) | |
46 endif() | |
47 | |
48 set(MLIR_CUDA_RUNNER_ENABLED 0 CACHE BOOL "Enable building the mlir CUDA runner") | |
49 | |
50 include_directories( "include") | |
51 include_directories( ${MLIR_INCLUDE_DIR}) | |
52 | |
53 add_subdirectory(include/mlir) | |
54 add_subdirectory(lib) | |
55 add_subdirectory(tools) | |
56 add_subdirectory(unittests) | |
57 add_subdirectory(test) | |
58 | |
59 if( LLVM_INCLUDE_EXAMPLES ) | |
60 add_subdirectory(examples) | |
61 endif() | |
62 | |
63 option(MLIR_INCLUDE_DOCS "Generate build targets for the MLIR docs." | |
64 ${LLVM_INCLUDE_DOCS}) | |
65 if (MLIR_INCLUDE_DOCS) | |
66 add_subdirectory(docs) | |
67 endif() | |
68 | |
69 if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) | |
70 install(DIRECTORY include/mlir include/mlir-c | |
71 DESTINATION include | |
72 COMPONENT mlir-headers | |
73 FILES_MATCHING | |
74 PATTERN "*.def" | |
75 PATTERN "*.h" | |
76 PATTERN "*.inc" | |
77 PATTERN "*.td" | |
78 PATTERN "LICENSE.TXT" | |
79 ) | |
80 | |
81 install(DIRECTORY ${MLIR_INCLUDE_DIR}/mlir ${MLIR_INCLUDE_DIR}/mlir-c | |
82 DESTINATION include | |
83 COMPONENT mlir-headers | |
84 FILES_MATCHING | |
85 PATTERN "*.def" | |
86 PATTERN "*.h" | |
87 PATTERN "*.gen" | |
88 PATTERN "*.inc" | |
89 PATTERN "*.td" | |
90 PATTERN "CMakeFiles" EXCLUDE | |
91 PATTERN "config.h" EXCLUDE | |
92 ) | |
93 | |
94 if (NOT LLVM_ENABLE_IDE) | |
95 add_llvm_install_targets(install-mlir-headers | |
96 DEPENDS mlir-headers | |
97 COMPONENT mlir-headers) | |
98 endif() | |
99 endif() | |
100 | |
101 add_subdirectory(cmake/modules) |