Skip to content
This repository was archived by the owner on Feb 17, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@ cm_deploy(TARGETS ${CMAKE_WORKSPACE_NAME}_${CURRENT_PROJECT_NAME}
INCLUDE ${CURRENT_SOURCES_DIR}/include
NAMESPACE ${CMAKE_WORKSPACE_NAME}::)

#add_subdirectory(test)
add_subdirectory(test)
6 changes: 5 additions & 1 deletion cmake/packages/FindGMP.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ endif()

find_library(GMP_LIBRARIES gmp PATHS $ENV{GMPDIR} ${LIB_INSTALL_DIR})

include(FindPackageHandleStandardArgs)
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(GMP DEFAULT_MSG
GMP_INCLUDES GMP_LIBRARIES GMP_VERSION_OK)
if (GMP_FOUND)
set(HAVE_GMP "${GMP_FOUND}")
endif()

mark_as_advanced(GMP_INCLUDES GMP_LIBRARIES)
66 changes: 66 additions & 0 deletions cmake/packages/FindMPC.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Try to find the MPC library
# See http://www.multiprecision.org/index.php?prog=mpc&page=home
#
# This module supports requiring a minimum version, e.g. you can do
# find_package(MPC 1.0.3)
# to require version 1.0.3 to newer of MPC.
#
# Once done this will define
#
# MPC_FOUND - system has MPC lib with correct version
# MPC_INCLUDES - the MPC include directory
# MPC_LIBRARIES - the MPC library
# MPC_VERSION - MPC version

find_path(MPC_INCLUDES NAMES mpc.h PATHS $ENV{GMPDIR} $ENV{MPFRDIR} $ENV{MPCDIR}
${INCLUDE_INSTALL_DIR})

# Set MPC_FIND_VERSION to 1.0.0 if no minimum version is specified
if(NOT MPC_FIND_VERSION)
if(NOT MPC_FIND_VERSION_MAJOR)
set(MPC_FIND_VERSION_MAJOR 1)
endif()
if(NOT MPC_FIND_VERSION_MINOR)
set(MPC_FIND_VERSION_MINOR 0)
endif()
if(NOT MPC_FIND_VERSION_PATCH)
set(MPC_FIND_VERSION_PATCH 0)
endif()
set(MPC_FIND_VERSION
"${MPC_FIND_VERSION_MAJOR}.${MPC_FIND_VERSION_MINOR}.${MPC_FIND_VERSION_PATCH}")
endif()

if(MPC_INCLUDES)
# Query MPC_VERSION
file(READ "${MPC_INCLUDES}/mpc.h" _mpc_version_header)

string(REGEX MATCH "define[ \t]+MPC_VERSION_MAJOR[ \t]+([0-9]+)"
_mpc_major_version_match "${_mpc_version_header}")
set(MPC_MAJOR_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define[ \t]+MPC_VERSION_MINOR[ \t]+([0-9]+)"
_mpc_minor_version_match "${_mpc_version_header}")
set(MPC_MINOR_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define[ \t]+MPC_VERSION_PATCHLEVEL[ \t]+([0-9]+)"
_mpc_patchlevel_version_match "${_mpc_version_header}")
set(MPC_PATCHLEVEL_VERSION "${CMAKE_MATCH_1}")

set(MPC_VERSION
${MPC_MAJOR_VERSION}.${MPC_MINOR_VERSION}.${MPC_PATCHLEVEL_VERSION})

# Check whether found version exceeds minimum required
if(${MPC_VERSION} VERSION_LESS ${MPC_FIND_VERSION})
set(MPC_VERSION_OK FALSE)
message(STATUS "MPC version ${MPC_VERSION} found in ${MPC_INCLUDES}, "
"but at least version ${MPC_FIND_VERSION} is required")
else()
set(MPC_VERSION_OK TRUE)
endif()
endif(MPC_INCLUDES)

