cmake: Add TomsFastMath support

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
This commit is contained in:
Steffen Jaeckel 2023-06-19 19:28:13 +02:00 committed by Jamie Reece Wilson
parent a8081c5641
commit ce021c898c

View File

@ -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)