Функция для подключения вычислений с высокой точностью
This commit is contained in:
parent
7cb811e4d1
commit
7c22ac6b82
@ -30,6 +30,7 @@ include(CMLibLSBInfo)
|
|||||||
include(CMLibCompiler)
|
include(CMLibCompiler)
|
||||||
include(CMLibCompilerFlags)
|
include(CMLibCompilerFlags)
|
||||||
include(CMLibDistCC)
|
include(CMLibDistCC)
|
||||||
|
include(CMLibHighPrecisionMath)
|
||||||
include(CMLibGenerateCompilerFeaturesHPP)
|
include(CMLibGenerateCompilerFeaturesHPP)
|
||||||
include(CMLibFlagRemove)
|
include(CMLibFlagRemove)
|
||||||
include(CMLibCotire)
|
include(CMLibCotire)
|
||||||
|
40
CMLibHighPrecisionMath.cmake
Normal file
40
CMLibHighPrecisionMath.cmake
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
function(enable_high_precision_math)
|
||||||
|
set(options QUAD MPFR)
|
||||||
|
set(oneValueArgs)
|
||||||
|
set(multiValueArgs)
|
||||||
|
|
||||||
|
cmake_parse_arguments(_PKG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||||
|
|
||||||
|
if(MPFR AND QUAD)
|
||||||
|
message(FATAL_ERROR "Mutually exclusive options QUAD and MPFR")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(MPFR)
|
||||||
|
find_package(MPFR)
|
||||||
|
if(MPFR_FOUND)
|
||||||
|
find_package(MPFRCppThirdparty)
|
||||||
|
endif()
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(QUAD)
|
||||||
|
find_package(Quadmath)
|
||||||
|
if(QUADMATH_FOUND)
|
||||||
|
add_definitions(-DHAVE_QUADMATH=1)
|
||||||
|
endif()
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Default
|
||||||
|
find_package(Quadmath)
|
||||||
|
if(QUADMATH_FOUND)
|
||||||
|
add_definitions(-DHAVE_QUADMATH=1)
|
||||||
|
else()
|
||||||
|
find_package(MPFR)
|
||||||
|
if(MPFR_FOUND)
|
||||||
|
find_package(MPFRCppThirdparty)
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Nor Quadmath, nor MPFR found.")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endfunction()
|
Loading…
Reference in New Issue
Block a user