mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-03 07:39:41 +00:00
Add executable to run CS tests
This commit is contained in:
parent
59f2fccc9f
commit
6f6e452dfa
7 changed files with 77 additions and 26 deletions
|
@ -1117,6 +1117,7 @@ fi
|
|||
|
||||
if [ -n "${TEST_FRAMEWORK}" ]; then
|
||||
add_cmake_opts -DBUILD_UNITTESTS=ON
|
||||
add_cmake_opts -DBUILD_OPENCS_TESTS=ON
|
||||
fi
|
||||
|
||||
if [ -n "$ACTIVATE_MSVC" ]; then
|
||||
|
|
|
@ -54,13 +54,14 @@ option(BUILD_UNITTESTS "Enable Unittests with Google C++ Unittest" OFF)
|
|||
option(BUILD_BENCHMARKS "Build benchmarks with Google Benchmark" OFF)
|
||||
option(BUILD_NAVMESHTOOL "Build navmesh tool" ON)
|
||||
option(BUILD_BULLETOBJECTTOOL "Build Bullet object tool" ON)
|
||||
option(BUILD_OPENCS_TESTS "Build OpenMW Construction Set tests" OFF)
|
||||
|
||||
set(OpenGL_GL_PREFERENCE LEGACY) # Use LEGACY as we use GL2; GLNVD is for GL3 and up.
|
||||
|
||||
if (NOT BUILD_LAUNCHER AND NOT BUILD_OPENCS AND NOT BUILD_WIZARD)
|
||||
set(USE_QT FALSE)
|
||||
else()
|
||||
if (BUILD_LAUNCHER OR BUILD_OPENCS OR BUILD_WIZARD OR BUILD_OPENCS_TESTS)
|
||||
set(USE_QT TRUE)
|
||||
else()
|
||||
set(USE_QT FALSE)
|
||||
endif()
|
||||
|
||||
# If the user doesn't supply a CMAKE_BUILD_TYPE via command line, choose one for them.
|
||||
|
@ -294,6 +295,11 @@ if (OPENMW_USE_SYSTEM_YAML_CPP)
|
|||
find_package(yaml-cpp REQUIRED)
|
||||
endif()
|
||||
|
||||
if ((BUILD_UNITTESTS OR BUILD_OPENCS_TESTS) AND OPENMW_USE_SYSTEM_GOOGLETEST)
|
||||
find_package(GTest 1.10 REQUIRED)
|
||||
find_package(GMock 1.10 REQUIRED)
|
||||
endif()
|
||||
|
||||
add_subdirectory(extern)
|
||||
|
||||
# Sound setup
|
||||
|
@ -621,7 +627,7 @@ endif (CMAKE_CXX_COMPILER_ID STREQUAL GNU OR CMAKE_CXX_COMPILER_ID STREQUAL Clan
|
|||
add_subdirectory (extern/osg-ffmpeg-videoplayer)
|
||||
add_subdirectory (extern/oics)
|
||||
add_subdirectory (extern/Base64)
|
||||
if (BUILD_OPENCS AND Qt5_FOUND)
|
||||
if ((BUILD_OPENCS OR BUILD_OPENCS_TESTS) AND Qt5_FOUND)
|
||||
add_subdirectory (extern/osgQt)
|
||||
endif()
|
||||
|
||||
|
@ -657,7 +663,7 @@ if (BUILD_ESSIMPORTER)
|
|||
add_subdirectory (apps/essimporter )
|
||||
endif()
|
||||
|
||||
if (BUILD_OPENCS)
|
||||
if (BUILD_OPENCS OR BUILD_OPENCS_TESTS)
|
||||
add_subdirectory (apps/opencs)
|
||||
endif()
|
||||
|
||||
|
@ -686,6 +692,10 @@ if (BUILD_BULLETOBJECTTOOL)
|
|||
add_subdirectory( apps/bulletobjecttool )
|
||||
endif()
|
||||
|
||||
if (BUILD_OPENCS_TESTS)
|
||||
add_subdirectory(apps/opencs_tests)
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
if (MSVC)
|
||||
foreach( OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES} )
|
||||
|
|
|
@ -176,18 +176,25 @@ add_library(openmw-cs-lib
|
|||
|
||||
set_target_properties(openmw-cs-lib PROPERTIES OUTPUT_NAME openmw-cs)
|
||||
|
||||
openmw_add_executable(openmw-cs
|
||||
MACOSX_BUNDLE
|
||||
${OPENCS_MAC_ICON}
|
||||
${OPENCS_CFG}
|
||||
${OPENCS_DEFAULT_FILTERS_FILE}
|
||||
${OPENCS_OPENMW_CFG}
|
||||
main.cpp
|
||||
)
|
||||
if(BUILD_OPENCS)
|
||||
openmw_add_executable(openmw-cs
|
||||
MACOSX_BUNDLE
|
||||
${OPENCS_MAC_ICON}
|
||||
${OPENCS_CFG}
|
||||
${OPENCS_DEFAULT_FILTERS_FILE}
|
||||
${OPENCS_OPENMW_CFG}
|
||||
main.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(openmw-cs openmw-cs-lib)
|
||||
target_link_libraries(openmw-cs openmw-cs-lib)
|
||||
|
||||
if(APPLE)
|
||||
if (BUILD_WITH_CODE_COVERAGE)
|
||||
target_compile_options(openmw-cs-lib PRIVATE --coverage)
|
||||
target_link_libraries(openmw-cs-lib gcov)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(APPLE AND BUILD_OPENCS)
|
||||
set(OPENCS_BUNDLE_NAME "OpenMW-CS")
|
||||
set(OPENCS_BUNDLE_RESOURCES_DIR "${OpenMW_BINARY_DIR}/${OPENCS_BUNDLE_NAME}.app/Contents/Resources")
|
||||
|
||||
|
@ -218,7 +225,7 @@ if(APPLE)
|
|||
add_custom_command(TARGET openmw-cs
|
||||
POST_BUILD
|
||||
COMMAND cp "${OpenMW_BINARY_DIR}/resources/version" "${OPENCS_BUNDLE_RESOURCES_DIR}/resources")
|
||||
endif(APPLE)
|
||||
endif()
|
||||
|
||||
target_link_libraries(openmw-cs-lib
|
||||
# CMake's built-in OSG finder does not use pkgconfig, so we have to
|
||||
|
@ -240,6 +247,9 @@ target_link_libraries(openmw-cs-lib Qt::Widgets Qt::Core Qt::Network Qt::OpenGL)
|
|||
|
||||
if (WIN32)
|
||||
target_link_libraries(openmw-cs-lib ${Boost_LOCALE_LIBRARY})
|
||||
endif()
|
||||
|
||||
if (WIN32 AND BUILD_OPENCS)
|
||||
INSTALL(TARGETS openmw-cs RUNTIME DESTINATION ".")
|
||||
|
||||
get_generator_is_multi_config(multi_config)
|
||||
|
@ -259,8 +269,7 @@ if (MSVC)
|
|||
endif (CMAKE_CL_64)
|
||||
endif (MSVC)
|
||||
|
||||
|
||||
if(APPLE)
|
||||
if(APPLE AND BUILD_OPENCS)
|
||||
INSTALL(TARGETS openmw-cs BUNDLE DESTINATION "." COMPONENT Bundle)
|
||||
endif()
|
||||
|
||||
|
@ -271,8 +280,6 @@ endif(USE_QT)
|
|||
if (BUILD_WITH_CODE_COVERAGE)
|
||||
target_compile_options(openmw-cs-lib PRIVATE --coverage)
|
||||
target_link_libraries(openmw-cs-lib gcov)
|
||||
target_compile_options(openmw-cs PRIVATE --coverage)
|
||||
target_link_libraries(openmw-cs gcov)
|
||||
endif()
|
||||
|
||||
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
|
||||
|
|
31
apps/opencs_tests/CMakeLists.txt
Normal file
31
apps/opencs_tests/CMakeLists.txt
Normal file
|
@ -0,0 +1,31 @@
|
|||
file(GLOB OPENCS_TESTS_SRC_FILES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
source_group(apps\\openmw-cs-tests FILES ${OPENCS_TESTS_SRC_FILES})
|
||||
|
||||
openmw_add_executable(openmw-cs-tests ${OPENCS_TESTS_SRC_FILES})
|
||||
|
||||
target_include_directories(openmw-cs-tests SYSTEM PRIVATE ${GTEST_INCLUDE_DIRS})
|
||||
target_include_directories(openmw-cs-tests SYSTEM PRIVATE ${GMOCK_INCLUDE_DIRS})
|
||||
|
||||
target_link_libraries(openmw-cs-tests PRIVATE
|
||||
openmw-cs-lib
|
||||
GTest::GTest
|
||||
GMock::GMock
|
||||
)
|
||||
|
||||
if (UNIX AND NOT APPLE)
|
||||
target_link_libraries(openmw-cs-tests PRIVATE ${CMAKE_THREAD_LIBS_INIT})
|
||||
endif()
|
||||
|
||||
if (BUILD_WITH_CODE_COVERAGE)
|
||||
target_compile_options(openmw-cs-tests PRIVATE --coverage)
|
||||
target_link_libraries(openmw-cs-tests PRIVATE gcov)
|
||||
endif()
|
||||
|
||||
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
|
||||
target_precompile_headers(openmw-cs-tests PRIVATE
|
||||
<gtest/gtest.h>
|
||||
)
|
||||
endif()
|
7
apps/opencs_tests/main.cpp
Normal file
7
apps/opencs_tests/main.cpp
Normal file
|
@ -0,0 +1,7 @@
|
|||
#include <gtest/gtest.h>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
|
@ -1,8 +1,3 @@
|
|||
if (OPENMW_USE_SYSTEM_GOOGLETEST)
|
||||
find_package(GTest 1.10 REQUIRED)
|
||||
find_package(GMock 1.10 REQUIRED)
|
||||
endif()
|
||||
|
||||
include_directories(SYSTEM ${GTEST_INCLUDE_DIRS})
|
||||
include_directories(SYSTEM ${GMOCK_INCLUDE_DIRS})
|
||||
|
||||
|
|
2
extern/CMakeLists.txt
vendored
2
extern/CMakeLists.txt
vendored
|
@ -303,7 +303,7 @@ if (NOT OPENMW_USE_SYSTEM_ICU)
|
|||
set(ICU_LIBRARIES ICU::i18n ICU::uc ICU::data PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
if (BUILD_UNITTESTS AND NOT OPENMW_USE_SYSTEM_GOOGLETEST)
|
||||
if ((BUILD_UNITTESTS OR BUILD_OPENCS_TESTS) AND NOT OPENMW_USE_SYSTEM_GOOGLETEST)
|
||||
cmake_minimum_required(VERSION 3.11)
|
||||
|
||||
include(FetchContent)
|
||||
|
|
Loading…
Reference in a new issue