Files
pokemon-battle-engine/benchmarks/CMakeLists.txt
cdemeyer-teachx ee337f001a codebase refactor
2025-08-15 12:38:44 +09:00

57 lines
1.5 KiB
CMake

# Benchmarks CMakeLists.txt
include(FetchContent)
# Download and configure Google Benchmark
FetchContent_Declare(
googlebenchmark
URL https://github.com/google/benchmark/archive/v1.8.3.zip
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
)
# Prevent overriding the parent project's compiler/linker settings
set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "Suppressing benchmark's tests" FORCE)
set(BENCHMARK_ENABLE_GTEST_TESTS OFF CACHE BOOL "Suppressing benchmark's gtest tests" FORCE)
# Suppress warnings in Google Benchmark build
set(BENCHMARK_ENABLE_WERROR OFF CACHE BOOL "Disable -Werror in benchmark build" FORCE)
# Make Google Benchmark available
FetchContent_MakeAvailable(googlebenchmark)
# Get the benchmark target and suppress warnings
if(TARGET benchmark)
target_compile_options(benchmark PRIVATE
-Wno-conversion
-Wno-sign-conversion
)
endif()
if(TARGET benchmark_main)
target_compile_options(benchmark_main PRIVATE
-Wno-conversion
-Wno-sign-conversion
)
endif()
# Create benchmark executable
add_executable(benchmarks
main.cpp
core/battle_simulation_bench.cpp
core/pokemon_creation_bench.cpp
)
# Link with Google Benchmark and our library
target_link_libraries(benchmarks
PRIVATE
benchmark::benchmark
benchmark::benchmark_main
PokEng::pokemon_battle_sim
)
# Include directories
target_include_directories(benchmarks
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/include
)