2019-01-16 21:21:49 +08:00
|
|
|
cmake_minimum_required(VERSION 3.8)
|
2018-01-19 04:57:21 +08: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-28 00:51:30 +08:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto -DNDEBUG -O3")
|
2018-01-19 04:57:21 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# configure Google Benchmarks
|
|
|
|
set(BENCHMARK_ENABLE_TESTING OFF CACHE INTERNAL "" FORCE)
|
|
|
|
add_subdirectory(thirdparty/benchmark)
|
|
|
|
|
|
|
|
# header directories
|
|
|
|
include_directories(thirdparty)
|
2018-02-02 05:26:26 +08:00
|
|
|
include_directories(${CMAKE_SOURCE_DIR}/../single_include)
|
2018-01-19 04:57:21 +08:00
|
|
|
|
|
|
|
# copy test files to build folder
|
|
|
|
file(COPY ${CMAKE_SOURCE_DIR}/data DESTINATION .)
|
|
|
|
file(COPY ${CMAKE_SOURCE_DIR}/../test/data/regression/floats.json
|
|
|
|
${CMAKE_SOURCE_DIR}/../test/data/regression/unsigned_ints.json
|
|
|
|
${CMAKE_SOURCE_DIR}/../test/data/regression/signed_ints.json
|
2019-01-01 23:45:58 +08:00
|
|
|
${CMAKE_SOURCE_DIR}/../test/data/regression/small_signed_ints.json
|
2018-01-19 04:57:21 +08:00
|
|
|
DESTINATION data/numbers)
|
|
|
|
|
|
|
|
# benchmark binary
|
|
|
|
add_executable(json_benchmarks src/benchmarks.cpp)
|
2018-03-28 00:51:30 +08:00
|
|
|
target_compile_features(json_benchmarks PRIVATE cxx_std_11)
|
2018-01-19 04:57:21 +08:00
|
|
|
target_link_libraries(json_benchmarks benchmark ${CMAKE_THREAD_LIBS_INIT})
|