|
|
|
|
@ -26,6 +26,7 @@ option(USE_SDL1 "Use SDL1.2 instead of SDL2" OFF)
|
|
|
|
|
option(NONET "Disable network support" OFF) |
|
|
|
|
option(NOSOUND "Disable sound support" OFF) |
|
|
|
|
option(RUN_TESTS "Build and run tests" OFF) |
|
|
|
|
option(ENABLE_CODECOVERAGE "Instrument code for code coverage (only enabled with RUN_TESTS)" OFF) |
|
|
|
|
option(USE_GETTEXT "Build translation files using gettext" OFF) |
|
|
|
|
|
|
|
|
|
option(DISABLE_STREAMING_MUSIC "Disable streaming music (to work around broken platform implementations)" OFF) |
|
|
|
|
@ -542,11 +543,20 @@ if(RUN_TESTS)
|
|
|
|
|
include(GoogleTest) |
|
|
|
|
find_package(GTest REQUIRED) |
|
|
|
|
target_include_directories(devilutionx-tests PRIVATE ${GTEST_INCLUDE_DIRS}) |
|
|
|
|
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC") |
|
|
|
|
target_compile_options(devilutionx-tests PRIVATE -fprofile-arcs -ftest-coverage) |
|
|
|
|
target_link_libraries(devilutionx-tests PRIVATE libdevilutionx) |
|
|
|
|
target_link_libraries(devilutionx-tests PRIVATE ${GTEST_LIBRARIES}) |
|
|
|
|
if(ENABLE_CODECOVERAGE) |
|
|
|
|
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") |
|
|
|
|
message(WARNING "Codecoverage not supported with MSVC") |
|
|
|
|
else() |
|
|
|
|
target_compile_options(devilutionx-tests PRIVATE -fprofile-arcs -ftest-coverage) |
|
|
|
|
target_compile_options(libdevilutionx PRIVATE -fprofile-arcs -ftest-coverage) |
|
|
|
|
target_compile_options(${BIN_TARGET} PRIVATE -fprofile-arcs -ftest-coverage) |
|
|
|
|
target_link_options(devilutionx-tests PRIVATE -fprofile-arcs) |
|
|
|
|
target_link_options(libdevilutionx PRIVATE -fprofile-arcs) |
|
|
|
|
target_link_options(${BIN_TARGET} PRIVATE -fprofile-arcs) |
|
|
|
|
endif() |
|
|
|
|
endif() |
|
|
|
|
target_link_libraries(devilutionx-tests PRIVATE -fprofile-arcs libdevilutionx) |
|
|
|
|
target_link_libraries(devilutionx-tests PRIVATE -fprofile-arcs ${GTEST_LIBRARIES}) |
|
|
|
|
gtest_add_tests(devilutionx-tests "" AUTO) |
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|