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

Conversation

lntue
Copy link
Contributor

@lntue lntue commented Jan 28, 2025

No description provided.

@llvmbot
Copy link
Member

llvmbot commented Jan 28, 2025

@llvm/pr-subscribers-libc

Author: None (lntue)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/124810.diff

2 Files Affected:

  • (modified) libc/cmake/modules/LLVMLibCCheckMPC.cmake (+2-2)
  • (modified) libc/utils/MPCWrapper/CMakeLists.txt (+8)
diff --git a/libc/cmake/modules/LLVMLibCCheckMPC.cmake b/libc/cmake/modules/LLVMLibCCheckMPC.cmake
index 633719b77575cf..6cc9ee2d9a6f61 100644
--- a/libc/cmake/modules/LLVMLibCCheckMPC.cmake
+++ b/libc/cmake/modules/LLVMLibCCheckMPC.cmake
@@ -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,
diff --git a/libc/utils/MPCWrapper/CMakeLists.txt b/libc/utils/MPCWrapper/CMakeLists.txt
index 6c12f73109a576..38e635c5539354 100644
--- a/libc/utils/MPCWrapper/CMakeLists.txt
+++ b/libc/utils/MPCWrapper/CMakeLists.txt
@@ -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()
   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)

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.

Copy link
Member

@Sh0g0-1758 Sh0g0-1758 left a comment

Choose a reason for hiding this comment

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

LGTM

@lntue lntue merged commit bcf306e into llvm:main Jan 29, 2025
16 checks passed
@lntue lntue deleted the mpc branch January 29, 2025 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants