mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 02:33:06 +01:00
Revert "[CMake] Simplify CMake handling for zlib"
This reverts commit 1adc494bce44f6004994deed61b30d4b71fe1d05. This patch broke the Windows compilation on buildbot and pre-merge testing: http://lab.llvm.org:8011/builders/mlir-windows/builds/5945 https://buildkite.com/llvm-project/llvm-master-build/builds/780
This commit is contained in:
parent
2a20f7c161
commit
e33dafd15e
@ -56,6 +56,7 @@ check_include_file(sys/types.h HAVE_SYS_TYPES_H)
|
||||
check_include_file(termios.h HAVE_TERMIOS_H)
|
||||
check_include_file(unistd.h HAVE_UNISTD_H)
|
||||
check_include_file(valgrind/valgrind.h HAVE_VALGRIND_VALGRIND_H)
|
||||
check_include_file(zlib.h HAVE_ZLIB_H)
|
||||
check_include_file(fenv.h HAVE_FENV_H)
|
||||
check_symbol_exists(FE_ALL_EXCEPT "fenv.h" HAVE_DECL_FE_ALL_EXCEPT)
|
||||
check_symbol_exists(FE_INEXACT "fenv.h" HAVE_DECL_FE_INEXACT)
|
||||
@ -117,13 +118,17 @@ endif()
|
||||
# Don't look for these libraries if we're using MSan, since uninstrumented third
|
||||
# party code may call MSan interceptors like strlen, leading to false positives.
|
||||
if(NOT LLVM_USE_SANITIZER MATCHES "Memory.*")
|
||||
set(HAVE_LIBZ 0)
|
||||
if(LLVM_ENABLE_ZLIB)
|
||||
if(LLVM_ENABLE_ZLIB STREQUAL FORCE_ON)
|
||||
find_package(ZLIB REQUIRED)
|
||||
else()
|
||||
find_package(ZLIB)
|
||||
endif()
|
||||
set(LLVM_ENABLE_ZLIB "${ZLIB_FOUND}")
|
||||
foreach(library z zlib_static zlib)
|
||||
string(TOUPPER ${library} library_suffix)
|
||||
check_library_exists(${library} compress2 "" HAVE_LIBZ_${library_suffix})
|
||||
if(HAVE_LIBZ_${library_suffix})
|
||||
set(HAVE_LIBZ 1)
|
||||
set(ZLIB_LIBRARIES "${library}")
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# Don't look for these libraries on Windows.
|
||||
@ -164,14 +169,16 @@ if(NOT LLVM_USE_SANITIZER MATCHES "Memory.*")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
set(LLVM_ENABLE_ZLIB FALSE)
|
||||
endif()
|
||||
|
||||
if (LLVM_ENABLE_LIBXML2 STREQUAL "FORCE_ON" AND NOT LLVM_LIBXML2_ENABLED)
|
||||
message(FATAL_ERROR "Failed to congifure libxml2")
|
||||
endif()
|
||||
|
||||
if (LLVM_ENABLE_ZLIB STREQUAL "FORCE_ON" AND NOT HAVE_LIBZ)
|
||||
message(FATAL_ERROR "Failed to configure zlib")
|
||||
endif()
|
||||
|
||||
check_library_exists(xar xar_open "" HAVE_LIBXAR)
|
||||
if(HAVE_LIBXAR)
|
||||
set(XAR_LIB xar)
|
||||
@ -510,6 +517,13 @@ else( LLVM_ENABLE_THREADS )
|
||||
message(STATUS "Threads disabled.")
|
||||
endif()
|
||||
|
||||
if (LLVM_ENABLE_ZLIB )
|
||||
# Check if zlib is available in the system.
|
||||
if ( NOT HAVE_ZLIB_H OR NOT HAVE_LIBZ )
|
||||
set(LLVM_ENABLE_ZLIB 0)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (LLVM_ENABLE_DOXYGEN)
|
||||
message(STATUS "Doxygen enabled.")
|
||||
find_package(Doxygen REQUIRED)
|
||||
|
@ -51,9 +51,6 @@ set(LLVM_ENABLE_THREADS @LLVM_ENABLE_THREADS@)
|
||||
set(LLVM_ENABLE_UNWIND_TABLES @LLVM_ENABLE_UNWIND_TABLES@)
|
||||
|
||||
set(LLVM_ENABLE_ZLIB @LLVM_ENABLE_ZLIB@)
|
||||
if(LLVM_ENABLE_ZLIB)
|
||||
find_package(ZLIB)
|
||||
endif()
|
||||
|
||||
set(LLVM_LIBXML2_ENABLED @LLVM_LIBXML2_ENABLED@)
|
||||
|
||||
|
@ -115,6 +115,9 @@
|
||||
/* Define to 1 if you have the `pthread_setname_np' function. */
|
||||
#cmakedefine HAVE_PTHREAD_SETNAME_NP ${HAVE_PTHREAD_SETNAME_NP}
|
||||
|
||||
/* Define to 1 if you have the `z' library (-lz). */
|
||||
#cmakedefine HAVE_LIBZ ${HAVE_LIBZ}
|
||||
|
||||
/* Define to 1 if you have the <link.h> header file. */
|
||||
#cmakedefine HAVE_LINK_H ${HAVE_LINK_H}
|
||||
|
||||
@ -223,6 +226,9 @@
|
||||
/* Define to 1 if you have the <valgrind/valgrind.h> header file. */
|
||||
#cmakedefine HAVE_VALGRIND_VALGRIND_H ${HAVE_VALGRIND_VALGRIND_H}
|
||||
|
||||
/* Define to 1 if you have the <zlib.h> header file. */
|
||||
#cmakedefine HAVE_ZLIB_H ${HAVE_ZLIB_H}
|
||||
|
||||
/* Have host's _alloca */
|
||||
#cmakedefine HAVE__ALLOCA ${HAVE__ALLOCA}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
if(LLVM_ENABLE_ZLIB)
|
||||
set(imported_libs ZLIB::ZLIB)
|
||||
set(system_libs)
|
||||
if ( LLVM_ENABLE_ZLIB AND HAVE_LIBZ )
|
||||
set(system_libs ${system_libs} ${ZLIB_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if( MSVC OR MINGW )
|
||||
# libuuid required for FOLDERID_Profile usage in lib/Support/Windows/Path.inc.
|
||||
# advapi32 required for CryptAcquireContextW in lib/Support/Windows/Path.inc.
|
||||
@ -194,35 +194,10 @@ add_llvm_component_library(LLVMSupport
|
||||
${LLVM_MAIN_INCLUDE_DIR}/llvm/ADT
|
||||
${LLVM_MAIN_INCLUDE_DIR}/llvm/Support
|
||||
${Backtrace_INCLUDE_DIRS}
|
||||
LINK_LIBS ${system_libs} ${imported_libs} ${delayload_flags} ${Z3_LINK_FILES}
|
||||
LINK_LIBS ${system_libs} ${delayload_flags} ${Z3_LINK_FILES}
|
||||
)
|
||||
|
||||
set(llvm_system_libs ${system_libs})
|
||||
|
||||
if(LLVM_ENABLE_ZLIB)
|
||||
# CMAKE_BUILD_TYPE is only meaningful to single-configuration generators.
|
||||
if(CMAKE_BUILD_TYPE)
|
||||
string(TOUPPER ${CMAKE_BUILD_TYPE} build_type)
|
||||
get_property(zlib_library TARGET ZLIB::ZLIB PROPERTY LOCATION_${build_type})
|
||||
endif()
|
||||
if(NOT zlib_library)
|
||||
get_property(zlib_library TARGET ZLIB::ZLIB PROPERTY LOCATION)
|
||||
endif()
|
||||
get_filename_component(zlib_library ${zlib_library} NAME)
|
||||
if(CMAKE_STATIC_LIBRARY_PREFIX AND CMAKE_STATIC_LIBRARY_SUFFIX AND
|
||||
zlib_library MATCHES "^${CMAKE_STATIC_LIBRARY_PREFIX}.*${CMAKE_STATIC_LIBRARY_SUFFIX}$")
|
||||
STRING(REGEX REPLACE "^${CMAKE_STATIC_LIBRARY_PREFIX}" "" zlib_library ${zlib_library})
|
||||
STRING(REGEX REPLACE "${CMAKE_STATIC_LIBRARY_SUFFIX}$" "" zlib_library ${zlib_library})
|
||||
endif()
|
||||
if(CMAKE_SHARED_LIBRARY_PREFIX AND CMAKE_SHARED_LIBRARY_SUFFIX AND
|
||||
zlib_library MATCHES "^${CMAKE_SHARED_LIBRARY_PREFIX}.*${CMAKE_SHARED_LIBRARY_SUFFIX}$")
|
||||
STRING(REGEX REPLACE "^${CMAKE_SHARED_LIBRARY_PREFIX}" "" zlib_library ${zlib_library})
|
||||
STRING(REGEX REPLACE "${CMAKE_SHARED_LIBRARY_SUFFIX}$" "" zlib_library ${zlib_library})
|
||||
endif()
|
||||
set(llvm_system_libs ${llvm_system_libs} "${zlib_library}")
|
||||
endif()
|
||||
|
||||
set_property(TARGET LLVMSupport PROPERTY LLVM_SYSTEM_LIBS "${llvm_system_libs}")
|
||||
set_property(TARGET LLVMSupport PROPERTY LLVM_SYSTEM_LIBS "${system_libs}")
|
||||
|
||||
if(LLVM_WITH_Z3)
|
||||
target_include_directories(LLVMSupport SYSTEM
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
#if !LLVM_ENABLE_ZLIB
|
||||
#if LLVM_ENABLE_ZLIB == 0 || !HAVE_ZLIB_H
|
||||
|
||||
static const uint32_t CRCTable[256] = {
|
||||
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
|
||||
|
@ -17,13 +17,13 @@
|
||||
#include "llvm/Support/Compiler.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#if LLVM_ENABLE_ZLIB
|
||||
#if LLVM_ENABLE_ZLIB == 1 && HAVE_ZLIB_H
|
||||
#include <zlib.h>
|
||||
#endif
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
#if LLVM_ENABLE_ZLIB
|
||||
#if LLVM_ENABLE_ZLIB == 1 && HAVE_LIBZ
|
||||
static Error createError(StringRef Err) {
|
||||
return make_error<StringError>(Err, inconvertibleErrorCode());
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
llvm_canonicalize_cmake_booleans(
|
||||
BUILD_SHARED_LIBS
|
||||
HAVE_LIBXAR
|
||||
HAVE_LIBZ
|
||||
HAVE_OCAMLOPT
|
||||
HAVE_OCAML_OUNIT
|
||||
LLVM_ENABLE_DIA_SDK
|
||||
LLVM_ENABLE_FFI
|
||||
LLVM_ENABLE_THREADS
|
||||
LLVM_ENABLE_ZLIB
|
||||
LLVM_INCLUDE_GO_TESTS
|
||||
LLVM_LIBXML2_ENABLED
|
||||
LLVM_LINK_LLVM_DYLIB
|
||||
|
@ -33,7 +33,7 @@ config.host_cxx = "@HOST_CXX@"
|
||||
config.host_ldflags = '@HOST_LDFLAGS@'
|
||||
config.llvm_use_intel_jitevents = @LLVM_USE_INTEL_JITEVENTS@
|
||||
config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
|
||||
config.have_zlib = @LLVM_ENABLE_ZLIB@
|
||||
config.have_zlib = @HAVE_LIBZ@
|
||||
config.have_libxar = @HAVE_LIBXAR@
|
||||
config.have_dia_sdk = @LLVM_ENABLE_DIA_SDK@
|
||||
config.enable_ffi = @LLVM_ENABLE_FFI@
|
||||
|
@ -21,7 +21,7 @@ using namespace llvm;
|
||||
|
||||
namespace {
|
||||
|
||||
#if LLVM_ENABLE_ZLIB
|
||||
#if LLVM_ENABLE_ZLIB == 1 && HAVE_LIBZ
|
||||
|
||||
void TestZlibCompression(StringRef Input, int Level) {
|
||||
SmallString<32> Compressed;
|
||||
|
@ -79,9 +79,9 @@ write_lit_config("lit_site_cfg") {
|
||||
}
|
||||
|
||||
if (llvm_enable_zlib) {
|
||||
extra_values += [ "LLVM_ENABLE_ZLIB=1" ]
|
||||
extra_values += [ "HAVE_LIBZ=1" ]
|
||||
} else {
|
||||
extra_values += [ "LLVM_ENABLE_ZLIB=0" ] # Must be 0.
|
||||
extra_values += [ "HAVE_LIBZ=0" ] # Must be 0.
|
||||
}
|
||||
|
||||
if (host_cpu == "x64") {
|
||||
|
@ -86,8 +86,8 @@ write_cmake_config("lit_common_configured") {
|
||||
}
|
||||
|
||||
if (llvm_enable_zlib) {
|
||||
values += [ "LLVM_ENABLE_ZLIB=1" ]
|
||||
values += [ "HAVE_LIBZ=1" ]
|
||||
} else {
|
||||
values += [ "LLVM_ENABLE_ZLIB=0" ]
|
||||
values += [ "HAVE_LIBZ=0" ]
|
||||
}
|
||||
}
|
||||
|
@ -49,9 +49,9 @@ write_lit_cfg("lit_site_cfg") {
|
||||
}
|
||||
|
||||
if (llvm_enable_zlib) {
|
||||
extra_values += [ "LLVM_ENABLE_ZLIB=1" ]
|
||||
extra_values += [ "HAVE_LIBZ=1" ]
|
||||
} else {
|
||||
extra_values += [ "LLVM_ENABLE_ZLIB=0" ] # Must be 0.
|
||||
extra_values += [ "HAVE_LIBZ=0" ] # Must be 0.
|
||||
}
|
||||
|
||||
if (current_cpu == "x64" || current_cpu == "arm64" ||
|
||||
|
@ -295,10 +295,20 @@ write_cmake_config("config") {
|
||||
values += [ "LLVM_ENABLE_DIA_SDK=" ]
|
||||
}
|
||||
|
||||
# FIXME: Once https://reviews.llvm.org/D79219 is in, remove the two
|
||||
# redundant HAVE_ variables.
|
||||
if (llvm_enable_zlib) {
|
||||
values += [ "LLVM_ENABLE_ZLIB=1" ]
|
||||
values += [
|
||||
"HAVE_LIBZ=1",
|
||||
"HAVE_ZLIB_H=1",
|
||||
"LLVM_ENABLE_ZLIB=1",
|
||||
]
|
||||
} else {
|
||||
values += [ "LLVM_ENABLE_ZLIB=" ]
|
||||
values += [
|
||||
"HAVE_LIBZ=",
|
||||
"HAVE_ZLIB_H=",
|
||||
"LLVM_ENABLE_ZLIB=",
|
||||
]
|
||||
}
|
||||
|
||||
if (llvm_enable_libxml2) {
|
||||
|
@ -174,9 +174,9 @@ write_lit_config("lit_site_cfg") {
|
||||
}
|
||||
|
||||
if (llvm_enable_zlib) {
|
||||
extra_values += [ "LLVM_ENABLE_ZLIB=1" ]
|
||||
extra_values += [ "HAVE_LIBZ=1" ]
|
||||
} else {
|
||||
extra_values += [ "LLVM_ENABLE_ZLIB=0" ] # Must be 0.
|
||||
extra_values += [ "HAVE_LIBZ=0" ] # Must be 0.
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user