-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathCMakeLists.txt
126 lines (91 loc) · 3.08 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
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
# ---- CMake requirements ----
cmake_minimum_required(VERSION 3.11)
set(TOP_PROJECT_NAME "OmniSketch")
project(${TOP_PROJECT_NAME})
# ---- CXX standard ----
set(CMAKE_CXX_STANDARD 17)
# To disable warnings in common/toml.h on a few c++20 compiler flags
set(CMAKE_CXX_FLAGS "-Wno-unknown-warning-option -Wno-deprecated-declarations")
# ---- Python Components ----
find_package(Python COMPONENTS Interpreter)
# ---- Include testing ----
include(CTest)
# ---- Include path of header files ----
include_directories(src)
# ---- Submodules ----
add_subdirectory(third_party/eigen)
add_subdirectory(third_party/fmt)
add_subdirectory(third_party/toml)
# Configuring toml & eigen needs a bit more work
include_directories(third_party/toml/include)
include_directories(third_party/eigen)
# ---- Boost libraries ----
find_package(Boost REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})
# ---- Compile static libraries ----
add_library(OmniTools src/impl/utils.cpp src/impl/logger.cpp src/impl/data.cpp src/impl/test.cpp src/impl/hash.cpp)
target_link_libraries(OmniTools fmt)
# ---- Add testing ----
add_subdirectory(test)
# ---- Pcap Library ----
function(check_library)
find_library(${ARGV0} ${ARGV1})
if(NOT ${ARGV0})
message(FATAL_ERROR "lib ${ARGV1} not found")
else()
message(STATUS "lib ${ARGV1} found at ${${ARGV0}}")
endif()
endfunction(check_library)
if(BUILD_PCAP_PARSER)
check_library(PCPP Pcap++)
check_library(PACPP Packet++)
check_library(COMPP Common++)
check_library(PCAP pcap)
endif()
# ---- Pcap Parser ----
if(NOT PCPP_INCLUDE_PATH)
set(PCPP_INCLUDE_PATH /usr/local/include/pcapplusplus)
message(STATUS "pcapplusplus is included at ${PCPP_INCLUDE_PATH} by default")
else()
message(STATUS "pcapplusplus is included at ${PCPP_INCLUDE_PATH}")
endif()
if(BUILD_PCAP_PARSER)
add_executable(parser ${CMAKE_CURRENT_SOURCE_DIR}/src/pcap_parser/parser.cpp)
target_include_directories(parser PRIVATE ${PCPP_INCLUDE_PATH})
target_link_libraries(parser ${PCPP} ${PACPP} ${COMPP} ${PCAP} fmt OmniTools)
endif()
# ---- User-defined sketches ----
function(add_user_sketch)
add_custom_target(${ARGV1}
DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/src/driver/${ARGV1}Driver.cpp
)
add_custom_command(
OUTPUT
${CMAKE_CURRENT_SOURCE_DIR}/src/driver/${ARGV1}Driver.cpp
COMMAND
${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/src/generate_driver.py sketch_test/${ARGV1}Test.h
DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/src/sketch_test/${ARGV1}Test.h
WORKING_DIRECTORY
${CMAKE_CURRENT_SOURCE_DIR}/src
)
add_executable(${ARGV0} ${CMAKE_CURRENT_SOURCE_DIR}/src/driver/${ARGV1}Driver.cpp)
target_link_libraries(${ARGV0} OmniTools)
endfunction(add_user_sketch)
# Bloom Filter
add_user_sketch(BF BloomFilter)
# Count Min Sketch
add_user_sketch(CM CMSketch)
# CH-optimized Count Min Sketch
add_user_sketch(CHCM CHCMSketch)
# CU Sketch
add_user_sketch(CU CUSketch)
# HashPipe
add_user_sketch(HP HashPipe)
# Count Sketch
add_user_sketch(CS CountSketch)
# Flow Radar
add_user_sketch(FR FlowRadar)
# Counting Bloom Filter
add_user_sketch(CBF CountingBloomFilter)