-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
111 lines (85 loc) · 2.9 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
cmake_minimum_required(VERSION 3.1)
project(HawkTracer
VERSION 0.8.0)
include(GNUInstallDirs)
option(ENABLE_ASAN "Enable address sanitizer" OFF)
option(ENABLE_TESTS "Enable unit tests" OFF)
option(ENABLE_CODE_COVERAGE "Enable code coverage" OFF)
option(ENABLE_BENCHMARKS "Enable benchmarks" OFF)
option(ENABLE_EXAMPLES "Enable examples" OFF)
option(ENABLE_DOC "Build documentation" ON)
option(ENABLE_CLIENT "Enable client application for parsing HawkTracer stream" ON)
option(ENABLE_PYTHON_BINDINGS "Enable Python bindings (requires ENABLE_CLIENT=ON)" OFF)
option(ENABLE_POSITION_INDEPENDENT_CODE "Enable position independent code of
the HawkTracer library. For most of the casses, it adds -fPIC flag to a compiler." OFF)
option(BUILD_STATIC_LIB "Build static hawktracer library" OFF)
option(ENABLE_MAINTAINER_MODE "Enables maintainer mode. Overrides some flags
(e.g. ENABLE_TESTS, ENABLE_CODE_COVERAGE, ENABLE_BENCHMARKS)")
option(ENABLE_RELEASE_MODE "Enables release mode. This flag should be used
to compile and release product.")
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# PLATFORM FEATURES
include(platform_features)
define_platform_feature(CPU_USAGE "cpu_usage.c" DEFAULT)
define_platform_feature(MEMORY_USAGE "memory_usage.c" DEFAULT)
define_platform_feature(ALLOC_HOOKS "alloc_hooks.c" OFF)
# VARIABLES
if(WIN32 AND NOT CYGWIN)
set(INSTALL_DOC_DIR doc)
else()
set(INSTALL_DOC_DIR ${CMAKE_INSTALL_DATAROOTDIR}/doc/hawktracer-${PROJECT_VERSION})
endif()
set (CMAKE_CXX_STANDARD 11)
set (CMAKE_C_STANDARD 99)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
if(ENABLE_MAINTAINER_MODE)
set(ENABLE_PYTHON_BINDINGS ON)
set(ENABLE_TESTS ON)
set(ENABLE_CODE_COVERAGE ON)
set(ENABLE_BENCHMARKS ON)
set(ENABLE_EXAMPLES ON)
endif(ENABLE_MAINTAINER_MODE)
if(ENABLE_RELEASE_MODE)
set(ENABLE_TESTS ON)
set(ENABLE_BENCHMARKS ON)
set(ENABLE_EXAMPLES ON)
set(ENABLE_PYTHON_BINDINGS ON)
endif(ENABLE_RELEASE_MODE)
include(warnings)
include(test_amalgamation)
if(ENABLE_ASAN)
include(asan)
endif(ENABLE_ASAN)
if(ENABLE_CODE_COVERAGE)
include(coverage)
endif(ENABLE_CODE_COVERAGE)
if(ENABLE_DOC)
include(documentation)
endif(ENABLE_DOC)
if(BUILD_STATIC_LIB)
set(HAWKTRACER_LIB_TYPE STATIC)
else ()
set(HAWKTRACER_LIB_TYPE SHARED)
endif(BUILD_STATIC_LIB)
add_subdirectory(lib)
if(ENABLE_CLIENT)
add_subdirectory(parser)
add_subdirectory(client_utils)
add_subdirectory(client)
endif(ENABLE_CLIENT)
add_subdirectory(bindings)
add_subdirectory(tools_integration)
if(ENABLE_TESTS)
enable_testing()
add_subdirectory(tests)
endif(ENABLE_TESTS)
if(ENABLE_EXAMPLES)
add_subdirectory(examples)
endif(ENABLE_EXAMPLES)
install(DIRECTORY examples DESTINATION ${INSTALL_DOC_DIR})
if(ENABLE_BENCHMARKS)
add_subdirectory(benchmarks)
endif(ENABLE_BENCHMARKS)
include(packager)