Introduce benchmark support using Google Benchmark

This commit is contained in:
2023-12-11 11:33:11 +01:00
parent ed2a675145
commit a89f4a3065
5 changed files with 237 additions and 0 deletions

View File

@@ -90,6 +90,7 @@ set(DRAMSYS_EXTENSIONS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/extensions")
### Build options ###
option(DRAMSYS_BUILD_TESTS "Build DRAMSys unit tests" OFF)
option(DRAMSYS_BUILD_BENCHMARKS "Build DRAMSys benchmarks" OFF)
option(DRAMSYS_VERBOSE_CMAKE_OUTPUT "Show detailed CMake output" OFF)
option(DRAMSYS_BUILD_CLI "Build DRAMSys Command Line Tool" ON)
option(DRAMSYS_WITH_DRAMPOWER "Build with DRAMPower support enabled." OFF)
@@ -125,6 +126,18 @@ if(DRAMSYS_BUILD_TESTS)
set_target_properties(gtest_main PROPERTIES FOLDER lib/gtest)
endif()
### GoogleBenchmark ###
if(DRAMSYS_BUILD_BENCHMARKS)
set(BENCHMARK_ENABLE_TESTING OFF)
FetchContent_Declare(
benchmark
URL https://github.com/google/benchmark/archive/refs/tags/v1.8.3.zip
)
FetchContent_MakeAvailable(benchmark)
endif()
### SystemC ###
if (DRAMSYS_USE_EXTERNAL_SYSTEMC)
list(APPEND CMAKE_PREFIX_PATH $ENV{SYSTEMC_HOME} /opt/systemc)
@@ -179,3 +192,11 @@ if(DRAMSYS_BUILD_TESTS)
include(CTest)
add_subdirectory(tests)
endif()
###############################################
### Benchmark Directory ###
###############################################
if(DRAMSYS_BUILD_BENCHMARKS)
add_subdirectory(benches)
endif()