From 3f33ccf181e3fda54fd315625daa973680be8929 Mon Sep 17 00:00:00 2001 From: Steffen Jaeckel Date: Mon, 19 Jun 2023 19:28:13 +0200 Subject: [PATCH] cmake: Add TomsFastMath support Signed-off-by: Steffen Jaeckel --- CMakeLists.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 63419c23..a401f479 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,6 +33,7 @@ include(sources.cmake) # Options #----------------------------------------------------------------------------- option(WITH_LTM "Build with support for libtommath" TRUE) +option(WITH_TFM "Build with support for tomsfastmath" FALSE) option(WITH_GMP "Build with support for GNU Multi Precision Arithmetic Library" FALSE) set(MPI_PROVIDER "LTM" CACHE STRING "Build tests and demos against 'LTM', 'TFM' or 'GMP', default is LTM") option(BUILD_SHARED_LIBS "Build shared library and only the shared library if \"ON\", default is static" OFF) @@ -138,6 +139,17 @@ if(WITH_LTM) target_link_libraries(${PROJECT_NAME} PUBLIC libtommath) list(APPEND MPI_PROVIDERS -ltommath) endif() +# tomsfastmath +if(WITH_TFM) + find_package(tomsfastmath 0.13.1 REQUIRED) + + target_compile_definitions(${PROJECT_NAME} PUBLIC TFM_DESC) + if(MPI_PROVIDER MATCHES "TFM") + target_compile_definitions(${PROJECT_NAME} PUBLIC USE_TFM) + endif() + target_link_libraries(${PROJECT_NAME} PUBLIC tomsfastmath) + list(APPEND MPI_PROVIDERS -ltfm) +endif() # GNU MP if(WITH_GMP) pkg_check_modules(GMP REQUIRED gmp>=6.1.2)