Compare commits

...

3 Commits

Author SHA1 Message Date
bff3b163d1 Опечатка 2019-03-06 01:39:24 +03:00
57396140b2 QuadMath 2019-03-05 23:33:32 +03:00
5615f2f78b MPFR 2019-03-05 23:33:13 +03:00
2 changed files with 83 additions and 0 deletions

33
FindMPFR.cmake Normal file
View File

@@ -0,0 +1,33 @@
# Copyright (c) 2008-2010 Kent State University
# Copyright (c) 2011-2012 Texas A&M University
#
# This file is distributed under the MIT License. See the accompanying file
# LICENSE.txt or http://www.opensource.org/licenses/mit-license.php for terms
# and conditions.
# NOTE: MPFR prefix is understood to be the path to the root of the MPFR
# installation library.
set(MPFR_PREFIX "" CACHE PATH "The path to the previx of an MPFR installation")
find_path(MPFR_INCLUDE_DIR mpfr.h
PATHS ${MPFR_PREFIX}/include)
find_library(MPFR_LIBRARIES NAMES mpfr
PATHS ${MPFR_PREFIX}/lib)
if(MPFR_INCLUDE_DIR AND MPFR_LIBRARIES)
get_filename_component(MPFR_LIBRARY_DIR ${MPFR_LIBRARIES} PATH)
set(MPFR_FOUND TRUE)
endif()
if(MPFR_FOUND)
if(NOT MPFR_FIND_QUIETLY)
MESSAGE(STATUS "Found MPFR: ${MPFR_LIBRARIES}")
endif()
set(HAVE_MPFR 1)
elseif(MPFR_FOUND)
if(MPFR_FIND_REQUIRED)
message(FATAL_ERROR "Could not find MPFR")
endif()
endif()

50
FindQuadmath.cmake Normal file
View File

@@ -0,0 +1,50 @@
# Module that checks whether the compiler supports the
# quadruple precision floating point math
#
# Sets the following variables:
# QUADMATH_FOUND
# QUADMATH_LIBRARIES
#
# perform tests
include(CheckCSourceCompiles)
include(CheckCXXSourceCompiles)
include(CMakePushCheckState)
include(CheckCXXCompilerFlag)
if(NOT DEFINED USE_QUADMATH OR USE_QUADMATH)
if(NOT DEFINED HAVE_EXTENDED_NUMERIC_LITERALS)
check_cxx_compiler_flag("-Werror -fext-numeric-literals" HAVE_EXTENDED_NUMERIC_LITERALS)
endif()
if (HAVE_EXTENDED_NUMERIC_LITERALS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fext-numeric-literals")
endif()
cmake_push_check_state(RESET)
list(APPEND CMAKE_REQUIRED_LIBRARIES "quadmath")
CHECK_CXX_SOURCE_COMPILES("
#include <quadmath.h>
int main(void){
__float128 foo = sqrtq(123.456);
foo = FLT128_MIN;
}" QUADMATH_FOUND)
cmake_pop_check_state()
if (QUADMATH_FOUND)
set(QUADMATH_LIBRARIES "quadmath")
set(QUADMATH_FOUND "${QUADMATH_FOUND}")
set(HAVE_QUADMATH 1)
endif()
endif()
if (USE_QUADMATH AND NOT QUADMATH_FOUND)
message(FATAL_ERROR "Quadruple precision math support was explicitly requested but is unavailable!")
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Quadmath
DEFAULT_MSG
QUADMATH_LIBRARIES
QUADMATH_FOUND
)