diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a329165f..49a5c37eb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/cmake/packages/FindGMP.cmake b/cmake/packages/FindGMP.cmake index 6315da43a..4d6fd7a6c 100644 --- a/cmake/packages/FindGMP.cmake +++ b/cmake/packages/FindGMP.cmake @@ -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) \ No newline at end of file diff --git a/cmake/packages/FindMPC.cmake b/cmake/packages/FindMPC.cmake new file mode 100644 index 000000000..362fa9596 --- /dev/null +++ b/cmake/packages/FindMPC.cmake @@ -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) diff --git a/cmake/packages/FindMPFI.cmake b/cmake/packages/FindMPFI.cmake new file mode 100644 index 000000000..b97161971 --- /dev/null +++ b/cmake/packages/FindMPFI.cmake @@ -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 ) diff --git a/cmake/packages/FindMPFR.cmake b/cmake/packages/FindMPFR.cmake new file mode 100644 index 000000000..83e5bec51 --- /dev/null +++ b/cmake/packages/FindMPFR.cmake @@ -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, +# Copyright (c) 2008, 2009 Gael Guennebaud, +# Copyright (c) 2010 Jitse Niesen, +# Copyright (c) 2015 Jack Poulson, +# 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) \ No newline at end of file diff --git a/cmake/packages/FindPackageHandleStandardArgs.cmake b/cmake/packages/FindPackageHandleStandardArgs.cmake new file mode 100644 index 000000000..00b3c02a8 --- /dev/null +++ b/cmake/packages/FindPackageHandleStandardArgs.cmake @@ -0,0 +1,260 @@ +# FIND_PACKAGE_HANDLE_STANDARD_ARGS( ... ) +# +# This function is intended to be used in FindXXX.cmake modules files. +# It handles the REQUIRED, QUIET and version-related arguments to FIND_PACKAGE(). +# It also sets the _FOUND variable. +# The package is considered found if all variables ... listed contain +# valid results, e.g. valid filepaths. +# +# There are two modes of this function. The first argument in both modes is +# the name of the Find-module where it is called (in original casing). +# +# The first simple mode looks like this: +# FIND_PACKAGE_HANDLE_STANDARD_ARGS( (DEFAULT_MSG|"Custom failure message") ... ) +# If the variables to are all valid, then _FOUND +# will be set to TRUE. +# If DEFAULT_MSG is given as second argument, then the function will generate +# itself useful success and error messages. You can also supply a custom error message +# for the failure case. This is not recommended. +# +# The second mode is more powerful and also supports version checking: +# FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME [REQUIRED_VARS ...] +# [VERSION_VAR +# [CONFIG_MODE] +# [FAIL_MESSAGE "Custom failure message"] ) +# +# As above, if through are all valid, _FOUND +# will be set to TRUE. +# After REQUIRED_VARS the variables which are required for this package are listed. +# Following VERSION_VAR the name of the variable can be specified which holds +# the version of the package which has been found. If this is done, this version +# will be checked against the (potentially) specified required version used +# in the find_package() call. The EXACT keyword is also handled. The default +# messages include information about the required version and the version +# which has been actually found, both if the version is ok or not. +# Use the option CONFIG_MODE if your FindXXX.cmake module is a wrapper for +# a find_package(... NO_MODULE) call, in this case all the information +# provided by the config-mode of find_package() will be evaluated +# automatically. +# Via FAIL_MESSAGE a custom failure message can be specified, if this is not +# used, the default message will be displayed. +# +# Example for mode 1: +# +# FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 DEFAULT_MSG LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR) +# +# LibXml2 is considered to be found, if both LIBXML2_LIBRARY and +# LIBXML2_INCLUDE_DIR are valid. Then also LIBXML2_FOUND is set to TRUE. +# If it is not found and REQUIRED was used, it fails with FATAL_ERROR, +# independent whether QUIET was used or not. +# If it is found, success will be reported, including the content of . +# On repeated Cmake runs, the same message won't be printed again. +# +# Example for mode 2: +# +# FIND_PACKAGE_HANDLE_STANDARD_ARGS(BISON REQUIRED_VARS BISON_EXECUTABLE +# VERSION_VAR BISON_VERSION) +# In this case, BISON is considered to be found if the variable(s) listed +# after REQUIRED_VAR are all valid, i.e. BISON_EXECUTABLE in this case. +# Also the version of BISON will be checked by using the version contained +# in BISON_VERSION. +# Since no FAIL_MESSAGE is given, the default messages will be printed. +# +# Another example for mode 2: +# +# FIND_PACKAGE(Automoc4 QUIET NO_MODULE HINTS /opt/automoc4) +# FIND_PACKAGE_HANDLE_STANDARD_ARGS(Automoc4 CONFIG_MODE) +# In this case, FindAutmoc4.cmake wraps a call to FIND_PACKAGE(Automoc4 NO_MODULE) +# and adds an additional search directory for automoc4. +# The following FIND_PACKAGE_HANDLE_STANDARD_ARGS() call produces a proper +# success/error message. + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +INCLUDE(FindPackageMessage) +INCLUDE(CMakeParseArguments) + +# internal helper macro +MACRO(_FPHSA_FAILURE_MESSAGE _msg) + IF (${_NAME}_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "${_msg}") + ELSE (${_NAME}_FIND_REQUIRED) + IF (NOT ${_NAME}_FIND_QUIETLY) + MESSAGE(STATUS "${_msg}") + ENDIF (NOT ${_NAME}_FIND_QUIETLY) + ENDIF (${_NAME}_FIND_REQUIRED) +ENDMACRO(_FPHSA_FAILURE_MESSAGE _msg) + + +# internal helper macro to generate the failure message when used in CONFIG_MODE: +MACRO(_FPHSA_HANDLE_FAILURE_CONFIG_MODE) + # _CONFIG is set, but FOUND is false, this means that some other of the REQUIRED_VARS was not found: + IF(${_NAME}_CONFIG) + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: missing: ${MISSING_VARS} (found ${${_NAME}_CONFIG} ${VERSION_MSG})") + ELSE(${_NAME}_CONFIG) + # If _CONSIDERED_CONFIGS is set, the config-file has been found, but no suitable version. + # List them all in the error message: + IF(${_NAME}_CONSIDERED_CONFIGS) + SET(configsText "") + LIST(LENGTH ${_NAME}_CONSIDERED_CONFIGS configsCount) + MATH(EXPR configsCount "${configsCount} - 1") + FOREACH(currentConfigIndex RANGE ${configsCount}) + LIST(GET ${_NAME}_CONSIDERED_CONFIGS ${currentConfigIndex} filename) + LIST(GET ${_NAME}_CONSIDERED_VERSIONS ${currentConfigIndex} version) + SET(configsText "${configsText} ${filename} (version ${version})\n") + ENDFOREACH(currentConfigIndex) + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} ${VERSION_MSG}, checked the following files:\n${configsText}") + + ELSE(${_NAME}_CONSIDERED_CONFIGS) + # Simple case: No Config-file was found at all: + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: found neither ${_NAME}Config.cmake nor ${_NAME_LOWER}-config.cmake ${VERSION_MSG}") + ENDIF(${_NAME}_CONSIDERED_CONFIGS) + ENDIF(${_NAME}_CONFIG) +ENDMACRO(_FPHSA_HANDLE_FAILURE_CONFIG_MODE) + + +FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG) + + # set up the arguments for CMAKE_PARSE_ARGUMENTS and check whether we are in + # new extended or in the "old" mode: + SET(options CONFIG_MODE) + SET(oneValueArgs FAIL_MESSAGE VERSION_VAR) + SET(multiValueArgs REQUIRED_VARS) + SET(_KEYWORDS_FOR_EXTENDED_MODE ${options} ${oneValueArgs} ${multiValueArgs} ) + LIST(FIND _KEYWORDS_FOR_EXTENDED_MODE "${_FIRST_ARG}" INDEX) + + IF(${INDEX} EQUAL -1) + SET(FPHSA_FAIL_MESSAGE ${_FIRST_ARG}) + SET(FPHSA_REQUIRED_VARS ${ARGN}) + SET(FPHSA_VERSION_VAR) + ELSE(${INDEX} EQUAL -1) + + CMAKE_PARSE_ARGUMENTS(FPHSA "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${ARGN}) + + IF(FPHSA_UNPARSED_ARGUMENTS) + MESSAGE(FATAL_ERROR "Unknown keywords given to FIND_PACKAGE_HANDLE_STANDARD_ARGS(): \"${FPHSA_UNPARSED_ARGUMENTS}\"") + ENDIF(FPHSA_UNPARSED_ARGUMENTS) + + IF(NOT FPHSA_FAIL_MESSAGE) + SET(FPHSA_FAIL_MESSAGE "DEFAULT_MSG") + ENDIF(NOT FPHSA_FAIL_MESSAGE) + ENDIF(${INDEX} EQUAL -1) + + # now that we collected all arguments, process them + + IF("${FPHSA_FAIL_MESSAGE}" STREQUAL "DEFAULT_MSG") + SET(FPHSA_FAIL_MESSAGE "Could NOT find ${_NAME}") + ENDIF("${FPHSA_FAIL_MESSAGE}" STREQUAL "DEFAULT_MSG") + + # In config-mode, we rely on the variable _CONFIG, which is set by find_package() + # when it successfully found the config-file, including version checking: + IF(FPHSA_CONFIG_MODE) + LIST(INSERT FPHSA_REQUIRED_VARS 0 ${_NAME}_CONFIG) + LIST(REMOVE_DUPLICATES FPHSA_REQUIRED_VARS) + SET(FPHSA_VERSION_VAR ${_NAME}_VERSION) + ENDIF(FPHSA_CONFIG_MODE) + + IF(NOT FPHSA_REQUIRED_VARS) + MESSAGE(FATAL_ERROR "No REQUIRED_VARS specified for FIND_PACKAGE_HANDLE_STANDARD_ARGS()") + ENDIF(NOT FPHSA_REQUIRED_VARS) + + LIST(GET FPHSA_REQUIRED_VARS 0 _FIRST_REQUIRED_VAR) + + STRING(TOUPPER ${_NAME} _NAME_UPPER) + STRING(TOLOWER ${_NAME} _NAME_LOWER) + + # collect all variables which were not found, so they can be printed, so the + # user knows better what went wrong (#6375) + SET(MISSING_VARS "") + SET(DETAILS "") + SET(${_NAME_UPPER}_FOUND TRUE) + # check if all passed variables are valid + FOREACH(_CURRENT_VAR ${FPHSA_REQUIRED_VARS}) + IF(NOT ${_CURRENT_VAR}) + SET(${_NAME_UPPER}_FOUND FALSE) + SET(MISSING_VARS "${MISSING_VARS} ${_CURRENT_VAR}") + ELSE(NOT ${_CURRENT_VAR}) + SET(DETAILS "${DETAILS}[${${_CURRENT_VAR}}]") + ENDIF(NOT ${_CURRENT_VAR}) + ENDFOREACH(_CURRENT_VAR) + + + # version handling: + SET(VERSION_MSG "") + SET(VERSION_OK TRUE) + SET(VERSION ${${FPHSA_VERSION_VAR}} ) + IF (${_NAME}_FIND_VERSION) + + IF(VERSION) + + IF(${_NAME}_FIND_VERSION_EXACT) # exact version required + IF (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}") + SET(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"") + SET(VERSION_OK FALSE) + ELSE (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}") + SET(VERSION_MSG "(found suitable exact version \"${VERSION}\")") + ENDIF (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}") + + ELSE(${_NAME}_FIND_VERSION_EXACT) # minimum version specified: + IF ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}") + SET(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is at least \"${${_NAME}_FIND_VERSION}\"") + SET(VERSION_OK FALSE) + ELSE ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}") + SET(VERSION_MSG "(found suitable version \"${VERSION}\", required is \"${${_NAME}_FIND_VERSION}\")") + ENDIF ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}") + ENDIF(${_NAME}_FIND_VERSION_EXACT) + + ELSE(VERSION) + + # if the package was not found, but a version was given, add that to the output: + IF(${_NAME}_FIND_VERSION_EXACT) + SET(VERSION_MSG "(Required is exact version \"${${_NAME}_FIND_VERSION}\")") + ELSE(${_NAME}_FIND_VERSION_EXACT) + SET(VERSION_MSG "(Required is at least version \"${${_NAME}_FIND_VERSION}\")") + ENDIF(${_NAME}_FIND_VERSION_EXACT) + + ENDIF(VERSION) + ELSE (${_NAME}_FIND_VERSION) + IF(VERSION) + SET(VERSION_MSG "(found version \"${VERSION}\")") + ENDIF(VERSION) + ENDIF (${_NAME}_FIND_VERSION) + + IF(VERSION_OK) + SET(DETAILS "${DETAILS}[v${VERSION}(${${_NAME}_FIND_VERSION})]") + ELSE(VERSION_OK) + SET(${_NAME_UPPER}_FOUND FALSE) + ENDIF(VERSION_OK) + + + # print the result: + IF (${_NAME_UPPER}_FOUND) + FIND_PACKAGE_MESSAGE(${_NAME} "Found ${_NAME}: ${${_FIRST_REQUIRED_VAR}} ${VERSION_MSG}" "${DETAILS}") + ELSE (${_NAME_UPPER}_FOUND) + + IF(FPHSA_CONFIG_MODE) + _FPHSA_HANDLE_FAILURE_CONFIG_MODE() + ELSE(FPHSA_CONFIG_MODE) + IF(NOT VERSION_OK) + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: ${VERSION_MSG} (found ${${_FIRST_REQUIRED_VAR}})") + ELSE(NOT VERSION_OK) + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} (missing: ${MISSING_VARS}) ${VERSION_MSG}") + ENDIF(NOT VERSION_OK) + ENDIF(FPHSA_CONFIG_MODE) + + ENDIF (${_NAME_UPPER}_FOUND) + + SET(${_NAME_UPPER}_FOUND ${${_NAME_UPPER}_FOUND} PARENT_SCOPE) + +ENDFUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _FIRST_ARG) \ No newline at end of file diff --git a/cmake/packages/FindQuadmath.cmake b/cmake/packages/FindQuadmath.cmake index 47ba2b589..620fd9728 100644 --- a/cmake/packages/FindQuadmath.cmake +++ b/cmake/packages/FindQuadmath.cmake @@ -1,49 +1,82 @@ -# Module that checks whether the compiler supports the -# quadruple precision floating point math +# Originally copied from the KDE project repository: +# http://websvn.kde.org/trunk/KDE/kdeutils/cmake/modules/FindGMP.cmake?view=markup&pathrev=675218 + +# Copyright (c) 2006, Laurent Montel, +# Copyright (c) 2008-2019 Francesco Biscani, + +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: # -# Sets the following variables: -# HAVE_QUAD -# QUADMATH_LIBRARIES +# 1. Redistributions of source code must retain the copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. # -# perform tests -include(CheckCSourceCompiles) -include(CheckCXXSourceCompiles) +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------------------ + +include(FindPackageHandleStandardArgs) include(CMakePushCheckState) -include(CheckCXXCompilerFlag) +include(CheckCXXSourceCompiles) -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(Quadmath_INCLUDE_DIR AND Quadmath_LIBRARY) + # Already in cache, be silent + set(Quadmath_FIND_QUIETLY TRUE) +endif() - if (HAVE_EXTENDED_NUMERIC_LITERALS) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fext-numeric-literals") - endif() +find_path(Quadmath_INCLUDE_DIR NAMES quadmath.h PATHS /usr/local/lib) +find_library(Quadmath_LIBRARY NAMES libquadmath.a PATHS /usr/local/lib/gcc/8/) +message(--- ${Quadmath_INCLUDE_DIR}) +message(--- ${Quadmath_LIBRARY}) + +if(NOT Quadmath_INCLUDE_DIR OR NOT Quadmath_LIBRARY) cmake_push_check_state(RESET) list(APPEND CMAKE_REQUIRED_LIBRARIES "quadmath") CHECK_CXX_SOURCE_COMPILES(" -#include - -int main(void){ - __float128 foo = sqrtq(123.456); - foo = FLT128_MIN; -}" QUADMATH_FOUND) + #include + int main(void){ + __float128 foo = ::sqrtq(123.456); + }" + Quadmath_USE_DIRECTLY) cmake_pop_check_state() - - if (QUADMATH_FOUND) - set(QUADMATH_LIBRARIES "quadmath") - set(HAVE_QUAD "${QUADMATH_FOUND}") + if (Quadmath_USE_DIRECTLY) + set(Quadmath_INCLUDE_DIR "unused" CACHE PATH "" FORCE) + set(Quadmath_LIBRARY "quadmath" CACHE FILEPATH "" FORCE) endif() endif() -if (USE_QUADMATH AND NOT QUADMATH_FOUND) - message(FATAL_ERROR "Quadruple precision math support was explicitly requested but is unavailable!") -endif() +find_package_handle_standard_args(Quadmath DEFAULT_MSG Quadmath_LIBRARY Quadmath_INCLUDE_DIR) -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Quadmath - DEFAULT_MSG - QUADMATH_LIBRARIES - HAVE_QUAD - ) +mark_as_advanced(Quadmath_INCLUDE_DIR Quadmath_LIBRARY) + +# NOTE: this has been adapted from CMake's FindPNG.cmake. +if(Quadmath_FOUND AND NOT TARGET Quadmath::quadmath) + message(STATUS "Creating the 'Quadmath::quadmath' imported target.") + if(Quadmath_USE_DIRECTLY) + message(STATUS "libquadmath will be included and linked directly.") + # If we are using it directly, we must define an interface library, + # as we do not have the full path to the shared library. + add_library(Quadmath::quadmath INTERFACE IMPORTED) + set_target_properties(Quadmath::quadmath PROPERTIES INTERFACE_LINK_LIBRARIES "${Quadmath_LIBRARY}") + else() + # Otherwise, we proceed as usual. + add_library(Quadmath::quadmath UNKNOWN IMPORTED) + set_target_properties(Quadmath::quadmath PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${Quadmath_INCLUDE_DIR}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${Quadmath_LIBRARY}") + endif() +endif() diff --git a/cmake/packages/FindTomMath.cmake b/cmake/packages/FindTomMath.cmake index 317276baf..9f99a6869 100644 --- a/cmake/packages/FindTomMath.cmake +++ b/cmake/packages/FindTomMath.cmake @@ -21,6 +21,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(TomMath DEFAULT_MSG TomMath_LIBRARY TomMath IF(TOMMATH_FOUND) set( TomMath_FOUND true ) SET( TomMath_LIBRARIES ${TomMath_LIBRARY} ) + SET( TomMath_INCLUDES ${TomMath_INCLUDE_DIR} ) ENDIF(TOMMATH_FOUND) MARK_AS_ADVANCED(TomMath_INCLUDE_DIR TomMath_LIBRARY TomMath_FOUND) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index f1e9cea6d..e08d47dfe 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,15 +1,27 @@ include(CMTest) +find_package(GMP) +find_package(Quadmath) +find_package(TomMath) +find_package(MPFR) +find_package(MPFI) +find_package(MPC) +find_package(Eigen3) + if(BOOST_CMAKE) - cm_find_package(${CMAKE_WORKSPACE_NAME}_algorithm) - cm_find_package(${CMAKE_WORKSPACE_NAME}_chrono) - cm_find_package(${CMAKE_WORKSPACE_NAME}_exception) - cm_find_package(${CMAKE_WORKSPACE_NAME}_timer) - cm_find_package(${CMAKE_WORKSPACE_NAME}_numeric_ublas) - cm_find_package(${CMAKE_WORKSPACE_NAME}_filesystem) - cm_find_package(${CMAKE_WORKSPACE_NAME}_test) - cm_find_package(${CMAKE_WORKSPACE_NAME}_serialization) - cm_find_package(${CMAKE_WORKSPACE_NAME}_numeric_interval) + find_package(${CMAKE_WORKSPACE_NAME}_algorithm) + find_package(${CMAKE_WORKSPACE_NAME}_chrono) + find_package(${CMAKE_WORKSPACE_NAME}_exception) + find_package(${CMAKE_WORKSPACE_NAME}_timer) + find_package(${CMAKE_WORKSPACE_NAME}_numeric_ublas) + find_package(${CMAKE_WORKSPACE_NAME}_filesystem) + find_package(${CMAKE_WORKSPACE_NAME}_test) + find_package(${CMAKE_WORKSPACE_NAME}_serialization) + find_package(${CMAKE_WORKSPACE_NAME}_numeric_interval) + find_package(${CMAKE_WORKSPACE_NAME}_detail) + find_package(${CMAKE_WORKSPACE_NAME}_throw_exception) + find_package(${CMAKE_WORKSPACE_NAME}_math) + find_package(${CMAKE_WORKSPACE_NAME}_regexp) cm_test_link_libraries(${CMAKE_WORKSPACE_NAME}_multiprecision ${CMAKE_WORKSPACE_NAME}::algorithm @@ -21,14 +33,20 @@ if(BOOST_CMAKE) ${CMAKE_WORKSPACE_NAME}::test ${CMAKE_WORKSPACE_NAME}::serialization ${CMAKE_WORKSPACE_NAME}::numeric_interval + ${CMAKE_WORKSPACE_NAME}::detail + ${CMAKE_WORKSPACE_NAME}::throw_exception + ${CMAKE_WORKSPACE_NAME}::math + ${CMAKE_WORKSPACE_NAME}::regexp ) else() - cm_find_package(Boost COMPONENTS chrono timer exception filesystem - unit_test_framework serialization) + find_package(Boost 1.70.0 REQUIRED chrono exception timer filesystem filesystem + unit_test_framework serialization regex ) cm_test_link_libraries(${CMAKE_WORKSPACE_NAME}_multiprecision ${Boost_LIBRARIES} ) + + include_directories(${Boost_INCLUDE_DIRS}) endif() # copyright John Maddock 2011 @@ -52,414 +70,726 @@ cm_test_link_libraries(multiprecision_test_settings) #msvc,off:-RTCc #msvc,off:_ALLOW_RTCc_IN_STL -# add_library(no_eh_support STATIC no_eh_test_support.cpp) +# add_library(no_eh_support STATIC no_eh_support.cpp) # cm_mark_as_test(no_eh_support) # target_link_libraries(no_eh_support boost_throw_exception) # cm_target_link_test_libs(no_eh_support) -try_compile(HAS_GMP ${CURRENT_TEST_SOURCES_DIR}/../config ${CURRENT_TEST_SOURCES_DIR}/../config/has_gmp.cpp CMAKE_FLAGS - "-DCMAKE_CXX_LINK_EXECUTABLE='echo not linking now...'") -try_compile(HAS_MPFR ${CURRENT_TEST_SOURCES_DIR}/../config ${CURRENT_TEST_SOURCES_DIR}/../config/has_mpfr.cpp CMAKE_FLAGS - "-DCMAKE_CXX_LINK_EXECUTABLE='echo not linking now...'") -try_compile(HAS_TOMMATH ${CURRENT_TEST_SOURCES_DIR}/../config ${CURRENT_TEST_SOURCES_DIR}/../config/has_tommath.cpp CMAKE_FLAGS - "-DCMAKE_CXX_LINK_EXECUTABLE='echo not linking now...'") -try_compile(HAS_FLOAT128 ${CURRENT_TEST_SOURCES_DIR}/../config ${CURRENT_TEST_SOURCES_DIR}/../config/has_float128.cpp) -try_compile(HAS_MPFI ${CURRENT_TEST_SOURCES_DIR}/../config ${CURRENT_TEST_SOURCES_DIR}/../config/has_mpfi.cpp CMAKE_FLAGS - "-DCMAKE_CXX_LINK_EXECUTABLE='echo not linking now...'") -try_compile(HAS_INTEL_QUAD ${CURRENT_TEST_SOURCES_DIR}/../config ${CURRENT_TEST_SOURCES_DIR}/../config/has_intel_quad.cpp CMAKE_FLAGS +try_compile(GMP_COMPILED ${CMAKE_BINARY_DIR} ${CURRENT_TEST_SOURCES_DIR}/../config/has_gmp.cpp + LINK_LIBRARIES ${GMP_LIBRARIES} + CMAKE_FLAGS "-DCMAKE_CXX_LINK_EXECUTABLE='echo not linking now...'" "-DINCLUDE_DIRECTORIES=${GMP_INCLUDES}") + +try_compile(MPFR_COMPILED ${CMAKE_BINARY_DIR} ${CURRENT_TEST_SOURCES_DIR}/../config/has_mpfr.cpp + LINK_LIBRARIES ${MPFR_LIBRARIES} + CMAKE_FLAGS "-DCMAKE_CXX_LINK_EXECUTABLE='echo not linking now...'" "-DINCLUDE_DIRECTORIES=${MPFR_INCLUDES}") + +try_compile(TOMMATH_COMPILED ${CMAKE_BINARY_DIR} ${CURRENT_TEST_SOURCES_DIR}/../config/has_tommath.cpp + LINK_LIBRARIES ${TomMath_LIBRARIES} + CMAKE_FLAGS "-DCMAKE_CXX_LINK_EXECUTABLE='echo not linking now...'" "-DINCLUDE_DIRECTORIES=${TomMath_INCLUDES}") + +try_compile(FLOAT128_COMPILED ${CMAKE_BINARY_DIR} ${CURRENT_TEST_SOURCES_DIR}/../config/has_float128.cpp) + +try_compile(MPFI_COMPILED ${CMAKE_BINARY_DIR} ${CURRENT_TEST_SOURCES_DIR}/../config/has_mpfi.cpp + LINK_LIBRARIES ${MPFI_LIBRARIES} + CMAKE_FLAGS "-DCMAKE_CXX_LINK_EXECUTABLE='echo not linking now...'" "-DINCLUDE_DIRECTORIES=${MPFI_INCLUDES}") + +try_compile(INTEL_QUAD_COMPILED ${CMAKE_BINARY_DIR} ${CURRENT_TEST_SOURCES_DIR}/../config/has_intel_quad.cpp CMAKE_FLAGS "-DCMAKE_CXX_LINK_EXECUTABLE='echo not linking now...'") +try_compile(MPC_COMPILED ${CMAKE_BINARY_DIR} ${CURRENT_TEST_SOURCES_DIR}/../config/has_mpc.cpp + LINK_LIBRARIES ${MPC_LIBRARIES} + CMAKE_FLAGS "-DCMAKE_CXX_LINK_EXECUTABLE='echo not linking now...'" "-DINCLUDE_DIRECTORIES=${MPC_INCLUDES}") + +try_compile(EIGEN_COMPILED ${CMAKE_BINARY_DIR} ${CURRENT_TEST_SOURCES_DIR}/../config/has_eigen.cpp + CMAKE_FLAGS "-DCMAKE_CXX_LINK_EXECUTABLE='echo not linking now...'" "-DINCLUDE_DIRECTORIES=${EIGEN3_INCLUDE_DIR}") + +message(${EIGEN3_INCLUDE_DIR}) +message(GMP_COMPILED=${GMP_COMPILED}) +message(MPFR_COMPILED=${MPFR_COMPILED}) +message(TOMMATH_COMPILED=${TOMMATH_COMPILED}) +message(FLOAT128_COMPILED=${FLOAT128_COMPILED}) +message(MPFI_COMPILED=${MPFI_COMPILED}) +message(INTEL_QUAD_COMPILED=${INTEL_QUAD_COMPILED}) +message(MPC_COMPILED=${MPC_COMPILED}) +message(EIGEN_COMPILED=${EIGEN_COMPILED}) + +#cm_test(NAME GMP_MY SOURCES ${CURRENT_TEST_SOURCES_DIR}/../config/has_float128.cpp) +#target_link_libraries(GMP_MY ${Quadmath_LIBRARY}) +#target_include_directories(GMP_MY PRIVATE ${Quadmath_INCLUDE_DIR}) + +add_library(no_eh_support SHARED ${CURRENT_TEST_SOURCES_DIR}/no_eh_test_support.cpp) + cm_test(NAME multiprecision_test_test_arithmetic_backend_concept SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_backend_concept.cpp) +target_link_libraries(multiprecision_test_test_arithmetic_backend_concept no_eh_support) cm_test(NAME multiprecision_test_test_arithmetic_cpp_dec_float_1 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_cpp_dec_float_1.cpp) +target_link_libraries(multiprecision_test_test_arithmetic_cpp_dec_float_1 no_eh_support) cm_test(NAME multiprecision_test_test_arithmetic_cpp_dec_float_2 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_cpp_dec_float_2.cpp) +target_link_libraries( multiprecision_test_test_arithmetic_cpp_dec_float_2 no_eh_support) cm_test(NAME multiprecision_test_test_arithmetic_cpp_dec_float_3 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_cpp_dec_float_3.cpp) - -if(NOT CMAKE_CXX_COMPILER_ID MATCHES "GNU") - # TODO: fix test. Reason error: [-fpermissive] - cm_test(NAME multiprecision_test_test_arithmetic_cpp_bin_float_1 SOURCES ${CMAKE_CURRENT_BINARY_DIR}/test_arithmetic_cpp_bin_float_1.cpp SOURCES_PREFIX ${CURRENT_TEST_SOURCES_DIR}) - cm_test(NAME multiprecision_test_test_arithmetic_cpp_bin_float_2 SOURCES ${CMAKE_CURRENT_BINARY_DIR}/test_arithmetic_cpp_bin_float_2.cpp SOURCES_PREFIX ${CURRENT_TEST_SOURCES_DIR}) - cm_test(NAME multiprecision_test_test_arithmetic_cpp_bin_float_3 SOURCES ${CMAKE_CURRENT_BINARY_DIR}/test_arithmetic_cpp_bin_float_3.cpp SOURCES_PREFIX ${CURRENT_TEST_SOURCES_DIR}) -endif() - -if(HAS_GMP) +target_link_libraries(multiprecision_test_test_arithmetic_cpp_dec_float_3 no_eh_support) +cm_test(NAME multiprecision_test_test_arithmetic_cpp_dec_float_3m SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_cpp_dec_float_3m.cpp) +target_link_libraries(multiprecision_test_test_arithmetic_cpp_dec_float_3m no_eh_support) + +cm_test(NAME multiprecision_test_test_arithmetic_cpp_bin_float_1 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_cpp_bin_float_1.cpp) +target_link_libraries(multiprecision_test_test_arithmetic_cpp_bin_float_1 no_eh_support) +cm_test(NAME multiprecision_test_test_arithmetic_cpp_bin_float_2 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_cpp_bin_float_2.cpp) +target_link_libraries(multiprecision_test_test_arithmetic_cpp_bin_float_2 no_eh_support) +cm_test(NAME multiprecision_test_test_arithmetic_cpp_bin_float_2m SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_cpp_bin_float_2m.cpp) +target_link_libraries(multiprecision_test_test_arithmetic_cpp_bin_float_2m no_eh_support) +cm_test(NAME multiprecision_test_test_arithmetic_cpp_bin_float_3 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_cpp_bin_float_3.cpp) +target_link_libraries(multiprecision_test_test_arithmetic_cpp_bin_float_3 no_eh_support) + +if(GMP_COMPILED) cm_test(NAME multiprecision_test_test_arithmetic_mpf_50 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_mpf_50.cpp) + target_link_libraries(multiprecision_test_test_arithmetic_mpf_50 ${GMP_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_arithmetic_mpf_50 PRIVATE ${GMP_INCLUDES}) cm_test(NAME multiprecision_test_test_arithmetic_mpf SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_mpf.cpp) + target_link_libraries(multiprecision_test_test_arithmetic_mpf ${GMP_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_arithmetic_mpf PRIVATE ${GMP_INCLUDES}) cm_test(NAME multiprecision_test_test_arithmetic_mpz SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_mpz.cpp) + target_link_libraries(multiprecision_test_test_arithmetic_mpz ${GMP_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_arithmetic_mpz PRIVATE ${GMP_INCLUDES}) cm_test(NAME multiprecision_test_test_arithmetic_mpz_rat SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_mpz_rat.cpp) + target_link_libraries(multiprecision_test_test_arithmetic_mpz_rat ${GMP_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_arithmetic_mpz_rat PRIVATE ${GMP_INCLUDES}) cm_test(NAME multiprecision_test_test_arithmetic_mpz_br SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_mpz_br.cpp) + target_link_libraries(multiprecision_test_test_arithmetic_mpz_br ${GMP_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_arithmetic_mpz_br PRIVATE ${GMP_INCLUDES}) cm_test(NAME multiprecision_test_test_arithmetic_mpq SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_mpq.cpp) + target_link_libraries(multiprecision_test_test_arithmetic_mpq ${GMP_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_arithmetic_mpq PRIVATE ${GMP_INCLUDES}) endif() -if(HAS_MPFR) +if(MPFR_COMPILED) cm_test(NAME multiprecision_test_test_arithmetic_mpfr SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_mpfr.cpp) + target_link_libraries(multiprecision_test_test_arithmetic_mpfr ${MPFR_LIBRARIES} ${GMP_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_arithmetic_mpfr PRIVATE ${GMP_INCLUDES}) cm_test(NAME multiprecision_test_test_arithmetic_mpfr_50 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_mpfr_50.cpp) + target_link_libraries(multiprecision_test_test_arithmetic_mpfr_50 ${MPFR_LIBRARIES} ${GMP_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_arithmetic_mpfr_50 PRIVATE ${GMP_INCLUDES}) cm_test(NAME multiprecision_test_test_arithmetic_mpfr_50_static SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_mpfr_50_static.cpp) + target_link_libraries(multiprecision_test_test_arithmetic_mpfr_50_static ${MPFR_LIBRARIES} ${GMP_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_arithmetic_mpfr_50_static PRIVATE ${GMP_INCLUDES}) endif() -if(HAS_TOMMATH) +if(TOMMATH_COMPILED) cm_test(NAME multiprecision_test_test_arithmetic_tommath SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_tommath.cpp) + target_link_libraries(multiprecision_test_test_arithmetic_tommath ${TomMath_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_arithmetic_tommath PRIVATE ${TomMath_INCLUDES}) cm_test(NAME multiprecision_test_test_arithmetic_tommath_rat SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_tommath_rat.cpp) + target_link_libraries(multiprecision_test_test_arithmetic_tommath_rat ${TomMath_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_arithmetic_tommath_rat PRIVATE ${TomMath_INCLUDES}) cm_test(NAME multiprecision_test_test_arithmetic_tommath_br SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_tommath_br.cpp) + target_link_libraries(multiprecision_test_test_arithmetic_tommath_br ${TomMath_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_arithmetic_tommath_br PRIVATE ${TomMath_INCLUDES}) endif() -if(NOT CMAKE_CXX_COMPILER_ID MATCHES "GNU") - # TODO: fix test. Reason error: [-fpermissive] - cm_test(NAME multiprecision_test_test_arithmetic_cpp_int_2 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_cpp_int_2.cpp) - cm_test(NAME multiprecision_test_test_arithmetic_cpp_int_3 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_cpp_int_3.cpp) - cm_test(NAME multiprecision_test_test_arithmetic_cpp_int_4 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_cpp_int_4.cpp) - cm_test(NAME multiprecision_test_test_arithmetic_cpp_int_5 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_cpp_int_5.cpp) - cm_test(NAME multiprecision_test_test_arithmetic_cpp_int_6 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_cpp_int_6.cpp) - cm_test(NAME multiprecision_test_test_arithmetic_cpp_int_7 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_cpp_int_7.cpp) - cm_test(NAME multiprecision_test_test_arithmetic_cpp_int_8 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_cpp_int_8.cpp) - cm_test(NAME multiprecision_test_test_arithmetic_cpp_int_9 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_cpp_int_9.cpp) - cm_test(NAME multiprecision_test_test_arithmetic_cpp_int_10 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_cpp_int_10.cpp) - cm_test(NAME multiprecision_test_test_arithmetic_cpp_int_11 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_cpp_int_11.cpp) - cm_test(NAME multiprecision_test_test_arithmetic_cpp_int_12 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_cpp_int_12.cpp) - cm_test(NAME multiprecision_test_test_arithmetic_cpp_int_13 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_cpp_int_13.cpp) - cm_test(NAME multiprecision_test_test_arithmetic_cpp_int_14 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_cpp_int_14.cpp) - cm_test(NAME multiprecision_test_test_arithmetic_cpp_int_15 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_cpp_int_15.cpp) - cm_test(NAME multiprecision_test_test_arithmetic_cpp_int_16 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_cpp_int_16.cpp) - cm_test(NAME multiprecision_test_test_arithmetic_cpp_int_17 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_cpp_int_17.cpp) - cm_test(NAME multiprecision_test_test_arithmetic_cpp_int_18 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_cpp_int_18.cpp) - cm_test(NAME multiprecision_test_test_arithmetic_cpp_int_br SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_cpp_int_br.cpp) -endif() +cm_test(NAME multiprecision_test_test_arithmetic_cpp_int_1 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_cpp_int_1.cpp) +target_link_libraries(multiprecision_test_test_arithmetic_cpp_int_1 no_eh_support) +cm_test(NAME multiprecision_test_test_arithmetic_cpp_int_2 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_cpp_int_2.cpp) +target_link_libraries(multiprecision_test_test_arithmetic_cpp_int_2 no_eh_support) +cm_test(NAME multiprecision_test_test_arithmetic_cpp_int_3 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_cpp_int_3.cpp) +target_link_libraries(multiprecision_test_test_arithmetic_cpp_int_3 no_eh_support) +cm_test(NAME multiprecision_test_test_arithmetic_cpp_int_4 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_cpp_int_4.cpp) +target_link_libraries(multiprecision_test_test_arithmetic_cpp_int_4 no_eh_support) +cm_test(NAME multiprecision_test_test_arithmetic_cpp_int_5 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_cpp_int_5.cpp) +target_link_libraries(multiprecision_test_test_arithmetic_cpp_int_5 no_eh_support) +cm_test(NAME multiprecision_test_test_arithmetic_cpp_int_6 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_cpp_int_6.cpp) +target_link_libraries(multiprecision_test_test_arithmetic_cpp_int_6 no_eh_support) +cm_test(NAME multiprecision_test_test_arithmetic_cpp_int_7 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_cpp_int_7.cpp) +target_link_libraries(multiprecision_test_test_arithmetic_cpp_int_7 no_eh_support) +cm_test(NAME multiprecision_test_test_arithmetic_cpp_int_8 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_cpp_int_8.cpp) +target_link_libraries(multiprecision_test_test_arithmetic_cpp_int_8 no_eh_support) +cm_test(NAME multiprecision_test_test_arithmetic_cpp_int_9 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_cpp_int_9.cpp) +target_link_libraries(multiprecision_test_test_arithmetic_cpp_int_9 no_eh_support) +cm_test(NAME multiprecision_test_test_arithmetic_cpp_int_10 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_cpp_int_10.cpp) +target_link_libraries(multiprecision_test_test_arithmetic_cpp_int_10 no_eh_support) +cm_test(NAME multiprecision_test_test_arithmetic_cpp_int_11 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_cpp_int_11.cpp) +target_link_libraries(multiprecision_test_test_arithmetic_cpp_int_11 no_eh_support) +cm_test(NAME multiprecision_test_test_arithmetic_cpp_int_12 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_cpp_int_12.cpp) +target_link_libraries(multiprecision_test_test_arithmetic_cpp_int_12 no_eh_support) +cm_test(NAME multiprecision_test_test_arithmetic_cpp_int_13 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_cpp_int_13.cpp) +target_link_libraries(multiprecision_test_test_arithmetic_cpp_int_13 no_eh_support) +cm_test(NAME multiprecision_test_test_arithmetic_cpp_int_14 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_cpp_int_14.cpp) +target_link_libraries(multiprecision_test_test_arithmetic_cpp_int_14 no_eh_support) +cm_test(NAME multiprecision_test_test_arithmetic_cpp_int_15 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_cpp_int_15.cpp) +target_link_libraries(multiprecision_test_test_arithmetic_cpp_int_15 no_eh_support) +cm_test(NAME multiprecision_test_test_arithmetic_cpp_int_16 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_cpp_int_16.cpp) +target_link_libraries(multiprecision_test_test_arithmetic_cpp_int_16 no_eh_support) +cm_test(NAME multiprecision_test_test_arithmetic_cpp_int_17 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_cpp_int_17.cpp) +target_link_libraries(multiprecision_test_test_arithmetic_cpp_int_17 no_eh_support) +cm_test(NAME multiprecision_test_test_arithmetic_cpp_int_18 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_cpp_int_18.cpp) +target_link_libraries(multiprecision_test_test_arithmetic_cpp_int_18 no_eh_support) +cm_test(NAME multiprecision_test_test_arithmetic_cpp_int_19 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_cpp_int_19.cpp) +target_link_libraries(multiprecision_test_test_arithmetic_cpp_int_19 no_eh_support) +cm_test(NAME multiprecision_test_test_arithmetic_cpp_int_br SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_cpp_int_br.cpp) +target_link_libraries(multiprecision_test_test_arithmetic_cpp_int_br no_eh_support) cm_test(NAME multiprecision_test_test_arithmetic_ab_1 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_ab_1.cpp) +target_link_libraries(multiprecision_test_test_arithmetic_ab_1 no_eh_support) cm_test(NAME multiprecision_test_test_arithmetic_ab_2 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_ab_2.cpp) +target_link_libraries(multiprecision_test_test_arithmetic_ab_2 no_eh_support) cm_test(NAME multiprecision_test_test_arithmetic_ab_3 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_ab_3.cpp) +target_link_libraries(multiprecision_test_test_arithmetic_ab_3 no_eh_support) cm_test(NAME multiprecision_test_test_cpp_dec_float_round SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_cpp_dec_float_round.cpp) +target_link_libraries(multiprecision_test_test_cpp_dec_float_round no_eh_support) -if(NOT CMAKE_CXX_COMPILER_ID MATCHES "GNU") - # TODO: fix test. Reason error: [-fpermissive] - cm_test(NAME multiprecision_test_test_arithmetic_logged_1 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_logged_1.cpp) - cm_test(NAME multiprecision_test_test_arithmetic_logged_2 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_logged_2.cpp) +cm_test(NAME multiprecision_test_test_arithmetic_logged_1 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_logged_1.cpp) +target_link_libraries(multiprecision_test_test_arithmetic_logged_1 no_eh_support) +cm_test(NAME multiprecision_test_test_arithmetic_logged_2 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_logged_2.cpp) +target_link_libraries(multiprecision_test_test_arithmetic_logged_2 no_eh_support) - cm_test(NAME multiprecision_test_test_arithmetic_dbg_adptr1 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_dbg_adptr1.cpp) - cm_test(NAME multiprecision_test_test_arithmetic_dbg_adptr2 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_dbg_adptr2.cpp) -endif() +cm_test(NAME multiprecision_test_test_arithmetic_dbg_adptr1 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_dbg_adptr1.cpp) +target_link_libraries(multiprecision_test_test_arithmetic_dbg_adptr1 no_eh_support) +cm_test(NAME multiprecision_test_test_arithmetic_dbg_adptr1m SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_dbg_adptr1m.cpp) +target_link_libraries(multiprecision_test_test_arithmetic_dbg_adptr1m no_eh_support) +cm_test(NAME multiprecision_test_test_arithmetic_dbg_adptr2 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_dbg_adptr2.cpp) +target_link_libraries(multiprecision_test_test_arithmetic_dbg_adptr2 no_eh_support) -if(HAS_MPFI) +if(MPFI_COMPILED) cm_test(NAME multiprecision_test_test_arithmetic_mpfi_50 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_mpfi_50.cpp) + target_link_libraries(multiprecision_test_test_arithmetic_mpfi_50 ${MPFI_LIBRARIES} ${MPFR_LIBRARIES} ${GMP_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_arithmetic_mpfi_50 PRIVATE ${MPFI_INCLUDES}) endif() -if(NOT CMAKE_CXX_COMPILER_ID MATCHES "GNU") - # TODO: fix test. Reason error: [-fpermissive] - cm_test(NAME multiprecision_test_test_numeric_limits_backend_concept SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_numeric_limits.cpp) - target_compile_definitions(multiprecision_test_test_numeric_limits_backend_concept PUBLIC -DTEST_BACKEND) +if (INTEL_QUAD_COMPILED) + cm_test(NAME multiprecision_test_test_arithmetic_float_128 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_float_128.cpp) +endif() + +if (FLOAT128_COMPILED) + cm_test(NAME multiprecision_test_test_arithmetic_float_128_quad SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_float_128.cpp) endif() -if(HAS_GMP) +if (MPC_COMPILED) + cm_test(NAME multiprecision_test_test_arithmetic_mpc SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_mpc.cpp) + target_link_libraries(multiprecision_test_test_arithmetic_mpc ${MPC_LIBRARIES} ${MPFR_LIBRARIES} ${GMP_LIBRARIES}) + target_include_directories(multiprecision_test_test_arithmetic_mpc PRIVATE ${GMP_INCLUDES}) + cm_test(NAME multiprecision_test_test_mpfr_mpc_precisions SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_mpfr_mpc_precisions.cpp) + target_link_libraries(multiprecision_test_test_mpfr_mpc_precisions ${MPC_LIBRARIES} ${MPFR_LIBRARIES} ${GMP_LIBRARIES}) + target_include_directories(multiprecision_test_test_mpfr_mpc_precisions PRIVATE ${GMP_INCLUDES}) +endif() +if (MPFI_COMPILED) + cm_test(NAME multiprecision_test_test_mpfi_precisions SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_mpfi_precisions.cpp) + target_link_libraries(multiprecision_test_test_mpfi_precisions ${MPFI_LIBRARIES} ${MPFR_LIBRARIES} ${GMP_LIBRARIES}) + target_include_directories(multiprecision_test_test_mpfi_precisions PRIVATE ${MPFI_INCLUDES}) +endif() + +if (GMP_COMPILED) + cm_test(NAME multiprecision_test_test_mpf_precisions SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_mpf_precisions.cpp) + target_link_libraries(multiprecision_test_test_mpf_precisions ${GMP_LIBRARIES}) + target_include_directories(multiprecision_test_test_mpf_precisions PRIVATE ${GMP_INCLUDES}) +endif() + +if ((MPC_COMPILED) AND (FLOAT128_COMPILED)) + cm_test(NAME multiprecision_test_test_complex SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_complex.cpp) +endif() +cm_test(NAME multiprecision_test_test_arithmetic_complex_adaptor SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_complex_adaptor.cpp) +cm_test(NAME multiprecision_test_test_arithmetic_complex_adaptor_2 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_complex_adaptor_2.cpp) + +if (FLOAT128_COMPILED) + cm_test(NAME multiprecision_test_test_arithmetic_complex128 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_arithmetic_complex128.cpp) +endif() + +set(LOCAL_SOURCES test_exp.cpp test_log.cpp test_pow.cpp test_sinh.cpp test_sqrt.cpp test_cosh.cpp test_tanh.cpp test_sin.cpp test_cos.cpp test_tan.cpp test_asin.cpp test_acos.cpp test_atan.cpp test_round.cpp test_fpclassify.cpp test_sf_import_c99.cpp) +foreach(FILE ${LOCAL_SOURCES}) + get_filename_component(NAME ${FILE} NAME_WE) + if(GMP_COMPILED) + cm_test(NAME multiprecision_test_${NAME}_mpf50 SOURCES ${CURRENT_TEST_SOURCES_DIR}/${FILE}) + target_compile_definitions(multiprecision_test_${NAME}_mpf50 PUBLIC -DTEST_MPF_50) + target_link_libraries(multiprecision_test_${NAME}_mpf50 ${GMP_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_${NAME}_mpf50 PRIVATE ${GMP_INCLUDES}) + endif() + if(MPFR_COMPILED) + cm_test(NAME multiprecision_test_${NAME}_mpfr50 SOURCES ${CURRENT_TEST_SOURCES_DIR}/${FILE}) + target_compile_definitions(multiprecision_test_${NAME}_mpfr50 PUBLIC -DTEST_MPFR_50) + target_link_libraries(multiprecision_test_${NAME}_mpfr50 ${MPFR_LIBRARIES} ${GMP_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_${NAME}_mpfr50 PRIVATE ${GMP_INCLUDES}) + endif() + if(MPFI_COMPILED) + cm_test(NAME multiprecision_test_${NAME}_mpfi50 SOURCES ${CURRENT_TEST_SOURCES_DIR}/${FILE}) + target_compile_definitions(multiprecision_test_${NAME}_mpfi50 PUBLIC -DTEST_MPFI_50) + target_link_libraries(multiprecision_test_${NAME}_mpfi50 ${MPFI_LIBRARIES} ${MPFR_LIBRARIES} ${GMP_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_${NAME}_mpfi50 PRIVATE ${MPFI_INCLUDES}) + endif() + + cm_test(NAME multiprecision_test_${NAME}_cpp_dec_float SOURCES ${CURRENT_TEST_SOURCES_DIR}/${FILE}) + target_compile_definitions(multiprecision_test_${NAME}_cpp_dec_float PUBLIC -DTEST_CPP_DEC_FLOAT) + target_link_libraries(multiprecision_test_${NAME}_cpp_dec_float no_eh_support) + + cm_test(NAME multiprecision_test_${NAME}_cpp_bin_float SOURCES ${CURRENT_TEST_SOURCES_DIR}/${FILE}) + target_compile_definitions(multiprecision_test_${NAME}_cpp_bin_float PUBLIC -DTEST_CPP_BIN_FLOAT) + target_link_libraries(multiprecision_test_${NAME}_cpp_bin_float no_eh_support) + + if(FLOAT128_COMPILED) + cm_test(NAME multiprecision_test_${NAME}_float128 SOURCES ${CURRENT_TEST_SOURCES_DIR}/${FILE}) + target_compile_definitions(multiprecision_test_${NAME}_float128 PUBLIC -DTEST_FLOAT128) + target_link_libraries(multiprecision_test_${NAME}_float128 no_eh_support) + endif() + + if(INTEL_QUAD_COMPILED) + cm_test(NAME multiprecision_test_${NAME}_intel_quad SOURCES ${CURRENT_TEST_SOURCES_DIR}/${FILE}) + target_compile_definitions(multiprecision_test_${NAME}_intel_quad PUBLIC -DTEST_FLOAT128) + target_link_libraries(multiprecision_test_${NAME}_intel_quad no_eh_support) + endif() +endforeach() + +cm_test(NAME multiprecision_test_test_numeric_limits_backend_concept SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_numeric_limits.cpp) +target_compile_definitions(multiprecision_test_test_numeric_limits_backend_concept PUBLIC -DTEST_BACKEND) +target_link_libraries(multiprecision_test_test_numeric_limits_backend_concept no_eh_support) + +if(GMP_COMPILED) cm_test(NAME multiprecision_test_test_numeric_limits_mpf50 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_numeric_limits.cpp) target_compile_definitions(multiprecision_test_test_numeric_limits_mpf50 PUBLIC -DTEST_MPF_50) + target_link_libraries(multiprecision_test_test_numeric_limits_mpf50 ${GMP_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_numeric_limits_mpf50 PRIVATE ${GMP_INCLUDES}) cm_test(NAME multiprecision_test_test_numeric_limits_mpf SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_numeric_limits.cpp) target_compile_definitions(multiprecision_test_test_numeric_limits_mpf PUBLIC -DTEST_MPF) + target_link_libraries(multiprecision_test_test_numeric_limits_mpf ${GMP_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_numeric_limits_mpf PRIVATE ${GMP_INCLUDES}) cm_test(NAME multiprecision_test_test_numeric_limits_mpz SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_numeric_limits.cpp) target_compile_definitions(multiprecision_test_test_numeric_limits_mpz PUBLIC -DTEST_MPZ) + target_link_libraries(multiprecision_test_test_numeric_limits_mpz ${GMP_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_numeric_limits_mpz PRIVATE ${GMP_INCLUDES}) cm_test(NAME multiprecision_test_test_numeric_limits_mpq SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_numeric_limits.cpp) target_compile_definitions(multiprecision_test_test_numeric_limits_mpq PUBLIC -DTEST_MPQ) + target_link_libraries(multiprecision_test_test_numeric_limits_mpq ${GMP_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_numeric_limits_mpq PRIVATE ${GMP_INCLUDES}) endif() -if(HAS_MPFR) +if(MPFR_COMPILED) cm_test(NAME multiprecision_test_test_numeric_limits_mpfr SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_numeric_limits.cpp) target_compile_definitions(multiprecision_test_test_numeric_limits_mpfr PUBLIC -DTEST_MPFR) + target_link_libraries(multiprecision_test_test_numeric_limits_mpfr ${MPFR_LIBRARIES} ${GMP_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_numeric_limits_mpfr PRIVATE ${GMP_INCLUDES}) cm_test(NAME multiprecision_test_test_numeric_limits_mpfr_50 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_numeric_limits.cpp) target_compile_definitions(multiprecision_test_test_numeric_limits_mpfr_50 PUBLIC -DTEST_MPFR_50) + target_link_libraries(multiprecision_test_test_numeric_limits_mpfr_50 ${MPFR_LIBRARIES} ${GMP_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_numeric_limits_mpfr_50 PRIVATE ${GMP_INCLUDES}) endif() -if(HAS_GMP) - cm_test(NAME multiprecision_test_test_numeric_limits_cpp_dec_float SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_numeric_limits.cpp) - target_compile_definitions(multiprecision_test_test_numeric_limits_cpp_dec_float PUBLIC -TDEST_CPP_DEC_FLOAT) +cm_test(NAME multiprecision_test_test_numeric_limits_cpp_dec_float SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_numeric_limits.cpp) +target_compile_definitions(multiprecision_test_test_numeric_limits_cpp_dec_float PUBLIC -DTEST_CPP_DEC_FLOAT) +target_link_libraries(multiprecision_test_test_numeric_limits_cpp_dec_float no_eh_support) - cm_test(NAME multiprecision_test_test_numeric_limits_cpp_bin_float SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_numeric_limits.cpp) - target_compile_definitions(multiprecision_test_test_numeric_limits_cpp_bin_float PUBLIC -DTEST_CPP_BIN_FLOAT) -endif() +cm_test(NAME multiprecision_test_test_numeric_limits_cpp_bin_float SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_numeric_limits.cpp) +target_compile_definitions(multiprecision_test_test_numeric_limits_cpp_bin_float PUBLIC -DTEST_CPP_BIN_FLOAT) +target_link_libraries(multiprecision_test_test_numeric_limits_cpp_bin_float no_eh_support) -if(HAS_TOMMATH) +if(TOMMATH_COMPILED) cm_test(NAME multiprecision_test_test_numeric_limits_tommath SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_numeric_limits.cpp) target_compile_definitions(multiprecision_test_test_numeric_limits_tommath PUBLIC -DTEST_TOMMATH) + target_link_libraries(multiprecision_test_test_numeric_limits_tommath ${TomMath_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_numeric_limits_tommath PRIVATE ${TomMath_INCLUDES}) endif() if(NOT CMAKE_CXX_COMPILER_ID MATCHES "GNU") cm_test(NAME multiprecision_test_test_numeric_limits_cpp_int SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_numeric_limits.cpp) target_compile_definitions(multiprecision_test_test_numeric_limits_cpp_int PUBLIC -DTEST_CPP_INT) + target_link_libraries(multiprecision_test_test_numeric_limits_cpp_int no_eh_support) endif() -if(HAS_MPFI) +if(MPFI_COMPILED) cm_test(NAME multiprecision_test_test_numeric_limits_mpfi_50 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_numeric_limits.cpp) target_compile_definitions(multiprecision_test_test_numeric_limits_mpfi_50 PUBLIC -DTEST_MPFI_50) + target_link_libraries(multiprecision_test_test_numeric_limits_mpfi_50 ${MPFI_LIBRARIES} ${MPFR_LIBRARIES} ${GMP_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_numeric_limits_mpfi_50 PRIVATE ${MPFI_INCLUDES}) endif() -if(HAS_FLOAT128) +if(FLOAT128_COMPILED) cm_test(NAME multiprecision_test_test_numeric_limits_float128 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_numeric_limits.cpp) target_compile_definitions(multiprecision_test_test_numeric_limits_float128 PUBLIC -DTEST_FLOAT128) endif() -if((HAS_INTEL_QUAD) AND (HAS_FLOAT128)) +if((INTEL_QUAD_COMPILED) AND (FLOAT128_COMPILED)) cm_test(NAME multiprecision_test_test_numeric_limits_intel_quad SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_numeric_limits.cpp) target_compile_definitions(multiprecision_test_test_numeric_limits_intel_quad PUBLIC -DTEST_FLOAT128) endif() +cm_test(NAME multiprecision_test_test_sf_import_c99_cpp_dec_float_2 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_sf_import_c99.cpp) +target_compile_definitions(multiprecision_test_test_sf_import_c99_cpp_dec_float_2 PUBLIC -DTEST_CPP_DEC_FLOAT_2) +cm_test(NAME multiprecision_test_test_sf_import_c99_cpp_dec_float_3 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_sf_import_c99.cpp) +target_compile_definitions(multiprecision_test_test_sf_import_c99_cpp_dec_float_3 PUBLIC -DTEST_CPP_DEC_FLOAT_3) +cm_test(NAME multiprecision_test_test_sf_import_c99_cpp_dec_float_4 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_sf_import_c99.cpp) +target_compile_definitions(multiprecision_test_test_sf_import_c99_cpp_dec_float_4 PUBLIC -DTEST_CPP_DEC_FLOAT_4) +cm_test(NAME multiprecision_test_test_sf_import_c99_cpp_dec_float_5 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_sf_import_c99.cpp) +target_compile_definitions(multiprecision_test_test_sf_import_c99_cpp_dec_float_5 PUBLIC -DTEST_CPP_DEC_FLOAT_5) +cm_test(NAME multiprecision_test_test_sf_import_c99_cpp_dec_float_6 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_sf_import_c99.cpp) +target_compile_definitions(multiprecision_test_test_sf_import_c99_cpp_dec_float_6 PUBLIC -DTEST_CPP_DEC_FLOAT_6) + +cm_test(NAME multiprecision_test_test_sf_import_c99_cpp_bin_float_2 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_sf_import_c99.cpp) +target_compile_definitions(multiprecision_test_test_sf_import_c99_cpp_bin_float_2 PUBLIC -DTEST_CPP_BIN_FLOAT_2) +cm_test(NAME multiprecision_test_test_sf_import_c99_cpp_bin_float_3 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_sf_import_c99.cpp) +target_compile_definitions(multiprecision_test_test_sf_import_c99_cpp_bin_float_3 PUBLIC -DTEST_CPP_BIN_FLOAT_2) + +if(MPFR_COMPILED) + cm_test(NAME multiprecision_test_test_move_mpfr SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_move.cpp) + target_compile_definitions(multiprecision_test_test_move_mpfr PUBLIC -DTEST_MPFR) + target_link_libraries(multiprecision_test_test_move_mpfr ${MPFR_LIBRARIES} ${GMP_LIBRARIES} no_eh_support) +endif() -if(NOT CMAKE_CXX_COMPILER_ID MATCHES "GNU") - set(LOCAL_SOURCES "") - # TODO: fix test. Reason error: [-fpermissive] - set(LOCAL_SOURCES test_log.cpp test_pow.cpp test_sinh.cpp test_sqrt.cpp test_cosh.cpp test_tanh.cpp test_sin.cpp - test_tan.cpp test_asin.cpp test_atan.cpp test_fpclassify.cpp) - foreach(FILE ${LOCAL_SOURCES}) - get_filename_component(NAME ${FILE} NAME_WE) - if(HAS_GMP) - cm_test(NAME multiprecision_test_${NAME}_mpf50 SOURCES ${CURRENT_TEST_SOURCES_DIR}/${FILE}) - target_compile_definitions(multiprecision_test_${NAME}_mpf50 PUBLIC -DTEST_MPF_50) - endif() - if(HAS_MPFR) - cm_test(NAME multiprecision_test_${NAME}_mpfr50 SOURCES ${CURRENT_TEST_SOURCES_DIR}/${FILE}) - target_compile_definitions(multiprecision_test_${NAME}_mpfr50 PUBLIC -DTEST_MPFR_50) - endif() - if(HAS_MPFI) - cm_test(NAME multiprecision_test_${NAME}_mpfi50 SOURCES ${CURRENT_TEST_SOURCES_DIR}/${FILE}) - target_compile_definitions(multiprecision_test_${NAME}_mpfi50 PUBLIC -DTEST_MPFI_50) - endif() - - cm_test(NAME multiprecision_test_${FILE}_cpp_dec_float SOURCES ${CURRENT_TEST_SOURCES_DIR}/${FILE}) - target_compile_definitions(multiprecision_test_${FILE}_cpp_dec_float PUBLIC -DTEST_CPP_DEC_FLOAT) - - cm_test(NAME multiprecision_test_${NAME}_cpp_bin_float SOURCES ${CURRENT_TEST_SOURCES_DIR}/${FILE}) - target_compile_definitions(multiprecision_test_${NAME}_cpp_bin_float PUBLIC -DTEST_CPP_BIN_FLOAT) +if(MPC_COMPILED) + cm_test(NAME multiprecision_test_test_move_mpc SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_move.cpp) + target_compile_definitions(multiprecision_test_test_move_mpc PUBLIC -DTEST_MPC) + target_link_libraries(multiprecision_test_test_move_mpc ${MPC_LIBRARIES} ${MPFR_LIBRARIES} ${GMP_LIBRARIES} no_eh_support) +endif() - if(HAS_FLOAT128) - cm_test(NAME multiprecision_test_${NAME}_float128 SOURCES ${CURRENT_TEST_SOURCES_DIR}/${FILE}) - target_compile_definitions(multiprecision_test_${NAME}_float128 PUBLIC -DTEST_FLOAT128) - endif() +if(GMP_COMPILED) + cm_test(NAME multiprecision_test_test_move_gmp SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_move.cpp) + target_compile_definitions(multiprecision_test_test_move_gmp PUBLIC -DTEST_GMP) + target_link_libraries(multiprecision_test_test_move_gmp ${GMP_LIBRARIES} no_eh_support) +endif() - if(HAS_INTEL_QUAD) - cm_test(NAME multiprecision_test_${NAME}_intel_quad SOURCES ${CURRENT_TEST_SOURCES_DIR}/${FILE}) - target_compile_definitions(multiprecision_test_${NAME}_intel_quad PUBLIC -DTEST_FLOAT128) - endif() - endforeach() +if(TOMMATH_COMPILED) + cm_test(NAME multiprecision_test_test_move_tommath SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_move.cpp) + target_compile_definitions(multiprecision_test_test_move_tommath PUBLIC -DTEST_TOMMATH) + target_link_libraries(multiprecision_test_test_move_tommath ${TomMath_LIBRARIES} no_eh_support) endif() -if(HAS_GMP) +cm_test(NAME multiprecision_test_test_move_cpp_int SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_move.cpp) +target_compile_definitions(multiprecision_test_test_move_tommath PUBLIC -DTEST_CPP_INT) +target_link_libraries(multiprecision_test_test_move_tommath no_eh_support) + +if(GMP_COMPILED) cm_test(NAME multiprecision_test_test_gmp_conversions SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_gmp_conversions.cpp) + target_link_libraries(multiprecision_test_test_gmp_conversions ${GMP_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_gmp_conversions PRIVATE ${GMP_INCLUDES}) endif() -if(HAS_MPFR) +if(MPFR_COMPILED) cm_test(NAME multiprecision_test_test_mpfr_conversions SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_mpfr_conversions.cpp) + target_link_libraries(multiprecision_test_test_mpfr_conversions ${MPFR_LIBRARIES} ${GMP_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_mpfr_conversions PRIVATE ${GMP_INCLUDES}) +endif() + +if(MPC_COMPILED) + cm_test(NAME multiprecision_test_test_mpc_conversions SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_mpfr_conversions.cpp) + target_link_libraries(multiprecision_test_test_mpc_conversions ${MPC_LIBRARIES} ${MPFR_LIBRARIES} ${GMP_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_mpc_conversions PRIVATE ${GMP_INCLUDES}) endif() -if(HAS_GMP) +if(GMP_COMPILED) cm_test(NAME multiprecision_test_test_constants_mpf50 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_constants.cpp) target_compile_definitions(multiprecision_test_test_constants_mpf50 PUBLIC -DTEST_MPF_50) + target_link_libraries(multiprecision_test_test_constants_mpf50 ${GMP_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_constants_mpf50 PRIVATE ${GMP_INCLUDES}) endif() -if(HAS_MPFR) +if(MPFR_COMPILED) cm_test(NAME multiprecision_test_test_constants_mpfr_50 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_constants.cpp) target_compile_definitions(multiprecision_test_test_constants_mpfr_50 PUBLIC -DTEST_MPFR_50) + target_link_libraries(multiprecision_test_test_constants_mpfr_50 ${MPFR_LIBRARIES} ${GMP_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_constants_mpfr_50 PRIVATE ${GMP_INCLUDES}) endif() cm_test(NAME multiprecision_test_test_constants_cpp_dec_float SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_constants.cpp) target_compile_definitions(multiprecision_test_test_constants_cpp_dec_float PUBLIC -DTEST_CPP_DEC_FLOAT) +target_link_libraries(multiprecision_test_test_constants_cpp_dec_float no_eh_support) -if(HAS_MPFR) - cm_test(NAME multiprecision_test_test_move_mpfr SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_move.cpp) - target_compile_definitions(multiprecision_test_test_move_mpfr PUBLIC -DTEST_MPFR) -endif() +cm_test(NAME multiprecision_test_test_test SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_test.cpp) -if(HAS_GMP) - cm_test(NAME multiprecision_test_test_move_gmp SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_move.cpp) - target_compile_definitions(multiprecision_test_test_move_gmp PUBLIC -DTEST_GMP) -endif() +cm_test(NAME multiprecision_test_test_cpp_int_lit SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_cpp_int_lit.cpp) +target_link_libraries(multiprecision_test_test_cpp_int_lit no_eh_support) + +if ((GMP_COMPILED) AND (MPFR_COMPILED) AND (MPFI_COMPILED) AND (TOMMATH_COMPILED) AND (FLOAT128_COMPILED)) + cm_test(NAME multiprecision_test_test_convert_from_cpp_int SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_convert_from_cpp_int.cpp) + target_link_libraries(multiprecision_test_test_convert_from_cpp_int ${QUADMATH_LIBRARIES} ${TomMath_LIBRARIES} + ${MPFI_LIBRARIES} ${MPFR_LIBRARIES} ${GMP_LIBRARIES}) + target_compile_definitions(multiprecision_test_test_convert_from_cpp_int PRIVATE -DHAS_GMP -DHAS_MPFR -DHAS_MPFI -DHAS_TOMMATH -DFLOAT128_COMPILED) + + cm_test(NAME multiprecision_test_test_convert_from_mpz_int SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_convert_from_mpz_int.cpp) + target_link_libraries(multiprecision_test_test_convert_from_mpz_int ${QUADMATH_LIBRARIES} ${TomMath_LIBRARIES} + ${MPFI_LIBRARIES} ${MPFR_LIBRARIES} ${GMP_LIBRARIES}) + target_compile_definitions(multiprecision_test_test_convert_from_mpz_int PRIVATE -DHAS_GMP -DHAS_MPFR -DHAS_MPFI -DHAS_TOMMATH -DFLOAT128_COMPILED) + + cm_test(NAME multiprecision_test_test_convert_from_tom_int SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_convert_from_tom_int.cpp) + target_link_libraries(multiprecision_test_test_convert_from_tom_int ${QUADMATH_LIBRARIES} ${TomMath_LIBRARIES} + ${MPFI_LIBRARIES} ${MPFR_LIBRARIES} ${GMP_LIBRARIES}) + target_compile_definitions(multiprecision_test_test_convert_from_tom_int PRIVATE -DHAS_GMP -DHAS_MPFR -DHAS_MPFI -DHAS_TOMMATH -DFLOAT128_COMPILED) + + cm_test(NAME multiprecision_test_test_convert_from_cpp_rational SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_convert_from_cpp_rational.cpp) + target_link_libraries(multiprecision_test_test_convert_from_cpp_rational ${QUADMATH_LIBRARIES} ${TomMath_LIBRARIES} + ${MPFI_LIBRARIES} ${MPFR_LIBRARIES} ${GMP_LIBRARIES}) + target_compile_definitions(multiprecision_test_test_convert_from_cpp_rational PRIVATE -DHAS_GMP -DHAS_MPFR -DHAS_MPFI -DHAS_TOMMATH -DFLOAT128_COMPILED) + + cm_test(NAME multiprecision_test_test_convert_from_gmp_rational SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_convert_from_gmp_rational.cpp) + target_link_libraries(test_convert_from_gmp_rational ${QUADMATH_LIBRARIES} ${TomMath_LIBRARIES} + ${MPFI_LIBRARIES} ${MPFR_LIBRARIES} ${GMP_LIBRARIES}) + target_compile_definitions(multiprecision_test_test_convert_from_gmp_rational PRIVATE -DHAS_GMP -DHAS_MPFR -DHAS_MPFI -DHAS_TOMMATH -DFLOAT128_COMPILED) + + cm_test(NAME multiprecision_test_test_convert_from_tom_rational SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_convert_from_tom_rational.cpp) + target_link_libraries(test_convert_from_tom_rational ${QUADMATH_LIBRARIES} ${TomMath_LIBRARIES} + ${MPFI_LIBRARIES} ${MPFR_LIBRARIES} ${GMP_LIBRARIES}) + target_compile_definitions(multiprecision_test_test_convert_from_tom_rational PRIVATE -DHAS_GMP -DHAS_MPFR -DHAS_MPFI -DHAS_TOMMATH -DFLOAT128_COMPILED) + + cm_test(NAME multiprecision_test_test_convert_from_cpp_bin_float SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_convert_from_cpp_bin_float.cpp) + target_link_libraries(test_convert_from_cpp_bin_float ${QUADMATH_LIBRARIES} ${TomMath_LIBRARIES} + ${MPFI_LIBRARIES} ${MPFR_LIBRARIES} ${GMP_LIBRARIES}) + target_compile_definitions(multiprecision_test_test_convert_from_cpp_bin_float PRIVATE -DHAS_GMP -DHAS_MPFR -DHAS_MPFI -DHAS_TOMMATH -DFLOAT128_COMPILED) + + cm_test(NAME multiprecision_test_test_convert_from_cpp_dec_float SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_convert_from_cpp_dec_float.cpp) + target_link_libraries(test_convert_from_cpp_dec_float ${QUADMATH_LIBRARIES} ${TomMath_LIBRARIES} + ${MPFI_LIBRARIES} ${MPFR_LIBRARIES} ${GMP_LIBRARIES}) + target_compile_definitions(multiprecision_test_test_convert_from_cpp_dec_float PRIVATE -DHAS_GMP -DHAS_MPFR -DHAS_MPFI -DHAS_TOMMATH -DFLOAT128_COMPILED) + + cm_test(NAME multiprecision_test_test_convert_from_mpf_float SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_convert_from_mpf_float.cpp) + target_link_libraries(test_convert_from_mpf_float ${QUADMATH_LIBRARIES} ${TomMath_LIBRARIES} + ${MPFI_LIBRARIES} ${MPFR_LIBRARIES} ${GMP_LIBRARIES}) + target_compile_definitions(multiprecision_test_test_convert_from_mpf_float PRIVATE -DHAS_GMP -DHAS_MPFR -DHAS_MPFI -DHAS_TOMMATH -DFLOAT128_COMPILED) + + cm_test(NAME multiprecision_test_test_convert_from_mpfr_float SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_convert_from_mpfr_float.cpp) + target_link_libraries(test_convert_from_mpfr_float ${QUADMATH_LIBRARIES} ${TomMath_LIBRARIES} + ${MPFI_LIBRARIES} ${MPFR_LIBRARIES} ${GMP_LIBRARIES}) + target_compile_definitions(multiprecision_test_test_convert_from_mpfr_float PRIVATE -DHAS_GMP -DHAS_MPFR -DHAS_MPFI -DHAS_TOMMATH -DFLOAT128_COMPILED) + + cm_test(NAME multiprecision_test_test_convert_from_mpfi_float SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_convert_from_mpfi_float.cpp) + target_link_libraries(test_convert_from_mpfi_float ${QUADMATH_LIBRARIES} ${TomMath_LIBRARIES} + ${MPFI_LIBRARIES} ${MPFR_LIBRARIES} ${GMP_LIBRARIES}) + target_compile_definitions(multiprecision_test_test_convert_from_mpfi_float PRIVATE -DHAS_GMP -DHAS_MPFR -DHAS_MPFI -DHAS_TOMMATH -DFLOAT128_COMPILED) + + cm_test(NAME multiprecision_test_test_convert_from_float128 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_convert_from_float128.cpp) + target_link_libraries(test_convert_from_float128 ${QUADMATH_LIBRARIES} ${TomMath_LIBRARIES} + ${MPFI_LIBRARIES} ${MPFR_LIBRARIES} ${GMP_LIBRARIES}) + target_compile_definitions(multiprecision_test_test_convert_from_float128 PRIVATE -DHAS_GMP -DHAS_MPFR -DHAS_MPFI -DHAS_TOMMATH -DFLOAT128_COMPILED) -if(HAS_TOMMATH) - cm_test(NAME multiprecision_test_test_move_tommath SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_move.cpp) - target_compile_definitions(multiprecision_test_test_move_tommath PUBLIC -DTEST_TOMMATH) endif() -if(NOT CMAKE_CXX_COMPILER_ID MATCHES "GNU") - # TODO: fix test. Reason error: [-fpermissive] - cm_test(NAME multiprecision_test_test_move_cpp_int SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_move.cpp) - target_compile_definitions(multiprecision_test_test_move_cpp_int PUBLIC -DTEST_CPP_INT) -endif() +cm_test(NAME multiprecision_test_test_cpp_bin_float_conv SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_cpp_bin_float_conv.cpp) -cm_test(NAME multiprecision_test_test_test SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_test.cpp) +cm_test(NAME multiprecision_test_test_cpp_bin_float_io_1 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_cpp_bin_float_io.cpp) +target_compile_definitions(multiprecision_test_test_cpp_bin_float_io_1 PUBLIC -DTEST1 -DTEST_CPP_BIN_FLOAT) -if(NOT CMAKE_CXX_COMPILER_ID MATCHES "GNU") - # TODO: fix test. Reason error: [-fpermissive] - cm_test(NAME multiprecision_test_test_cpp_int_lit SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_cpp_int_lit.cpp) -endif() +cm_test(NAME multiprecision_test_test_cpp_bin_float_io_2 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_cpp_bin_float_io.cpp) +target_compile_definitions(multiprecision_test_test_cpp_bin_float_io_2 PUBLIC -DTEST2 -DTEST_CPP_BIN_FLOAT) -if((HAS_FLOAT128) AND (HAS_INTEL_QUAD)) - cm_test(NAME multiprecision_test_test_constexpr SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_constexpr.cpp COMPILE_ONLY) - target_compile_definitions(multiprecision_test_test_constexpr PUBLIC -DHAVE_FLOAT128) +if(MPFR_COMPILED) + cm_test(NAME multiprecision_test_test_cpp_bin_float SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_cpp_bin_float.cpp) + target_compile_definitions(multiprecision_test_test_cpp_bin_float PUBLIC -DTEST_MPFR) + target_link_libraries(multiprecision_test_test_cpp_bin_float ${MPFR_LIBRARIES} ${GMP_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_cpp_bin_float PRIVATE ${GMP_INCLUDES}) endif() -cm_test(NAME multiprecision_test_test_nothrow_cpp_int SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_nothrow_cpp_int.cpp COMPILE_ONLY) -cm_test(NAME multiprecision_test_test_nothrow_cpp_rational SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_nothrow_cpp_rational.cpp COMPILE_ONLY) - -cm_test(NAME multiprecision_test_test_nothrow_cpp_bin_float SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_nothrow_cpp_bin_float.cpp COMPILE_ONLY) -cm_test(NAME multiprecision_test_test_nothrow_cpp_dec_float SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_nothrow_cpp_dec_float.cpp COMPILE_ONLY) - +cm_test(NAME multiprecision_test_cpp_dec_float SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_float_io.cpp) +target_compile_definitions(multiprecision_test_cpp_dec_float PUBLIC -DTEST_CPP_DEC_FLOAT) +target_link_libraries(multiprecision_test_cpp_dec_float no_eh_support) -if(HAS_FLOAT128) - cm_test(NAME multiprecision_test_test_nothrow_float128 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_nothrow_float128.cpp COMPILE_ONLY) +if(GMP_COMPILED) + cm_test(NAME multiprecision_test_test_float_io_mpf SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_float_io.cpp) + target_compile_definitions(multiprecision_test_test_float_io_mpf PUBLIC -DTEST_MPF_50) + target_link_libraries(multiprecision_test_test_float_io_mpf ${GMP_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_float_io_mpf PRIVATE ${GMP_INCLUDES}) endif() -if(HAS_GMP) - cm_test(NAME multiprecision_test_test_nothrow_gmp SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_nothrow_gmp.cpp COMPILE_ONLY) +if(MPFR_COMPILED) + cm_test(NAME multiprecision_test_test_float_io_mpfr SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_float_io.cpp) + target_compile_definitions(multiprecision_test_test_float_io_mpfr PUBLIC -DTEST_MPFR_50) + target_link_libraries(multiprecision_test_test_float_io_mpfr ${MPFR_LIBRARIES} ${GMP_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_float_io_mpfr PRIVATE ${GMP_INCLUDES}) endif() -if(HAS_MPFR) - cm_test(NAME multiprecision_test_test_nothrow_mpfr SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_nothrow_mpfr.cpp COMPILE_ONLY) +if(MPFI_COMPILED) + cm_test(NAME multiprecision_test_test_float_io_mpfi SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_float_io.cpp) + target_compile_definitions(multiprecision_test_test_float_io_mpfi PUBLIC -DTEST_MPFI_50) + target_link_libraries(multiprecision_test_test_float_io_mpfi ${MPFI_LIBRARIES} ${MPFR_LIBRARIES} ${GMP_LIBRARIES} ${TomMath_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_float_io_mpfi PRIVATE ${GMP_INCLUDES} ${MPFI_INCLUDES}) endif() -if(NOT CMAKE_CXX_COMPILER_ID MATCHES "GNU") - # TODO: fix test. Reason error: [-fpermissive] - cm_test(NAME multiprecision_test_test_cpp_bin_float_io_1 SOURCES ${CMAKE_CURRENT_BINARY_DIR}/test_cpp_bin_float_io.cpp SOURCES_PREFIX ${CURRENT_TEST_SOURCES_DIR}) - target_compile_definitions(multiprecision_test_test_cpp_bin_float_io_1 PUBLIC -DTEST1 -DTEST_CPP_BIN_FLOAT) - - cm_test(NAME multiprecision_test_test_cpp_bin_float_io_2 SOURCES ${CMAKE_CURRENT_BINARY_DIR}/test_cpp_bin_float_io.cpp SOURCES_PREFIX ${CURRENT_TEST_SOURCES_DIR}) - target_compile_definitions(multiprecision_test_test_cpp_bin_float_io_2 PUBLIC -DTEST2 -DTEST_CPP_BIN_FLOAT) - - if(HAS_MPFR) - cm_test(NAME multiprecision_test_test_cpp_bin_float SOURCES ${CMAKE_CURRENT_BINARY_DIR}/test_cpp_bin_float.cpp SOURCES_PREFIX ${CURRENT_TEST_SOURCES_DIR}) - target_compile_definitions(multiprecision_test_test_cpp_bin_float PUBLIC -DTEST_MPFR) - endif() +if(FLOAT128_COMPILED) + cm_test(NAME multiprecision_test_test_float_io_float128 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_float_io.cpp) + target_compile_definitions(multiprecision_test_test_float_io_float128 PUBLIC -DTEST_FLOAT128) + target_link_libraries(multiprecision_test_test_float_io_float128 ${QUADMATH_LIBRARIES} no_eh_support) +endif() - cm_test(NAME multiprecision_test_cpp_dec_float SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_float_io.cpp SOURCES_PREFIX ${CURRENT_TEST_SOURCES_DIR}) - target_compile_definitions(multiprecision_test_cpp_dec_float PUBLIC -DTEST_CPP_DEC_FLOAT) +if((INTEL_QUAD_COMPILED) AND (FLOAT128_COMPILED)) + cm_test(NAME multiprecision_test_test_float_io_intel_quad SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_float_io.cpp) + target_compile_definitions(multiprecision_test_test_float_io_intel_quad PUBLIC -DTEST_FLOAT128) + target_link_libraries(multiprecision_test_test_float_io_intel_quad no_eh_support) +endif() - if(HAS_GMP) - cm_test(NAME multiprecision_test_test_float_io_mpf SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_float_io.cpp SOURCES_PREFIX ${CURRENT_TEST_SOURCES_DIR}) - target_compile_definitions(multiprecision_test_test_float_io_mpf PUBLIC -DTEST_MPF_50) - endif() +if(TOMMATH_COMPILED) + cm_test(NAME multiprecision_test_test_int_io_tommath SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_int_io.cpp) + target_compile_definitions(multiprecision_test_test_int_io_tommath PUBLIC -DTEST_TOMMATH) + target_link_libraries(multiprecision_test_test_int_io_tommath ${TomMath_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_int_io_tommath PRIVATE ${TomMath_INCLUDES}) +endif() - if(HAS_MPFR) - cm_test(NAME multiprecision_test_test_float_io_mpfr SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_float_io.cpp SOURCES_PREFIX ${CURRENT_TEST_SOURCES_DIR}) - target_compile_definitions(multiprecision_test_test_float_io_mpfr PUBLIC -DTEST_MPFR_50) - endif() +if(GMP_COMPILED) + cm_test(NAME multiprecision_test_test_int_io_mpz SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_int_io.cpp) + target_compile_definitions(multiprecision_test_test_int_io_mpz PUBLIC -DTEST_MPZ) + target_link_libraries(multiprecision_test_test_int_io_mpz ${GMP_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_int_io_mpz PRIVATE ${GMP_INCLUDES}) +endif() - if(HAS_MPFI) - cm_test(NAME multiprecision_test_test_float_io_mpfi SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_float_io.cpp SOURCES_PREFIX ${CURRENT_TEST_SOURCES_DIR}) - target_compile_definitions(multiprecision_test_test_float_io_mpfi PUBLIC -DTEST_MPFI_50) - endif() +cm_test(NAME multiprecision_test_test_int_io_cpp_int SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_int_io.cpp) +target_compile_definitions(multiprecision_test_test_int_io_cpp_int PUBLIC -DTEST_CPP_INT) +target_link_libraries(multiprecision_test_test_int_io_cpp_int no_eh_support) + +if(GMP_COMPILED) + cm_test(NAME multiprecision_test_test_cpp_int_left_shift SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_cpp_int_left_shift.cpp) + target_link_libraries(multiprecision_test_test_cpp_int_left_shift ${GMP_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_cpp_int_left_shift PRIVATE ${GMP_INCLUDES}) + + cm_test(NAME multiprecision_test_test_cpp_int_1 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_cpp_int.cpp) + target_compile_definitions(multiprecision_test_test_cpp_int_1 PUBLIC -DTEST1) + target_link_libraries(multiprecision_test_test_cpp_int_1 ${GMP_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_cpp_int_1 PRIVATE ${GMP_INCLUDES}) + + cm_test(NAME multiprecision_test_test_cpp_int_2 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_cpp_int.cpp) + target_compile_definitions(multiprecision_test_test_cpp_int_2 PUBLIC -DTEST2) + target_link_libraries(multiprecision_test_test_cpp_int_2 ${GMP_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_cpp_int_2 PRIVATE ${GMP_INCLUDES}) + + cm_test(NAME multiprecision_test_test_cpp_int_3 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_cpp_int.cpp) + target_compile_definitions(multiprecision_test_test_cpp_int_3 PUBLIC -DTEST3) + target_link_libraries(multiprecision_test_test_cpp_int_3 ${GMP_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_cpp_int_3 PRIVATE ${GMP_INCLUDES}) + + cm_test(NAME multiprecision_test_test_cpp_int_4 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_cpp_int.cpp) + target_compile_definitions(multiprecision_test_test_cpp_int_4 PUBLIC -DTEST4) + target_link_libraries(multiprecision_test_test_cpp_int_4 ${GMP_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_cpp_int_4 PRIVATE ${GMP_INCLUDES}) + + cm_test(NAME multiprecision_test_test_cpp_int_5 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_cpp_int.cpp) + target_compile_definitions(multiprecision_test_test_cpp_int_5 PUBLIC -DTEST5) + target_link_libraries(multiprecision_test_test_cpp_int_5 ${GMP_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_cpp_int_5 PRIVATE ${GMP_INCLUDES}) +endif() - if(HAS_FLOAT128) - cm_test(NAME multiprecision_test_test_float_io_float128 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_float_io.cpp SOURCES_PREFIX ${CURRENT_TEST_SOURCES_DIR}) - target_compile_definitions(multiprecision_test_test_float_io_float128 PUBLIC -DTEST_FLOAT128) - endif() +cm_test(NAME multiprecision_test_test_checked_cpp_int SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_checked_cpp_int.cpp) +target_link_libraries(multiprecision_test_test_checked_cpp_int no_eh_support) +cm_test(NAME multiprecision_test_test_unchecked_cpp_int SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_unchecked_cpp_int.cpp) +target_link_libraries(multiprecision_test_test_unchecked_cpp_int no_eh_support) - if((HAS_INTEL_QUAD) AND (HAS_FLOAT128)) - cm_test(NAME multiprecision_test_test_float_io_intel_quad SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_float_io.cpp SOURCES_PREFIX ${CURRENT_TEST_SOURCES_DIR}) - target_compile_definitions(multiprecision_test_test_float_io_intel_quad PUBLIC -DTEST_FLOAT128) - endif() +cm_test(NAME multiprecision_test_test_cpp_int_serial_1 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_cpp_int_serial.cpp) +target_compile_definitions(multiprecision_test_test_cpp_int_serial_1 PUBLIC -DTEST1) +cm_test(NAME multiprecision_test_test_cpp_int_serial_2 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_cpp_int_serial.cpp) +target_compile_definitions(multiprecision_test_test_cpp_int_serial_2 PUBLIC -DTEST2) +cm_test(NAME multiprecision_test_test_cpp_int_serial_3 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_cpp_int_serial.cpp) +target_compile_definitions(multiprecision_test_test_cpp_int_serial_3 PUBLIC -DTEST3) +cm_test(NAME multiprecision_test_test_cpp_int_serial_4 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_cpp_int_serial.cpp) +target_compile_definitions(multiprecision_test_test_cpp_int_serial_4 PUBLIC -DTEST4) - if(HAS_TOMMATH) - cm_test(NAME multiprecision_test_test_int_io_tommath SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_int_io.cpp SOURCES_PREFIX ${CURRENT_TEST_SOURCES_DIR}) - target_compile_definitions(multiprecision_test_test_int_io_tommath PUBLIC -DTEST_TOMMATH) - endif() +cm_test(NAME multiprecision_test_test_cpp_int_deserial SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_cpp_int_deserial.cpp) +cm_test(NAME multiprecision_test_test_cpp_rat_serial SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_cpp_rat_serial.cpp) - if(HAS_GMP) - cm_test(NAME multiprecision_test_test_int_io_mpz SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_int_io.cpp SOURCES_PREFIX ${CURRENT_TEST_SOURCES_DIR}) - target_compile_definitions(multiprecision_test_test_int_io_mpz PUBLIC -DTEST_MPZ) - endif() +if((FLOAT128_COMPILED) AND (QUADMATH_COMPILED)) + cm_test(NAME multiprecision_test_test_constexpr SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_constexpr.cpp COMPILE_ONLY) + target_compile_definitions(multiprecision_test_test_constexpr PUBLIC -DHAVE_FLOAT128) +endif() - cm_test(NAME multiprecision_test_test_int_io_cpp_int SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_int_io.cpp SOURCES_PREFIX ${CURRENT_TEST_SOURCES_DIR}) - target_compile_definitions(multiprecision_test_test_int_io_cpp_int PUBLIC -DTEST_CPP_INT) +cm_test(NAME multiprecision_test_test_nothrow_cpp_int SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_nothrow_cpp_int.cpp COMPILE_ONLY) +cm_test(NAME multiprecision_test_test_nothrow_cpp_rational SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_nothrow_cpp_rational.cpp COMPILE_ONLY) - if(HAS_GMP) - cm_test(NAME multiprecision_test_test_cpp_int_1 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_cpp_int.cpp SOURCES_PREFIX ${CURRENT_TEST_SOURCES_DIR}) - target_compile_definitions(multiprecision_test_test_cpp_int_1 PUBLIC -DTEST1) +cm_test(NAME multiprecision_test_test_nothrow_cpp_bin_float SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_nothrow_cpp_bin_float.cpp COMPILE_ONLY) +cm_test(NAME multiprecision_test_test_nothrow_cpp_dec_float SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_nothrow_cpp_dec_float.cpp COMPILE_ONLY) - cm_test(NAME multiprecision_test_test_cpp_int_2 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_cpp_int.cpp SOURCES_PREFIX ${CURRENT_TEST_SOURCES_DIR}) - target_compile_definitions(multiprecision_test_test_cpp_int_2 PUBLIC -DTEST2) +if(FLOAT128_COMPILED) + cm_test(NAME multiprecision_test_test_nothrow_float128 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_nothrow_float128.cpp COMPILE_ONLY) +endif() - cm_test(NAME multiprecision_test_test_cpp_int_3 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_cpp_int.cpp SOURCES_PREFIX ${CURRENT_TEST_SOURCES_DIR}) - target_compile_definitions(multiprecision_test_test_cpp_int_3 PUBLIC -DTEST2) - endif() +if(GMP_COMPILED) + cm_test(NAME multiprecision_test_test_nothrow_gmp SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_nothrow_gmp.cpp COMPILE_ONLY) endif() -if(NOT CMAKE_CXX_COMPILER_ID MATCHES "GNU") - # TODO: fix test. Reason error: [-fpermissive] - cm_test(NAME multiprecision_test_test_checked_cpp_int SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_checked_cpp_int.cpp) +if(MPFR_COMPILED) + cm_test(NAME multiprecision_test_test_nothrow_mpfr SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_nothrow_mpfr.cpp COMPILE_ONLY) endif() -if(HAS_GMP) +if(GMP_COMPILED) cm_test(NAME multiprecision_test_test_miller_rabin SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_miller_rabin.cpp) + target_link_libraries(multiprecision_test_test_miller_rabin ${GMP_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_miller_rabin PRIVATE ${GMP_INCLUDES}) endif() -if(NOT CMAKE_CXX_COMPILER_ID MATCHES "GNU") - # TODO: fix test. Reason error: [-fpermissive] - if(HAS_TOMMATH) - cm_test(NAME multiprecision_test_test_rational_io_tommath SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_rational_io.cpp) - target_compile_definitions(multiprecision_test_test_rational_io_tommath PUBLIC -DTEST_TOMMATH) - endif() - - if(HAS_GMP) - cm_test(NAME multiprecision_test_test_rational_io_mpz SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_rational_io.cpp) - target_compile_definitions(multiprecision_test_test_rational_io_mpz PUBLIC -DTEST_MPQ) - endif() +if(TOMMATH_COMPILED) + cm_test(NAME multiprecision_test_test_rational_io_tommath SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_rational_io.cpp) + target_compile_definitions(multiprecision_test_test_rational_io_tommath PUBLIC -DTEST_TOMMATH) + target_link_libraries(multiprecision_test_test_rational_io_tommath ${TomMath_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_rational_io_tommath PRIVATE ${TomMath_INCLUDES}) +endif() - cm_test(NAME multiprecision_test_test_rational_io_cpp_int SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_rational_io.cpp) - target_compile_definitions(multiprecision_test_test_rational_io_cpp_int PUBLIC -DTEST_CPP_INT) +if(GMP_COMPILED) + cm_test(NAME multiprecision_test_test_rational_io_mpz SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_rational_io.cpp) + target_compile_definitions(multiprecision_test_test_rational_io_mpz PUBLIC -DTEST_MPQ) + target_link_libraries(multiprecision_test_test_rational_io_mpz ${GMP_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_rational_io_mpz PRIVATE ${GMP_INCLUDES}) endif() -if((HAS_GMP) AND (HAS_TOMMATH) AND (HAS_MPFR)) +cm_test(NAME multiprecision_test_test_rational_io_cpp_int SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_rational_io.cpp) +target_compile_definitions(multiprecision_test_test_rational_io_cpp_int PUBLIC -DTEST_CPP_INT) +target_link_libraries(multiprecision_test_test_rational_io_cpp_int ${GMP_LIBRARIES} no_eh_support) + +if((GMP_COMPILED) AND (TOMMATH_COMPILED) AND (MPFR_COMPILED)) cm_test(NAME multiprecision_test_test_generic_conv SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_generic_conv.cpp) target_compile_definitions(multiprecision_test_test_generic_conv PUBLIC -DTEST_GMP -DTEST_TOMMATH -DTEST_MPFR) - + target_link_libraries(multiprecision_test_test_generic_conv ${TomMath_LIBRARIES} ${MPFR_LIBRARIES} ${GMP_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_generic_conv PRIVATE ${GMP_INCLUDES}) endif() -if(NOT CMAKE_CXX_COMPILER_ID MATCHES "GNU") - # TODO: fix test. Reason error: [-fpermissive] - cm_test(NAME multiprecision_test_test_rat_float_interconv_1 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_rat_float_interconv.cpp) - target_compile_definitions(multiprecision_test_test_rat_float_interconv_1 PUBLIC TEST1) +cm_test(NAME multiprecision_test_test_rat_float_interconv_1 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_rat_float_interconv.cpp) +target_compile_definitions(multiprecision_test_test_rat_float_interconv_1 PUBLIC -DTEST1) +target_link_libraries(multiprecision_test_test_rat_float_interconv_1 no_eh_support) - cm_test(NAME multiprecision_test_test_rat_float_interconv_2 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_rat_float_interconv.cpp) - target_compile_definitions(multiprecision_test_test_rat_float_interconv_2 PUBLIC TEST2) +cm_test(NAME multiprecision_test_test_rat_float_interconv_2 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_rat_float_interconv.cpp) +target_compile_definitions(multiprecision_test_test_rat_float_interconv_2 PUBLIC -DTEST2) +target_link_libraries(multiprecision_test_test_rat_float_interconv_2 no_eh_support) - cm_test(NAME multiprecision_test_test_rat_float_interconv_3 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_rat_float_interconv.cpp) - target_compile_definitions(multiprecision_test_test_rat_float_interconv_3 PUBLIC TEST3) +cm_test(NAME multiprecision_test_test_rat_float_interconv_3 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_rat_float_interconv.cpp) +target_compile_definitions(multiprecision_test_test_rat_float_interconv_3 PUBLIC -DTEST3) +target_link_libraries(multiprecision_test_test_rat_float_interconv_3 no_eh_support) - cm_test(NAME multiprecision_test_test_rat_float_interconv_4 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_rat_float_interconv.cpp) - target_compile_definitions(multiprecision_test_test_rat_float_interconv_4 PUBLIC TEST4) -endif() +cm_test(NAME multiprecision_test_test_rat_float_interconv_4 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_rat_float_interconv.cpp) +target_compile_definitions(multiprecision_test_test_rat_float_interconv_4 PUBLIC -DTEST4) +target_link_libraries(multiprecision_test_test_rat_float_interconv_4 no_eh_support) -if(HAS_MPFR) +if(MPFR_COMPILED) cm_test(NAME multiprecision_test_test_rat_float_interconv_5 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_rat_float_interconv.cpp) target_compile_definitions(multiprecision_test_test_rat_float_interconv_5 PUBLIC -DTEST5) + target_link_libraries(multiprecision_test_test_rat_float_interconv_5 ${MPFR_LIBRARIES} ${GMP_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_rat_float_interconv_5 PRIVATE ${GMP_INCLUDES}) cm_test(NAME multiprecision_test_test_rat_float_interconv_6 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_rat_float_interconv.cpp) target_compile_definitions(multiprecision_test_test_rat_float_interconv_6 PUBLIC -DTEST6) + target_link_libraries(multiprecision_test_test_rat_float_interconv_6 ${MPFR_LIBRARIES} ${GMP_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_rat_float_interconv_6 PRIVATE ${GMP_INCLUDES}) cm_test(NAME multiprecision_test_test_rat_float_interconv_7 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_rat_float_interconv.cpp) target_compile_definitions(multiprecision_test_test_rat_float_interconv_7 PUBLIC -DTEST7) + target_link_libraries(multiprecision_test_test_rat_float_interconv_7 ${MPFR_LIBRARIES} ${GMP_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_rat_float_interconv_7 PRIVATE ${GMP_INCLUDES}) cm_test(NAME multiprecision_test_test_rat_float_interconv_8 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_rat_float_interconv.cpp) target_compile_definitions(multiprecision_test_test_rat_float_interconv_8 PUBLIC -DTEST8) + target_link_libraries(multiprecision_test_test_rat_float_interconv_8 ${MPFR_LIBRARIES} ${GMP_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_rat_float_interconv_8 PRIVATE ${GMP_INCLUDES}) endif() -if(NOT CMAKE_CXX_COMPILER_ID MATCHES "GNU") - # TODO: fix test. Reason error: [-fpermissive] - cm_test(NAME multiprecision_test_test_cpp_int_conv SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_cpp_int_conv.cpp) - cm_test(NAME multiprecision_test_test_native_integer SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_native_integer.cpp) - cm_test(NAME multiprecision_test_test_mixed_cpp_int SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_mixed_cpp_int.cpp) +cm_test(NAME multiprecision_test_test_cpp_int_conv SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_cpp_int_conv.cpp) +target_link_libraries(multiprecision_test_test_cpp_int_conv no_eh_support) +cm_test(NAME multiprecision_test_test_cpp_int_import_export SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_cpp_int_import_export.cpp) +target_link_libraries(multiprecision_test_test_cpp_int_import_export no_eh_support) +cm_test(NAME multiprecision_test_test_native_integer SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_native_integer.cpp) +target_link_libraries(multiprecision_test_test_native_integer no_eh_support) - if((HAS_GMP) AND (HAS_MPFR)) - cm_test(NAME multiprecision_test_test_mixed_float SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_mixed_float.cpp) - endif() +cm_test(NAME multiprecision_test_test_mixed_cpp_int SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_mixed_cpp_int.cpp) +target_link_libraries(multiprecision_test_test_mixed_cpp_int no_eh_support) + +if((GMP_COMPILED) AND (MPFR_COMPILED)) + cm_test(NAME multiprecision_test_test_mixed_float SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_mixed_float.cpp) + target_link_libraries(multiprecision_test_test_mixed_float ${MPFR_LIBRARIES} ${GMP_LIBRARIES} no_eh_support) endif() -if(HAS_MPFR) +if(MPFR_COMPILED) cm_test(NAME multiprecision_test_include_test_mpfr_include_test SOURCES ${CURRENT_TEST_SOURCES_DIR}/include_test/mpfr_include_test.cpp COMPILE_ONLY) endif() -if(HAS_GMP) +if(GMP_COMPILED) cm_test(NAME multiprecision_test_include_test_gmp_include_test SOURCES ${CURRENT_TEST_SOURCES_DIR}/include_test/gmp_include_test.cpp COMPILE_ONLY) endif() -if(HAS_TOMMATH) +if(TOMMATH_COMPILED) cm_test(NAME multiprecision_test_include_test_tommath_include_test SOURCES ${CURRENT_TEST_SOURCES_DIR}/include_test/tommath_include_test.cpp COMPILE_ONLY) endif() cm_test(NAME multiprecision_test_include_test_cpp_int_include_test SOURCES ${CURRENT_TEST_SOURCES_DIR}/include_test/cpp_int_include_test.cpp COMPILE_ONLY) @@ -470,21 +800,25 @@ cm_test(NAME multiprecision_test_ublas_interop_test1 SOURCES ${CURRENT_TEST_SOUR ${CURRENT_TEST_SOURCES_DIR}/ublas_interop/test11.cpp ${CURRENT_TEST_SOURCES_DIR}/ublas_interop/test12.cpp ${CURRENT_TEST_SOURCES_DIR}/ublas_interop/test13.cpp) - +target_link_libraries(multiprecision_test_ublas_interop_test1 no_eh_support) cm_test(NAME multiprecision_test_ublas_interop_test2 SOURCES ${CURRENT_TEST_SOURCES_DIR}/ublas_interop/test2.cpp ${CURRENT_TEST_SOURCES_DIR}/ublas_interop/test21.cpp ${CURRENT_TEST_SOURCES_DIR}/ublas_interop/test22.cpp ${CURRENT_TEST_SOURCES_DIR}/ublas_interop/test23.cpp) +target_link_libraries(multiprecision_test_ublas_interop_test2 no_eh_support) #run ublas_interop/test3.cpp ublas_interop/test31.cpp ublas_interop/test32.cpp ublas_interop/test33.cpp ; cm_test(NAME multiprecision_test_ublas_interop_test4 SOURCES ${CURRENT_TEST_SOURCES_DIR}/ublas_interop/test4.cpp ${CURRENT_TEST_SOURCES_DIR}/ublas_interop/test42.cpp ${CURRENT_TEST_SOURCES_DIR}/ublas_interop/test43.cpp) +target_link_libraries(multiprecision_test_ublas_interop_test4 no_eh_support) cm_test(NAME multiprecision_test_ublas_interop_test5 SOURCES ${CURRENT_TEST_SOURCES_DIR}/ublas_interop/test5.cpp ${CURRENT_TEST_SOURCES_DIR}/ublas_interop/test52.cpp ${CURRENT_TEST_SOURCES_DIR}/ublas_interop/test53.cpp) +target_link_libraries(multiprecision_test_ublas_interop_test5 no_eh_support) cm_test(NAME multiprecision_test_ublas_interop_test6 SOURCES ${CURRENT_TEST_SOURCES_DIR}/ublas_interop/test6.cpp ${CURRENT_TEST_SOURCES_DIR}/ublas_interop/test62.cpp ${CURRENT_TEST_SOURCES_DIR}/ublas_interop/test63.cpp) +target_link_libraries(multiprecision_test_ublas_interop_test6 no_eh_support) #run ublas_interop/test7.cpp ublas_interop/test71.cpp ublas_interop/test72.cpp ublas_interop/test73.cpp ; cm_test(NAME multiprecision_test_ublas_interop_test1_et SOURCES @@ -492,174 +826,365 @@ cm_test(NAME multiprecision_test_ublas_interop_test1_et SOURCES ${CURRENT_TEST_SOURCES_DIR}/ublas_interop/test11.cpp ${CURRENT_TEST_SOURCES_DIR}/ublas_interop/test12.cpp ${CURRENT_TEST_SOURCES_DIR}/ublas_interop/test13.cpp) -target_include_directories(multiprecision_test_ublas_interop_test1_et PUBLIC -DTEST_ET=1) +target_link_libraries(multiprecision_test_ublas_interop_test1_et no_eh_support) +target_compile_definitions(multiprecision_test_ublas_interop_test1_et PUBLIC -DTEST_ET=1) cm_test(NAME multiprecision_test_ublas_interop_test2_et SOURCES ${CURRENT_TEST_SOURCES_DIR}/ublas_interop/test2.cpp ${CURRENT_TEST_SOURCES_DIR}/ublas_interop/test21.cpp ${CURRENT_TEST_SOURCES_DIR}/ublas_interop/test22.cpp ${CURRENT_TEST_SOURCES_DIR}/ublas_interop/test23.cpp) -target_include_directories(multiprecision_test_ublas_interop_test2_et PUBLIC -DTEST_ET=1) +target_link_libraries(multiprecision_test_ublas_interop_test2_et no_eh_support) +target_compile_definitions(multiprecision_test_ublas_interop_test2_et PUBLIC -DTEST_ET=1) #run ublas_interop/test3.cpp ublas_interop/test31.cpp ublas_interop/test32.cpp ublas_interop/test33.cpp ; cm_test(NAME multiprecision_test_ublas_interop_test4_et SOURCES ${CURRENT_TEST_SOURCES_DIR}/ublas_interop/test4.cpp ${CURRENT_TEST_SOURCES_DIR}/ublas_interop/test42.cpp ${CURRENT_TEST_SOURCES_DIR}/ublas_interop/test43.cpp) -target_include_directories(multiprecision_test_ublas_interop_test4_et PUBLIC -DTEST_ET=1) +target_link_libraries(multiprecision_test_ublas_interop_test4_et no_eh_support) +target_compile_definitions(multiprecision_test_ublas_interop_test4_et PUBLIC -DTEST_ET=1) cm_test(NAME multiprecision_test_ublas_interop_test5_et SOURCES ${CURRENT_TEST_SOURCES_DIR}/ublas_interop/test5.cpp ${CURRENT_TEST_SOURCES_DIR}/ublas_interop/test52.cpp ${CURRENT_TEST_SOURCES_DIR}/ublas_interop/test53.cpp) -target_include_directories(multiprecision_test_ublas_interop_test5_et PUBLIC -DTEST_ET=1) +target_link_libraries(multiprecision_test_ublas_interop_test5_et no_eh_support) +target_compile_definitions(multiprecision_test_ublas_interop_test5_et PUBLIC -DTEST_ET=1) cm_test(NAME multiprecision_test_ublas_interop_test6_et SOURCES ${CURRENT_TEST_SOURCES_DIR}/ublas_interop/test6.cpp ${CURRENT_TEST_SOURCES_DIR}/ublas_interop/test62.cpp ${CURRENT_TEST_SOURCES_DIR}/ublas_interop/test63.cpp) -target_include_directories(multiprecision_test_ublas_interop_test6_et PUBLIC -DTEST_ET=1) - +target_link_libraries(multiprecision_test_ublas_interop_test6_et no_eh_support) +target_compile_definitions(multiprecision_test_ublas_interop_test6_et PUBLIC -DTEST_ET=1) #run ublas_interop/test7.cpp ublas_interop/test71.cpp ublas_interop/test72.cpp ublas_interop/test73.cpp ; -if(NOT CMAKE_CXX_COMPILER_ID MATCHES "GNU") - # TODO: fix test. Reason error: [-fpermissive] - cm_test(NAME multiprecision_test_test_cpp_int_serial_1 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_cpp_int_serial.cpp SOURCES_PREFIX ${CURRENT_TEST_SOURCES_DIR}) - target_compile_definitions(multiprecision_test_test_cpp_int_serial_1 PUBLIC -DTEST1) - cm_test(NAME multiprecision_test_test_cpp_int_serial_2 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_cpp_int_serial.cpp SOURCES_PREFIX ${CURRENT_TEST_SOURCES_DIR}) - target_compile_definitions(multiprecision_test_test_cpp_int_serial_2 PUBLIC -DTEST2) - cm_test(NAME multiprecision_test_test_cpp_int_serial_3 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_cpp_int_serial.cpp SOURCES_PREFIX ${CURRENT_TEST_SOURCES_DIR}) - target_compile_definitions(multiprecision_test_test_cpp_int_serial_3 PUBLIC -DTEST3) - cm_test(NAME multiprecision_test_test_cpp_int_serial_4 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_cpp_int_serial.cpp SOURCES_PREFIX ${CURRENT_TEST_SOURCES_DIR}) - target_compile_definitions(multiprecision_test_test_cpp_int_serial_4 PUBLIC -DTEST4) - cm_test(NAME multiprecision_test_test_cpp_int_deserial SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_cpp_int_deserial.cpp) - cm_test(NAME multiprecision_test_test_cpp_rat_serial SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_cpp_rat_serial.cpp) - cm_test(NAME multiprecision_test_test_adapt_serial SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_adapt_serial.cpp) - cm_test(NAME multiprecision_test_test_cpp_dec_float_serial_1 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_cpp_dec_float_serial.cpp) - target_compile_definitions(multiprecision_test_test_cpp_dec_float_serial_1 PUBLIC -DTEST1) - cm_test(NAME multiprecision_test_test_cpp_dec_float_serial_2 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_cpp_dec_float_serial.cpp) - target_compile_definitions(multiprecision_test_test_cpp_dec_float_serial_2 PUBLIC -DTEST2) -endif() - -if(HAS_FLOAT128) + +cm_test(NAME multiprecision_test_test_adapt_serial SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_adapt_serial.cpp) +cm_test(NAME multiprecision_test_test_cpp_dec_float_serial_1 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_cpp_dec_float_serial.cpp) +target_compile_definitions(multiprecision_test_test_cpp_dec_float_serial_1 PUBLIC -DTEST1) +cm_test(NAME multiprecision_test_test_cpp_dec_float_serial_2 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_cpp_dec_float_serial.cpp) +target_compile_definitions(multiprecision_test_test_cpp_dec_float_serial_2 PUBLIC -DTEST2) + +if(QUADMATH_COMPILED) cm_test(NAME multiprecision_test_test_float128_serial SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_float128_serial.cpp) endif() +#TODO: Enable this +#[[ +cm_test(NAME multiprecision_test_test_bin_dec_float_serial_1 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_cpp_bin_float_serial.cpp) +target_compile_definitions(multiprecision_test_test_bin_dec_float_serial_1 PUBLIC -DTEST1) +cm_test(NAME multiprecision_test_test_bin_dec_float_serial_2 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_cpp_bin_float_serial.cpp) +target_compile_definitions(multiprecision_test_test_bin_dec_float_serial_2 PUBLIC -DTEST2) +]] +cm_test(NAME multiprecision_test_test_checked_mixed_cpp_int SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_checked_mixed_cpp_int.cpp) +target_link_libraries(multiprecision_test_test_checked_mixed_cpp_int no_eh_support) +cm_test(NAME multiprecision_test_test_mixed_cpp_bin_float SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_mixed_cpp_bin_float.cpp) +target_link_libraries(multiprecision_test_test_mixed_cpp_bin_float no_eh_support) +cm_test(NAME multiprecision_test_test_mixed_cpp_dec_float SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_mixed_cpp_dec_float.cpp) +target_link_libraries(multiprecision_test_test_mixed_cpp_dec_float no_eh_support) +if(GMP_COMPILED) + cm_test(NAME multiprecision_test_test_mixed_mpf_float SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_mixed_mpf_float.cpp) + target_link_libraries(multiprecision_test_test_mixed_mpf_float ${GMP_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_mixed_mpf_float PRIVATE ${GMP_INCLUDES}) +endif() +if(MPFR_COMPILED) + cm_test(NAME multiprecision_test_test_mixed_mpfr_float SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_mixed_mpfr_float.cpp) + target_link_libraries(multiprecision_test_test_mixed_mpfr_float ${MPFR_LIBRARIES} ${GMP_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_test_mixed_mpfr_float PRIVATE ${GMP_INCLUDES}) +endif() -if(NOT CMAKE_CXX_COMPILER_ID MATCHES "GNU") - # TODO: fix test. Reason error: [-fpermissive] - cm_test(NAME multiprecision_test_test_bin_dec_float_serial_1 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_cpp_bin_float_serial.cpp) - target_compile_definitions(multiprecision_test_test_bin_dec_float_serial_1 PUBLIC TEST1) +cm_test(NAME multiprecision_test_test_float_conversions SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_float_conversions.cpp) +target_link_libraries(multiprecision_test_test_float_conversions no_eh_support) + +cm_test(NAME multiprecision_test_bug11922 SOURCES ${CURRENT_TEST_SOURCES_DIR}/bug11922.cpp COMPILE_ONLY) - cm_test(NAME multiprecision_test_test_bin_dec_float_serial_2 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_cpp_bin_float_serial.cpp) - target_compile_definitions(multiprecision_test_test_bin_dec_float_serial_2 PUBLIC TEST2) +cm_test(NAME multiprecision_test_bug12039 SOURCES ${CURRENT_TEST_SOURCES_DIR}/bug12039.cpp) +target_link_libraries(multiprecision_test_bug12039 no_eh_support) - cm_test(NAME multiprecision_test_test_checked_mixed_cpp_int SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_checked_mixed_cpp_int.cpp) - cm_test(NAME multiprecision_test_test_mixed_cpp_bin_float SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_mixed_cpp_bin_float.cpp) - cm_test(NAME multiprecision_test_test_mixed_cpp_dec_float SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_mixed_cpp_dec_float.cpp) +cm_test(NAME multiprecision_test_git_issue_30 SOURCES ${CURRENT_TEST_SOURCES_DIR}/git_issue_30.cpp COMPILE_ONLY) +cm_test(NAME multiprecision_test_git_issue_98 SOURCES ${CURRENT_TEST_SOURCES_DIR}/git_issue_98.cpp COMPILE_ONLY) + +if ((GMP_COMPILED) AND (MPFR_COMPILED) AND (MPC_COMPILED) AND (FLOAT128_COMPILED)) + cm_test(NAME multiprecision_test_git_issue_98 ${CURRENT_TEST_SOURCES_DIR}/git_issue_98.cpp COMPILE_ONLY) + target_link_libraries(multiprecision_test_git_issue_98 ${QUADMATH_LIBRARIES} ${MPC_LIBRARIES} ${MPFR_LIBRARIES} ${GMP_LIBRARIES}) + target_compile_definitions(multiprecision_test_git_issue_98 PRIVATE -DHAS_GMP -DHAS_MPFR -DHAS_MPC -DFLOAT128_COMPILED) endif() -if(HAS_GMP) - cm_test(NAME multiprecision_test_test_mixed_mpf_float SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_mixed_mpf_float.cpp) +cm_test(NAME multiprecision_test_issue_13301 SOURCES ${CURRENT_TEST_SOURCES_DIR}/issue_13301.cpp) +cm_test(NAME multiprecision_test_issue_13148 SOURCES ${CURRENT_TEST_SOURCES_DIR}/issue_13148.cpp) + +if ((GMP_COMPILED) AND (MPFR_COMPILED) AND (MPFI_COMPILED) AND (TomMath_COMPILED) AND (FLOAT128_COMPILED)) + cm_test(NAME multiprecision_test_test_hash ${CURRENT_TEST_SOURCES_DIR}/test_hash.cpp COMPILE_ONLY) + target_link_libraries(multiprecision_test_test_hash ${QUADMATH_LIBRARIES} ${MPFI_LIBRARIES} ${MPFR_LIBRARIES} + ${GMP_LIBRARIES} ${TomMath_LIBRARIES}) + target_compile_definitions(multiprecision_test_test_hash PRIVATE -DHAS_GMP -DHAS_MPFR -DHAS_MPFI -DHAS_TOMMATH -DFLOAT128_COMPILED) endif() -if(HAS_MPFR) - cm_test(NAME multiprecision_test_test_mixed_mpfr_float SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_mixed_mpfr_float.cpp) + +cm_test(NAME multiprecision_test_test_optional_compat SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_optional_compat.cpp) + +# TODO: Fix this +#[[ +if (EIGEN_COMPILED) + cm_test(NAME multiprecision_test_test_eigen_interop_cpp_int SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_eigen_interop_cpp_int.cpp) + target_include_directories(multiprecision_test_test_eigen_interop_cpp_int PRIVATE ${EIGEN3_INCLUDE_DIR}) + + cm_test(NAME multiprecision_test_test_eigen_interop_cpp_dec_float SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_eigen_interop_cpp_dec_float.cpp) + target_include_directories(multiprecision_test_test_eigen_interop_cpp_dec_float PRIVATE ${EIGEN3_INCLUDE_DIR}) + + cm_test(NAME multiprecision_test_test_eigen_interop_cpp_dec_float_2 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_eigen_interop_cpp_dec_float_2.cpp) + target_include_directories(multiprecision_test_test_eigen_interop_cpp_dec_float_2 PRIVATE ${EIGEN3_INCLUDE_DIR}) + + cm_test(NAME multiprecision_test_test_eigen_interop_cpp_dec_float_3 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_eigen_interop_cpp_dec_float_3.cpp) + target_include_directories(multiprecision_test_test_eigen_interop_cpp_dec_float_3 PRIVATE ${EIGEN3_INCLUDE_DIR}) + + cm_test(NAME multiprecision_test_test_eigen_interop_cpp_bin_float_1 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_eigen_interop_cpp_bin_float_1.cpp) + target_include_directories(multiprecision_test_test_eigen_interop_cpp_bin_float_1 PRIVATE ${EIGEN3_INCLUDE_DIR}) + + cm_test(NAME multiprecision_test_test_eigen_interop_cpp_bin_float_2 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_eigen_interop_cpp_bin_float_2.cpp) + target_include_directories(multiprecision_test_test_eigen_interop_cpp_bin_float_2 PRIVATE ${EIGEN3_INCLUDE_DIR}) + + cm_test(NAME multiprecision_test_test_eigen_interop_cpp_bin_float_3 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_eigen_interop_cpp_bin_float_3.cpp) + target_include_directories(multiprecision_test_test_eigen_interop_cpp_bin_float_3 PRIVATE ${EIGEN3_INCLUDE_DIR}) endif() -file(GLOB TEST_FILES ${CURRENT_TEST_SOURCES_DIR}/math/*.cpp) -# reason error: right operand of shift expression ‘(1u << 63u)’ is >= than the precision of the left operand [-fpermissive] -set(TEST_FILES "") +if ((EIGEN_COMPILED) AND (MPFR_COMPILED)) + cm_test(NAME multiprecision_test_test_eigen_interop_mpfr_1 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_eigen_interop_mpfr_1.cpp) + target_link_libraries(multiprecision_test_test_eigen_interop_mpfr_1 ${MPFR_LIBRARIES} ${GMP_LIBRARIES}) + target_include_directories(multiprecision_test_test_eigen_interop_mpfr_1 PRIVATE ${EIGEN3_INCLUDE_DIR} ${GMP_INCLUDES}) -foreach(FILEB ${TEST_FILES}) - get_filename_component(NAME ${FILEB} NAME_WE) - if(HAS_MPFR) - cm_test(NAME multiprecision_test_math_${NAME}_mpfr SOURCES ${FILEB}) - target_compile_definitions(multiprecision_test_math_${NAME}_mpfr PRIVATE -DTEST_MPFR_50 -DBOOST_ALL_NO_LIB -DBOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE) - target_include_directories(multiprecision_test_math_${NAME}_mpfr PRIVATE ${CURRENT_TEST_SOURCES_DIR}/../../math/include_private) - endif() + cm_test(NAME multiprecision_test_test_eigen_interop_mpfr_2 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_eigen_interop_mpfr_2.cpp) + target_link_libraries(multiprecision_test_test_eigen_interop_mpfr_2 ${MPFR_LIBRARIES} ${GMP_LIBRARIES}) + target_include_directories(multiprecision_test_test_eigen_interop_mpfr_2 PRIVATE ${EIGEN3_INCLUDE_DIR} ${GMP_INCLUDES}) - if(HAS_GMP) - cm_test(NAME multiprecision_test_math_${NAME}_mpf SOURCES ${FILEB}) - target_compile_definitions(multiprecision_test_math_${NAME}_mpf PRIVATE -DTEST_MPF_50 -DBOOST_ALL_NO_LIB -DBOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE) - target_include_directories(multiprecision_test_math_${NAME}_mpf PRIVATE ${CURRENT_TEST_SOURCES_DIR}/../../math/include_private) - endif() + cm_test(NAME multiprecision_test_test_eigen_interop_mpfr_3 SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_eigen_interop_mpfr_3.cpp) + target_link_libraries(multiprecision_test_test_eigen_interop_mpfr_3 ${MPFR_LIBRARIES} ${GMP_LIBRARIES}) + target_include_directories(multiprecision_test_test_eigen_interop_mpfr_3 PRIVATE ${EIGEN3_INCLUDE_DIR} ${GMP_INCLUDES}) +endif() - cm_test(NAME multiprecision_test_math_${NAME}_cpp_dec_float SOURCES ${FILEB}) - target_compile_definitions(multiprecision_test_math_${NAME}_cpp_dec_float PRIVATE -DTEST_CPP_DEC_FLOAT -DBOOST_ALL_NO_LIB -DBOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE) - target_include_directories(multiprecision_test_math_${NAME}_cpp_dec_float PRIVATE ${CURRENT_TEST_SOURCES_DIR}/../../math/include_private) +if ((EIGEN_COMPILED) AND (GMP_COMPILED)) + cm_test(NAME multiprecision_test_test_eigen_interop_gmp SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_eigen_interop_gmp.cpp) + target_link_libraries(multiprecision_test_test_eigen_interop_gmp ${GMP_LIBRARIES}) + target_include_directories(multiprecision_test_test_eigen_interop_gmp PRIVATE ${EIGEN3_INCLUDE_DIR} ${GMP_INCLUDES}) +endif() - cm_test(NAME multiprecision_test_math_${NAME}_cpp_bin_float SOURCES ${FILEB}) - target_compile_definitions(multiprecision_test_math_${NAME}_cpp_bin_float PRIVATE -DTEST_CPP_BIN_FLOAT -DBOOST_ALL_NO_LIB -DBOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE) - target_include_directories(multiprecision_test_math_${NAME}_cpp_bin_float PRIVATE ${CURRENT_TEST_SOURCES_DIR}/../../math/include_private) +if ((EIGEN_COMPILED) AND (MPC_COMPILED)) + cm_test(NAME multiprecision_test_test_eigen_interop_mpc SOURCES ${CURRENT_TEST_SOURCES_DIR}/test_eigen_interop_mpc.cpp) + target_link_libraries(multiprecision_test_test_eigen_interop_mpc ${MPC_LIBRARIES} ${MPFR_LIBRARIES} ${GMP_LIBRARIES}) + target_include_directories(multiprecision_test_test_eigen_interop_mpc PUBLIC ${EIGEN3_INCLUDE_DIR} ${GMP_INCLUDES}) +endif() +#]] + +#TODO: enable it +#[[ +if (BUILD_WITH_SOURCES_DIR) + file(GLOB TEST_FILES ${CURRENT_TEST_SOURCES_DIR}/math/*.cpp) + foreach(FILEB ${TEST_FILES}) + get_filename_component(NAME ${FILEB} NAME_WE) + if(MPFR_COMPILED) + cm_test(NAME multiprecision_test_math_${NAME}_mpfr SOURCES ${FILEB}) + target_compile_definitions(multiprecision_test_math_${NAME}_mpfr PRIVATE -DTEST_MPFR_50 -DBOOST_ALL_NO_LIB -DBOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE) + target_include_directories(multiprecision_test_math_${NAME}_mpfr PRIVATE ${BUILD_WITH_SOURCES_DIR}/libs/math/include_private ${BUILD_WITH_SOURCES_DIR} ${GMP_INCLUDES}) + target_link_libraries(multiprecision_test_math_${NAME}_mpfr ${MPFR_LIBRARIES} ${GMP_LIBRARIES}) + endif() - if(HAS_FLOAT128) - cm_test(NAME multiprecision_test_math_${NAME}_float128 SOURCES ${FILEB}) - target_compile_definitions(multiprecision_test_math_${NAME}_float128 PRIVATE -DTEST_FLOAT128 -DBOOST_ALL_NO_LIB -DBOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE) - target_include_directories(multiprecision_test_math_${NAME}_float128 PRIVATE ${CURRENT_TEST_SOURCES_DIR}/../../math/include_private) - endif() + if(GMP_COMPILED) + cm_test(NAME multiprecision_test_math_${NAME}_mpf SOURCES ${FILEB}) + target_compile_definitions(multiprecision_test_math_${NAME}_mpf PRIVATE -DTEST_MPF_50 -DBOOST_ALL_NO_LIB -DBOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE) + target_include_directories(multiprecision_test_math_${NAME}_mpf PRIVATE ${GMP_INCLUDES} ${BUILD_WITH_SOURCES_DIR} ${BUILD_WITH_SOURCES_DIR}/libs/math/include_private) + target_link_libraries(multiprecision_test_math_${NAME}_mpf ${GMP_LIBRARIES}) + endif() - if((HAS_FLOAT128) AND (HAS_INTEL_QUAD)) - cm_test(NAME multiprecision_test_math_${NAME}_intel_quad SOURCES ${FILEB}) - target_compile_definitions(multiprecision_test_math_${NAME}_intel_quad PRIVATE -DTEST_FLOAT128 -DBOOST_ALL_NO_LIB -DBOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE) - target_include_directories(multiprecision_test_math_${NAME}_intel_quad PRIVATE ${CURRENT_TEST_SOURCES_DIR}/../../math/include_private) - endif() -endforeach() + cm_test(NAME multiprecision_test_math_${NAME}_cpp_dec_float SOURCES ${FILEB}) + target_compile_definitions(multiprecision_test_math_${NAME}_cpp_dec_float PRIVATE -DTEST_CPP_DEC_FLOAT -DBOOST_ALL_NO_LIB -DBOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE) + target_include_directories(multiprecision_test_math_${NAME}_cpp_dec_float PRIVATE ${BUILD_WITH_SOURCES_DIR} ${BUILD_WITH_SOURCES_DIR}/libs/math/include_private) -file(GLOB TEST_FILES ${CURRENT_TEST_SOURCES_DIR}/math/high_prec/*.cpp) -# reason error: right operand of shift expression ‘(1u << 63u)’ is >= than the precision of the left operand [-fpermissive] -list(REMOVE_ITEM TEST_FILES ${CURRENT_TEST_SOURCES_DIR}/math/high_prec/test_gamma.cpp) + cm_test(NAME multiprecision_test_math_${NAME}_cpp_bin_float SOURCES ${FILEB}) + target_compile_definitions(multiprecision_test_math_${NAME}_cpp_bin_float PRIVATE -DTEST_CPP_BIN_FLOAT -DBOOST_ALL_NO_LIB -DBOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE) + target_include_directories(multiprecision_test_math_${NAME}_cpp_bin_float PRIVATE ${BUILD_WITH_SOURCES_DIR} ${BUILD_WITH_SOURCES_DIR}/libs/math/include_private) -foreach(FILEB ${TEST_FILES}) - get_filename_component(NAME ${FILEB} NAME_WE) - cm_test(NAME multiprecision_test_math_high_prec_${NAME} SOURCES ${FILEB}) - if(HAS_MPFR) - target_compile_definitions(multiprecision_test_math_high_prec_${NAME} PRIVATE -DTEST_MPFR) - endif() - target_compile_definitions(multiprecision_test_math_high_prec_${NAME} PRIVATE -DBOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE -DBOOST_ALL_NO_LIB) - target_include_directories(multiprecision_test_math_high_prec_${NAME} PRIVATE ${CURRENT_TEST_SOURCES_DIR}/../../math/include_private) -endforeach() + if(FLOAT128_COMPILED) + cm_test(NAME multiprecision_test_math_${NAME}_float128 SOURCES ${FILEB}) + target_compile_definitions(multiprecision_test_math_${NAME}_float128 PRIVATE -DTEST_FLOAT128 -DBOOST_ALL_NO_LIB -DBOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE) + target_include_directories(multiprecision_test_math_${NAME}_float128 PRIVATE ${BUILD_WITH_SOURCES_DIR} ${BUILD_WITH_SOURCES_DIR}/libs/math/include_private) + target_link_libraries(multiprecision_test_math_${NAME}_float128 ${QUADMATH_LIBRARIES}) + endif() + if((FLOAT128_COMPILED) AND (HAS_INTEL_QUAD)) + #TODO: fix test + cm_test(NAME multiprecision_test_math_${NAME}_intel_quad SOURCES ${FILEB}) + target_compile_definitions(multiprecision_test_math_${NAME}_intel_quad PRIVATE -DTEST_FLOAT128 -DBOOST_ALL_NO_LIB -DBOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE) + target_include_directories(multiprecision_test_math_${NAME}_intel_quad PRIVATE ${BUILD_WITH_SOURCES_DIR} ${BUILD_WITH_SOURCES_DIR}/libs/math/include_private) + endif() + endforeach() +endif() +]] + +#TODO: implicit entry/start for main executable +#[[ +if (BUILD_WITH_SOURCES_DIR) + file(GLOB TEST_FILES ${CURRENT_TEST_SOURCES_DIR}/math/high_prec/*.cpp) + foreach(FILEB ${TEST_FILES}) + if(MPFR_COMPILED) + get_filename_component(NAME ${FILEB} NAME_WE) + cm_test(NAME multiprecision_test_math_high_prec_${NAME} SOURCES ${FILEB}) + target_compile_definitions(multiprecision_test_math_high_prec_${NAME} PRIVATE -DTEST_MPFR -DBOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE -DBOOST_ALL_NO_LIB) + target_include_directories(multiprecision_test_math_high_prec_${NAME} PRIVATE ${GMP_INCLUDES} ${BUILD_WITH_SOURCES_DIR} ${BUILD_WITH_SOURCES_DIR}/libs/math/include_private) + target_link_libraries(multiprecision_test_math_high_prec_${NAME} ${GMP_LIBRARIES} ${MPFR_LIBRARIES}) + endif() + endforeach() +endif() +]] file(GLOB TEST_FILES ${CURRENT_TEST_SOURCES_DIR}/compile_fail/*.cpp) foreach(FILEB ${TEST_FILES}) - get_filename_component(NAME ${FILEB} NAME_WE) - cm_test(NAME multiprecision_test_compile_fail_${NAME} SOURCES ${FILEB} COMPILE_ONLY WILL_FAIL) - if(HAS_GMP) - target_compile_definitions(multiprecision_test_compile_fail_${NAME} PUBLIC -DTEST_GMP) - endif() - if(HAS_MPFR) - target_compile_definitions(multiprecision_test_compile_fail_${NAME} PUBLIC -DTEST_MPFR) + if ((GMP_COMPILED) AND (MPFR_COMPILED)) + get_filename_component(NAME ${FILEB} NAME_WE) + cm_test(NAME multiprecision_test_compile_fail_${NAME} SOURCES ${FILEB} COMPILE_ONLY WILL_FAIL) + target_compile_definitions(multiprecision_test_compile_fail_${NAME} PRIVATE -DTEST_GMP -DTEST_MPFR) endif() endforeach() -file(GLOB TEST_FILES ${CURRENT_TEST_SOURCES_DIR}/concepts/*.cpp) -foreach(FILEB ${TEST_FILES}) - get_filename_component(NAME ${FILEB} NAME_WE) +if (BUILD_WITH_SOURCES_DIR) + file(GLOB TEST_FILES ${CURRENT_TEST_SOURCES_DIR}/concepts/*.cpp) + foreach(FILEB ${TEST_FILES}) + get_filename_component(NAME ${FILEB} NAME_WE) + + if (MPFR_COMPILED) + cm_test(NAME multiprecision_test_concepts_${NAME}_mpfr_50 SOURCES ${FILEB} COMPILE_ONLY) + target_compile_definitions(multiprecision_test_concepts_${NAME}_mpfr_50 PUBLIC -DTEST_MPFR_50) + target_link_libraries(multiprecision_test_concepts_${NAME}_mpfr_50 ${MPFR_LIBRARIES}) + target_include_directories(multiprecision_test_concepts_${NAME}_mpfr_50 PRIVATE ${BUILD_WITH_SOURCES_DIR}) + + cm_test(NAME multiprecision_test_concepts_${NAME}_mpfr_6 SOURCES ${FILEB} COMPILE_ONLY) + target_compile_definitions(multiprecision_test_concepts_${NAME}_mpfr_6 PUBLIC -DTEST_MPFR_6) + target_link_libraries(multiprecision_test_concepts_${NAME}_mpfr_6 ${MPFR_LIBRARIES}) + target_include_directories(multiprecision_test_concepts_${NAME}_mpfr_6 PRIVATE ${BUILD_WITH_SOURCES_DIR}) + + cm_test(NAME multiprecision_test_concepts_${NAME}_mpfr_15 SOURCES ${FILEB} COMPILE_ONLY) + target_compile_definitions(multiprecision_test_concepts_${NAME}_mpfr_15 PUBLIC -DTEST_MPFR_15) + target_link_libraries(multiprecision_test_concepts_${NAME}_mpfr_15 ${MPFR_LIBRARIES}) + target_include_directories(multiprecision_test_concepts_${NAME}_mpfr_15 PRIVATE ${BUILD_WITH_SOURCES_DIR}) + + cm_test(NAME multiprecision_test_concepts_${NAME}_mpfr_17 SOURCES ${FILEB} COMPILE_ONLY) + target_compile_definitions(multiprecision_test_concepts_${NAME}_mpfr_17 PUBLIC -DTEST_MPFR_17) + target_link_libraries(multiprecision_test_concepts_${NAME}_mpfr_17 ${MPFR_LIBRARIES}) + target_include_directories(multiprecision_test_concepts_${NAME}_mpfr_17 PRIVATE ${BUILD_WITH_SOURCES_DIR}) + + cm_test(NAME multiprecision_test_concepts_${NAME}_mpfr_30 SOURCES ${FILEB} COMPILE_ONLY) + target_compile_definitions(multiprecision_test_concepts_${NAME}_mpfr_30 PUBLIC -DTEST_MPFR_30) + target_link_libraries(multiprecision_test_concepts_${NAME}_mpfr_30 ${MPFR_LIBRARIES}) + target_include_directories(multiprecision_test_concepts_${NAME}_mpfr_30 PRIVATE ${BUILD_WITH_SOURCES_DIR}) + + endif() - cm_test(NAME multiprecision_test_concepts_${NAME}_mpfr_50 SOURCES ${FILEB} COMPILE_ONLY) - target_compile_definitions(multiprecision_test_concepts_${NAME}_mpfr_50 PUBLIC -DTEST_MPFR_50) + if (GMP_COMPILED) + cm_test(NAME multiprecision_test_concepts_${NAME}_mpf50 SOURCES ${FILEB} COMPILE_ONLY) + target_compile_definitions(multiprecision_test_concepts_${NAME}_mpf50 PUBLIC -DTEST_MPF_50) + target_link_libraries(multiprecision_test_concepts_${NAME}_mpf50 ${GMP_LIBRARIES}) + target_include_directories(multiprecision_test_concepts_${NAME}_mpf50 PRIVATE ${BUILD_WITH_SOURCES_DIR}) + endif() - cm_test(NAME multiprecision_test_concepts_${NAME}_mpfr_6 SOURCES ${FILEB} COMPILE_ONLY) - target_compile_definitions(multiprecision_test_concepts_${NAME}_mpfr_6 PUBLIC -DTEST_MPFR_6) + cm_test(NAME multiprecision_test_concepts_${NAME}_cpp_dec_float SOURCES ${FILEB} COMPILE_ONLY) + target_compile_definitions(multiprecision_test_concepts_${NAME}_cpp_dec_float PUBLIC -DTEST_CPP_DEC_FLOAT) + target_include_directories(multiprecision_test_concepts_${NAME}_cpp_dec_float PRIVATE ${BUILD_WITH_SOURCES_DIR}) - cm_test(NAME multiprecision_test_concepts_${NAME}_mpfr_15 SOURCES ${FILEB} COMPILE_ONLY) - target_compile_definitions(multiprecision_test_concepts_${NAME}_mpfr_15 PUBLIC -DTEST_MPFR_15) + cm_test(NAME multiprecision_test_concepts_${NAME}_cpp_bin_float SOURCES ${FILEB} COMPILE_ONLY) + target_compile_definitions(multiprecision_test_concepts_${NAME}_cpp_bin_float PUBLIC -DTEST_CPP_BIN_FLOAT) + target_include_directories(multiprecision_test_concepts_${NAME}_cpp_bin_float PRIVATE ${BUILD_WITH_SOURCES_DIR}) - cm_test(NAME multiprecision_test_concepts_${NAME}_mpfr_17 SOURCES ${FILEB} COMPILE_ONLY) - target_compile_definitions(multiprecision_test_concepts_${NAME}_mpfr_17 PUBLIC -DTEST_MPFR_17) + cm_test(NAME multiprecision_test_concepts_${NAME}_cpp_dec_float_no_et SOURCES ${FILEB} COMPILE_ONLY) + target_compile_definitions(multiprecision_test_concepts_${NAME}_cpp_dec_float_no_et PUBLIC -DTEST_CPP_DEC_FLOAT_NO_ET) + target_include_directories(multiprecision_test_concepts_${NAME}_cpp_dec_float_no_et PRIVATE ${BUILD_WITH_SOURCES_DIR}) - cm_test(NAME multiprecision_test_concepts_${NAME}_mpfr_30 SOURCES ${FILEB} COMPILE_ONLY) - target_compile_definitions(multiprecision_test_concepts_${NAME}_mpfr_30 PUBLIC -DTEST_MPFR_30) + cm_test(NAME multiprecision_test_concepts_${NAME}_backend_concept SOURCES ${FILEB} COMPILE_ONLY) + target_compile_definitions(multiprecision_test_concepts_${NAME}_backend_concept PUBLIC -DTEST_BACKEND) + target_include_directories(multiprecision_test_concepts_${NAME}_backend_concept PRIVATE ${BUILD_WITH_SOURCES_DIR}) - cm_test(NAME multiprecision_test_concepts_${NAME}_mpf50 SOURCES ${FILEB} COMPILE_ONLY) - target_compile_definitions(multiprecision_test_concepts_${NAME}_mpf50 PUBLIC -DTEST_MPF_50) + cm_test(NAME multiprecision_test_concepts_${NAME}_logged_adaptor SOURCES ${FILEB} COMPILE_ONLY) + target_compile_definitions(multiprecision_test_concepts_${NAME}_logged_adaptor PUBLIC -DTEST_LOGGED_ADAPTER) + target_include_directories(multiprecision_test_concepts_${NAME}_logged_adaptor PRIVATE ${BUILD_WITH_SOURCES_DIR}) + endforeach() +endif() - cm_test(NAME multiprecision_test_concepts_${NAME}_cpp_dec_float SOURCES ${FILEB} COMPILE_ONLY) - target_compile_definitions(multiprecision_test_concepts_${NAME}_cpp_dec_float PUBLIC -DTEST_CPP_DEC_FLOAT) +#test-suite examples - cm_test(NAME multiprecision_test_concepts_${NAME}_cpp_bin_float SOURCES ${FILEB} COMPILE_ONLY) - target_compile_definitions(multiprecision_test_concepts_${NAME}_cpp_bin_float PUBLIC -DTEST_CPP_BIN_FLOAT) +cm_test(NAME multiprecision_test_cpp_int_snips SOURCES ${CURRENT_TEST_SOURCES_DIR}/../example/cpp_int_snips.cpp) +target_link_libraries(multiprecision_test_cpp_int_snips no_eh_support) +cm_test(NAME multiprecision_test_cpp_int_import_export SOURCES ${CURRENT_TEST_SOURCES_DIR}/../example/cpp_int_import_export.cpp) +target_link_libraries(multiprecision_test_cpp_int_import_export no_eh_support) +cm_test(NAME multiprecision_test_cpp_bin_float_import_export SOURCES ${CURRENT_TEST_SOURCES_DIR}/../example/cpp_bin_float_import_export.cpp) +target_link_libraries(multiprecision_test_cpp_bin_float_import_export no_eh_support) - cm_test(NAME multiprecision_test_concepts_${NAME}_cpp_dec_float_no_et SOURCES ${FILEB} COMPILE_ONLY) - target_compile_definitions(multiprecision_test_concepts_${NAME}_cpp_dec_float_no_et PUBLIC -DTEST_CPP_DEC_FLOAT_NO_ET) +cm_test(NAME multiprecision_test_cpp_dec_float_snips SOURCES ${CURRENT_TEST_SOURCES_DIR}/../example/cpp_dec_float_snips.cpp) +target_link_libraries(multiprecision_test_cpp_dec_float_snips no_eh_support) - cm_test(NAME multiprecision_test_concepts_${NAME}_backend_concept SOURCES ${FILEB} COMPILE_ONLY) - target_compile_definitions(multiprecision_test_concepts_${NAME}_backend_concept PUBLIC -DTEST_BACKEND) +cm_test(NAME multiprecision_test_cpp_bin_float_snips SOURCES ${CURRENT_TEST_SOURCES_DIR}/../example/cpp_bin_float_snips.cpp) +target_link_libraries(multiprecision_test_cpp_bin_float_snips no_eh_support) - cm_test(NAME multiprecision_test_concepts_${NAME}_logged_adaptor SOURCES ${FILEB} COMPILE_ONLY) - target_compile_definitions(multiprecision_test_concepts_${NAME}_logged_adaptor PUBLIC -DTEST_LOGGED_ADAPTER) -endforeach() +cm_test(NAME multiprecision_test_debug_adaptor_snips SOURCES ${CURRENT_TEST_SOURCES_DIR}/../example/debug_adaptor_snips.cpp) +target_link_libraries(multiprecision_test_debug_adaptor_snips no_eh_support) + +if (FLOAT128_COMPILED) + #TODO: fix this + #[ run float128_snips.cpp quadmath no_eh_eg_support : : : [ check-target-builds ../config//has_float128 : : no ] ] + cm_test(NAME multiprecision_test_debug_adaptor_snips SOURCES ${CURRENT_TEST_SOURCES_DIR}/../example/debug_adaptor_snips.cpp) + target_link_libraries(multiprecision_test_debug_adaptor_snips no_eh_support) +endif() + +cm_test(NAME multiprecision_test_floating_point_examples SOURCES ${CURRENT_TEST_SOURCES_DIR}/../example/floating_point_examples.cpp) +target_link_libraries(multiprecision_test_floating_point_examples no_eh_support) + +#TODO: Enable this +#cm_test(NAME multiprecision_test_gauss_laguerre_quadrature SOURCES ${CURRENT_TEST_SOURCES_DIR}/../example/gauss_laguerre_quadrature.cpp) +#target_link_libraries(multiprecision_test_gauss_laguerre_quadrature no_eh_support) + +#TODO: Fix this +#cm_test(NAME multiprecision_test_hypergeometric_luke_algorithms SOURCES ${CURRENT_TEST_SOURCES_DIR}/../example/hypergeometric_luke_algorithms.cpp) +#target_link_libraries(multiprecision_test_hypergeometric_luke_algorithms no_eh_support) + +cm_test(NAME multiprecision_test_integer_examples SOURCES ${CURRENT_TEST_SOURCES_DIR}/../example/integer_examples.cpp) +target_link_libraries(multiprecision_test_integer_examples no_eh_support) + +if (MPFI_COMPILED) + cm_test(NAME multiprecision_test_logged_adaptor SOURCES ${CURRENT_TEST_SOURCES_DIR}/../example/logged_adaptor.cpp) + target_link_libraries(multiprecision_test_logged_adaptor ${GMP_LIBRARIES} ${MPFR_LIBRARIES} ${MPFI_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_logged_adaptor PRIVATE ${GMP_INCLUDES} ${MPFI_INCLUDES}) +endif() + +cm_test(NAME multiprecision_test_mixed_integer_arithmetic SOURCES ${CURRENT_TEST_SOURCES_DIR}/../example/mixed_integer_arithmetic.cpp) +target_link_libraries(multiprecision_test_mixed_integer_arithmetic no_eh_support) + +if (FLOAT128_COMPILED) + #TODO: fix this + #[ run numeric_limits_snips.cpp no_eh_eg_support /boost//test_exec_monitor : : : [ requires cxx11_numeric_limits ] [ check-target-builds ../config//has_float128 : quadmath ] ] +endif() + +if (GMP_COMPILED) + #TODO: enable this + #cm_test(NAME multiprecision_test_random_snips SOURCES ${CURRENT_TEST_SOURCES_DIR}/../example/random_snips.cpp) + #target_link_libraries(multiprecision_test_random_snips ${GMP_LIBRARIES} no_eh_support) + #target_include_directories(multiprecision_test_random_snips PRIVATE ${GMP_INCLUDES}) +endif() + +cm_test(NAME multiprecision_test_safe_prime SOURCES ${CURRENT_TEST_SOURCES_DIR}/../example/safe_prime.cpp) +target_link_libraries(multiprecision_test_safe_prime no_eh_support) + +if (GMP_COMPILED) + cm_test(NAME multiprecision_test_gmp_snips SOURCES ${CURRENT_TEST_SOURCES_DIR}/../example/gmp_snips.cpp) + target_link_libraries(multiprecision_test_gmp_snips ${GMP_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_gmp_snips PRIVATE ${GMP_INCLUDES}) +endif() + +if (MPFI_COMPILED) + cm_test(NAME multiprecision_test_mpfi_snips SOURCES ${CURRENT_TEST_SOURCES_DIR}/../example/mpfi_snips.cpp) + target_link_libraries(multiprecision_test_mpfi_snips ${GMP_LIBRARIES} ${MPFI_LIBRARIES} ${MPFR_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_mpfi_snips PRIVATE ${GMP_INCLUDES} ${MPFI_INCLUDES}) +endif() + +if (MPFR_COMPILED) + cm_test(NAME multiprecision_test_mpfr_snips SOURCES ${CURRENT_TEST_SOURCES_DIR}/../example/mpfr_snips.cpp) + target_link_libraries(multiprecision_test_mpfr_snips ${GMP_LIBRARIES} ${MPFR_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_mpfr_snips PRIVATE ${GMP_INCLUDES}) +endif() + +if (TOMMATH_COMPILED) + cm_test(NAME multiprecision_test_tommath_snips SOURCES ${CURRENT_TEST_SOURCES_DIR}/../example/tommath_snips.cpp) + target_link_libraries(multiprecision_test_tommath_snips ${TomMath_LIBRARIES} no_eh_support) + target_include_directories(multiprecision_test_tommath_snips PRIVATE ${TomMath_INCLUDES}) +endif() -include_directories(${CMAKE_WORKSPACE_SOURCES_DIR}) \ No newline at end of file +include_directories(${CMAKE_WORKSPACE_SOURCES_DIR})