View on GitHub

sqeazy

A modern and modular high-bandwidth compression engine for on-the-microscope data reduction

Binary Distribution

This document tries to summarize, what steps were taken to build and bundle the sqeazy shared library that is distributed on bintray.

Build preparations

macOS

Before you do anything, export the following in your terminal to achieve a cross-OSX/macOS-platform binary:

$ export MACOSX_DEPLOYMENT_TARGET=10.9

At the time of writing, Xcode didn’t provide a usable OpenMP implementation. Thus, we had to build llvm manually (the version shipped with homebrew didn’t contain position independent code).

Follow the steps indicated here, make sure you include the openmp library from llvm, unpack all source code in the relevant subdirectories of the llvm source tree. Let the llvm source tree be located in src-llvm, create a build folder next to it and cd into it. Then:

$ cmake -DCMAKE_INSTALL_PREFIX=$PREFIX -DLLVM_ENABLE_PIC=ON -DCMAKE_BUILD_TYPE=Release -DLIBOMP_ENABLE_SHARED=OFF ../src-llvm/
$ make 
$ make install

X264

Obtain the source from here or directly clone from the official repo:

$ git clone http://git.videolan.org/git/x264.git
$ cd x264
$ ./configure --disable-opencl --enable-pic --enable-static --disable-cli --prefix=$PREFIX

X265

Obtain the source from here or directly clone from the official repo:

hg clone https://bitbucket.org/multicoreware/x265
cd x265
cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_SHARED=OFF -DENABLE_PIC=ON -DENABLE_CLI=OFF -DSTATIC_LINK_CRT=ON -DCMAKE_INSTALL_PREFIX=$PREFIX ..

FFMPEG

Obtain the source from here or directly clone from the official repo:

git clone git://source.ffmpeg.org/ffmpeg.git
cd ffmpeg
./configure --pkg-config-flags=--static --extra-ldflags='$X264_PREFIX/lib/libx264.a $X265_PREFIX/lib/libx265.a' --disable-doc --enable-small --disable-shared --disable-encoders --disable-decoders --enable-encoder=libx264,libx264rgb,libx265 --enable-decoder=h264,h264_vda,hevc --enable-pic --enable-static --enable-libx264 --enable-libx265 --enable-gpl  --disable-sdl --disable-libxcb --disable-zlib --disable-bzlib --disable-xlib --disable-lzma --disable-indevs --disable-outdevs  --disable-protocols --disable-muxers --disable-demuxers --enable-muxer=h264,hevc --enable-demuxer=h264,hevc --disable-filters --disable-parsers --enable-parser=x264,hevc --prefix=$PREFIX

HDF5

LZ4

Obtain the source from here. Then go to the contrib/cmake_unofficial/ subfolder and issue:

mkdir build
cd build 
cmake -DBUILD_SHARED_LIBS=OFF -DLZ4_POSITION_INDEPENDENT_LIB=ON ..

Build

The following assumes that you installed all dependencies as described above

using gradle

gradle upload_os_bundle -Pboost_path=<boost_static_path>  -Ptiff_path=<tiff_static_path> -Pffmpeg_path=<ffmpeg_static_path> -Plz4_path=<lz4_static_path> -Phdf5_path=<hdf5_static_path> -Pcmake_app_path=<path_to_cmake_if_nonstandard>
gradle merge_local_bundles -Pboost_path=<boost_static_path>  -Ptiff_path=<tiff_static_path> -Pffmpeg_path=<ffmpeg_static_path> -Plz4_path=<lz4_static_path> -Phdf5_path=<hdf5_static_path> -Pcmake_app_path=<path_to_cmake_if_nonstandard>
gradle bintrayUpload

Tested on

Linux

Windows

macOS

Building and Uploading

The documentation below assumes that you have the rights to access the sqeazy bintray account and that bintray_user and bintray_key are defined by some global mechanism (e.g. /Users/me/.gradle/gradle.properties).

Windows 7

macOS

I assume, that you have all the dependencies installed. In my case, I found ffmpeg to be critical on macOS. Homebrew allowed me to install boost and hdf5 in a static fashion, so there is no need to point gradle/cmake to it. Only ffmpeg required special attention. Call:

$ gradle -Pcxx_compiler=`which clang++` -Pffmpeg_path=/Users/steinbac/software/ffmpeg/3.0.2-x264-hevc-static-minimal/ upload_bundle

Linux

I advice you to use the Dockerfiles in share/docker/trusty and build the image by doing:

$ cd /path/to/sqeazy
$ cd share/docker/trusty
$ make build-static
$ docker run -e ORG_GRADLE_PROJECT_bintray_user=${MY_BINTRAY_USER} -e ORG_GRADLE_PROJECT_bintray_key=${MY_BINTRAY_KEY} -it --rm -v /path/to/sqeazy/:/sqeazy sqy/trusty/static:latest
$ cd /sqeazy #now inside the container
$ gradle upload_bundle