2019-01-16 13:21:49 +00:00
|
|
|
cmake_minimum_required(VERSION 3.8)
|
2018-01-18 20:57:21 +00:00
|
|
|
project(JSON_Benchmarks LANGUAGES CXX)
|
|
|
|
|
|
|
|
# set compiler flags
|
|
|
|
if((CMAKE_CXX_COMPILER_ID MATCHES GNU) OR (CMAKE_CXX_COMPILER_ID MATCHES Clang))
|
2018-03-27 16:51:30 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto -DNDEBUG -O3")
|
2018-01-18 20:57:21 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# configure Google Benchmarks
|
|
|
|
set(BENCHMARK_ENABLE_TESTING OFF CACHE INTERNAL "" FORCE)
|
|
|
|
add_subdirectory(thirdparty/benchmark)
|
|
|
|
|
|
|
|
# header directories
|
|
|
|
include_directories(thirdparty)
|
2018-02-01 21:26:26 +00:00
|
|
|
include_directories(${CMAKE_SOURCE_DIR}/../single_include)
|
2018-01-18 20:57:21 +00:00
|
|
|
|
2020-05-01 18:59:47 +00:00
|
|
|
# download test data
|
|
|
|
include(${CMAKE_SOURCE_DIR}/../cmake/download_test_data.cmake)
|
2018-01-18 20:57:21 +00:00
|
|
|
|
|
|
|
# benchmark binary
|
|
|
|
add_executable(json_benchmarks src/benchmarks.cpp)
|
2018-03-27 16:51:30 +00:00
|
|
|
target_compile_features(json_benchmarks PRIVATE cxx_std_11)
|
2018-01-18 20:57:21 +00:00
|
|
|
target_link_libraries(json_benchmarks benchmark ${CMAKE_THREAD_LIBS_INIT})
|
2020-05-01 18:59:47 +00:00
|
|
|
add_dependencies(json_benchmarks download_test_data)
|
|
|
|
target_include_directories(json_benchmarks PRIVATE ${CMAKE_BINARY_DIR}/include)
|