forked from stellar/medida
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
198 lines (160 loc) · 4.57 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
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
cmake_minimum_required (VERSION 2.8.3)
## Metadata
project (medida)
set (medida_VERSION_MAJOR 0)
set (medida_VERSION_MINOR 1)
set (medida_VERSION_PATCH 0)
set (medida_VERSION_TAG "")
set (medida_VERSION "${medida_VERSION_MAJOR}.${medida_VERSION_MINOR}.${medida_VERSION_PATCH}${medida_VERSION_TAG}")
## Configuration
if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fno-diagnostics-show-option -std=c++0x -Wall -Wextra -pedantic -Wno-long-long -Wno-deprecated -fno-strict-aliasing")
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
include(FindPkgConfig)
endif()
## Source
set(medida_SOURCES
src/medida/stats/snapshot.cc
src/medida/stats/ewma.cc
src/medida/stats/uniform_sample.cc
src/medida/stats/exp_decay_sample.cc
src/medida/stats/sliding_window_sample.cc
src/medida/stats/ckms.cc
src/medida/stats/ckms_sample.cc
src/medida/buckets.cc
src/medida/counter.cc
src/medida/meter.cc
src/medida/metric_name.cc
src/medida/metric_processor.cc
src/medida/metrics_registry.cc
src/medida/timer.cc
src/medida/timer_context.cc
src/medida/reporting/abstract_polling_reporter.cc
src/medida/reporting/collectd_reporter.cc
src/medida/reporting/console_reporter.cc
src/medida/reporting/json_reporter.cc
src/medida/reporting/util.cc
src/medida/histogram.cc
)
set(medida_HEADERS
src/medida/buckets.h
src/medida/medida.h
src/medida/counter.h
src/medida/histogram.h
src/medida/meter.h
src/medida/metered_interface.h
src/medida/metric_interface.h
src/medida/metric_name.h
src/medida/metric_processor.h
src/medida/metrics_registry.h
src/medida/sampling_interface.h
src/medida/summarizable_interface.h
src/medida/timer.h
src/medida/timer_context.h
src/medida/reporting/abstract_polling_reporter.h
src/medida/reporting/collectd_reporter.h
src/medida/reporting/console_reporter.h
src/medida/reporting/json_reporter.h
src/medida/reporting/util.h
src/medida/stats/ewma.h
src/medida/stats/exp_decay_sample.h
src/medida/stats/sliding_window_sample.h
src/medida/stats/sample.h
src/medida/stats/snapshot.h
src/medida/stats/uniform_sample.h
src/medida/stats/ckms.h
src/medida/stats/ckms_sample.h
)
## Dependencies
find_package(Threads REQUIRED)
include_directories(
${medida_SOURCE_DIR}/src
${medida_BINARY_DIR}
)
add_library(medida SHARED
${medida_SOURCES}
${medida_PROTO_SRCS}
)
target_link_libraries(medida
${CMAKE_THREAD_LIBS_INIT}
)
set_target_properties(medida PROPERTIES
OUTPUT_NAME medida
VERSION ${medida_VERSION}
SOVERSION ${medida_VERSION_MAJOR}
)
install(TARGETS medida
LIBRARY DESTINATION lib
)
install(FILES
src/medida/medida.h
src/medida/counter.h
src/medida/histogram.h
src/medida/meter.h
src/medida/metered_interface.h
src/medida/metric_interface.h
src/medida/metric_name.h
src/medida/metric_processor.h
src/medida/metrics_registry.h
src/medida/sampling_interface.h
src/medida/summarizable_interface.h
src/medida/timer.h
src/medida/timer_context.h
src/medida/types.h
DESTINATION include/medida/
)
install(FILES
src/medida/reporting/abstract_polling_reporter.h
src/medida/reporting/collectd_reporter.h
src/medida/reporting/console_reporter.h
src/medida/reporting/json_reporter.h
src/medida/reporting/util.h
DESTINATION include/medida/reporting/
)
install(FILES
src/medida/stats/ewma.h
src/medida/stats/exp_decay_sample.h
src/medida/stats/sliding_window_sample.h
src/medida/stats/ckms.h
src/medida/stats/ckms_sample.h
src/medida/stats/sample.h
src/medida/stats/snapshot.h
src/medida/stats/uniform_sample.h
DESTINATION include/medida/stats/
)
## pkgconfig
set(PKGCONFIG_FILE ${medida_BINARY_DIR}/libmedida.pc)
configure_file(libmedida.pc.in ${PKGCONFIG_FILE} @ONLY)
install(FILES ${PKGCONFIG_FILE}
DESTINATION lib/pkgconfig
)
## Testing
enable_testing()
add_subdirectory(test)
## Documentation
option(BUILD_DOCS "Build HTML docs with Doxygen" OFF)
if(BUILD_DOCS)
find_package(Doxygen)
if (NOT DOXYGEN_FOUND)
message(FATAL_ERROR "Doxygen not installed.")
endif()
file(COPY doc DESTINATION ${PROJECT_BINARY_DIR})
configure_file(doc/doxygen.cfg.in
${PROJECT_BINARY_DIR}/doxygen.cfg @ONLY IMMEDIATE
)
add_custom_target (docs ALL
COMMAND ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/doxygen.cfg
SOURCES ${PROJECT_BINARY_DIR}/doxygen.cfg
)
endif()
install(DIRECTORY ${PROJECT_BINARY_DIR}/doc/
DESTINATION share/doc/libmedida-dev/html/
)
## Examples
add_subdirectory(examples)
install(FILES
examples/medida_example1.cc
DESTINATION share/doc/libmedida-dev/examples/
)