find_library(MPC_LIBRARIES mpc
PATHS $ENV{GMPDIR} $ENV{MPFRDIR} $ENV{MPCDIR} ${LIB_INSTALL_DIR})

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MPC DEFAULT_MSG
MPC_INCLUDES MPC_LIBRARIES MPC_VERSION_OK)
mark_as_advanced(MPC_INCLUDES MPC_LIBRARIES)
87 changes: 87 additions & 0 deletions cmake/packages/FindMPFI.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
find_package( GMP QUIET )
find_package( MPFR QUIET )

if( GMP_FOUND AND MPFR_FOUND )

if( MPFI_INCLUDES AND MPFI_LIBRARIES )
set( MPFI_FOUND TRUE )
endif( MPFI_INCLUDES AND MPFI_LIBRARIES )

find_path(MPFI_INCLUDES NAMES mpfi.h
HINTS ENV MPFI_INC_DIR
ENV MPFI_DIR
PATHS ${GMP_INCLUDE_DIR_SEARCH}
PATH_SUFFIXES include
DOC "The directory containing the MPFI header files"
)
if(MPFI_INCLUDES)
file(READ "${MPFI_INCLUDES}/mpfi.h" _mpfr_version_header)

string(REGEX MATCH "define[ \t]+MPFI_VERSION_MAJOR[ \t]+([0-9]+)"
_mpfr_major_version_match "${_mpfr_version_header}")
set(MPFI_MAJOR_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define[ \t]+MPFI_VERSION_MINOR[ \t]+([0-9]+)"
_mpfr_minor_version_match "${_mpfr_version_header}")
set(MPFI_MINOR_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define[ \t]+MPFI_VERSION_PATCHLEVEL[ \t]+([0-9]+)"
_mpfr_patchlevel_version_match "${_mpfr_version_header}")
set(MPFI_PATCHLEVEL_VERSION "${CMAKE_MATCH_1}")

set(MPFI_VERSION
${MPFI_MAJOR_VERSION}.${MPFI_MINOR_VERSION}.${MPFI_PATCHLEVEL_VERSION})
endif()


find_library(MPFI_LIBRARIES NAMES mpfi
HINTS ENV MPFI_LIB_DIR
ENV MPFI_DIR
PATHS ${GMP_LIBRARIES_DIR_SEARCH}
PATH_SUFFIXES lib
DOC "Directory containing the MPFI library"
)

if( MPFI_LIBRARIES )
get_filename_component(MPFI_LIBRARIES_DIR ${MPFI_LIBRARIES} PATH CACHE )
endif( MPFI_LIBRARIES )

if( NOT MPFI_INCLUDES OR NOT MPFI_LIBRARIES_DIR )
include( MPFIConfig OPTIONAL )
endif( NOT MPFI_INCLUDES OR NOT MPFI_LIBRARIES_DIR )

include(FindPackageHandleStandardArgs)

find_package_handle_standard_args( MPFI
"DEFAULT_MSG"
MPFI_LIBRARIES
MPFI_INCLUDES )

else( GMP_FOUND AND MPFR_FOUND )

message( STATUS "MPFI needs GMP and MPFR" )

endif( GMP_FOUND AND MPFR_FOUND )

if( MPFI_FOUND )
if ("${MPFR_VERSION}" VERSION_LESS "4.0.0")
set(_MPFR_OLD TRUE)
endif()

if ("${MPFI_VERSION}" VERSION_LESS "1.5.2")
set(_MPFI_OLD TRUE)
endif()

if( ( _MPFR_OLD AND NOT _MPFI_OLD ) OR ( NOT _MPFR_OLD AND _MPFI_OLD ) )

message(
STATUS
"MPFI<1.5.2 requires MPFR<4.0.0; MPFI>=1.5.2 requires MPFR>=4.0.0" )

set( MPFI_FOUND FALSE )

else( ( _MPFR_OLD AND NOT _MPFI_OLD ) OR ( NOT _MPFR_OLD AND _MPFI_OLD ) )

