Skip to content

Commit

Permalink
libpressio version 0.22.0
Browse files Browse the repository at this point in the history
Major Features

+ This version supports being compiled with a C++11 compiler.  Pass
  `-DLIBPRESSIO_CXX_VERSION=11` to cmake to use this version.  Added
  backwards compatibility headers for a variety of newer c++ features.
  For systems without c++17, Boost is required.
+ BREAKING CHANGE Refactored constexpr inline variables to constexpr functions to
  allow them to be compiled in c++11.

Minor Features

+ Added additional version variables to inspect the configured options
  • Loading branch information
robertu94 committed Nov 11, 2019
1 parent 5cfb629 commit 83c6dd6
Show file tree
Hide file tree
Showing 33 changed files with 534 additions and 244 deletions.
42 changes: 30 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
project(libpressio VERSION "0.21.1" LANGUAGES CXX C)
project(libpressio VERSION "0.22.0" LANGUAGES CXX C)

#correct was to set a default build type
# https://blog.kitware.com/cmake-and-the-default-build-type/
Expand All @@ -12,6 +12,13 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
"MinSizeRel" "RelWithDebInfo")
endif()

set(default_cxx_standard 17)
if(NOT LIBPRESSIO_CXX_VERSION)
set(LIBPRESSIO_CXX_VERSION ${default_cxx_standard} CACHE
STRING "Which version of the cxx standard to expect" FORCE)
set_property(CACHE LIBPRESSIO_CXX_VERSION PROPERTY STRINGS 11 14 17)
endif()

enable_testing()
include(CTestCustom.cmake)
include(CTest)
Expand All @@ -29,14 +36,15 @@ if(HAVE_NO_OMIT_FRAME_POINTER)
set(NO_OMIT_FRAME_POINTER_FLAG "-fno-omit-frame-pointer")
endif()

#check for c++17 numeric functions

#check for c++17 features
function(check_cpp_standard api)
string(TOUPPER "${api}" HEADER_SUFFIX)
try_compile(
COMPILED
${CMAKE_BINARY_DIR}
SOURCES "${CMAKE_SOURCE_DIR}/checks/${api}.cc"
CXX_STANDARD 17
CXX_STANDARD ${LIBPRESSIO_CXX_VERSION}
CXX_STANDARD_REQUIRED ON
)
message(STATUS "Checking for ${api}: ${COMPILED}")
Expand All @@ -45,6 +53,13 @@ endfunction()

check_cpp_standard(transform_reduce)
check_cpp_standard(exclusive_scan)
check_cpp_standard(exchange)
check_cpp_standard(rbeginend)
check_cpp_standard(optional)
check_cpp_standard(variant)
check_cpp_standard(make_unique)
check_cpp_standard(conjunction)
check_cpp_standard(multiplies)


