Files
clang-p2996/libc/utils/MPCWrapper/CMakeLists.txt
Jorge Gorbe Moya f9a6ea4489 [libc][bazel] Add BUILD targets for complex functions and tests. (#129618)
This involved a little bit of yak shaving because one of the new tests
depends on MPC, and we didn't have targets for it yet, so I ended up
needing to add a similar setup to what we have for MPFR.
2025-03-04 11:05:01 -08:00

34 lines
1.3 KiB
CMake

if(LIBC_TESTS_CAN_USE_MPC)
add_library(libcMPCWrapper STATIC
MPCUtils.cpp
MPCUtils.h
mpc_inc.h
)
_get_common_test_compile_options(compile_options "" "")
list(REMOVE_ITEM compile_options "-ffreestanding")
target_compile_options(libcMPCWrapper PRIVATE -O3 ${compile_options})
add_dependencies(
libcMPCWrapper
libcMPCommon
libc.src.__support.CPP.array
libc.src.__support.CPP.string
libc.src.__support.CPP.stringstream
libc.src.__support.CPP.type_traits
libc.src.__support.FPUtil.fp_bits
libc.src.__support.complex_type
LibcTest.unit
)
if(EXISTS ${LLVM_LIBC_MPFR_INSTALL_PATH})
target_include_directories(libcMPCWrapper PUBLIC ${LLVM_LIBC_MPFR_INSTALL_PATH}/include)
target_link_directories(libcMPCWrapper PUBLIC ${LLVM_LIBC_MPFR_INSTALL_PATH}/lib)
endif()
if(EXISTS ${LIBC_MPC_INSTALL_PATH})
target_include_directories(libcMPCWrapper PUBLIC ${LIBC_MPC_INSTALL_PATH}/include)
target_link_directories(libcMPCWrapper PUBLIC ${LIBC_MPC_INSTALL_PATH}/lib)
endif()
target_include_directories(libcMPCWrapper PUBLIC ${LIBC_SOURCE_DIR})
target_link_libraries(libcMPCWrapper PUBLIC libcMPCommon LibcFPTestHelpers.unit LibcTest.unit mpc)
elseif(NOT LIBC_TARGET_OS_IS_GPU AND NOT LLVM_LIBC_FULL_BUILD)
message(WARNING "Math tests using MPC will be skipped.")
endif()