bolt/deps/llvm-18.1.8/libc/utils/MPFRWrapper/CMakeLists.txt
2025-02-14 19:21:04 +01:00

29 lines
1.2 KiB
CMake

if(LIBC_TESTS_CAN_USE_MPFR)
add_library(libcMPFRWrapper
MPFRUtils.cpp
MPFRUtils.h
mpfr_inc.h
)
target_compile_options(libcMPFRWrapper PRIVATE -O3)
if (LLVM_LIBC_FULL_BUILD)
# It is not easy to make libcMPFRWrapper a standalone library because gmp.h may unconditionally
# pull in some STL headers. As a result, targets using this library will need to link against
# C++ and unwind libraries. Since we are using MPFR anyway, we directly specifies the GNU toolchain.
target_link_libraries(libcMPFRWrapper PUBLIC -lstdc++ -lgcc_s)
endif()
add_dependencies(
libcMPFRWrapper
libc.src.__support.CPP.string_view
libc.src.__support.CPP.type_traits
libc.src.__support.FPUtil.fp_bits
libc.src.__support.FPUtil.fpbits_str
LibcTest.unit
)
if(EXISTS ${LLVM_LIBC_MPFR_INSTALL_PATH})
target_include_directories(libcMPFRWrapper PUBLIC ${LLVM_LIBC_MPFR_INSTALL_PATH}/include)
target_link_directories(libcMPFRWrapper PUBLIC ${LLVM_LIBC_MPFR_INSTALL_PATH}/lib)
endif()
target_link_libraries(libcMPFRWrapper PUBLIC LibcFPTestHelpers.unit LibcTest.unit mpfr gmp)
elseif(NOT LIBC_TARGET_ARCHITECTURE_IS_GPU)
message(WARNING "Math tests using MPFR will be skipped.")
endif()