set(LIBPRESSIO_FEATURES "")
Expand Down Expand Up @@ -92,15 +107,20 @@ add_library(libpressio

target_include_directories(libpressio
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/libpressio>
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/include
)
target_compile_options(libpressio PRIVATE
$<$<CONFIG:Debug>: -Wall -Werror -Wextra -Wpedantic>
$<$<CONFIG:RelWithDebInfo>: ${NO_OMIT_FRAME_POINTER_FLAG}>
)
target_compile_features(libpressio PUBLIC cxx_std_17)
target_compile_features(libpressio PUBLIC cxx_std_${LIBPRESSIO_CXX_VERSION})

if(NOT (LIBPRESSIO_COMPAT_HAS_VARIANT OR LIBPRESSIO_COMPAT_HAS_OPTIONAL))
find_package(Boost COMPONENTS REQUIRED)
target_link_libraries(libpressio PUBLIC Boost::boost)
endif()

find_package(PkgConfig REQUIRED)

Expand Down Expand Up @@ -171,18 +191,16 @@ endif()

option(LIBPRESSIO_HAS_MAGICK "build the image magick plugin" ON)
if(LIBPRESSIO_HAS_MAGICK)
pkg_search_module(ImageMagick IMPORTED_TARGET GLOBAL Magick++)
pkg_search_module(Magick++ IMPORTED_TARGET GLOBAL Magick++)
try_compile(
LIBPRESSIO_COMPAT_HAS_IMAGEMAGICK_LONGLONG
${CMAKE_BINARY_DIR}
SOURCES "${CMAKE_SOURCE_DIR}/checks/imagemagick.cc"
LINK_LIBRARIES PkgConfig::ImageMagick
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
LINK_LIBRARIES PkgConfig::Magick++
)
message(STATUS "Checking for Magick::LongLong: ${LIBPRESSIO_COMPAT_HAS_IMAGEMAGICK_LONGLONG}")
set(LIBPRESSIO_COMPRESSORS "${LIBPRESSIO_COMPRESSORS} magick")
target_link_libraries(libpressio PUBLIC PkgConfig::ImageMagick)
target_link_libraries(libpressio PUBLIC PkgConfig::Magick++)
target_sources(libpressio
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src/plugins/compressors/magick++.cc
Expand Down Expand Up @@ -263,7 +281,7 @@ endif()
option(BUILD_DOCKER_CONTAINERS "build docker containers for testing" OFF)
if(BUILD_DOCKER_CONTAINERS)

foreach(CONTAINER Fedora Ubuntu18.04)
foreach(CONTAINER Fedora Ubuntu18.04 CentOS)
set(BuildSentinel ${CMAKE_BINARY_DIR}/${CONTAINER}-built)
set(Dockerfile docker/Dockerfile-${CONTAINER})
string(TOLOWER "libpressio-${CONTAINER}" CONTAINER_TAG)
Expand Down
2 changes: 1 addition & 1 deletion COPYRIGHT.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Copyright © 2019 , UChicago Argonne, LLC
All Rights Reserved
[libpressio, Version 0.21.1]
[libpressio, Version 0.22.0]
Robert Underwood
Argonne National Laboratory

Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Libpressio additionally optionally requires:
+ `swig` version 3.0.12 or later for python support
+ `ImageMagick` version 6.9.7 or later for ImageMagick image support. Version 7 or later supports additional data types.
+ `blosc` version 1.14.2 for lossless compressor support via blosc
+ `boost` version 1.53 to compile on a c++14 or earlier compiler

You can also use the provided `Dockerfile`s in `./docker` to get a working libpressio install. Doing so requires installing `docker` version 17.05 or higher or other build tool that supports this version of Dockerfile syntax or later.

Expand Down Expand Up @@ -67,6 +68,16 @@ make docs
# the man pages can be found in $BUILD_DIR/man/
```

To build on a C++11 compiler:

```
BUILD_DIR=build
mkdir $BUILD_DIR
cd $BUILD_DIR
cmake -DLIBPRESSIO_CXX_VERSION=11
make
```

To build the experimental python bindings:

```
Expand Down
6 changes: 6 additions & 0 deletions checks/conjunction.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <type_traits>
int main(int argc, char *argv[])
{

return std::conjunction<std::is_same<int,int>, std::is_same<float,float>>::value;
}
6 changes: 6 additions & 0 deletions checks/exchange.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <utility>
int main() {
int i = 1;
int j = 2;
j = std::exchange(i,0);
}
6 changes: 6 additions & 0 deletions checks/make_unique.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <memory>
int main(int argc, char *argv[])
{
auto i = std::make_unique<int>(3);
return *i;
}
6 changes: 6 additions & 0 deletions checks/multiplies.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <functional>

int main(int argc, char *argv[])
{
return std::multiplies<>{}(1, 2);
}
7 changes: 7 additions & 0 deletions checks/optional.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <optional>

int main(int argc, char *argv[])
{
std::optional<int> o = 3;
return *o;
}
12 changes: 12 additions & 0 deletions checks/rbeginend.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include <vector>
#include <iterator>

int main(int argc, char *argv[])
{
int sum;
std::vector<int> foo{1,2,2};
for (auto it = std::rbegin(foo); it != std::rend(foo); ++it) {
sum+=*it;
}
return sum;
}
9 changes: 9 additions & 0 deletions checks/variant.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include <variant>

int main(int argc, char *argv[])
{
std::variant<std::monostate, int, float> v;
v = 1.2f;
v = 1;
return std::get<int>(v);
}
54 changes: 54 additions & 0 deletions docker/Dockerfile-CentOS
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
FROM centos:7 as builder
RUN yum install -y epel-release && \
yum install -y git swig3 cmake3 gcc-c++ zlib-devel libzstd-devel ninja-build hdf5-devel python3-devel python3-numpy blosc-devel boost-devel && \
yum clean all
RUN git clone https://github.com/LLNL/zfp /src/zfp && \
git clone https://github.com/disheng222/sz /src/sz && \
git clone https://github.com/CODARcode/MGARD /src/mgard && \
git clone https://github.com/CODARcode/libpressio /src/libpressio && \
mkdir -p /src/autotuning && \
cd /src/sz && \
mkdir build && \
cd build && \
cmake3 .. -DCMAKE_INSTALL_PREFIX=/usr -G Ninja && \
cmake3 --build . && \
ninja-build install && \
cd /src/zfp && \
mkdir build && \
cd build && \
cmake3 .. -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_TESTING=OFF -G Ninja && \
cmake3 --build . && \
ninja-build install && \
cd /src/mgard && \
mkdir build && \
cd build && \
cmake3 .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=lib64 -DBUILD_TESTING=OFF -G Ninja && \
cmake3 --build . && \
ninja-build install && \
cd /src/libpressio && \
rm -rf build && \
mkdir build && \
cd build && \
cmake3 .. -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_TESTS=ON -DLIBPRESSIO_HAS_MAGICK=OFF -DLIBPRESSIO_HAS_MGARD=ON -DBUILD_PYTHON_WRAPPER=ON -G Ninja && \
cmake3 --build . && \
CTEST_OUTPUT_ON_FAILURE=1 ctest3 . && \
ninja-build install

FROM centos:7
RUN yum install -y epel-release && \
yum install -y zlib hdf5 libzstd fftw python3-numpy blosc boost\
&& \
yum clean all
COPY --from=builder /usr/lib64/libSZ.so* \
/usr/lib64/liblibpressio.so* \
/usr/lib64/libzfp.so* \
/usr/lib64/libmgard.so* \
/usr/lib64/
COPY --from=builder /usr/include/libpressio \
/usr/include/sz \
/usr/include/zfp* \
/usr/include/mgard* \
/usr/include/
COPY --from=builder /usr/bin/sz /usr/bin/
COPY --from=builder /usr/lib/python3.6/site-packages/*pressio* /usr/lib64/python3.6/site-packages/

Loading

0 comments on commit 83c6dd6

Please sign in to comment.