Skip to content

Commit

Permalink
libpressio version 0.30.0
Browse files Browse the repository at this point in the history
Major Changes

+ BREAKING CHANGE - libpressio now uses CMakes PRIVATE linking options
  for compressors and external libraries that do not appear in the
  headers of libpressio itself.  This resolves the dependency problem
  where downstream projects have to update their CMake files every time
  they want to use libpressio and a new compressor is added.  This means
  that libraries now need to depend on libraries they have explicit
  dependencies on rather than rely on transitive dependence on
  libpressio (i.e.  including <sz/sz.h> to provide REL or ABS).
  • Loading branch information
robertu94 committed Jan 22, 2020
1 parent 567c56b commit d65fd19
Show file tree
Hide file tree
Showing 19 changed files with 43 additions and 66 deletions.
28 changes: 12 additions & 16 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.29.1" LANGUAGES CXX C)
project(libpressio VERSION "0.30.0" LANGUAGES CXX C)

#correct was to set a default build type
# https://blog.kitware.com/cmake-and-the-default-build-type/
Expand Down Expand Up @@ -135,9 +135,8 @@ if(LIBPRESSIO_HAS_MGARD)
target_sources(libpressio
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src/plugins/compressors/mgard_plugin.cc
${CMAKE_CURRENT_SOURCE_DIR}/include/libpressio_ext/compressors/mgard.h
)
target_link_libraries(libpressio PUBLIC mgard::mgard)
target_link_libraries(libpressio PRIVATE mgard::mgard)
endif()

option(LIBPRESSIO_HAS_ZFP "build the ZFP plugin" OFF)
Expand All @@ -147,9 +146,8 @@ if(LIBPRESSIO_HAS_ZFP)
target_sources(libpressio
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src/plugins/compressors/zfp_plugin.cc
${CMAKE_CURRENT_SOURCE_DIR}/include/libpressio_ext/compressors/zfp.h
)
target_link_libraries(libpressio PUBLIC zfp::zfp)
target_link_libraries(libpressio PRIVATE zfp::zfp)
endif()

option(LIBPRESSIO_HAS_SZ "build the SZ plugin" OFF)
Expand All @@ -162,9 +160,8 @@ if(LIBPRESSIO_HAS_SZ)
target_sources(libpressio
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src/plugins/compressors/sz_plugin.cc
${CMAKE_CURRENT_SOURCE_DIR}/include/libpressio_ext/compressors/sz.h
)
target_link_libraries(libpressio PUBLIC SZ)
target_link_libraries(libpressio PRIVATE SZ)
endif()

option(LIBPRESSIO_HAS_BLOSC "build the BLOSC plugin" OFF)
Expand All @@ -173,20 +170,19 @@ if(LIBPRESSIO_HAS_BLOSC)
target_sources(libpressio
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src/plugins/compressors/blosc_plugin.cc
${CMAKE_CURRENT_SOURCE_DIR}/include/libpressio_ext/compressors/blosc.h
)
pkg_search_module(BLOSC IMPORTED_TARGET GLOBAL blosc)
if(BLOSC_FOUND)
target_link_libraries(libpressio PUBLIC PkgConfig::BLOSC)
target_link_libraries(libpressio PRIVATE PkgConfig::BLOSC)
else()
find_library(BLOSC_LIBRARIES blosc)
find_file(BLOSC_INCLUDE_FILE blosc.h)
if(NOT BLOSC_LIBRARIES)
message(FATAL_ERROR "Failed to find blosc and it was enabled")
endif()
get_filename_component(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_FILE} DIRECTORY)
target_link_libraries(libpressio PUBLIC ${BLOSC_LIBRARIES})
target_include_directories(libpressio PUBLIC ${BLOSC_INCLUDE_DIRS})
target_link_libraries(libpressio PRIVATE ${BLOSC_LIBRARIES})
target_include_directories(libpressio PRIVATE ${BLOSC_INCLUDE_DIRS})

endif()

