Files
XCEngine/tests/CMakeLists.txt

85 lines
2.4 KiB
CMake
Raw Normal View History

cmake_minimum_required(VERSION 3.15)
project(XCEngineTests)
2026-04-05 04:55:25 +08:00
set(CMAKE_CXX_STANDARD 20)
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
# ============================================================
2026-03-29 01:36:53 +08:00
add_subdirectory(Core)
add_subdirectory(Memory)
add_subdirectory(Threading)
add_subdirectory(Debug)
add_subdirectory(Components)
add_subdirectory(Scene)
add_subdirectory(Scripting)
add_subdirectory(Rendering)
2026-03-29 01:36:53 +08:00
add_subdirectory(RHI)
add_subdirectory(Resources)
add_subdirectory(Input)
add_subdirectory(Editor)
2026-04-05 19:05:53 +08:00
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/NewEditor")
add_subdirectory(NewEditor)
endif()
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:"
2026-04-05 04:55:25 +08:00
)