add GTest infrastructure and port first mathematical tests from Java
- Add Google Test via CMake FetchContent (v1.14.0) - Add clausen.hpp: Clausen integral, Lobachevsky function, Im(Li2) - Add hyper_ideal_utility.hpp: generalized and ideal-vertex hyperbolic tetrahedron volume formulas using Eigen for the 4x4 Gram determinant - Port ClausenTest (5 tests) and HyperIdealUtilityTest (8 tests) from Java/JUnit — all 13 pass with same tolerances as the Java originals - Fix pre-existing VIEWER/viewer case mismatch in CMakeLists.txt Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -22,14 +22,31 @@ endif()
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU")
|
||||
add_compile_options(-Wall -Wextra -Wpedantic)
|
||||
|
||||
# AddressSanitizer nur im Debug
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
# AddressSanitizer nur im Debug (nicht für Tests, da gtest_discover_tests
|
||||
# die Binary zur Buildzeit ausführt und ASan dabei hängt)
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug" AND NOT BUILD_TESTING)
|
||||
add_compile_options(-fsanitize=address -fno-omit-frame-pointer)
|
||||
add_link_options(-fsanitize=address)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
# ----- Testing (Google Test via FetchContent) -----
|
||||
include(FetchContent)
|
||||
include(CTest)
|
||||
enable_testing()
|
||||
|
||||
FetchContent_Declare(
|
||||
googletest
|
||||
GIT_REPOSITORY https://github.com/google/googletest.git
|
||||
GIT_TAG v1.14.0
|
||||
)
|
||||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
||||
set(INSTALL_GTEST OFF CACHE BOOL "" FORCE)
|
||||
set(BUILD_GMOCK OFF CACHE BOOL "" FORCE)
|
||||
FetchContent_MakeAvailable(googletest)
|
||||
# --------------------------------------------------
|
||||
|
||||
add_subdirectory(deps)
|
||||
add_subdirectory(deps/glfw-3.4)
|
||||
|
||||
@@ -38,7 +55,7 @@ add_library(glad STATIC ${CMAKE_CURRENT_SOURCE_DIR}/deps/libigl-glad/src/glad.c)
|
||||
target_include_directories(glad PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/deps/libigl-glad/include)
|
||||
# --------- VIEWER Lib (separat → nur bei src/viewer/* Änderung gebaut!) ---------
|
||||
add_library(viewer STATIC src/viewer/simple_viewer.cpp)
|
||||
target_include_directories(VIEWER PUBLIC
|
||||
target_include_directories(viewer PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/deps/libigl-2.6.0/include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/deps/libigl-glad/include
|
||||
@@ -52,7 +69,7 @@ target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/deps/eigen-3.4.0/
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/deps/CGAL-6.1.1/include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/deps/boost_1_90_0/
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/deps/libigl-2.6.0/include # Core libigl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/deps/libigl-2.6.0/include
|
||||
)
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
#-------- Compiler-Definitionen ---------
|
||||
@@ -61,5 +78,5 @@ target_link_libraries(${PROJECT_NAME} PRIVATE viewer)
|
||||
#--------- Output-Ordner ---------
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin)
|
||||
|
||||
|
||||
add_subdirectory(tests)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user