This is an archive of the discontinued LLVM Phabricator instance.

tweak zstd behavior in cmake and llvm config for better testing
ClosedPublic

Authored by ckissane on Aug 29 2022, 10:27 AM.

Details

Summary

add LLVM_PREFER_STATIC_ZSTD (default TRUE) cmake config flag
(compression test seems to fail for shared zstd on windows, note that zstd multithread is by default disabled in the static build so it may be a hidden variable)
propagate variable zstd_DIR in LLVMConfig.cmake.in
fix llvm-config CMakeLists.txt behavior for absolute libs windows
get zstd lib name

Diff Detail

Event Timeline

ckissane created this revision.Aug 29 2022, 10:27 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 29 2022, 10:27 AM
ckissane requested review of this revision.Aug 29 2022, 10:27 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 29 2022, 10:27 AM
phosek added inline comments.Aug 29 2022, 11:03 AM
llvm/cmake/modules/LLVMConfig.cmake.in
77–78

I think it should be possible to omit this line altogether, this shouldn't be needed (zlib above is a special case).

llvm/lib/Support/CMakeLists.txt
24

This is unnecessary, you can just omit this line.

ckissane added inline comments.Aug 29 2022, 11:05 AM
llvm/cmake/modules/LLVMConfig.cmake.in
77–78

unfortunately this is the critical change

ckissane updated this revision to Diff 456419.Aug 29 2022, 11:11 AM
  • omit uneeded line
ckissane marked an inline comment as done.Aug 29 2022, 11:13 AM
ckissane added inline comments.
llvm/cmake/modules/LLVMConfig.cmake.in
77–78

without this:
the builders that set custom zstd_DIR when building clang will build fine
but tests that run then using the llvmconfig vars will fail to find zstd

llvm/lib/Support/CMakeLists.txt
24

omitted

ckissane updated this revision to Diff 456734.Aug 30 2022, 11:13 AM
ckissane marked an inline comment as done.
  • add LLVM_PREFER_STATIC_ZSTD (default TRUE)
ckissane edited the summary of this revision. (Show Details)Aug 30 2022, 11:15 AM
ckissane edited the summary of this revision. (Show Details)Aug 30 2022, 11:46 AM
ckissane retitled this revision from tweak zstd behavior in cmake and llvm config for better testing to tweak zstd behavior in cmake and llvm config for better testing.
ckissane edited the summary of this revision. (Show Details)
ckissane updated this revision to Diff 457030.Aug 31 2022, 11:14 AM
  • remove nit
llvm/cmake/modules/LLVMConfig.cmake.in
77–78

apparently warning which this fixes can be ignored anyway... so removing for now...

phosek accepted this revision.Sep 1 2022, 1:03 AM

LGTM

llvm/lib/Support/CMakeLists.txt
31–43

I'd prefer a slightly simpler strategy which is to follow what linkers do (and what we also sometimes use elsewhere in the build): try shared first, if it doesn't exist use static plus provide a flag to skip the shared library search.

This revision is now accepted and ready to land.Sep 1 2022, 1:03 AM