From b11156c60fb5b824c273c5783d00cd3fefa1a876 Mon Sep 17 00:00:00 2001 From: neurolabusc Date: Fri, 31 Jan 2020 16:02:27 -0500 Subject: [PATCH] Support for zlib-ng --- README.md | 22 +++++++++++++++++++++- SuperBuild/External-ZLIBng.cmake | 8 ++++++-- SuperBuild/SuperBuild.cmake | 4 ++-- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d4795e1..f8e56cf 100755 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Be aware that some pigz does not work on some [Linux systems](https://github.com ## Installing -The recommended method is to compile your own copy of pigz. This will ensure that pigz is built using the latest [glibc](https://github.com/madler/pigz/issues/68) version on your system: +The recommended method is to compile your own copy of pigz. This will ensure that pigz is built using the latest [glibc](https://github.com/madler/pigz/issues/68) version on your system (which will use the [CloudFlare zlib](https://github.com/cloudflare/zlib) by default) which is currently the best performing option: ``` git clone https://github.com/neurolabusc/pigz.git @@ -18,6 +18,26 @@ cmake .. make ``` +Alternatively, you can build for [zlib-ng](https://github.com/zlib-ng/zlib-ng): + +``` +git clone https://github.com/neurolabusc/pigz.git +cd pigz +mkdir build && cd build +-DZLIB_IMPLEMENTATION=ng .. +make +``` + + +Finally, you can build for your system zlib, which will likely provide the poorest performance: + +``` +git clone https://github.com/neurolabusc/pigz.git +cd pigz +mkdir build && cd build +-DZLIB_IMPLEMENTATION=System .. +make +``` You can get a precompiled version by going to the [releases](https://github.com/neurolabusc/pigz/releases) tab. Different Linux versions are provided, e.g. for Ubuntu 16.04, 18.04 or 19.10. You should use the latest version supported by your system, as [glibc](https://github.com/madler/pigz/issues/68) has been improved to fix parallel threading issues. diff --git a/SuperBuild/External-ZLIBng.cmake b/SuperBuild/External-ZLIBng.cmake index 988106b..a6cef3e 100644 --- a/SuperBuild/External-ZLIBng.cmake +++ b/SuperBuild/External-ZLIBng.cmake @@ -1,14 +1,18 @@ set(NG_BRANCH develop) # zlib-ng branch ExternalProject_Add(zlib - GIT_REPOSITORY "${git_protocol}://github.com/rordenlab/zlib-ng.git" + GIT_REPOSITORY "${git_protocol}://github.com/zlib-ng/zlib-ng.git" GIT_TAG "${NG_BRANCH}" SOURCE_DIR ng-zlib BINARY_DIR ng-zlib-build - CMAKE_ARGS + BUILD_BYPRODUCTS ${ZLIB_STATIC_LIBRARIES} + CMAKE_ARGS -Wno-dev -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH=${DEP_INSTALL_DIR} + -DZLIB_COMPAT:STRING=ON + -DBUILD_SHARED_LIBS:STRING=OFF ) +set(CMAKE_FIND_LIBRARY_SUFFIXES .a) set(ZLIB_ROOT ${DEP_INSTALL_DIR}) diff --git a/SuperBuild/SuperBuild.cmake b/SuperBuild/SuperBuild.cmake index 73bcca7..b39d42d 100644 --- a/SuperBuild/SuperBuild.cmake +++ b/SuperBuild/SuperBuild.cmake @@ -49,7 +49,7 @@ else() endif() set(ZLIB_IMPLEMENTATION "Cloudflare" CACHE STRING "Choose zlib implementation.") -set_property(CACHE ZLIB_IMPLEMENTATION PROPERTY STRINGS "System;Cloudflare;Custom") +set_property(CACHE ZLIB_IMPLEMENTATION PROPERTY STRINGS "Cloudflare;System;ng;Custom") if(${ZLIB_IMPLEMENTATION} STREQUAL "Cloudflare") message("-- Build with Cloudflare zlib: ON") include(${CMAKE_SOURCE_DIR}/SuperBuild/External-CLOUDFLARE-ZLIB.cmake) @@ -60,7 +60,7 @@ elseif(${ZLIB_IMPLEMENTATION} STREQUAL "ng") message("-- Build with zlib-ng: ON") include(${CMAKE_SOURCE_DIR}/SuperBuild/External-ZLIBng.cmake) list(APPEND DEPENDENCIES zlib) - set(BUILD_CLOUDFLARE-ZLIB TRUE) + set(BUILD_NG-ZLIB TRUE) message("-- Will build zlib-ng from github") elseif(${ZLIB_IMPLEMENTATION} STREQUAL "Custom") set(ZLIB_ROOT ${ZLIB_ROOT} CACHE PATH "Specify custom zlib root directory.")