82 lines
2.3 KiB
CMake
82 lines
2.3 KiB
CMake
cmake_minimum_required(VERSION 3.15)
|
|
project(XCEngineTests)
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
# ============================================================
|
|
# Test Configuration
|
|
# ============================================================
|
|
|
|
option(ENABLE_COVERAGE "Enable code coverage" OFF)
|
|
option(ENABLE_BENCHMARK "Enable benchmark tests" OFF)
|
|
|
|
# ============================================================
|
|
# Dependencies
|
|
# ============================================================
|
|
|
|
include(FetchContent)
|
|
FetchContent_Declare(
|
|
googletest
|
|
GIT_REPOSITORY https://gitee.com/mirrors/googletest.git
|
|
GIT_TAG v1.14.0
|
|
)
|
|
|
|
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
|
FetchContent_MakeAvailable(googletest)
|
|
|
|
enable_testing()
|
|
|
|
# ============================================================
|
|
# Test Subdirectories
|
|
# ============================================================
|
|
|
|
add_subdirectory(Core)
|
|
add_subdirectory(Memory)
|
|
add_subdirectory(Threading)
|
|
add_subdirectory(Debug)
|
|
add_subdirectory(Components)
|
|
add_subdirectory(Scene)
|
|
add_subdirectory(Scripting)
|
|
add_subdirectory(Rendering)
|
|
add_subdirectory(RHI)
|
|
add_subdirectory(Resources)
|
|
add_subdirectory(Input)
|
|
add_subdirectory(Editor)
|
|
|
|
if(WIN32)
|
|
find_program(XCENGINE_POWERSHELL_EXECUTABLE NAMES powershell pwsh REQUIRED)
|
|
|
|
add_custom_target(rendering_phase_regression_build
|
|
DEPENDS
|
|
rendering_all_tests
|
|
editor_tests
|
|
XCEditor
|
|
)
|
|
|
|
add_custom_target(rendering_phase_regression
|
|
DEPENDS
|
|
rendering_phase_regression_build
|
|
COMMAND "${XCENGINE_POWERSHELL_EXECUTABLE}"
|
|
-NoProfile
|
|
-ExecutionPolicy Bypass
|
|
-File "${CMAKE_SOURCE_DIR}/scripts/Run-RendererPhaseRegression.ps1"
|
|
-RepoRoot "${CMAKE_SOURCE_DIR}"
|
|
-BuildDir "${CMAKE_BINARY_DIR}"
|
|
-Config $<CONFIG>
|
|
-SkipBuild
|
|
USES_TERMINAL
|
|
COMMENT "Run renderer phase regression suite"
|
|
)
|
|
endif()
|
|
|
|
# ============================================================
|
|
# Test Summary
|
|
# ============================================================
|
|
|
|
add_custom_target(print_tests
|
|
COMMAND ${CMAKE_COMMAND} -E echo "===== XCEngine Test Suite ====="
|
|
COMMAND ${CMAKE_CTEST_COMMAND} -N
|
|
COMMENT "Available tests:"
|
|
)
|