-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
236 lines (204 loc) · 5 KB
/
Copy pathCMakeLists.txt
File metadata and controls
236 lines (204 loc) · 5 KB
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
cmake_minimum_required(VERSION 3.14)
project(detectmateperformance)
# GoogleTest requires at least C++17
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip
)
FetchContent_Declare(
pybind11
GIT_REPOSITORY https://github.com/pybind/pybind11.git
GIT_TAG v3.0.1 # Use the latest stable version
)
FetchContent_MakeAvailable(pybind11)
# For Windows: Prevent overriding the parent project's compiler/linker settings
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
enable_testing()
add_test(
NAME memory_leak_test
COMMAND valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose ./test_c
)
add_library(
aux
src/detectmateperformance/_core/aux.h
src/detectmateperformance/_core/aux.cpp
)
add_library(
templates
src/detectmateperformance/_core/_type/templates.h
src/detectmateperformance/_core/_type/templates.cpp
)
add_library(
parsedelement
src/detectmateperformance/_core/_type/element.h
src/detectmateperformance/_core/_type/element.cpp
)
add_library(
parsed
src/detectmateperformance/_core/_type/parsed.h
src/detectmateperformance/_core/_type/parsed.cpp
)
add_library(
tree
src/detectmateperformance/_core/template_matcher/tree.h
src/detectmateperformance/_core/template_matcher/tree.cpp
)
add_library(
variable
src/detectmateperformance/_core/template_matcher/variables.h
src/detectmateperformance/_core/template_matcher/variables.cpp
)
add_library(
tree_op
src/detectmateperformance/_core/template_matcher/tree_op.h
src/detectmateperformance/_core/template_matcher/tree_op.cpp
)
add_library(
match_tree
src/detectmateperformance/_core/template_matcher/match_tree.h
src/detectmateperformance/_core/template_matcher/match_tree.cpp
)
add_library(
drain_op
src/detectmateperformance/_core/parsers/drain.h
src/detectmateperformance/_core/parsers/drain.cpp
)
add_library(
auto_parser_op
src/detectmateperformance/_core/parsers/auto_parser.h
src/detectmateperformance/_core/parsers/auto_parser.cpp
)
# match_tree depends on variable and tree_op; make those transitive so
# consumers of match_tree (executables/tests) don't need to worry about
# static library link ordering.
target_link_libraries(
match_tree
PUBLIC
variable
tree_op
tree
drain_op
auto_parser_op
)
add_executable(
test_c
tests/test_c/test_message.cpp
)
add_executable(
test_type
tests/test_c/test_type.cpp
)
add_executable(
test_matcher_tree
tests/test_c/test_matcher_tree.cpp
)
add_executable(
test_matcher_vars
tests/test_c/test_matcher_vars.cpp
)
add_executable(
test_drain_op
tests/test_c/test_drain_op.cpp
)
add_executable(
test_auto_parser
tests/test_c/test_auto_parser.cpp
)
pybind11_add_module(
bind_class
src/detectmateperformance/_core/bind_class.cpp
src/detectmateperformance/_core/aux.h
src/detectmateperformance/_core/aux.cpp
src/detectmateperformance/_core/_type/templates.h
src/detectmateperformance/_core/_type/templates.cpp
src/detectmateperformance/_core/_type/element.h
src/detectmateperformance/_core/_type/element.cpp
src/detectmateperformance/_core/_type/parsed.h
src/detectmateperformance/_core/_type/parsed.cpp
src/detectmateperformance/_core/template_matcher/tree.h
src/detectmateperformance/_core/template_matcher/tree.cpp
src/detectmateperformance/_core/template_matcher/variables.h
src/detectmateperformance/_core/template_matcher/variables.cpp
src/detectmateperformance/_core/template_matcher/tree_op.h
src/detectmateperformance/_core/template_matcher/tree_op.cpp
src/detectmateperformance/_core/template_matcher/match_tree.h
src/detectmateperformance/_core/template_matcher/match_tree.cpp
src/detectmateperformance/_core/parsers/drain.h
src/detectmateperformance/_core/parsers/drain.cpp
src/detectmateperformance/_core/parsers/auto_parser.h
src/detectmateperformance/_core/parsers/auto_parser.cpp
)
target_link_libraries(
test_c
GTest::gtest_main
templates
parsedelement
parsed
tree
variable
tree_op
match_tree
aux
)
target_link_libraries(
test_type
GTest::gtest_main
templates
parsedelement
parsed
aux
)
target_link_libraries(
test_matcher_tree
GTest::gtest_main
tree
)
target_link_libraries(
test_matcher_vars
GTest::gtest_main
templates
parsedelement
parsed
tree
variable
tree_op
match_tree
aux
)
target_link_libraries(
test_drain_op
GTest::gtest_main
drain_op
templates
parsedelement
parsed
tree
variable
tree_op
match_tree
aux
)
target_link_libraries(
test_auto_parser
GTest::gtest_main
auto_parser_op
templates
parsedelement
parsed
tree
variable
tree_op
match_tree
aux
)
include(GoogleTest)
gtest_discover_tests(test_c)
gtest_discover_tests(test_type)
gtest_discover_tests(test_matcher_tree)
gtest_discover_tests(test_matcher_vars)
gtest_discover_tests(test_drain_op)
gtest_discover_tests(test_auto_parser)