Skip to content

[libc] Update include directory for libcMPCWrapper target when LIBC_MPC_INSTALL_PATH is set. #124810

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions libc/cmake/modules/LLVMLibCCheckMPC.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
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)")
set(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)
if(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,
Expand Down
8 changes: 8 additions & 0 deletions libc/utils/MPCWrapper/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ if(LIBC_TESTS_CAN_USE_MPC)
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()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the idea to support LLVM_ prefixed and non-prefixed LIBC_MPFR_INSTALL_PATH simultaneously for a time?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think for LLVM 21, we might provide message / warnings about switching from LLVM_LIBC_* flags to LIBC_* flags, and supporting both, before removing LLVM_LIBC_* flags in LLVM 22?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like a good plan. Do we have a bug on file for that? If not, would you please file one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've created #124860 to track that plan.

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)
Expand Down