-
Notifications
You must be signed in to change notification settings - Fork 70
feat: add clang support to llvm-core Conan recipe #513
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
zhangxffff
merged 8 commits into
bytedance:main
from
zhangxffff:feat/add_clang_to_llvm_recipe
Apr 19, 2026
+102
−2
Merged
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ff1fce0
feat: add clang support to llvm-core Conan recipe
zhangxffff 6083afd
fix: remove redundant buildenv_info PATH for clang
zhangxffff 4ed463b
fix: prioritize local recipe remotes over CI remote
zhangxffff af374cb
Revert "fix: prioritize local recipe remotes over CI remote"
zhangxffff e1bd370
feat: override only PR-modified Conan recipes in CI
zhangxffff a870387
fix: use $HOME instead of ~ for conan path expansion
zhangxffff ede552d
feat: verify clang exists in llvm-core package during conan install
zhangxffff 58f69d8
refactor: rename llvm-core patched version to 19.1.7-bolt
zhangxffff File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| diff --git a/recipes/llvm-core/all/conandata.yml b/recipes/llvm-core/all/conandata.yml | ||
| index dd26cdba..bc4c16a9 100644 | ||
| --- a/recipes/llvm-core/all/conandata.yml | ||
| +++ b/recipes/llvm-core/all/conandata.yml | ||
| @@ -6,6 +6,9 @@ sources: | ||
| "cmake": | ||
| url: https://github.com/llvm/llvm-project/releases/download/llvmorg-19.1.7/cmake-19.1.7.src.tar.xz | ||
| sha256: 11c5a28f90053b0c43d0dec3d0ad579347fc277199c005206b963c19aae514e3 | ||
| + "clang": | ||
| + url: https://github.com/llvm/llvm-project/releases/download/llvmorg-19.1.7/clang-19.1.7.src.tar.xz | ||
| + sha256: 11e5e4ecab5338b9914de3b83a4622cb200de466b7c56ba675afb72fa7d64675 | ||
| "13.0.0": | ||
| url: https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/llvm-13.0.0.src.tar.xz | ||
| sha256: 408d11708643ea826f519ff79761fcdfc12d641a2510229eec459e72f8163020 | ||
| diff --git a/recipes/llvm-core/all/conanfile.py b/recipes/llvm-core/all/conanfile.py | ||
| index e8290099..c6d1e93d 100644 | ||
| --- a/recipes/llvm-core/all/conanfile.py | ||
| +++ b/recipes/llvm-core/all/conanfile.py | ||
| @@ -171,6 +171,7 @@ class LLVMCoreConan(ConanFile): | ||
| "with_xml2": [True, False], | ||
| "with_z3": [True, False], | ||
| "with_zstd": [True, False], | ||
| + "with_clang": [True, False], | ||
| } | ||
| default_options = { | ||
| "shared": False, | ||
| @@ -193,6 +194,7 @@ class LLVMCoreConan(ConanFile): | ||
| "with_z3": True, | ||
| "with_zlib": True, | ||
| "with_zstd": True, | ||
| + "with_clang": False, | ||
| } | ||
|
|
||
| @property | ||
| @@ -301,6 +303,8 @@ class LLVMCoreConan(ConanFile): | ||
| # LLVM >=15 split up several components in its release, including cmake | ||
| get(self, **sources["llvm"], destination='llvm-main', strip_root=True) | ||
| get(self, **sources["cmake"], destination='cmake', strip_root=True) | ||
| + if "clang" in sources: | ||
| + get(self, **sources["clang"], destination='clang', strip_root=True) | ||
|
|
||
| def _apply_resource_limits(self, cmake_definitions): | ||
| if os.getenv("CONAN_CENTER_BUILD_SERVICE"): | ||
| @@ -373,6 +377,9 @@ class LLVMCoreConan(ConanFile): | ||
| if self.options.targets != "all": | ||
| cmake_variables["LLVM_TARGETS_TO_BUILD"] = self.options.targets | ||
|
|
||
| + if self.options.with_clang: | ||
| + cmake_variables["LLVM_ENABLE_PROJECTS"] = "clang" | ||
| + | ||
| self._apply_resource_limits(cmake_variables) | ||
|
|
||
| if is_msvc(self): | ||
| @@ -415,7 +422,9 @@ class LLVMCoreConan(ConanFile): | ||
| "LLVMTableGenGlobalISel.*", | ||
| "CONAN_LIB.*", | ||
| "LLVMExegesis.*", | ||
| - "LLVMCFIVerify.*" | ||
| + "LLVMCFIVerify.*", | ||
| + "clang.*", | ||
| + "libclang.*", | ||
| ] | ||
| graphviz_options = textwrap.dedent(f""" | ||
| set(GRAPHVIZ_EXECUTABLES OFF) | ||
| @@ -547,3 +556,7 @@ class LLVMCoreConan(ConanFile): | ||
| else: | ||
| self.cpp_info.set_property("cmake_target_name", "LLVM") | ||
| self.cpp_info.libs = collect_libs(self) | ||
| + | ||
| + if self.options.with_clang: | ||
| + bindir = os.path.join(self.package_folder, "bin") | ||
| + self.buildenv_info.prepend_path("PATH", bindir) | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the conan documentation at https://docs.conan.io/2/reference/conanfile/methods/package_info.html
It looks like this is not necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I am mistaken as
bindirhere is just the variable. But maybe LLVM should export it's bindir to the conan package so that the binaries are propagated?On the same page, the example is