2015-11-02 01:31:29 +08:00
|
|
|
project(xlnt.test)
|
|
|
|
|
|
|
|
include_directories(../include)
|
|
|
|
include_directories(../source)
|
2015-11-03 21:38:09 +08:00
|
|
|
include_directories(../tests)
|
2015-11-02 01:31:29 +08:00
|
|
|
include_directories(../third-party/cxxtest)
|
2015-11-03 21:38:09 +08:00
|
|
|
include_directories(../third-party/pugixml/src)
|
|
|
|
|
|
|
|
FILE(GLOB CELL_TESTS ../source/cell/tests/test_*.hpp)
|
|
|
|
FILE(GLOB CHARTS_TESTS ../source/charts/tests/test_*.hpp)
|
|
|
|
FILE(GLOB CHARTSHEET_TESTS ../source/chartsheet/tests/test_*.hpp)
|
|
|
|
FILE(GLOB DRAWING_TESTS ../source/drawing/tests/test_*.hpp)
|
|
|
|
FILE(GLOB FORMULA_TESTS ../source/formula/tests/test_*.hpp)
|
|
|
|
FILE(GLOB PACKAGING_TESTS ../source/packaging/tests/test_*.hpp)
|
|
|
|
FILE(GLOB SERIALIZATION_TESTS ../source/serialization/tests/test_*.hpp)
|
|
|
|
FILE(GLOB STYLES_TESTS ../source/styles/tests/test_*.hpp)
|
|
|
|
FILE(GLOB UTILS_TESTS ../source/utils/tests/test_*.hpp)
|
|
|
|
FILE(GLOB WORKBOOK_TESTS ../source/workbook/tests/test_*.hpp)
|
|
|
|
FILE(GLOB WORKSHEET_TESTS ../source/worksheet/tests/test_*.hpp)
|
|
|
|
|
|
|
|
SET(TESTS ${CELL_TESTS} ${CHARTS_TESTS} ${CHARTSHEET_TESTS} ${DRAWING_TESTS} ${FORMULA_TESTS} ${PACKAGING_TESTS} ${SERIALIZATION_TESTS} ${STYLES_TESTS} ${UTILS_TESTS} ${WORKBOOK_TESTS} ${WORKSHEET_TESTS})
|
2015-11-02 01:31:29 +08:00
|
|
|
|
2015-11-02 12:52:19 +08:00
|
|
|
FILE(GLOB TEST_HELPERS_HEADERS ../tests/helpers/*.hpp)
|
|
|
|
FILE(GLOB TEST_HELPERS_SOURCES ../tests/helpers/*.cpp)
|
|
|
|
|
2015-11-03 21:38:09 +08:00
|
|
|
SET(TEST_HELPERS ${TEST_HELPERS_HEADERS} ${TEST_HELPERS_SOURCES})
|
|
|
|
|
|
|
|
SET(RUNNER ../tests/runner-autogen.cpp)
|
|
|
|
|
|
|
|
add_executable(xlnt.test ${TEST_HELPERS} ${TESTS} ${RUNNER} )
|
2015-11-02 12:52:19 +08:00
|
|
|
|
2015-11-03 21:38:09 +08:00
|
|
|
source_group(helpers FILES ${TEST_HELPERS})
|
|
|
|
source_group(tests\\cell FILES ${CELL_TESTS})
|
|
|
|
source_group(tests\\charts FILES ${CHARTS_TESTS})
|
|
|
|
source_group(tests\\chartsheet FILES ${CHARTSHEET_TESTS})
|
|
|
|
source_group(tests\\drawing FILES ${DRAWING_TESTS})
|
|
|
|
source_group(tests\\formula FILES ${FORMULA_TESTS})
|
|
|
|
source_group(tests\\packaging FILES ${PACKAGING_TESTS})
|
|
|
|
source_group(tests\\serialization FILES ${SERIALIZATION_TESTS})
|
|
|
|
source_group(tests\\styles FILES ${STYLES_TESTS})
|
|
|
|
source_group(tests\\utils FILES ${UTILS_TESTS})
|
|
|
|
source_group(tests\\workbook FILES ${WORKBOOK_TESTS})
|
|
|
|
source_group(tests\\worksheet FILES ${WORKSHEET_TESTS})
|
|
|
|
source_group(runner FILES ${RUNNER})
|
2015-11-02 01:31:29 +08:00
|
|
|
|
|
|
|
target_link_libraries(xlnt.test xlnt)
|
|
|
|
|
2015-11-08 09:00:54 +08:00
|
|
|
if(MSVC)
|
2015-11-11 09:47:07 +08:00
|
|
|
set_target_properties(xlnt.test PROPERTIES COMPILE_FLAGS "/wd\"4251\" /wd\"4275\"")
|
2015-11-08 09:00:54 +08:00
|
|
|
endif()
|
|
|
|
|
2015-11-03 21:38:09 +08:00
|
|
|
# Needed for PathFileExists in path_helper (test helper)
|
2015-11-03 06:25:10 +08:00
|
|
|
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
|
|
|
|
target_link_libraries(xlnt.test Shlwapi)
|
|
|
|
endif()
|
|
|
|
|
2015-11-02 12:52:19 +08:00
|
|
|
add_custom_target (generate-test-runner
|
2015-11-03 03:22:13 +08:00
|
|
|
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/generate-tests
|
2015-11-03 21:38:09 +08:00
|
|
|
COMMENT "Generating test runner ${RUNNER}"
|
2015-11-02 01:31:29 +08:00
|
|
|
)
|
|
|
|
|
2015-11-02 12:52:19 +08:00
|
|
|
add_dependencies(xlnt.test generate-test-runner)
|
2015-11-02 01:31:29 +08:00
|
|
|
|
2015-11-04 12:02:43 +08:00
|
|
|
if(AUTORUN_TESTS)
|
|
|
|
add_custom_command(
|
|
|
|
TARGET xlnt.test
|
|
|
|
POST_BUILD
|
|
|
|
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/../bin/xlnt.test
|
|
|
|
VERBATIM
|
|
|
|
)
|
2015-11-03 06:25:10 +08:00
|
|
|
endif()
|