forked from thegoldgoat/cicero_compiler_cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
100 lines (78 loc) · 2.01 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
cmake_minimum_required(VERSION 3.20)
project("CiceroCompilerCpp")
set(CMAKE_CXX_STANDARD 17)
find_package(MLIR REQUIRED CONFIG)
message(STATUS "Using MLIRConfig.cmake in: ${MLIR_DIR}")
message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")
set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/bin)
set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/lib)
set(MLIR_BINARY_DIR ${CMAKE_BINARY_DIR})
list(APPEND CMAKE_MODULE_PATH "${MLIR_CMAKE_DIR}")
list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}")
include(TableGen)
include(AddLLVM)
include(AddMLIR)
include(HandleLLVMOptions)
include_directories(${MLIR_INCLUDE_DIRS})
add_subdirectory(Parser)
add_subdirectory(src/mlir-dialect)
# Include generated dialect headers
include_directories(${CMAKE_CURRENT_BINARY_DIR}/src/mlir-dialect)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/Parser/src/mlir-dialect)
include_directories(include)
include_directories(Parser/include)
add_executable(
ciceroc
src/ciceroc.cpp
src/mlir-dialect/CiceroDialectWrapper.cpp
src/CiceroMLIRGenerator.cpp
src/CiceroPasses.cpp
src/cicero_helper.cpp
)
add_dependencies(
ciceroc
CiceroDialect
RegexDialect
)
add_executable(
ciceroc-measure
src/tool/ciceroc-measure.cpp
src/mlir-dialect/CiceroDialectWrapper.cpp
src/CiceroMLIRGenerator.cpp
src/CiceroPasses.cpp
src/cicero_helper.cpp
)
add_dependencies(
ciceroc-measure
CiceroDialect
RegexDialect
)
target_link_libraries(ciceroc-measure
PRIVATE
MLIRRegexParser
MLIRAnalysis
MLIRIR
MLIRParser
MLIRSideEffectInterfaces
MLIRTransforms)
link_directories(${LLVM_BUILD_LIBRARY_DIR})
target_link_libraries(ciceroc
PRIVATE
MLIRRegexParser
MLIRAnalysis
MLIRIR
MLIRParser
MLIRSideEffectInterfaces
MLIRTransforms)
add_executable(
objdump
src/tool/objdump.cpp
)
# Tests
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
include(CTest)
endif()
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
add_subdirectory(thirdparty/SoftwareCicero)
add_subdirectory(tests)
endif()