tweak zstd behavior in cmake and llvm config for better testing
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 Reviewed By: phosek Differential Revision: https://reviews.llvm.org/D132870
This commit is contained in:
parent
5134bd432f
commit
c0b4f248df
|
@ -486,6 +486,8 @@ set(LLVM_ENABLE_ZLIB "ON" CACHE STRING "Use zlib for compression/decompression i
|
|||
|
||||
set(LLVM_ENABLE_ZSTD "ON" CACHE STRING "Use zstd for compression/decompression if available. Can be ON, OFF, or FORCE_ON")
|
||||
|
||||
set(LLVM_PREFER_STATIC_ZSTD TRUE CACHE BOOL "Use static version of zstd if available. Can be TRUE, FALSE")
|
||||
|
||||
set(LLVM_ENABLE_CURL "OFF" CACHE STRING "Use libcurl for the HTTP client if available. Can be ON, OFF, or FORCE_ON")
|
||||
|
||||
set(LLVM_ENABLE_HTTPLIB "OFF" CACHE STRING "Use cpp-httplib HTTP server library if available. Can be ON, OFF, or FORCE_ON")
|
||||
|
|
|
@ -75,7 +75,6 @@ endif()
|
|||
|
||||
set(LLVM_ENABLE_ZSTD @LLVM_ENABLE_ZSTD@)
|
||||
if(LLVM_ENABLE_ZSTD)
|
||||
set(zstd_ROOT @zstd_ROOT@)
|
||||
find_package(zstd)
|
||||
endif()
|
||||
|
||||
|
|
|
@ -22,11 +22,29 @@ if (HAS_WERROR_GLOBAL_CTORS)
|
|||
endif()
|
||||
|
||||
if(LLVM_ENABLE_ZLIB)
|
||||
set(imported_libs ZLIB::ZLIB)
|
||||
list(APPEND imported_libs ZLIB::ZLIB)
|
||||
endif()
|
||||
|
||||
set(zstd_target none)
|
||||
|
||||
if(LLVM_ENABLE_ZSTD)
|
||||
if(LLVM_PREFER_STATIC_ZSTD)
|
||||
if(TARGET zstd::libzstd_static)
|
||||
set(zstd_target zstd::libzstd_static)
|
||||
else()
|
||||
set(zstd_target zstd::libzstd_shared)
|
||||
endif()
|
||||
else()
|
||||
if(TARGET zstd::libzstd_shared)
|
||||
set(zstd_target zstd::libzstd_shared)
|
||||
else()
|
||||
set(zstd_target zstd::libzstd_static)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(LLVM_ENABLE_ZSTD)
|
||||
list(APPEND imported_libs zstd::libzstd_shared)
|
||||
list(APPEND imported_libs ${zstd_target})
|
||||
endif()
|
||||
|
||||
if( MSVC OR MINGW )
|
||||
|
@ -301,11 +319,12 @@ if(LLVM_ENABLE_ZSTD)
|
|||
# CMAKE_BUILD_TYPE is only meaningful to single-configuration generators.
|
||||
if(CMAKE_BUILD_TYPE)
|
||||
string(TOUPPER ${CMAKE_BUILD_TYPE} build_type)
|
||||
get_property(zstd_library TARGET zstd::libzstd_shared PROPERTY LOCATION_${build_type})
|
||||
get_property(zstd_library TARGET ${zstd_target} PROPERTY LOCATION_${build_type})
|
||||
endif()
|
||||
if(NOT zstd_library)
|
||||
get_property(zstd_library TARGET zstd::libzstd_shared PROPERTY LOCATION)
|
||||
get_property(zstd_library TARGET ${zstd_target} PROPERTY LOCATION)
|
||||
endif()
|
||||
get_library_name(${zstd_library} zstd_library)
|
||||
set(llvm_system_libs ${llvm_system_libs} "${zstd_library}")
|
||||
endif()
|
||||
|
||||
|
|
|
@ -17,9 +17,14 @@ add_llvm_tool(llvm-config
|
|||
# Compute the substitution values for various items.
|
||||
get_property(SUPPORT_SYSTEM_LIBS TARGET LLVMSupport PROPERTY LLVM_SYSTEM_LIBS)
|
||||
get_property(WINDOWSMANIFEST_SYSTEM_LIBS TARGET LLVMWindowsManifest PROPERTY LLVM_SYSTEM_LIBS)
|
||||
|
||||
foreach(l ${SUPPORT_SYSTEM_LIBS} ${WINDOWSMANIFEST_SYSTEM_LIBS})
|
||||
if(MSVC)
|
||||
set(SYSTEM_LIBS ${SYSTEM_LIBS} "${l}.lib")
|
||||
if(IS_ABSOLUTE ${l})
|
||||
set(SYSTEM_LIBS ${SYSTEM_LIBS} "${l}")
|
||||
else()
|
||||
set(SYSTEM_LIBS ${SYSTEM_LIBS} "${l}.lib")
|
||||
endif()
|
||||
else()
|
||||
if (l MATCHES "^-")
|
||||
# If it's an option, pass it without changes.
|
||||
|
@ -34,6 +39,7 @@ foreach(l ${SUPPORT_SYSTEM_LIBS} ${WINDOWSMANIFEST_SYSTEM_LIBS})
|
|||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
string(REPLACE ";" " " SYSTEM_LIBS "${SYSTEM_LIBS}")
|
||||
|
||||
# Fetch target specific compile options, e.g. RTTI option
|
||||
|
|
Loading…
Reference in New Issue