@@ -15,7 +15,7 @@ include(FetchContent)
1515FetchContent_Declare (
1616 instrument_hooks_repo
1717 GIT_REPOSITORY https://github.com/CodSpeedHQ/instrument-hooks
18- GIT_TAG 4376be3e1e2d0e0c82d690bcb8e54bde98b7805c
18+ GIT_TAG ecdf31a3afd0fb879823e40df65129ec823d374b
1919)
2020FetchContent_MakeAvailable (instrument_hooks_repo)
2121FetchContent_GetProperties (instrument_hooks_repo)
@@ -25,17 +25,13 @@ endif()
2525set (instrument_hooks_SOURCE_DIR ${instrument_hooks_repo_SOURCE_DIR} )
2626
2727# Add the instrument_hooks library
28- add_library (
29- instrument_hooks
30- STATIC
31- ${instrument_hooks_SOURCE_DIR} /dist/core.c
32- )
28+ add_library (instrument_hooks STATIC ${instrument_hooks_SOURCE_DIR} /dist/core.c )
3329
3430target_include_directories (
3531 instrument_hooks
3632 PUBLIC
37- $<BUILD_INTERFACE :${instrument_hooks_SOURCE_DIR} /includes >
38- $<INSTALL_INTERFACE :includes >
33+ $<BUILD_INTERFACE :${instrument_hooks_SOURCE_DIR} /includes >
34+ $<INSTALL_INTERFACE :includes >
3935)
4036
4137# Option to enable strict warnings (for CI builds)
@@ -61,25 +57,20 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
6157 list (PREPEND INSTRUMENT_HOOKS_CFLAGS -Wall -Werror)
6258 endif ()
6359
64- target_compile_options (
65- instrument_hooks
66- PRIVATE
67- ${INSTRUMENT_HOOKS_CFLAGS}
68- )
60+ target_compile_options (instrument_hooks PRIVATE ${INSTRUMENT_HOOKS_CFLAGS} )
6961elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" )
7062 target_compile_options (
7163 instrument_hooks
7264 PRIVATE
73- /wd4101 # unreferenced local variable (equivalent to -Wno-unused-variable)
74- /wd4189 # local variable is initialized but not referenced (equivalent to -Wno-unused-but-set-variable)
75- /wd4100 # unreferenced formal parameter (equivalent to -Wno-unused-parameter)
76- /wd4245 # signed/unsigned mismatch
77- /wd4132 # const object should be initialized
78- /wd4146 # unary minus operator applied to unsigned type
65+ /wd4101 # unreferenced local variable (equivalent to -Wno-unused-variable)
66+ /wd4189 # local variable is initialized but not referenced (equivalent to -Wno-unused-but-set-variable)
67+ /wd4100 # unreferenced formal parameter (equivalent to -Wno-unused-parameter)
68+ /wd4245 # signed/unsigned mismatch
69+ /wd4132 # const object should be initialized
70+ /wd4146 # unary minus operator applied to unsigned type
7971 )
8072endif ()
8173
82-
8374# Add the main library
8475add_library (
8576 codspeed
@@ -99,24 +90,32 @@ add_compile_definitions(CODSPEED_VERSION="${CODSPEED_VERSION}")
9990# Collect compiler toolchain information for environment reporting
10091# Use the shared detect_toolchain.sh script (same as Bazel) for consistent output
10192execute_process (
102- COMMAND bash "${CMAKE_CURRENT_SOURCE_DIR} /scripts/detect_toolchain.sh"
103- "${CMAKE_CXX_COMPILER} " "${CMAKE_BUILD_TYPE} "
93+ COMMAND
94+ bash "${CMAKE_CURRENT_SOURCE_DIR} /scripts/detect_toolchain.sh"
95+ "${CMAKE_CXX_COMPILER} " "${CMAKE_BUILD_TYPE} "
10496 OUTPUT_VARIABLE CODSPEED_TOOLCHAIN_HEADER
10597 OUTPUT_STRIP_TRAILING_WHITESPACE
10698 RESULT_VARIABLE DETECT_TOOLCHAIN_RESULT
10799)
108100if (DETECT_TOOLCHAIN_RESULT EQUAL 0)
109- file (WRITE "${CMAKE_CURRENT_BINARY_DIR} /toolchain_info.h" "${CODSPEED_TOOLCHAIN_HEADER} \n " )
101+ file (
102+ WRITE "${CMAKE_CURRENT_BINARY_DIR} /toolchain_info.h"
103+ "${CODSPEED_TOOLCHAIN_HEADER} \n "
104+ )
110105else ()
111- message (WARNING "detect_toolchain.sh failed, toolchain info will not be available" )
106+ message (
107+ WARNING
108+ "detect_toolchain.sh failed, toolchain info will not be available"
109+ )
112110endif ()
113111target_include_directories (codspeed PRIVATE "${CMAKE_CURRENT_BINARY_DIR} " )
114112
115113# Specify the include directories for users of the library
116114target_include_directories (
117115 codspeed
118- PUBLIC $<BUILD_INTERFACE :${PROJECT_SOURCE_DIR} /include >
119- $<BUILD_INTERFACE :${instrument_hooks_SOURCE_DIR} /includes >
116+ PUBLIC
117+ $<BUILD_INTERFACE :${PROJECT_SOURCE_DIR} /include >
118+ $<BUILD_INTERFACE :${instrument_hooks_SOURCE_DIR} /includes >
120119)
121120
122121# Disable valgrind compilation errors
@@ -159,7 +158,13 @@ target_compile_definitions(
159158
160159message (STATUS "Using codspeed root directory: ${CODSPEED_ROOT_DIR} " )
161160
162- set (CODSPEED_MODE_ALLOWED_VALUES "off" "instrumentation" "simulation" "memory" "walltime" )
161+ set (CODSPEED_MODE_ALLOWED_VALUES
162+ "off"
163+ "instrumentation"
164+ "simulation"
165+ "memory"
166+ "walltime"
167+ )
163168set (CODSPEED_MODE "off" CACHE STRING "Build mode for Codspeed" )
164169set_property (
165170 CACHE CODSPEED_MODE
@@ -168,7 +173,10 @@ set_property(
168173
169174if (NOT CODSPEED_MODE STREQUAL "off" )
170175 target_compile_definitions (codspeed PUBLIC -DCODSPEED_ENABLED )
171- target_compile_definitions (codspeed PUBLIC -DCODSPEED_MODE_DISPLAY= "${CODSPEED_MODE} " )
176+ target_compile_definitions (
177+ codspeed
178+ PUBLIC -DCODSPEED_MODE_DISPLAY= "${CODSPEED_MODE} "
179+ )
172180
173181 if (NOT CMAKE_BUILD_TYPE )
174182 message (
@@ -183,11 +191,12 @@ if(NOT CODSPEED_MODE STREQUAL "off")
183191 endif ()
184192
185193 # Define a preprocessor macro based on the build mode
186- if (CODSPEED_MODE STREQUAL "instrumentation" OR CODSPEED_MODE STREQUAL "simulation" OR CODSPEED_MODE STREQUAL "memory" )
187- target_compile_definitions (
188- codspeed
189- PUBLIC -DCODSPEED_ANALYSIS
190- )
194+ if (
195+ CODSPEED_MODE STREQUAL "instrumentation"
196+ OR CODSPEED_MODE STREQUAL "simulation"
197+ OR CODSPEED_MODE STREQUAL "memory"
198+ )
199+ target_compile_definitions (codspeed PUBLIC -DCODSPEED_ANALYSIS )
191200 elseif (CODSPEED_MODE STREQUAL "walltime" )
192201 target_compile_definitions (codspeed PUBLIC -DCODSPEED_WALLTIME )
193202 else ()
0 commit comments