Files
yaze/cmake/dependencies/testing.cmake
scawful d07c0abae8 chore: enhance clangd and CI configurations for improved development experience
- Updated `.clangd` configuration to include additional include paths and feature flags tailored for ROM hacking workflows, optimizing IntelliSense support.
- Introduced `.pre-commit-config.yaml` for managing code quality checks and formatting, ensuring consistent code style across the project.
- Added `cmake-format.yaml` for CMake formatting configuration, promoting adherence to style guidelines.
- Enhanced CI workflows to include new actions for testing and building, improving overall reliability and efficiency in the development process.

Benefits:
- Streamlines development setup and improves code quality through automated checks.
- Facilitates better collaboration by ensuring consistent coding standards and configurations.
2025-10-31 20:19:22 -04:00

61 lines
1.5 KiB
CMake

# Testing dependencies (GTest, Benchmark)
# Uses CPM.cmake for consistent cross-platform builds
if(NOT YAZE_BUILD_TESTS)
return()
endif()
include(cmake/CPM.cmake)
include(cmake/dependencies.lock)
message(STATUS "Setting up testing dependencies with CPM.cmake")
# Google Test
CPMAddPackage(
NAME googletest
VERSION ${GTEST_VERSION}
GITHUB_REPOSITORY google/googletest
GIT_TAG v${GTEST_VERSION}
OPTIONS
"BUILD_GMOCK OFF"
"INSTALL_GTEST OFF"
"gtest_force_shared_crt ON"
)
# Verify GTest targets are available
if(NOT TARGET gtest)
message(FATAL_ERROR "GTest target not found after CPM fetch")
endif()
# Google Benchmark (optional, for performance tests)
if(YAZE_ENABLE_COVERAGE OR DEFINED ENV{YAZE_ENABLE_BENCHMARKS})
CPMAddPackage(
NAME benchmark
VERSION ${BENCHMARK_VERSION}
GITHUB_REPOSITORY google/benchmark
GIT_TAG v${BENCHMARK_VERSION}
OPTIONS
"BENCHMARK_ENABLE_TESTING OFF"
"BENCHMARK_ENABLE_INSTALL OFF"
)
if(NOT TARGET benchmark::benchmark)
message(FATAL_ERROR "Benchmark target not found after CPM fetch")
endif()
set(YAZE_BENCHMARK_TARGETS benchmark::benchmark PARENT_SCOPE)
endif()
# Create convenience targets for the rest of the project
add_library(yaze_testing INTERFACE)
target_link_libraries(yaze_testing INTERFACE gtest)
if(TARGET benchmark::benchmark)
target_link_libraries(yaze_testing INTERFACE benchmark::benchmark)
endif()
# Export testing targets for use in other CMake files
set(YAZE_TESTING_TARGETS yaze_testing)
message(STATUS "Testing dependencies setup complete")