Expand All @@ -204,7 +200,7 @@ if(LIBPRESSIO_HAS_MAGICK)
)
message(STATUS "Checking for Magick::LongLong: ${LIBPRESSIO_COMPAT_HAS_IMAGEMAGICK_LONGLONG}")
set(LIBPRESSIO_COMPRESSORS "${LIBPRESSIO_COMPRESSORS} magick")
target_link_libraries(libpressio PUBLIC PkgConfig::Magick++)
target_link_libraries(libpressio PRIVATE PkgConfig::Magick++)
target_sources(libpressio
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src/plugins/compressors/magick++.cc
Expand All @@ -215,9 +211,9 @@ option(LIBPRESSIO_HAS_HDF "build the hdf5 io plugin" OFF)
if(LIBPRESSIO_HAS_HDF)
set(LIBPRESSIO_FEATURES "${LIBPRESSIO_FEATURES} hdf5")
find_package(HDF5 REQUIRED COMPONENTS C)
target_link_libraries(libpressio PUBLIC ${HDF5_C_LIBRARIES})
target_include_directories(libpressio PUBLIC ${HDF5_C_INCLUDE_DIRS})
target_compile_definitions(libpressio PUBLIC ${HDF5_C_DEFINITIONS})
target_link_libraries(libpressio PRIVATE ${HDF5_C_LIBRARIES})
target_include_directories(libpressio PRIVATE ${HDF5_C_INCLUDE_DIRS})
target_compile_definitions(libpressio PRIVATE ${HDF5_C_DEFINITIONS})
target_sources(libpressio
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src/plugins/io/hdf5.cc
Expand All @@ -233,7 +229,7 @@ if(LIBPRESSIO_HAS_FPZIP)
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src/plugins/compressors/fpzip_plugin.cc
)
target_link_libraries(libpressio PUBLIC fpzip::fpzip)
target_link_libraries(libpressio PRIVATE fpzip::fpzip)

endif()

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 © 2020 , UChicago Argonne, LLC
All Rights Reserved
[libpressio, Version 0.29.1]
[libpressio, Version 0.30.0]
Robert Underwood
Argonne National Laboratory

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Here is a minimal example with error checking of how to use LibPressio:

```c
#include <libpressio.h>
#include <libpressio_ext/compressors/sz.h>
#include <sz.h>

// provides input function, found in ./test
#include "make_input_data.h"
Expand Down
5 changes: 0 additions & 5 deletions include/libpressio_ext/compressors/blosc.h

This file was deleted.

5 changes: 0 additions & 5 deletions include/libpressio_ext/compressors/magick.h

This file was deleted.

5 changes: 0 additions & 5 deletions include/libpressio_ext/compressors/mgard.h

This file was deleted.

4 changes: 0 additions & 4 deletions include/libpressio_ext/compressors/sz.h

This file was deleted.

4 changes: 0 additions & 4 deletions include/libpressio_ext/compressors/zfp.h

This file was deleted.

2 changes: 1 addition & 1 deletion swig/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if(SWIG_FOUND AND PYTHON3_FOUND)
SOURCES ${ARGV}
)
set_property(TARGET ${filelibname} PROPERTY SWIG_COMPILE_DEFINITIONS "SWIGWORDSIZE64")
target_link_libraries(${filelibname} PUBLIC libpressio Python3::Python Python3::NumPy)
target_link_libraries(${filelibname} PUBLIC SZ libpressio Python3::Python Python3::NumPy)
target_include_directories(${filelibname} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
get_property(swig_generated_module TARGET ${filelibname} PROPERTY SWIG_SUPPORT_FILES)

Expand Down
15 changes: 9 additions & 6 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,32 +48,35 @@ if(LIBPRESSIO_HAS_SZ)
target_include_directories(test_sz_plugin PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../include)

add_executable(sz_basic sz_basic.c make_input_data.cc)
target_link_libraries(sz_basic libpressio)
target_link_libraries(sz_basic libpressio SZ)
add_test(sz_basic_test sz_basic)

add_executable(sz_cpp sz_cpp.cc make_input_data.cc)
target_link_libraries(sz_cpp libpressio)
target_link_libraries(sz_cpp libpressio SZ)
add_test(sz_cpp_test sz_cpp)

add_executable(metrics metrics.c make_input_data.cc)
target_link_libraries(metrics libpressio)
target_link_libraries(metrics libpressio SZ)
add_test(metrics_test metrics)

add_executable(test_external_helper test_external_helper.cc)
add_executable(test_external test_external.cc make_input_data.cc)
target_link_libraries(test_external libpressio)
target_link_libraries(test_external_helper libpressio)
target_link_libraries(test_external libpressio SZ)
target_link_libraries(test_external_helper libpressio SZ)
add_test(test_external test_external ${CMAKE_CURRENT_BINARY_DIR}/test_external_helper)

add_gtest(test_register_metrics.cc make_input_data.cc)
target_link_libraries(test_register_metrics SZ)
add_gtest(test_metrics_options.cc make_input_data.cc)
target_link_libraries(test_metrics_options SZ)
add_gtest(test_register_compressor.cc make_input_data.cc)
target_link_libraries(test_register_compressor SZ)
endif()


if(LIBPRESSIO_HAS_ZFP)
add_executable(zfp_basic zfp_basic.c make_input_data.cc)
target_link_libraries(zfp_basic libpressio)
target_link_libraries(zfp_basic libpressio zfp::zfp)
add_test(zfp_basic_test zfp_basic)
endif()

Expand Down
3 changes: 2 additions & 1 deletion test/full.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
#include <stdio.h>

#include <libpressio.h>
#include <libpressio_ext/compressors/sz.h>
#include <sz/sz.h>

#include "make_input_data.h"


void print_all_options(struct pressio_options* options) {
struct pressio_options_iter* iter = pressio_options_get_iter(options);
while(pressio_options_iter_has_value(iter))
Expand Down
2 changes: 1 addition & 1 deletion test/metrics.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <libpressio.h>
#include <libpressio_ext/compressors/sz.h>
#include <sz/sz.h>

#include "make_input_data.h"

Expand Down
2 changes: 1 addition & 1 deletion test/sz_basic.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <libpressio.h>
#include <libpressio_ext/compressors/sz.h>
#include <sz/sz.h>

#include "make_input_data.h"

Expand Down
2 changes: 1 addition & 1 deletion test/sz_cpp.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <iostream>
#include <libpressio_ext/cpp/libpressio.h>
#include <libpressio_ext/compressors/sz.h>
#include <sz/sz.h>

#include "make_input_data.h"

Expand Down
2 changes: 1 addition & 1 deletion test/test_external.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <iostream>
#include <libpressio.h>
#include <libpressio_ext/compressors/sz.h>
#include <libpressio_ext/cpp/printers.h>
#include <sz/sz.h>

#include "make_input_data.h"

Expand Down
8 changes: 4 additions & 4 deletions test/test_metrics_options.cc
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#include "gtest/gtest.h"
#include <gtest/gtest.h>
#include <iterator>
#include "make_input_data.h"

#include <map>
#include <sz/sz.h>

#include "libpressio.h"
#include "libpressio_ext/cpp/data.h"
#include "libpressio_ext/cpp/metrics.h"
#include "libpressio_ext/cpp/options.h"
#include "libpressio_ext/cpp/pressio.h"
#include "libpressio_ext/compressors/sz.h"
#include "make_input_data.h"

class hasoptoins_metric : public libpressio_metrics_plugin
{
Expand Down
8 changes: 4 additions & 4 deletions test/test_register_compressor.cc
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#include "gtest/gtest.h"
#include <iterator>
#include "make_input_data.h"

#include <cmath>
#include <gtest/gtest.h>
#include <sz/sz.h>

#include "libpressio_ext/cpp/data.h"
#include "libpressio_ext/cpp/compressor.h"
#include "libpressio_ext/cpp/options.h"
#include "libpressio_ext/cpp/pressio.h"
#include "libpressio_ext/compressors/sz.h"
#include "libpressio_ext/compat/std_compat.h"
#include "make_input_data.h"

namespace {
struct log_fn{
Expand Down
8 changes: 4 additions & 4 deletions test/test_register_metrics.cc
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#include "gtest/gtest.h"
#include <gtest/gtest.h>
#include <iterator>
#include "make_input_data.h"

#include <map>
#include <sz/sz.h>

#include "libpressio_ext/cpp/data.h"
#include "libpressio_ext/cpp/metrics.h"
#include "libpressio_ext/cpp/options.h"
#include "libpressio_ext/cpp/pressio.h"
#include "libpressio_ext/compressors/sz.h"
#include "make_input_data.h"

class counting_metric: public libpressio_metrics_plugin {
public:
Expand Down
2 changes: 1 addition & 1 deletion test/zfp_basic.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <stdio.h>
#include <libpressio.h>
#include <libpressio_ext/compressors/zfp.h>
#include <zfp.h>

#include "make_input_data.h"

Expand Down

0 comments on commit d65fd19

Please sign in to comment.