mirror of
https://github.com/minetest/irrlicht.git
synced 2025-02-23 06:10:22 +01:00
Register Catch2 tests with CTest
This commit is contained in:
parent
030abc7b04
commit
246ee9c3ca
@ -33,6 +33,10 @@ if(NOT CMAKE_BUILD_TYPE)
|
|||||||
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type: Debug or Release" FORCE)
|
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type: Debug or Release" FORCE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
|
||||||
|
include(CTest)
|
||||||
|
endif()
|
||||||
|
|
||||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||||
enable_testing()
|
enable_testing()
|
||||||
|
|
||||||
|
14
README.md
14
README.md
@ -25,6 +25,7 @@ Aside from standard search options (`ZLIB_INCLUDE_DIR`, `ZLIB_LIBRARY`, ...) the
|
|||||||
* `ENABLE_GLES1` - Enable OpenGL ES driver, legacy
|
* `ENABLE_GLES1` - Enable OpenGL ES driver, legacy
|
||||||
* `ENABLE_GLES2` - Enable OpenGL ES 2+ driver
|
* `ENABLE_GLES2` - Enable OpenGL ES 2+ driver
|
||||||
* `USE_SDL2` (default: platform-dependent, usually `ON`) - Use SDL2 instead of older native device code
|
* `USE_SDL2` (default: platform-dependent, usually `ON`) - Use SDL2 instead of older native device code
|
||||||
|
* `BUILD_TESTING` (default: `ON`) - Build Catch2 tests
|
||||||
|
|
||||||
e.g. on a Linux system you might want to build for local use like this:
|
e.g. on a Linux system you might want to build for local use like this:
|
||||||
|
|
||||||
@ -50,6 +51,19 @@ Run the following script in PowerShell:
|
|||||||
cmake -B build -G "Visual Studio 17 2022" -A "Win64" -DCMAKE_TOOLCHAIN_FILE=[vcpkg-root]/scripts/buildsystems/vcpkg.cmake -DBUILD_SHARED_LIBS=OFF
|
cmake -B build -G "Visual Studio 17 2022" -A "Win64" -DCMAKE_TOOLCHAIN_FILE=[vcpkg-root]/scripts/buildsystems/vcpkg.cmake -DBUILD_SHARED_LIBS=OFF
|
||||||
cmake --build build --config Release
|
cmake --build build --config Release
|
||||||
|
|
||||||
|
Test
|
||||||
|
----
|
||||||
|
|
||||||
|
To run the Catch2 tests, the project must first be built with `BUILD_TESTING` enabled.
|
||||||
|
|
||||||
|
The tests can be run with ctest:
|
||||||
|
|
||||||
|
cd build
|
||||||
|
ctest
|
||||||
|
|
||||||
|
Run the tests directly for more detailed output:
|
||||||
|
build/bin/<sysname>/tests
|
||||||
|
|
||||||
Platforms
|
Platforms
|
||||||
---------
|
---------
|
||||||
|
|
||||||
|
@ -18,3 +18,9 @@ target_link_libraries(tests
|
|||||||
Catch2::Catch
|
Catch2::Catch
|
||||||
IrrlichtMt::IrrlichtMt
|
IrrlichtMt::IrrlichtMt
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_test(
|
||||||
|
NAME tests
|
||||||
|
COMMAND "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/tests"
|
||||||
|
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
|
||||||
|
)
|
||||||
|
@ -576,6 +576,10 @@ if(WIN32)
|
|||||||
set_target_properties(IrrlichtMt PROPERTIES PREFIX "") # for DLL name
|
set_target_properties(IrrlichtMt PROPERTIES PREFIX "") # for DLL name
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if((CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) AND BUILD_TESTING)
|
||||||
|
add_subdirectory(tests)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Installation of library
|
# Installation of library
|
||||||
install(TARGETS IrrlichtMt tinygltf
|
install(TARGETS IrrlichtMt tinygltf
|
||||||
EXPORT IrrlichtMt-export
|
EXPORT IrrlichtMt-export
|
||||||
|
Loading…
x
Reference in New Issue
Block a user