2017-01-29 17:38:13 +02:00
|
|
|
cmake_minimum_required(VERSION 2.8.7)
|
|
|
|
project(test)
|
2013-04-22 17:49:28 +03:00
|
|
|
enable_testing()
|
2016-08-12 08:38:26 +02:00
|
|
|
include_directories(${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/include ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/test)
|
2017-07-02 00:53:50 +02:00
|
|
|
include_directories(${Boost_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR})
|
2017-07-04 13:29:50 +02:00
|
|
|
find_package(GTest REQUIRED)
|
|
|
|
include_directories(${GTEST_INCLUDE_DIRS})
|
2013-04-22 17:49:28 +03:00
|
|
|
|
|
|
|
set(test_SRCS
|
2017-07-04 13:29:50 +02:00
|
|
|
StdInc.cpp
|
|
|
|
main.cpp
|
|
|
|
CMemoryBufferTest.cpp
|
|
|
|
CVcmiTestConfig.cpp
|
|
|
|
|
|
|
|
battle/BattleHexTest.cpp
|
|
|
|
battle/CHealthTest.cpp
|
|
|
|
|
|
|
|
map/CMapEditManagerTest.cpp
|
|
|
|
map/CMapFormatTest.cpp
|
|
|
|
map/MapComparer.cpp
|
2017-06-29 01:03:37 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
set(test_HEADERS
|
2017-07-04 13:29:50 +02:00
|
|
|
StdInc.h
|
|
|
|
|
|
|
|
CVcmiTestConfig.h
|
|
|
|
map/MapComparer.h
|
2013-04-22 17:49:28 +03:00
|
|
|
)
|
|
|
|
|
2017-06-29 01:03:37 +02:00
|
|
|
add_executable(vcmitest ${test_SRCS} ${test_HEADERS})
|
2017-07-04 13:29:50 +02:00
|
|
|
target_link_libraries(vcmitest vcmi gtest ${RT_LIB} ${DL_LIB})
|
2013-04-22 17:49:28 +03:00
|
|
|
add_test(vcmitest vcmitest)
|
|
|
|
|
2017-07-04 22:46:49 +02:00
|
|
|
vcmi_set_output_dir(vcmitest "")
|
|
|
|
|
2014-02-05 23:25:36 +03:00
|
|
|
set_target_properties(vcmitest PROPERTIES ${PCH_PROPERTIES})
|
|
|
|
cotire(vcmitest)
|
2014-02-01 16:37:26 +03:00
|
|
|
|
2013-04-25 19:09:48 +03:00
|
|
|
# Files to copy to the build directory
|
|
|
|
add_custom_target(vcmitestFiles ALL)
|
2013-04-22 17:49:28 +03:00
|
|
|
set(vcmitest_FILES
|
2016-11-13 12:38:42 +02:00
|
|
|
testdata/TerrainViewTest.h3m
|
|
|
|
testdata/terrainViewMappings.json
|
|
|
|
testdata/ObjectPropertyTest/header.json
|
|
|
|
testdata/ObjectPropertyTest/objects.json
|
|
|
|
testdata/ObjectPropertyTest/surface_terrain.json
|
|
|
|
testdata/ObjectPropertyTest/underground_terrain.json
|
2013-04-22 17:49:28 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
foreach(file ${vcmitest_FILES})
|
2017-07-04 13:29:50 +02:00
|
|
|
add_custom_command(TARGET vcmitestFiles POST_BUILD
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/${file}" ${CMAKE_CURRENT_BINARY_DIR}
|
|
|
|
)
|
2013-04-22 17:49:28 +03:00
|
|
|
endforeach()
|