Skip to content

Commit

Permalink
Merge pull request #49 from robertu94/static_libs
Browse files Browse the repository at this point in the history
CMake can now build SZ statically
  • Loading branch information
disheng222 authored Jan 7, 2020
2 parents 4608a64 + c713d09 commit a0e54ad
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 3 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build.*
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ if(TAGS)
)
endif()

option(BUILD_SHARED_LIBS "build shared libraries over static libraries" ON)

#find dependencies
include(GNUInstallDirs)
find_package(PkgConfig)
Expand Down Expand Up @@ -102,7 +104,7 @@ option(BUILD_RANDOMACCESS "build the random access code" OFF)
option(BUILD_DOCKER_CONTAINERS "build docker containers for testing" OFF)
if(BUILD_DOCKER_CONTAINERS)

foreach(CONTAINER Centos Fedora Ubuntu Travis)
foreach(CONTAINER Centos Fedora Ubuntu Travis CentosPackaged)
set(BuildSentinel ${CMAKE_BINARY_DIR}/${CONTAINER}-built)
set(Dockerfile docker/Dockerfile-${CONTAINER})
string(TOLOWER "sz${CONTAINER}" CONTAINER_TAG)
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ cmake --build .
sudo cmake --install .
```

Please note, building static libraries is incompatiable with building the python wrappers, and is building the python wrappers is disabled if `-DBUILD_SHARED_LIBS=OFF`

An example usage file can be found in `example/test.py`

Additional documentation can be found using the `help` function in python.
Expand Down
23 changes: 23 additions & 0 deletions docker/Dockerfile-CentosPackaged
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM centos:7
RUN yum update -y && \
yum install -y epel-release && \
yum install -y \
cmake3 \
CUnit-devel \
ctags \
gcc \
gcc-c++ \
fftw-devel \
netcdf-devel \
make \
swig3 \
python-devel \
numpy && \
yum clean all
COPY . /build/
WORKDIR /build/
RUN rm -rf build && \
mkdir -p build && \
cd build && \
cmake3 .. && \
make -j
2 changes: 1 addition & 1 deletion swig/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ official policies, either expressed or implied, of Robert Underwood.

cmake_minimum_required(VERSION 3.14)
find_package(SWIG)
if(SWIG_FOUND)
if(SWIG_FOUND AND BUILD_SHARED_LIBS)
include(UseSWIG)

find_package(Python COMPONENTS Interpreter Development NumPy)
Expand Down
2 changes: 1 addition & 1 deletion sz/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_library (SZ SHARED
add_library (SZ
src/ArithmeticCoding.c
src/ByteToolkit.c
src/CacheTable.c
Expand Down

0 comments on commit a0e54ad

Please sign in to comment.