2017-03-06 11:39:27 +08:00
|
|
|
cmake_minimum_required(VERSION 3.2)
|
2017-02-28 13:07:37 +08:00
|
|
|
project(xlnt.benchmarks)
|
2016-10-26 08:21:58 +08:00
|
|
|
|
2017-03-06 11:39:27 +08:00
|
|
|
set(CMAKE_CXX_STANDARD 14)
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
|
2016-12-03 19:13:17 +08:00
|
|
|
if(NOT COMBINED_PROJECT)
|
2017-03-06 11:59:55 +08:00
|
|
|
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../source ${CMAKE_CURRENT_BINARY_DIR}/source)
|
2016-12-03 19:13:17 +08:00
|
|
|
endif()
|
2016-10-26 08:21:58 +08:00
|
|
|
|
2017-04-14 08:18:32 +08:00
|
|
|
set(XLNT_BENCHMARK_DATA_DIR ${CMAKE_CURRENT_SOURCE_DIR}/data)
|
2016-10-26 08:21:58 +08:00
|
|
|
|
2017-04-14 08:18:32 +08:00
|
|
|
file(GLOB BENCHMARK_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
2016-12-03 19:13:17 +08:00
|
|
|
|
2017-04-14 08:18:32 +08:00
|
|
|
foreach(BENCHMARK_SOURCE IN ITEMS ${BENCHMARK_SOURCES})
|
|
|
|
get_filename_component(BENCHMARK_NAME ${BENCHMARK_SOURCE} NAME_WE)
|
|
|
|
set(BENCHMARK_EXECUTABLE benchmark-${BENCHMARK_NAME})
|
|
|
|
|
|
|
|
add_executable(${BENCHMARK_EXECUTABLE} ${BENCHMARK_SOURCE})
|
|
|
|
|
|
|
|
target_link_libraries(${BENCHMARK_EXECUTABLE} PRIVATE xlnt)
|
|
|
|
target_include_directories(${BENCHMARK_EXECUTABLE}
|
|
|
|
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../tests)
|
|
|
|
target_compile_definitions(${BENCHMARK_EXECUTABLE} PRIVATE XLNT_BENCHMARK_DATA_DIR=${XLNT_BENCHMARK_DATA_DIR})
|
|
|
|
|
|
|
|
if(MSVC AND NOT STATIC)
|
|
|
|
add_custom_command(TARGET ${BENCHMARK_EXECUTABLE} POST_BUILD
|
2017-04-12 05:57:56 +08:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
|
|
|
$<TARGET_FILE:xlnt>
|
2017-04-14 08:18:32 +08:00
|
|
|
$<TARGET_FILE_DIR:${BENCHMARK_EXECUTABLE}>)
|
2017-04-12 05:57:56 +08:00
|
|
|
endif()
|
2016-12-03 19:13:17 +08:00
|
|
|
endforeach()
|