geopro/tests/CMakeLists.txt

32 lines
1.2 KiB
CMake
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 单元测试(设计 §12。M1 spike 阶段先放一个 gtest 冒烟用例,
# 验证 gtest 经 vcpkg 接入、ctest 可跑;随 core/data/algo 实现补充真实用例。
find_package(GTest CONFIG REQUIRED)
add_executable(geopro_tests smoke_test.cpp)
target_link_libraries(geopro_tests PRIVATE GTest::gtest GTest::gtest_main)
include(GoogleTest)
# PROJ 运行时需要数据目录proj.db 等。vcpkg 把数据装在 share/proj 下。
# 通过测试环境变量 PROJ_DATA 注入,使 `ctest -R CrsTransform` 无需调用方手动 set。
file(GLOB _proj_data_dirs
"${CMAKE_BINARY_DIR}/vcpkg_installed/*/share/proj"
)
if(_proj_data_dirs)
list(GET _proj_data_dirs 0 GEOPRO_PROJ_DATA)
gtest_discover_tests(geopro_tests
PROPERTIES ENVIRONMENT "PROJ_DATA=${GEOPRO_PROJ_DATA}")
else()
gtest_discover_tests(geopro_tests)
endif()
target_sources(geopro_tests PRIVATE core/test_local_frame.cpp)
target_sources(geopro_tests PRIVATE core/test_model.cpp)
target_sources(geopro_tests PRIVATE core/test_color_scale.cpp)
target_sources(geopro_tests PRIVATE core/test_idw.cpp)
target_sources(geopro_tests PRIVATE core/test_crs_transform.cpp)
target_link_libraries(geopro_tests PRIVATE geopro_core)
add_subdirectory(spike) # spike S3: banded contour 渲染验证