@@ -16,17 +16,26 @@ if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
1616 set (XTENSOR_INCLUDE_DIR ${xtensor_INCLUDE_DIRS} )
1717endif ()
1818
19- message (STATUS "Forcing tests build type to Release" )
20- set (CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE )
19+ if (CODSPEED_MODE AND NOT CODSPEED_MODE STREQUAL "off" )
20+ message (STATUS "CodSpeed mode enabled (${CODSPEED_MODE} ) - using RelWithDebInfo build type" )
21+ set (CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE )
22+ else ()
23+ message (STATUS "Forcing tests build type to Release" )
24+ set (CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE )
25+ endif ()
2126
2227include (CheckCXXCompilerFlag )
2328
2429string (TOUPPER "${CMAKE_BUILD_TYPE} " U_CMAKE_BUILD_TYPE)
2530
2631if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Intel" )
27- CHECK_CXX_COMPILER_FLAG (-march=native arch_native_supported )
28- if (arch_native_supported AND NOT CMAKE_CXX_FLAGS MATCHES "-march" )
29- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native" )
32+ # Skip -march=native for CodSpeed simulation mode (valgrind does not
33+ # support all native instruction sets)
34+ if (NOT (CODSPEED_MODE STREQUAL "simulation" ))
35+ CHECK_CXX_COMPILER_FLAG (-march=native arch_native_supported )
36+ if (arch_native_supported AND NOT CMAKE_CXX_FLAGS MATCHES "-march" )
37+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native" )
38+ endif ()
3039 endif ()
3140 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -g -Wunused-parameter -Wextra -Wreorder" )
3241
@@ -80,13 +89,14 @@ if(DOWNLOAD_GBENCHMARK OR GBENCHMARK_SRC_DIR)
8089 GIT_TAG main)
8190
8291 FetchContent_Declare (googlebenchmark
83- GIT_REPOSITORY https://github.com/google/benchmark.git
84- GIT_TAG main) # need main for benchmark::benchmark
92+ GIT_REPOSITORY https://github.com/CodSpeedHQ/codspeed-cpp.git
93+ GIT_TAG main
94+ SOURCE_SUBDIR google_benchmark)
8595
8696 FetchContent_MakeAvailable (
8797 googletest
8898 googlebenchmark)
89- set (GBENCHMARK_INCLUDE_DIRS "${googlebenchmark_SOURCE_DIR} /include" )
99+ set (GBENCHMARK_INCLUDE_DIRS "${googlebenchmark_SOURCE_DIR} /google_benchmark/ include" )
90100 set (GBENCHMARK_LIBRARIES benchmark)
91101else ()
92102 find_package (benchmark REQUIRED )
0 commit comments