Commit 5f9211bc authored by Hans Wennborg's avatar Hans Wennborg
Browse files

Revert abb00753 "build: reduce CMake handling for zlib" (PR44780)

and follow-ups:
a2ca1c2d "build: disable zlib by default on Windows"
2181bf40 "[CMake] Link against ZLIB::ZLIB"
1079c68a "Attempt to fix ZLIB CMake logic on Windows"

This changed the output of llvm-config --system-libs, and more
importantly it broke stand-alone builds. Instead of piling on more fix
attempts, let's revert this to reduce the risk of more breakages.

(cherry picked from commit 916be8fd)
parent 001c8aac
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -9,6 +9,15 @@ endif ()

string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} CLANG_TOOLS_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})

if(CLANG_BUILT_STANDALONE)
  # Set HAVE_LIBZ according to recorded LLVM_ENABLE_ZLIB value. This
  # value is forced to 0 if zlib was not found, so it is fine to use it
  # instead of HAVE_LIBZ (not recorded).
  if(LLVM_ENABLE_ZLIB)
    set(HAVE_LIBZ 1)
  endif()
endif()

llvm_canonicalize_cmake_booleans(
  CLANG_BUILD_EXAMPLES
  CLANG_ENABLE_ARCMT
@@ -16,7 +25,7 @@ llvm_canonicalize_cmake_booleans(
  CLANG_SPAWN_CC1
  ENABLE_BACKTRACES
  ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER
  LLVM_ENABLE_ZLIB
  HAVE_LIBZ
  LLVM_ENABLE_PER_TARGET_RUNTIME_DIR
  LLVM_ENABLE_PLUGINS
  LLVM_ENABLE_THREADS)
+1 −1
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@ config.host_triple = "@LLVM_HOST_TRIPLE@"
config.target_triple = "@TARGET_TRIPLE@"
config.host_cxx = "@CMAKE_CXX_COMPILER@"
config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
config.have_zlib = @LLVM_ENABLE_ZLIB@
config.have_zlib = @HAVE_LIBZ@
config.clang_arcmt = @CLANG_ENABLE_ARCMT@
config.clang_default_cxx_stdlib = "@CLANG_DEFAULT_CXX_STDLIB@"
config.clang_staticanalyzer = @CLANG_ENABLE_STATIC_ANALYZER@
+1 −1
Original line number Diff line number Diff line
@@ -50,7 +50,7 @@ if config.enable_per_target_runtime_dir:
else:
  set_default("target_suffix", "-%s" % config.target_arch)

set_default("have_zlib", "@LLVM_ENABLE_ZLIB@")
set_default("have_zlib", "@HAVE_LIBZ@")
set_default("libcxx_used", "@LLVM_LIBCXX_USED@")

# LLVM tools dir can be passed in lit parameters, so try to
+10 −1
Original line number Diff line number Diff line
@@ -4,8 +4,17 @@ set(LLVM_BUILD_MODE "%(build_mode)s")
set(LLVM_TOOLS_DIR "${LLVM_TOOLS_BINARY_DIR}/%(build_config)s")
set(LLVM_LIBS_DIR "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/%(build_config)s")

if(LLD_BUILT_STANDALONE)
  # Set HAVE_LIBZ according to recorded LLVM_ENABLE_ZLIB value. This
  # value is forced to 0 if zlib was not found, so it is fine to use it
  # instead of HAVE_LIBZ (not recorded).
  if(LLVM_ENABLE_ZLIB)
    set(HAVE_LIBZ 1)
  endif()
endif()

llvm_canonicalize_cmake_booleans(
  LLVM_ENABLE_ZLIB
  HAVE_LIBZ
  LLVM_LIBXML2_ENABLED
  )

+1 −1
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@ config.lld_libs_dir = "@LLVM_LIBRARY_OUTPUT_INTDIR@"
config.lld_tools_dir = "@LLVM_RUNTIME_OUTPUT_INTDIR@"
config.target_triple = "@TARGET_TRIPLE@"
config.python_executable = "@PYTHON_EXECUTABLE@"
config.have_zlib = @LLVM_ENABLE_ZLIB@
config.have_zlib = @HAVE_LIBZ@
config.sizeof_void_p = @CMAKE_SIZEOF_VOID_P@

# Support substitution of the tools and libs dirs with user parameters. This is
Loading