diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt index 393e303f..8aae30fe 100644 --- a/benchmarks/CMakeLists.txt +++ b/benchmarks/CMakeLists.txt @@ -1,7 +1,29 @@ -project(xlnt.benchmarks) +cmake_minimum_required(VERSION 3.1) +include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/common.cmake) +project(${LIBRARY_NAME}.benchmarks VERSION ${LIBRARY_VERSION} LANGUAGES CXX) -include_directories(${XLNT_INCLUDE_DIR}) +if(NOT COMBINED_PROJECT) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../source ${CMAKE_CURRENT_BINARY_DIR}/source) +endif() -#add_executable(sample-basic ../samples/sample1.cpp) -#add_executable(sample-decrypt ../samples/decrypt.cpp) +include_directories(${LIBRARY_INCLUDE_DIR}) +file(GLOB SAMPLE_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) + +if(NOT MSVC) + set(THREADS_PREFER_PTHREAD_FLAG ON) + find_package(Threads REQUIRED) +endif() + +foreach(SAMPLE_SOURCE IN ITEMS ${SAMPLE_SOURCES}) + get_filename_component(SAMPLE_NAME ${SAMPLE_SOURCE} NAME_WE) + set(SAMPLE_EXECUTABLE benchmark-${SAMPLE_NAME}) + add_executable(${SAMPLE_EXECUTABLE} ${SAMPLE_SOURCE}) + target_link_libraries(${SAMPLE_EXECUTABLE} ${LIBRARY_NAME}) + if(NOT MSVC) + target_link_libraries(${SAMPLE_EXECUTABLE} Threads::Threads) + endif() +endforeach() + +file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/data + DESTINATION ${CMAKE_BINARY_DIR}/bin) diff --git a/benchmarks/files/large.xlsx b/benchmarks/data/large.xlsx similarity index 100% rename from benchmarks/files/large.xlsx rename to benchmarks/data/large.xlsx diff --git a/benchmarks/files/very_large.xlsx b/benchmarks/data/very_large.xlsx similarity index 100% rename from benchmarks/files/very_large.xlsx rename to benchmarks/data/very_large.xlsx