Skip to content

Commit

Permalink
A bit of logging for unit testing
Browse files Browse the repository at this point in the history
  • Loading branch information
IonutCava committed May 15, 2024
1 parent 0859c52 commit 3a45a14
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,11 @@ if (DIVIDE_STARTUP_TYPE STREQUAL "IN_EDITOR")
endif()

if (BUILD_TESTING_INTERNAL)
message("Unit testing enabled!")
list(APPEND CMAKE_CTEST_ARGUMENTS "--output-on-failure")
enable_testing()
endif()

add_subdirectory(Source)

set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" PROPERTY VS_STARTUP_PROJECT Divide-Framework)
Expand Down
5 changes: 2 additions & 3 deletions Source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -175,17 +175,16 @@ if(BUILD_TESTING_INTERNAL)
add_dependencies(${APP_EXE_TEST_PLATFORM} ${APP_EXE_DIVIDE}BinGenerated)
target_precompile_headers(${APP_EXE_TEST_PLATFORM} REUSE_FROM ${APP_LIB_DIVIDE})
catch_discover_tests( ${APP_EXE_TEST_PLATFORM} WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" )
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
target_compile_options(${APP_EXE_TEST_PLATFORM} PRIVATE /wd4866 /wd4868)
endif()

add_executable( ${APP_EXE_TEST_ENGINE} "UnitTests/main.cpp" ${TEST_ENGINE_SOURCE})
target_link_libraries( ${APP_EXE_TEST_ENGINE} PRIVATE ${COMMON_LIBS} PRIVATE Catch2::Catch2 )
target_compile_definitions( ${APP_EXE_TEST_ENGINE} PRIVATE ENGINE_TESTS )
add_dependencies(${APP_EXE_TEST_ENGINE} ${APP_EXE_DIVIDE}BinGenerated)
target_precompile_headers(${APP_EXE_TEST_ENGINE} REUSE_FROM ${APP_LIB_DIVIDE})
catch_discover_tests( ${APP_EXE_TEST_ENGINE} WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" )

if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
target_compile_options(${APP_EXE_TEST_PLATFORM} PRIVATE /wd4866 /wd4868)
target_compile_options(${APP_EXE_TEST_ENGINE} PRIVATE /wd4866 /wd4868)
endif()
endif()
Expand Down

0 comments on commit 3a45a14

Please sign in to comment.