@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.10)
22
33set (CODSPEED_VERSION 1.2.0)
44
5- project (codspeed VERSION ${CODSPEED_VERSION} LANGUAGES CXX )
5+ project (codspeed VERSION ${CODSPEED_VERSION} LANGUAGES CXX C )
66
77# Specify the C++ standard
88set (CMAKE_CXX_STANDARD 17)
@@ -11,22 +11,66 @@ set(CMAKE_CXX_STANDARD_REQUIRED True)
1111# Add the include directory
1212include_directories (include )
1313
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
1554add_library (
1655 codspeed
1756 src/codspeed.cpp
57+ src/measurement.cpp
1858 src/walltime.cpp
1959 src/uri.cpp
2060 src/workspace.cpp
2161)
2262
63+ # Link instrument_hooks to codspeed
64+ target_link_libraries (codspeed PRIVATE instrument_hooks )
65+
2366# Version
2467add_compile_definitions (CODSPEED_VERSION= "${CODSPEED_VERSION} " )
2568
2669# Specify the include directories for users of the library
2770target_include_directories (
2871 codspeed
2972 PUBLIC $<BUILD_INTERFACE :${PROJECT_SOURCE_DIR} /include >
73+ $<BUILD_INTERFACE :${PROJECT_SOURCE_DIR} /instrument -hooks /includes >
3074)
3175
3276# Disable valgrind compilation errors
@@ -116,7 +160,7 @@ install(
116160)
117161
118162install (
119- TARGETS codspeed
163+ TARGETS codspeed instrument_hooks
120164 EXPORT codspeed-targets
121165 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
122166 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
0 commit comments