8ae4b86e08
新增: - include/vde/foundation/exact_predicates_gmp.h: GMP 精确谓词 - orient_2d/3d, in_circle 完全精确(mpq_class 有理数) - 零舍入误差,任意精度 - include/vde/foundation/predicates.h: 统一谓词接口 - Predicates<T> 编译期选择后端 - VDE_USE_GMP=ON → GMP, OFF → 自适应 double - 便捷函数: orient(), in_circle() - cmake/FindGMP.cmake: GMP 查找模块 - CMake: -DVDE_USE_GMP=ON 启用 GMP 精确模式 - AdaptiveDouble 包装器: 统一后端接口 使用: cmake -DVDE_USE_GMP=ON .. # 完全精确模式
46 lines
1.2 KiB
CMake
46 lines
1.2 KiB
CMake
cmake_minimum_required(VERSION 3.16)
|
|
project(ViewDesignEngine VERSION 0.5.0 LANGUAGES C CXX)
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
|
|
option(BUILD_TESTS "Build tests" ON)
|
|
option(BUILD_EXAMPLES "Build examples" ON)
|
|
option(ENABLE_SANITIZERS "Enable ASan" OFF)
|
|
option(VDE_USE_GMP "GMP exact arithmetic" OFF)
|
|
option(VDE_BUILD_PYTHON "Python bindings" OFF)
|
|
|
|
add_library(vde_compile_options INTERFACE)
|
|
include(cmake/CompilerSettings.cmake)
|
|
|
|
find_package(Eigen3 3.3 QUIET)
|
|
if(NOT Eigen3_FOUND)
|
|
include(FetchContent)
|
|
FetchContent_Declare(Eigen3
|
|
URL https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.tar.gz)
|
|
FetchContent_MakeAvailable(Eigen3)
|
|
endif()
|
|
|
|
add_subdirectory(src)
|
|
|
|
if(BUILD_TESTS)
|
|
enable_testing()
|
|
find_package(GTest QUIET)
|
|
if(NOT GTest_FOUND)
|
|
include(FetchContent)
|
|
FetchContent_Declare(googletest
|
|
URL https://github.com/google/googletest/archive/refs/tags/v1.14.0.tar.gz)
|
|
set(INSTALL_GTEST OFF CACHE BOOL "" FORCE)
|
|
FetchContent_MakeAvailable(googletest)
|
|
endif()
|
|
add_subdirectory(tests)
|
|
endif()
|
|
|
|
if(BUILD_EXAMPLES)
|
|
add_subdirectory(examples)
|
|
endif()
|
|
|
|
if(VDE_BUILD_PYTHON)
|
|
add_subdirectory(python)
|
|
endif()
|