2026-03-20 17:37:09 +08:00
|
|
|
cmake_minimum_required(VERSION 3.15)
|
|
|
|
|
|
|
|
|
|
get_filename_component(PROJECT_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../.. ABSOLUTE)
|
|
|
|
|
|
|
|
|
|
find_package(OpenGL REQUIRED)
|
|
|
|
|
|
2026-03-29 01:36:53 +08:00
|
|
|
include_directories(${CMAKE_SOURCE_DIR}/mvs/OpenGL/package/include/)
|
2026-03-20 17:37:09 +08:00
|
|
|
include_directories(${PROJECT_ROOT_DIR}/engine/include)
|
|
|
|
|
include_directories(${PROJECT_ROOT_DIR}/engine/src)
|
|
|
|
|
|
|
|
|
|
find_package(GTest REQUIRED)
|
|
|
|
|
|
|
|
|
|
set(TEST_SOURCES
|
2026-03-29 01:36:53 +08:00
|
|
|
${CMAKE_SOURCE_DIR}/mvs/OpenGL/package/src/glad.c
|
2026-03-20 17:37:09 +08:00
|
|
|
fixtures/OpenGLTestFixture.cpp
|
|
|
|
|
test_device.cpp
|
|
|
|
|
test_buffer.cpp
|
|
|
|
|
test_fence.cpp
|
|
|
|
|
test_texture.cpp
|
|
|
|
|
test_shader.cpp
|
|
|
|
|
test_pipeline_state.cpp
|
|
|
|
|
test_vertex_array.cpp
|
|
|
|
|
test_command_list.cpp
|
|
|
|
|
test_render_target_view.cpp
|
|
|
|
|
test_depth_stencil_view.cpp
|
|
|
|
|
test_swap_chain.cpp
|
|
|
|
|
test_sampler.cpp
|
2026-03-27 21:26:32 +08:00
|
|
|
test_backend_specific.cpp
|
2026-03-20 17:37:09 +08:00
|
|
|
)
|
|
|
|
|
|
2026-03-23 18:53:29 +08:00
|
|
|
add_executable(rhi_opengl_tests ${TEST_SOURCES})
|
2026-03-20 17:37:09 +08:00
|
|
|
|
2026-03-23 18:53:29 +08:00
|
|
|
target_link_libraries(rhi_opengl_tests PRIVATE
|
2026-03-20 17:37:09 +08:00
|
|
|
opengl32
|
|
|
|
|
XCEngine
|
|
|
|
|
GTest::gtest
|
|
|
|
|
GTest::gtest_main
|
|
|
|
|
)
|
|
|
|
|
|
2026-03-23 18:53:29 +08:00
|
|
|
target_include_directories(rhi_opengl_tests PRIVATE
|
2026-03-20 17:37:09 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/fixtures
|
|
|
|
|
${PROJECT_ROOT_DIR}/engine/include
|
|
|
|
|
${PROJECT_ROOT_DIR}/engine/src
|
|
|
|
|
)
|
|
|
|
|
|
2026-04-09 02:59:36 +08:00
|
|
|
if(MSVC)
|
|
|
|
|
target_compile_options(rhi_opengl_tests PRIVATE /FS)
|
|
|
|
|
endif()
|
|
|
|
|
|
2026-03-20 17:37:09 +08:00
|
|
|
enable_testing()
|
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-27 21:26:32 +08:00
|
|
|
gtest_discover_tests(rhi_opengl_tests)
|