• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1cmake_minimum_required(VERSION 3.8)
2project(JSON_Benchmarks LANGUAGES CXX)
3
4# set compiler flags
5if((CMAKE_CXX_COMPILER_ID MATCHES GNU) OR (CMAKE_CXX_COMPILER_ID MATCHES Clang))
6   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto -DNDEBUG -O3")
7endif()
8
9# configure Google Benchmarks
10set(BENCHMARK_ENABLE_TESTING OFF CACHE INTERNAL "" FORCE)
11add_subdirectory(thirdparty/benchmark)
12
13# header directories
14include_directories(thirdparty)
15include_directories(${CMAKE_SOURCE_DIR}/../single_include)
16
17# copy test files to build folder
18file(COPY ${CMAKE_SOURCE_DIR}/data DESTINATION .)
19file(COPY ${CMAKE_SOURCE_DIR}/../test/data/regression/floats.json
20          ${CMAKE_SOURCE_DIR}/../test/data/regression/unsigned_ints.json
21          ${CMAKE_SOURCE_DIR}/../test/data/regression/signed_ints.json
22          ${CMAKE_SOURCE_DIR}/../test/data/regression/small_signed_ints.json
23    DESTINATION data/numbers)
24
25# benchmark binary
26add_executable(json_benchmarks src/benchmarks.cpp)
27target_compile_features(json_benchmarks PRIVATE cxx_std_11)
28target_link_libraries(json_benchmarks benchmark ${CMAKE_THREAD_LIBS_INIT})
29