From 938b3e6b4a063a00c52ea3e016f7e8f6b83e6acc Mon Sep 17 00:00:00 2001 From: "Agarwal, Udit" Date: Thu, 24 Oct 2024 07:51:02 -0700 Subject: [PATCH] Fix zstd build when static zstd libraries are not avilable --- buildbot/configure.py | 4 +--- llvm/cmake/config-ix.cmake | 7 +++++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/buildbot/configure.py b/buildbot/configure.py index e7e32cb4e7771..5a7fdd003a1de 100644 --- a/buildbot/configure.py +++ b/buildbot/configure.py @@ -64,7 +64,7 @@ def do_configure(args): sycl_enable_xpti_tracing = "ON" xpti_enable_werror = "OFF" - llvm_enable_zstd = "OFF" + llvm_enable_zstd = "ON" if sys.platform != "darwin": sycl_enabled_backends.append("level_zero") @@ -134,8 +134,6 @@ def do_configure(args): # For clang-format, clang-tidy and code coverage llvm_enable_projects += ";clang-tools-extra;compiler-rt" - # Build with zstd enabled on CI. - llvm_enable_zstd = "ON" if sys.platform != "darwin": # libclc is required for CI validation libclc_enabled = True diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake index 86f2bac7d23e8..03a532772cbfe 100644 --- a/llvm/cmake/config-ix.cmake +++ b/llvm/cmake/config-ix.cmake @@ -157,7 +157,14 @@ if(LLVM_ENABLE_ZSTD) find_package(zstd QUIET) endif() endif() + +# If LLVM_USE_STATIC_ZSTD is specified, make sure we enable zstd only if static +# libraries are found. +if(LLVM_USE_STATIC_ZSTD AND NOT TARGET zstd::libzstd_static) +set(LLVM_ENABLE_ZSTD OFF) +else() set(LLVM_ENABLE_ZSTD ${zstd_FOUND}) +endif() if(LLVM_ENABLE_LIBXML2) if(LLVM_ENABLE_LIBXML2 STREQUAL FORCE_ON)