Skip to content

Commit 3f33ccf

Browse files
committed
cmake: Add TomsFastMath support
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
1 parent 5330cd1 commit 3f33ccf

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ include(sources.cmake)
3333
# Options
3434
#-----------------------------------------------------------------------------
3535
option(WITH_LTM "Build with support for libtommath" TRUE)
36+
option(WITH_TFM "Build with support for tomsfastmath" FALSE)
3637
option(WITH_GMP "Build with support for GNU Multi Precision Arithmetic Library" FALSE)
3738
set(MPI_PROVIDER "LTM" CACHE STRING "Build tests and demos against 'LTM', 'TFM' or 'GMP', default is LTM")
3839
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)
138139
target_link_libraries(${PROJECT_NAME} PUBLIC libtommath)
139140
list(APPEND MPI_PROVIDERS -ltommath)
140141
endif()
142+
# tomsfastmath
143+
if(WITH_TFM)
144+
find_package(tomsfastmath 0.13.1 REQUIRED)
145+
146+
target_compile_definitions(${PROJECT_NAME} PUBLIC TFM_DESC)
147+
if(MPI_PROVIDER MATCHES "TFM")
148+
target_compile_definitions(${PROJECT_NAME} PUBLIC USE_TFM)
149+
endif()
150+
target_link_libraries(${PROJECT_NAME} PUBLIC tomsfastmath)
151+
list(APPEND MPI_PROVIDERS -ltfm)
152+
endif()
141153
# GNU MP
142154
if(WITH_GMP)
143155
pkg_check_modules(GMP REQUIRED gmp>=6.1.2)

0 commit comments

Comments
 (0)