-
Notifications
You must be signed in to change notification settings - Fork 5
/
CMakeLists.txt
68 lines (53 loc) · 2.02 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
CMAKE_MINIMUM_REQUIRED(VERSION 3.5.1)
ENABLE_LANGUAGE(CXX)
SET(CMAKE_CXX_STANDARD 11)
SET(CMAKE_CXX_STANDARD_REQUIRED ON)
SET(CMAKE_CXX_EXTENSIONS OFF)
INCLUDE(GNUInstallDirs)
SET(H2O_COMMIT "fb0d55a")
PROJECT(h2olog)
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE Release)
ENDIF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -flto")
SET(CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-unused-parameter -g3 ${CMAKE_CXX_FLAGS}")
FIND_PATH(LIBBCC_INCLUDE_DIR NAMES bcc/BPF.h)
FIND_LIBRARY(LIBBCC_LIB "bcc")
IF (LIBBCC_LIB)
IF (LIBBCC_INCLUDE_DIR)
INCLUDE_DIRECTORIES("${LIBBCC_INCLUDE_DIR}")
ELSE (LIBBCC_INCLUDE_DIR)
MESSAGE(SEND_ERROR "libbcc header files not found")
ENDIF (LIBBCC_INCLUDE_DIR)
ELSE (LIBBCC_LIB)
MESSAGE(SEND_ERROR "libbcc not found")
ENDIF (LIBBCC_LIB)
SET(SOURCE_FILES
"h2olog.h"
"h2olog.cc"
"http.cc"
"json.h"
"json.cc"
"quic.h"
)
ADD_CUSTOM_COMMAND(
OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/quicly-probes.d"
COMMAND curl -sLf 'https://raw.githubusercontent.com/h2o/h2o/${H2O_COMMIT}/deps/quicly/quicly-probes.d' >${CMAKE_CURRENT_SOURCE_DIR}/quicly-probes.d
)
LIST(APPEND DTRACE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/quicly-probes.d")
ADD_CUSTOM_COMMAND(
OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/h2o-probes.d"
COMMAND curl -sLf 'https://raw.githubusercontent.com/h2o/h2o/${H2O_COMMIT}/h2o-probes.d' >${CMAKE_CURRENT_SOURCE_DIR}/h2o-probes.d
)
LIST(APPEND DTRACE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/h2o-probes.d")
ADD_CUSTOM_COMMAND(
OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/generated-quic.cc"
COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/misc/gen-quic-bpf.py" "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/generated-quic.cc"
DEPENDS ${DTRACE_FILES}
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/misc/gen-quic-bpf.py"
)
LIST(APPEND SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/generated-quic.cc")
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
ADD_EXECUTABLE(h2olog ${SOURCE_FILES})
TARGET_LINK_LIBRARIES(h2olog ${LIBBCC_LIB})
INSTALL(TARGETS h2olog RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})