2020-02-24 08:07:17 +03:00
|
|
|
find_package(Qt5 COMPONENTS Core Test Xml Network Qml Quick REQUIRED)
|
2017-12-14 17:10:33 +03:00
|
|
|
|
2018-10-12 15:52:18 +03:00
|
|
|
macro(nextcloud_add_test test_class additional_cpp)
|
2014-07-07 18:30:32 +04:00
|
|
|
set(CMAKE_AUTOMOC TRUE)
|
2016-03-30 18:58:15 +03:00
|
|
|
set(OWNCLOUD_TEST_CLASS ${test_class})
|
2012-10-26 22:24:12 +04:00
|
|
|
string(TOLOWER "${OWNCLOUD_TEST_CLASS}" OWNCLOUD_TEST_CLASS_LOWERCASE)
|
|
|
|
|
2014-07-07 18:30:32 +04:00
|
|
|
add_executable(${OWNCLOUD_TEST_CLASS}Test test${OWNCLOUD_TEST_CLASS_LOWERCASE}.cpp ${additional_cpp})
|
2017-02-07 21:31:55 +03:00
|
|
|
set_target_properties(${OWNCLOUD_TEST_CLASS}Test PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIRECTORY})
|
2012-10-26 22:24:12 +04:00
|
|
|
|
|
|
|
target_link_libraries(${OWNCLOUD_TEST_CLASS}Test
|
2013-08-23 12:16:54 +04:00
|
|
|
${APPLICATION_EXECUTABLE}sync
|
2020-02-24 08:07:17 +03:00
|
|
|
Qt5::Core Qt5::Test Qt5::Xml Qt5::Network Qt5::Qml Qt5::Quick
|
2012-10-26 22:24:12 +04:00
|
|
|
)
|
|
|
|
|
2020-03-11 00:10:45 +03:00
|
|
|
IF(BUILD_UPDATER)
|
|
|
|
target_link_libraries(${OWNCLOUD_TEST_CLASS}Test
|
|
|
|
updater
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2015-10-02 10:40:44 +03:00
|
|
|
add_definitions(-DOWNCLOUD_TEST)
|
2017-07-06 09:41:02 +03:00
|
|
|
add_definitions(-DOWNCLOUD_BIN_PATH="${CMAKE_BINARY_DIR}/bin")
|
2018-08-15 11:46:16 +03:00
|
|
|
add_test(NAME ${OWNCLOUD_TEST_CLASS}Test
|
|
|
|
COMMAND ${OWNCLOUD_TEST_CLASS}Test
|
|
|
|
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
|
|
|
|
|
|
|
|
target_include_directories(${OWNCLOUD_TEST_CLASS}Test PRIVATE "${CMAKE_SOURCE_DIR}/test/")
|
2013-08-09 14:56:43 +04:00
|
|
|
endmacro()
|
2017-01-16 19:13:52 +03:00
|
|
|
|
2018-10-12 15:52:18 +03:00
|
|
|
macro(nextcloud_add_benchmark test_class additional_cpp)
|
2017-01-16 19:13:52 +03:00
|
|
|
set(CMAKE_AUTOMOC TRUE)
|
|
|
|
set(OWNCLOUD_TEST_CLASS ${test_class})
|
|
|
|
string(TOLOWER "${OWNCLOUD_TEST_CLASS}" OWNCLOUD_TEST_CLASS_LOWERCASE)
|
|
|
|
|
|
|
|
add_executable(${OWNCLOUD_TEST_CLASS}Bench benchmarks/bench${OWNCLOUD_TEST_CLASS_LOWERCASE}.cpp ${additional_cpp})
|
2017-02-07 21:31:55 +03:00
|
|
|
set_target_properties(${OWNCLOUD_TEST_CLASS}Bench PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIRECTORY})
|
2017-01-16 19:13:52 +03:00
|
|
|
|
|
|
|
target_link_libraries(${OWNCLOUD_TEST_CLASS}Bench
|
|
|
|
${APPLICATION_EXECUTABLE}sync
|
2017-12-14 17:10:33 +03:00
|
|
|
Qt5::Core Qt5::Test Qt5::Xml Qt5::Network
|
2017-01-16 19:13:52 +03:00
|
|
|
)
|
|
|
|
|
2020-03-11 00:10:45 +03:00
|
|
|
IF(BUILD_UPDATER)
|
|
|
|
target_link_libraries(${OWNCLOUD_TEST_CLASS}Bench
|
|
|
|
updater
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2017-01-16 19:13:52 +03:00
|
|
|
add_definitions(-DOWNCLOUD_TEST)
|
2017-07-06 09:41:02 +03:00
|
|
|
add_definitions(-DOWNCLOUD_BIN_PATH="${CMAKE_BINARY_DIR}/bin")
|
2017-01-16 19:13:52 +03:00
|
|
|
endmacro()
|