[llvm] r319533 - [cmake] Enable zlib support on windows
Rafael Avila de Espindola via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 1 14:37:02 PST 2017
This broke static linking on linux as ZLIB_LIBRARY_PATH points to the
.so instead of the .a.
Cheers,
Rafael
Pavel Labath via llvm-commits <llvm-commits at lists.llvm.org> writes:
> Author: labath
> Date: Fri Dec 1 03:41:07 2017
> New Revision: 319533
>
> URL: http://llvm.org/viewvc/llvm-project?rev=319533&view=rev
> Log:
> [cmake] Enable zlib support on windows
>
> Summary:
> zlib support was hard-wired to off for (non-cygwin) windows targets.
> This disables some features, such as reading debug info from compressed
> dwarf sections.
>
> This has been this way since zlib support was added in 2013 (r180083),
> but there is no obvious reason for that. Zlib is perfectly capable of
> being compiled for windows (it even has a cmake file that works out of
> the box).
>
> This enables one to turn on zlib support on windows, if one has zlib
> avaliable.
>
> Reviewers: rnk, beanz
>
> Subscribers: mgorny, aprantl, llvm-commits
>
> Differential Revision: https://reviews.llvm.org/D40655
>
> Modified:
> llvm/trunk/cmake/config-ix.cmake
> llvm/trunk/lib/Support/CMakeLists.txt
>
> Modified: llvm/trunk/cmake/config-ix.cmake
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/config-ix.cmake?rev=319533&r1=319532&r2=319533&view=diff
> ==============================================================================
> --- llvm/trunk/cmake/config-ix.cmake (original)
> +++ llvm/trunk/cmake/config-ix.cmake Fri Dec 1 03:41:07 2017
> @@ -127,45 +127,49 @@ if(HAVE_LIBPTHREAD)
> set(LLVM_PTHREAD_LIB ${CMAKE_THREAD_LIBS_INIT})
> endif()
>
> -# Don't look for these libraries on Windows. Also don't look for them if we're
> -# using MSan, since uninstrumented third party code may call MSan interceptors
> -# like strlen, leading to false positives.
> -if( NOT PURE_WINDOWS AND NOT LLVM_USE_SANITIZER MATCHES "Memory.*")
> - if (LLVM_ENABLE_ZLIB)
> - check_library_exists(z compress2 "" HAVE_LIBZ)
> +# 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.*")
> + find_library(ZLIB_LIBRARY_PATH NAMES z zlib)
> + if (LLVM_ENABLE_ZLIB AND ZLIB_LIBRARY_PATH)
> + check_library_exists(${ZLIB_LIBRARY_PATH} compress2 "" HAVE_LIBZ)
> else()
> set(HAVE_LIBZ 0)
> endif()
> - # Skip libedit if using ASan as it contains memory leaks.
> - if (LLVM_ENABLE_LIBEDIT AND HAVE_HISTEDIT_H AND NOT LLVM_USE_SANITIZER MATCHES ".*Address.*")
> - check_library_exists(edit el_init "" HAVE_LIBEDIT)
> - else()
> - set(HAVE_LIBEDIT 0)
> - endif()
> - if(LLVM_ENABLE_TERMINFO)
> - set(HAVE_TERMINFO 0)
> - foreach(library tinfo terminfo curses ncurses ncursesw)
> - string(TOUPPER ${library} library_suffix)
> - check_library_exists(${library} setupterm "" HAVE_TERMINFO_${library_suffix})
> - if(HAVE_TERMINFO_${library_suffix})
> - set(HAVE_TERMINFO 1)
> - set(TERMINFO_LIBS "${library}")
> - break()
> - endif()
> - endforeach()
> - else()
> - set(HAVE_TERMINFO 0)
> - endif()
>
> - find_library(ICONV_LIBRARY_PATH NAMES iconv libiconv libiconv-2 c)
> - set(LLVM_LIBXML2_ENABLED 0)
> - set(LIBXML2_FOUND 0)
> - if((LLVM_ENABLE_LIBXML2) AND ((CMAKE_SYSTEM_NAME MATCHES "Linux") AND (ICONV_LIBRARY_PATH) OR APPLE))
> - find_package(LibXml2)
> - if (LIBXML2_FOUND)
> - set(LLVM_LIBXML2_ENABLED 1)
> - include_directories(${LIBXML2_INCLUDE_DIR})
> - set(LIBXML2_LIBS "xml2")
> + # Don't look for these libraries on Windows.
> + if (NOT PURE_WINDOWS)
> + # Skip libedit if using ASan as it contains memory leaks.
> + if (LLVM_ENABLE_LIBEDIT AND HAVE_HISTEDIT_H AND NOT LLVM_USE_SANITIZER MATCHES ".*Address.*")
> + check_library_exists(edit el_init "" HAVE_LIBEDIT)
> + else()
> + set(HAVE_LIBEDIT 0)
> + endif()
> + if(LLVM_ENABLE_TERMINFO)
> + set(HAVE_TERMINFO 0)
> + foreach(library tinfo terminfo curses ncurses ncursesw)
> + string(TOUPPER ${library} library_suffix)
> + check_library_exists(${library} setupterm "" HAVE_TERMINFO_${library_suffix})
> + if(HAVE_TERMINFO_${library_suffix})
> + set(HAVE_TERMINFO 1)
> + set(TERMINFO_LIBS "${library}")
> + break()
> + endif()
> + endforeach()
> + else()
> + set(HAVE_TERMINFO 0)
> + endif()
> +
> + find_library(ICONV_LIBRARY_PATH NAMES iconv libiconv libiconv-2 c)
> + set(LLVM_LIBXML2_ENABLED 0)
> + set(LIBXML2_FOUND 0)
> + if((LLVM_ENABLE_LIBXML2) AND ((CMAKE_SYSTEM_NAME MATCHES "Linux") AND (ICONV_LIBRARY_PATH) OR APPLE))
> + find_package(LibXml2)
> + if (LIBXML2_FOUND)
> + set(LLVM_LIBXML2_ENABLED 1)
> + include_directories(${LIBXML2_INCLUDE_DIR})
> + set(LIBXML2_LIBS "xml2")
> + endif()
> endif()
> endif()
> endif()
>
> Modified: llvm/trunk/lib/Support/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/CMakeLists.txt?rev=319533&r1=319532&r2=319533&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Support/CMakeLists.txt (original)
> +++ llvm/trunk/lib/Support/CMakeLists.txt Fri Dec 1 03:41:07 2017
> @@ -1,4 +1,7 @@
> set(system_libs)
> +if ( LLVM_ENABLE_ZLIB AND HAVE_LIBZ )
> + set(system_libs ${system_libs} ${ZLIB_LIBRARY_PATH})
> +endif()
> if( MSVC OR MINGW )
> # libuuid required for FOLDERID_Profile usage in lib/Support/Windows/Path.inc.
> set(system_libs ${system_libs} psapi shell32 ole32 uuid)
> @@ -21,9 +24,6 @@ elseif( CMAKE_HOST_UNIX )
> set(system_libs ${system_libs} atomic)
> endif()
> set(system_libs ${system_libs} ${LLVM_PTHREAD_LIB})
> - if ( LLVM_ENABLE_ZLIB AND HAVE_LIBZ )
> - set(system_libs ${system_libs} z)
> - endif()
> if( UNIX AND NOT (BEOS OR HAIKU) )
> set(system_libs ${system_libs} m)
> endif()
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list