llvm-project/libc/cmake/modules/LLVMLibCCheckMPC.cmake
Shourya Goel 7f37b34d31
[libc][complex] Testing infra for MPC (#121261)
This PR aims to add the groundwork to test the precision of libc complex
functions against MPC. I took `cargf` as a test to verify that the infra
works fine.
2025-01-28 11:01:16 +05:30

23 lines
744 B
CMake

if(LIBC_TESTS_CAN_USE_MPFR)
set(LLVM_LIBC_MPC_INSTALL_PATH "" CACHE PATH "Path to where MPC is installed (e.g. C:/src/install or ~/src/install)")
if(LLVM_LIBC_MPC_INSTALL_PATH)
set(LIBC_TESTS_CAN_USE_MPC TRUE)
elseif(LIBC_TARGET_OS_IS_GPU OR LLVM_LIBC_FULL_BUILD)
# In full build mode, the MPC library should be built using our own facilities,
# which is currently not possible.
set(LIBC_TESTS_CAN_USE_MPC FALSE)
else()
try_compile(
LIBC_TESTS_CAN_USE_MPC
${CMAKE_CURRENT_BINARY_DIR}
SOURCES
${LIBC_SOURCE_DIR}/utils/MPCWrapper/check_mpc.cpp
COMPILE_DEFINITIONS
${LIBC_COMPILE_OPTIONS_DEFAULT}
LINK_LIBRARIES
-lmpc -lmpfr -lgmp -latomic
)
endif()
endif()