@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.10)
2
2
3
3
set (CODSPEED_VERSION 1.2.0)
4
4
5
- project (codspeed VERSION ${CODSPEED_VERSION} LANGUAGES CXX)
5
+ project (codspeed VERSION ${CODSPEED_VERSION} LANGUAGES CXX C )
6
6
7
7
# Specify the C++ standard
8
8
set (CMAKE_CXX_STANDARD 17)
@@ -11,22 +11,66 @@ set(CMAKE_CXX_STANDARD_REQUIRED True)
11
11
# Add the include directory
12
12
include_directories (include )
13
13
14
- # Add the library
14
+ # Add the instrument_hooks library
15
+ add_library (
16
+ instrument_hooks
17
+ STATIC
18
+ instrument-hooks/dist/core.c
19
+ )
20
+
21
+ target_include_directories (
22
+ instrument_hooks
23
+ PUBLIC
24
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /instrument-hooks/includes>
25
+ $<INSTALL_INTERFACE:includes>
26
+ )
27
+
28
+ # Suppress warnings for the instrument_hooks library
29
+ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang" )
30
+ target_compile_options (
31
+ instrument_hooks
32
+ PRIVATE
33
+ -Wno-maybe-uninitialized
34
+ -Wno-unused-variable
35
+ -Wno-unused-parameter
36
+ -Wno-unused-but-set-variable
37
+ -Wno-type -limits
38
+ )
39
+ elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" )
40
+ target_compile_options (
41
+ instrument_hooks
42
+ PRIVATE
43
+ /wd4101 # unreferenced local variable (equivalent to -Wno-unused-variable)
44
+ /wd4189 # local variable is initialized but not referenced (equivalent to -Wno-unused-but-set-variable)
45
+ /wd4100 # unreferenced formal parameter (equivalent to -Wno-unused-parameter)
46
+ /wd4245 # signed/unsigned mismatch
47
+ /wd4132 # const object should be initialized
48
+ /wd4146 # unary minus operator applied to unsigned type
49
+ )
50
+ endif ()
51
+
52
+
53
+ # Add the main library
15
54
add_library (
16
55
codspeed
17
56
src/codspeed.cpp
57
+ src/measurement .cpp
18
58
src/walltime.cpp
19
59
src/uri.cpp
20
60
src/workspace.cpp
21
61
)
22
62
63
+ # Link instrument_hooks to codspeed
64
+ target_link_libraries (codspeed PRIVATE instrument_hooks)
65
+
23
66
# Version
24
67
add_compile_definitions (CODSPEED_VERSION="${CODSPEED_VERSION} " )
25
68
26
69
# Specify the include directories for users of the library
27
70
target_include_directories (
28
71
codspeed
29
72
PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR} /include >
73
+ $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR} /instrument-hooks/includes>
30
74
)
31
75
32
76
# Disable valgrind compilation errors
@@ -116,7 +160,7 @@ install(
116
160
)
117
161
118
162
install (
119
- TARGETS codspeed
163
+ TARGETS codspeed instrument_hooks
120
164
EXPORT codspeed-targets
121
165
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
122
166
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
0 commit comments