2026-03-22 16:18:51 +08:00
|
|
|
cmake_minimum_required(VERSION 3.15)
|
|
|
|
|
|
|
|
|
|
get_filename_component(PROJECT_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../.. ABSOLUTE)
|
|
|
|
|
|
|
|
|
|
find_package(GTest REQUIRED)
|
|
|
|
|
|
|
|
|
|
set(TEST_SOURCES
|
|
|
|
|
fixtures/RHITestFixture.cpp
|
|
|
|
|
test_device.cpp
|
|
|
|
|
test_buffer.cpp
|
|
|
|
|
test_texture.cpp
|
|
|
|
|
test_swap_chain.cpp
|
|
|
|
|
test_command_list.cpp
|
|
|
|
|
test_command_queue.cpp
|
|
|
|
|
test_shader.cpp
|
|
|
|
|
test_fence.cpp
|
|
|
|
|
test_sampler.cpp
|
2026-03-23 19:17:32 +08:00
|
|
|
${CMAKE_SOURCE_DIR}/tests/opengl/package/src/glad.c
|
2026-03-22 16:18:51 +08:00
|
|
|
)
|
|
|
|
|
|
2026-03-23 20:32:33 +08:00
|
|
|
add_executable(rhi_unit_tests ${TEST_SOURCES})
|
2026-03-22 16:18:51 +08:00
|
|
|
|
2026-03-23 20:32:33 +08:00
|
|
|
target_compile_definitions(rhi_unit_tests PRIVATE XCENGINE_SUPPORT_OPENGL)
|
2026-03-23 19:17:32 +08:00
|
|
|
|
2026-03-23 20:32:33 +08:00
|
|
|
target_link_libraries(rhi_unit_tests PRIVATE
|
2026-03-22 16:18:51 +08:00
|
|
|
d3d12
|
|
|
|
|
dxgi
|
|
|
|
|
d3dcompiler
|
|
|
|
|
opengl32
|
|
|
|
|
XCEngine
|
|
|
|
|
GTest::gtest
|
|
|
|
|
GTest::gtest_main
|
|
|
|
|
)
|
|
|
|
|
|
2026-03-23 20:32:33 +08:00
|
|
|
target_include_directories(rhi_unit_tests PRIVATE
|
2026-03-22 16:18:51 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/fixtures
|
|
|
|
|
${PROJECT_ROOT_DIR}/engine/include
|
|
|
|
|
${PROJECT_ROOT_DIR}/engine/src
|
refactor: improve test infrastructure and fix OpenGL GLAD initialization
- Rename D3D12Enum.h to D3D12Enums.h for naming consistency
- Fix OpenGL unit test GLAD initialization by using gladLoadGL()
instead of gladLoadGLLoader(wglGetProcAddress) for fallback support
- Migrate remaining tests to use gtest_discover_tests for granular
test discovery (math, core, containers, memory, threading, debug,
components, scene, resources, input, opengl)
- Remove obsolete TEST_RESOURCES_DIR and copy_directory commands
from OpenGL unit test CMakeLists (minimal/Res doesn't exist)
- Update TEST_SPEC.md with performance metrics and per-module
build/test commands for faster development workflow
- Update CMake path references to use lowercase paths
2026-03-23 00:43:02 +08:00
|
|
|
${CMAKE_SOURCE_DIR}/tests/opengl/package/include/
|
2026-03-22 16:18:51 +08:00
|
|
|
)
|
|
|
|
|
|
refactor: improve test infrastructure and fix OpenGL GLAD initialization
- Rename D3D12Enum.h to D3D12Enums.h for naming consistency
- Fix OpenGL unit test GLAD initialization by using gladLoadGL()
instead of gladLoadGLLoader(wglGetProcAddress) for fallback support
- Migrate remaining tests to use gtest_discover_tests for granular
test discovery (math, core, containers, memory, threading, debug,
components, scene, resources, input, opengl)
- Remove obsolete TEST_RESOURCES_DIR and copy_directory commands
from OpenGL unit test CMakeLists (minimal/Res doesn't exist)
- Update TEST_SPEC.md with performance metrics and per-module
build/test commands for faster development workflow
- Update CMake path references to use lowercase paths
2026-03-23 00:43:02 +08:00
|
|
|
include(GoogleTest)
|
2026-03-23 20:32:33 +08:00
|
|
|
gtest_discover_tests(rhi_unit_tests)
|