Commit 567b0f3b by Maarten L. Hekkelman

Merge branch 'develop' of github.com:PDB-REDO/libcifpp into develop

parents b5454f09 8f293869
......@@ -34,10 +34,10 @@ enable_testing()
include(GNUInstallDirs)
include(CheckFunctionExists)
include(CheckIncludeFiles)
include(FindFilesystem)
include(CheckLibraryExists)
include(CMakePackageConfigHelpers)
include(Dart)
include(FindFilesystem)
include(GenerateExportHeader)
set(CXX_EXTENSIONS OFF)
......@@ -171,13 +171,10 @@ set(THREADS_PREFER_PTHREAD_FLAG)
find_package(Threads)
set(Boost_DETAILED_FAILURE_MSG ON)
set(Boost_USE_STATIC_LIBS ON)
# set(Boost_USE_STATIC_LIBS ON)
find_package(Boost 1.70.0 REQUIRED COMPONENTS system iostreams regex date_time program_options)
find_package(ZLIB REQUIRED)
find_package(BZip2 REQUIRED)
include_directories(${Boost_INCLUDE_DIR})
find_package(ZLIB REQUIRED COMPONENTS zlibstatic)
# Create a revision file, containing the current git version info
......@@ -205,7 +202,10 @@ if(RECREATE_SYMOP_DATA)
add_executable(symop-map-generator "${CMAKE_SOURCE_DIR}/tools/symop-map-generator.cpp")
target_link_libraries(symop-map-generator Threads::Threads ${Boost_LIBRARIES} std::filesystem ZLIB::ZLIB BZip2::BZip2)
target_link_libraries(symop-map-generator Threads::Threads ${Boost_LIBRARIES} std::filesystem ZLIB::ZLIB)
if(Boost_INCLUDE_DIR)
target_include_directories(symop-map-generator ${Boost_INCLUDE_DIR})
endif()
set($ENV{CLIBD} ${CLIBD})
......@@ -266,8 +266,12 @@ target_include_directories(cifpp
PUBLIC
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
${Boost_INCLUDE_DIR}
${ZLIB_INCLUDE_DIR}
)
target_link_libraries(cifpp Threads::Threads ${Boost_LIBRARIES} std::filesystem ZLIB::ZLIB)
if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
target_link_options(cifpp PRIVATE -undefined dynamic_lookup)
endif (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
......@@ -305,8 +309,6 @@ endif()
add_custom_target(COMPONENTS ALL DEPENDS ${COMPONENTS_CIF})
include_directories(${Boost_INCLUDE_DIRS})
set(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR} )
set(LIBRARY_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR} )
set(SHARE_INSTALL_DIR ${CMAKE_INSTALL_DATADIR}/libcifpp)
......@@ -389,6 +391,16 @@ set(exec_prefix ${CMAKE_INSTALL_PREFIX})
set(libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
set(includedir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR})
get_target_property(PRIVATE_LIBRARIES cifpp INTERFACE_LINK_LIBRARIES)
foreach(LIB ${PRIVATE_LIBRARIES})
set(PRIVATE_LIBS "${PRIVATE_LIBS} -l${LIB}")
endforeach()
get_target_property(PRIVATE_INCLUDE_DIRS cifpp INTERFACE_INCLUDE_DIRECTORIES)
foreach(INC ${PRIVATE_INCLUDE_DIRS})
set(PRIVATE_INC_DIRS "${PRIVATE_INC_DIRS} -I ${INC}")
endforeach()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libcifpp.pc.in
${CMAKE_CURRENT_BINARY_DIR}/libcifpp.pc.in @ONLY)
file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/libcifpp.pc
......@@ -425,7 +437,7 @@ if(CIFPP_BUILD_TESTS)
${CMAKE_CURRENT_BINARY_DIR} # for config.h
)
target_link_libraries(${CIFPP_TEST} PRIVATE Threads::Threads cifpp ${Boost_LIBRARIES} std::filesystem ZLIB::ZLIB BZip2::BZip2)
target_link_libraries(${CIFPP_TEST} PRIVATE Threads::Threads cifpp ${Boost_LIBRARIES} std::filesystem ZLIB::ZLIB)
if(MSVC)
# Specify unwind semantics so that MSVC knowns how to handle exceptions
......
Version 2.0.0
- New API interface for accessing query results
- Removed bzip2 support
Version 1.1.1
- Now with full support for MS Windows
......@@ -10,4 +14,4 @@ Version 1.0.1
then /var/cache and finally compiled in resources (with mrc).
Version 1.0.0
- First public release
\ No newline at end of file
- First public release
......@@ -8,5 +8,5 @@ Name: libcifpp
Description: C++ library for the manipulation of mmCIF files.
Version: @PACKAGE_VERSION@
Libs: -L${libdir} -lcifpp
Cflags: -I${includedir}
Libs: -L${libdir} -lcifpp @PRIVATE_LIBS@
Cflags: -I${includedir} @PRIVATE_INC_DIRS@
......@@ -37,7 +37,6 @@
#include <filesystem>
#include <boost/algorithm/string.hpp>
#include <boost/iostreams/filter/bzip2.hpp>
#include <boost/iostreams/filter/gzip.hpp>
#include <boost/iostreams/filtering_stream.hpp>
#include <boost/logic/tribool.hpp>
......@@ -3464,12 +3463,7 @@ void File::load(const std::string &p)
io::filtering_stream<io::input> in;
std::string ext;
if (path.extension() == ".bz2")
{
in.push(io::bzip2_decompressor());
ext = path.stem().extension().string();
}
else if (path.extension() == ".gz")
if (path.extension() == ".gz")
{
in.push(io::gzip_decompressor());
ext = path.stem().extension().string();
......@@ -3500,11 +3494,6 @@ void File::save(const std::string &p)
out.push(io::gzip_compressor());
path = path.stem();
}
else if (path.extension() == ".bz2")
{
out.push(io::bzip2_compressor());
path = path.stem();
}
out.push(outFile);
save(out);
......
......@@ -32,7 +32,6 @@
#include <boost/algorithm/string.hpp>
#include <boost/format.hpp>
#include <boost/iostreams/filter/bzip2.hpp>
#include <boost/iostreams/filter/gzip.hpp>
#include <boost/iostreams/filtering_stream.hpp>
......@@ -67,7 +66,6 @@ struct FileImpl
void FileImpl::load_data(const char *data, size_t length)
{
bool gzipped = length > 2 and data[0] == static_cast<char>(0x1f) and data[1] == static_cast<char>(0x8b);
bool bzip2ed = length > 3 and data[0] == static_cast<char>(0x42) and data[1] == static_cast<char>(0x5A) and data[2] == static_cast<char>(0x68);
try
{
......@@ -82,8 +80,6 @@ void FileImpl::load_data(const char *data, size_t length)
io::filtering_stream<io::input> in;
if (gzipped)
in.push(io::gzip_decompressor());
else if (bzip2ed)
in.push(io::bzip2_decompressor());
in.push(is);
mData.load(in);
......@@ -101,8 +97,6 @@ void FileImpl::load_data(const char *data, size_t length)
io::filtering_stream<io::input> in;
if (gzipped)
in.push(io::gzip_decompressor());
else if (bzip2ed)
in.push(io::bzip2_decompressor());
in.push(is);
ReadPDBFile(in, mData);
......@@ -129,12 +123,7 @@ void FileImpl::load(const std::string &p)
io::filtering_stream<io::input> in;
std::string ext = path.extension().string();
if (path.extension() == ".bz2")
{
in.push(io::bzip2_decompressor());
ext = path.stem().extension().string();
}
else if (path.extension() == ".gz")
if (path.extension() == ".gz")
{
in.push(io::gzip_decompressor());
ext = path.stem().extension().string();
......@@ -171,9 +160,7 @@ void FileImpl::load(const std::string &p)
else
inFile.open(path, std::ios_base::in | std::ios::binary);
if (path.extension() == ".bz2")
in.push(io::bzip2_decompressor());
else if (path.extension() == ".gz")
if (path.extension() == ".gz")
in.push(io::gzip_decompressor());
in.push(inFile);
......@@ -210,11 +197,6 @@ void FileImpl::save(const std::string &p)
out.push(io::gzip_compressor());
path = path.stem();
}
else if (path.extension() == ".bz2")
{
out.push(io::bzip2_compressor());
path = path.stem();
}
out.push(outFile);
......
......@@ -1665,3 +1665,11 @@ BOOST_AUTO_TEST_CASE(bondmap_2)
BOOST_CHECK(mmcif::BondMap::atomIDsForCompound("UN_").empty() == false);
}
BOOST_AUTO_TEST_CASE(reading_file_1)
{
std::istringstream is("Hello, world!");
cif::File file;
BOOST_CHECK_THROW(file.load(is), std::runtime_error);
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment