-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[lld] enable installing lld headers and libraries as part of distribution #127123
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
Conversation
@llvm/pr-subscribers-lld Author: Maksim Levental (makslevental) ChangesCurrently if one does
and then This PR fixes that. Full diff: https://github.com/llvm/llvm-project/pull/127123.diff 1 Files Affected:
diff --git a/lld/CMakeLists.txt b/lld/CMakeLists.txt
index 64c9f23805509..7beea1e15296e 100644
--- a/lld/CMakeLists.txt
+++ b/lld/CMakeLists.txt
@@ -180,12 +180,21 @@ include_directories(BEFORE
${CMAKE_CURRENT_SOURCE_DIR}/include
)
+add_custom_target(lld-headers)
+set_target_properties(lld-headers PROPERTIES FOLDER "Misc")
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
- install(DIRECTORY include/
+ install(DIRECTORY include/lld
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
+ COMPONENT lld-headers
FILES_MATCHING
PATTERN "*.h"
)
+
+ if (NOT LLVM_ENABLE_IDE)
+ add_llvm_install_targets(install-lld-headers
+ DEPENDS lld-headers
+ COMPONENT lld-headers)
+ endif()
endif()
add_subdirectory(Common)
|
Turns out libaries don't get installed either... |
88477db
to
fafbf21
Compare
Description:
I am not familiar with LLVM_DISTRIBUTION_COMPONENTS but this appears to be the intended behavior.
|
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.
.
Sorry I don't understand Do you mean that |
Right. lld headers should only be installed when
|
|
Sorry are you sure this is true? I just double checked: (base) mlevental@maksims-MacBook-Pro llvm-project % git rev-parse HEAD
fafbf216156043d1874cb339e44f57bb1e8dd4b6
(base) mlevental@maksims-MacBook-Pro llvm-project % rm -rf build llvm-install-release
(base) mlevental@maksims-MacBook-Pro llvm-project % cmake -B build -S llvm -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS=lld -DLLVM_DISTRIBUTION_COMPONENTS=lld -DCMAKE_INSTALL_PREFIX=llvm-install-release
-- The C compiler identification is AppleClang 16.0.0.16000026
-- The CXX compiler identification is AppleClang 16.0.0.16000026
...
-- Build files have been written to: /Users/mlevental/dev_projects/llvm-project/build
(base) mlevental@maksims-MacBook-Pro llvm-project % cmake --build build --target install-distribution
...
(base) mlevental@maksims-MacBook-Pro llvm-project % ls llvm-install-release
bin
(base) mlevental@maksims-MacBook-Pro llvm-project % ls llvm-install-release/bin
ld.lld ld64.lld lld lld-link wasm-ld |
I am sure. The clang behavior looks reasonable. The executable Can you clarify things in the PR description? State the behavior of |
I'm not saying I disagree with the clang behavior, I'm saying that the behavior I'm seeing is exactly what you expect i.e.
It is exactly what you expect and what this PR implements:
|
I am still confused. You mentioned the following in the description
I stated that this is the intended behavior: Can you clarify this in the PR description? Suggested description (please confirm the behavior): This patch allows |
Sorry sorry it wasn't clear to me what your were asking. I've now adjusted the PR description. Thank you for the suggested description. |
…tains lld-headers (#127946) Without this inc file `getLLDVersion` cannot be called; see https://github.com/llvm/llvm-project/blob/main/lld/include/lld/Common/Version.h#L16. Fixes incomplete solution introduced by #127123.
…PONENTS contains lld-headers (#127946) Without this inc file `getLLDVersion` cannot be called; see https://github.com/llvm/llvm-project/blob/main/lld/include/lld/Common/Version.h#L16. Fixes incomplete solution introduced by llvm/llvm-project#127123.
…tion (llvm#127123) This patch allows `lld-headers` and `lld-libraries` in `LLVM_DISTRIBUTION_COMPONENTS` to be specified and thus enable piecewise installation of `lld/**/*.h` headers and/or lld libraries (both in shared and static builds). This is similar to use cases such as `clang;clang-headers;clang-libraries`. Note when `lld-libraries` is present, `llvm-libraries` must be present as well because various lld libraries depend on various llvm libraries.
This patch allows
lld-headers
andlld-libraries
inLLVM_DISTRIBUTION_COMPONENTS
to be specified and thus enable piecewise installation oflld/**/*.h
headers and/or lld libraries (both in shared and static builds).This is similar to use cases such as
clang;clang-headers;clang-libraries
. Note whenlld-libraries
is present,llvm-libraries
must be present as well because various lld libraries depend on various llvm libraries.