Skip to content
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

[libc] support out of tree build with dynlibs #97959

Conversation

SchrodingerZhu
Copy link
Contributor

No description provided.

@SchrodingerZhu SchrodingerZhu marked this pull request as ready for review July 7, 2024 18:30
@llvmbot llvmbot added the libc label Jul 7, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Jul 7, 2024

@llvm/pr-subscribers-libc

Author: Schrodinger ZHU Yifan (SchrodingerZhu)

Changes

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

2 Files Affected:

  • (modified) libc/utils/HdrGen/CMakeLists.txt (+3-1)
  • (modified) libc/utils/LibcTableGenUtil/CMakeLists.txt (+6-2)
diff --git a/libc/utils/HdrGen/CMakeLists.txt b/libc/utils/HdrGen/CMakeLists.txt
index 0ec1cba542d40..47f845b9f9a5b 100644
--- a/libc/utils/HdrGen/CMakeLists.txt
+++ b/libc/utils/HdrGen/CMakeLists.txt
@@ -1,6 +1,8 @@
 include(TableGen)
 
-set(LLVM_LINK_COMPONENTS Support)
+if (NOT LLVM_LINK_LLVM_DYLIB)
+  set(LLVM_LINK_COMPONENTS Support)
+endif()
 
 add_tablegen(libc-hdrgen LIBC
   Command.h
diff --git a/libc/utils/LibcTableGenUtil/CMakeLists.txt b/libc/utils/LibcTableGenUtil/CMakeLists.txt
index dca6a7bb83065..9421383394a35 100644
--- a/libc/utils/LibcTableGenUtil/CMakeLists.txt
+++ b/libc/utils/LibcTableGenUtil/CMakeLists.txt
@@ -1,9 +1,13 @@
+if (NOT LLVM_LINK_LLVM_DYLIB)
+  set(flags "DISABLE_LLVM_LINK_LLVM_DYLIB;LINK_COMPONENTS;Support;TableGen")
+else()
+  set(flags "LINK_COMPONENTS;TableGen")
+endif()
 add_llvm_library(
   LibcTableGenUtil
   APIIndexer.cpp
   APIIndexer.h
-  DISABLE_LLVM_LINK_LLVM_DYLIB
-  LINK_COMPONENTS Support TableGen
+  ${flags}
 )
 target_include_directories(LibcTableGenUtil PUBLIC ${LIBC_SOURCE_DIR})
 target_include_directories(LibcTableGenUtil PRIVATE ${LLVM_INCLUDE_DIR} ${LLVM_MAIN_INCLUDE_DIR})

@SchrodingerZhu SchrodingerZhu requested a review from lntue July 7, 2024 18:39
@SchrodingerZhu SchrodingerZhu merged commit f13463e into llvm:main Jul 7, 2024
10 checks passed
@SchrodingerZhu SchrodingerZhu deleted the libc/support-out-of-tree-hdrgen-build branch July 7, 2024 19: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.

None yet

3 participants