Skip to content

Commit

Permalink
Support for zlib-ng
Browse files Browse the repository at this point in the history
  • Loading branch information
neurolabusc committed Jan 31, 2020
1 parent 93ef899 commit b11156c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.

Expand Down
8 changes: 6 additions & 2 deletions SuperBuild/External-ZLIBng.cmake
Original file line number Diff line number Diff line change
@@ -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})
4 changes: 2 additions & 2 deletions SuperBuild/SuperBuild.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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.")
Expand Down

0 comments on commit b11156c

Please sign in to comment.