set( MPFI_USE_FILE "CGAL_UseMPFI" )

endif( ( _MPFR_OLD AND NOT _MPFI_OLD ) OR ( NOT _MPFR_OLD AND _MPFI_OLD ) )

endif( MPFI_FOUND )
72 changes: 72 additions & 0 deletions cmake/packages/FindMPFR.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Try to find the MPFR library
# See http://www.mpfr.org/
#
# This module supports requiring a minimum version, e.g. you can do
# find_package(MPFR 2.3.0)
# to require version 2.3.0 to newer of MPFR.
#
# Once done this will define
#
# MPFR_FOUND - system has MPFR lib with correct version
# MPFR_INCLUDES - the MPFR include directory
# MPFR_LIBRARIES - the MPFR library
# MPFR_VERSION - MPFR version

# Copyright (c) 2006, 2007 Montel Laurent, <[email protected]>
# Copyright (c) 2008, 2009 Gael Guennebaud, <[email protected]>
# Copyright (c) 2010 Jitse Niesen, <[email protected]>
# Copyright (c) 2015 Jack Poulson, <[email protected]>
# Redistribution and use is allowed according to the terms of the BSD license.

find_path(MPFR_INCLUDES NAMES mpfr.h PATHS $ENV{GMPDIR} $ENV{MPFRDIR}
${INCLUDE_INSTALL_DIR})

# Set MPFR_FIND_VERSION to 1.0.0 if no minimum version is specified
if(NOT MPFR_FIND_VERSION)
if(NOT MPFR_FIND_VERSION_MAJOR)
set(MPFR_FIND_VERSION_MAJOR 1)
endif()
if(NOT MPFR_FIND_VERSION_MINOR)
set(MPFR_FIND_VERSION_MINOR 0)
endif()
if(NOT MPFR_FIND_VERSION_PATCH)
set(MPFR_FIND_VERSION_PATCH 0)
endif()
set(MPFR_FIND_VERSION
"${MPFR_FIND_VERSION_MAJOR}.${MPFR_FIND_VERSION_MINOR}.${MPFR_FIND_VERSION_PATCH}")
endif()

if(MPFR_INCLUDES)
# Query MPFR_VERSION
file(READ "${MPFR_INCLUDES}/mpfr.h" _mpfr_version_header)

string(REGEX MATCH "define[ \t]+MPFR_VERSION_MAJOR[ \t]+([0-9]+)"
_mpfr_major_version_match "${_mpfr_version_header}")
set(MPFR_MAJOR_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define[ \t]+MPFR_VERSION_MINOR[ \t]+([0-9]+)"
_mpfr_minor_version_match "${_mpfr_version_header}")
set(MPFR_MINOR_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define[ \t]+MPFR_VERSION_PATCHLEVEL[ \t]+([0-9]+)"
_mpfr_patchlevel_version_match "${_mpfr_version_header}")
set(MPFR_PATCHLEVEL_VERSION "${CMAKE_MATCH_1}")

set(MPFR_VERSION
${MPFR_MAJOR_VERSION}.${MPFR_MINOR_VERSION}.${MPFR_PATCHLEVEL_VERSION})

# Check whether found version exceeds minimum required
if(${MPFR_VERSION} VERSION_LESS ${MPFR_FIND_VERSION})
set(MPFR_VERSION_OK FALSE)
message(STATUS "MPFR version ${MPFR_VERSION} found in ${MPFR_INCLUDES}, "
"but at least version ${MPFR_FIND_VERSION} is required")
else()
set(MPFR_VERSION_OK TRUE)
endif()
endif()

find_library(MPFR_LIBRARIES mpfr
PATHS $ENV{GMPDIR} $ENV{MPFRDIR} ${LIB_INSTALL_DIR})

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MPFR DEFAULT_MSG
MPFR_INCLUDES MPFR_LIBRARIES MPFR_VERSION_OK)
mark_as_advanced(MPFR_INCLUDES MPFR_LIBRARIES)
Loading