Commit 9c75dbaa by Maarten L. Hekkelman

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

parents 19b652f6 5bd39b59
......@@ -25,7 +25,7 @@
cmake_minimum_required(VERSION 3.16)
# set the project name
project(cifpp VERSION 1.1.1 LANGUAGES CXX)
project(cifpp VERSION 2.0.0 LANGUAGES CXX)
list(PREPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
......@@ -34,6 +34,7 @@ enable_testing()
include(GNUInstallDirs)
include(CheckFunctionExists)
include(CheckIncludeFiles)
include(FindFilesystem)
include(CheckLibraryExists)
include(CMakePackageConfigHelpers)
include(Dart)
......@@ -43,6 +44,8 @@ set(CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(Filesystem REQUIRED)
if(CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-unused-parameter")
endif()
......@@ -81,12 +84,14 @@ endif()
# When CCP4 is sourced in the environment, we can recreate the symmetry operations table
if(EXISTS "${CCP4}")
option(RECREATE_SYMOP_DATA "Recreate SymOp data table in case it is out of date" ON)
if(RECREATE_SYMOP_DATA AND NOT EXISTS "${CLIBD}/syminfo.lib")
message(FATAL_ERROR "Symop data table recreation requested, but file syminfo.lib was not found in ${CLIBD}")
message(WARNING "Symop data table recreation requested, but file syminfo.lib was not found in ${CLIBD}")
set(RECREATE_SYMOP_DATA OFF)
else()
option(RECREATE_SYMOP_DATA "Recreate SymOp data table in case it is out of date" ON)
endif()
else()
set(RECREATE_SYMOP_DATA OFF)
message("Not trying to recreate SymOpTable_data.hpp since CCP4 is not defined")
endif()
......@@ -166,8 +171,6 @@ set(THREADS_PREFER_PTHREAD_FLAG)
find_package(Threads)
set (Boost_DETAILED_FAILURE_MSG ON)
# set (Boost_DEBUG ON)
# set (Boost_VERBOSE ON)
find_package(Boost 1.70.0 REQUIRED COMPONENTS system iostreams regex date_time program_options)
# find_package(ZLIB)
......@@ -364,11 +367,11 @@ install(FILES
COMPONENT Devel
)
set(cifpp_MAJOR_VERSION 1)
set(cifpp_MAJOR_VERSION ${CMAKE_PROJECT_VERSION_MAJOR})
set_target_properties(cifpp PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION 1
INTERFACE_cifpp_MAJOR_VERSION 1)
SOVERSION ${cifpp_MAJOR_VERSION}
INTERFACE_cifpp_MAJOR_VERSION ${cifpp_MAJOR_VERSION})
set_property(TARGET cifpp APPEND PROPERTY
COMPATIBLE_INTERFACE_STRING cifpp_MAJOR_VERSION
......
# Simplistic reimplementation of https://github.com/vector-of-bool/CMakeCM/blob/master/modules/FindFilesystem.cmake
if(TARGET std::filesystem)
return()
endif()
cmake_minimum_required(VERSION 3.10)
include(CMakePushCheckState)
include(CheckIncludeFileCXX)
include(CheckCXXSourceCompiles)
cmake_push_check_state()
set(CMAKE_CXX_STANDARD 17)
check_include_file_cxx("filesystem" _CXX_FILESYSTEM_HAVE_HEADER)
mark_as_advanced(_CXX_FILESYSTEM_HAVE_HEADER)
set(code [[
#include <cstdlib>
#include <filesystem>
int main() {
auto cwd = std::filesystem::current_path();
return EXIT_SUCCESS;
}
]])
# Check a simple filesystem program without any linker flags
check_cxx_source_compiles("${code}" CXX_FILESYSTEM_NO_LINK_NEEDED)
set(_found ${CXX_FILESYSTEM_NO_LINK_NEEDED})
if(NOT CXX_FILESYSTEM_NO_LINK_NEEDED)
set(prev_libraries ${CMAKE_REQUIRED_LIBRARIES})
# Add the libstdc++ flag
set(CMAKE_REQUIRED_LIBRARIES ${prev_libraries} -lstdc++fs)
check_cxx_source_compiles("${code}" CXX_FILESYSTEM_STDCPPFS_NEEDED)
set(_found ${CXX_FILESYSTEM_STDCPPFS_NEEDED})
if(NOT CXX_FILESYSTEM_STDCPPFS_NEEDED)
# Try the libc++ flag
set(CMAKE_REQUIRED_LIBRARIES ${prev_libraries} -lc++fs)
check_cxx_source_compiles("${code}" CXX_FILESYSTEM_CPPFS_NEEDED)
set(_found ${CXX_FILESYSTEM_CPPFS_NEEDED})
endif()
endif()
if(_found)
add_library(std::filesystem INTERFACE IMPORTED)
set_property(TARGET std::filesystem APPEND PROPERTY INTERFACE_COMPILE_FEATURES cxx_std_17)
if(CXX_FILESYSTEM_NO_LINK_NEEDED)
# Nothing to add...
elseif(CXX_FILESYSTEM_STDCPPFS_NEEDED)
set_property(TARGET std::filesystem APPEND PROPERTY INTERFACE_LINK_LIBRARIES -lstdc++fs)
elseif(CXX_FILESYSTEM_CPPFS_NEEDED)
set_property(TARGET std::filesystem APPEND PROPERTY INTERFACE_LINK_LIBRARIES -lc++fs)
endif()
endif()
cmake_pop_check_state()
set(Filesystem_FOUND ${_found} CACHE BOOL "TRUE if we can run a program using std::filesystem" FORCE)
if(Filesystem_FIND_REQUIRED AND NOT Filesystem_FOUND)
message(FATAL_ERROR "Cannot run simple program using std::filesystem")
endif()
......@@ -2354,8 +2354,6 @@ conditional_iterator_proxy<CategoryType, Ts...>::conditional_iterator_proxy(Cate
{
static_assert(sizeof...(Ts) == sizeof...(Ns), "Number of column names should be equal to number of requested value types");
size_t N = sizeof...(Ns);
mCondition.prepare(cat);
while (mCBegin != mCEnd and not mCondition(*mCat, mCBegin.row()))
......
......@@ -1053,7 +1053,7 @@ Atom Residue::atomByID(const std::string &atomID) const
}
}
if (not result and cif::VERBOSE)
if (not result and cif::VERBOSE > 1)
std::cerr << "Atom with atom_id " << atomID << " not found in residue " << mAsymID << ':' << mSeqID << std::endl;
return result;
......@@ -2216,7 +2216,7 @@ std::string Structure::insertCompound(const std::string &compoundID, bool isEnti
catch(const std::exception& ex)
{
auto &entity = db["entity"];
entity_id = std::to_string(entity.size() + 1);
entity_id = entity.getUniqueID("");
entity.emplace({
{"id", entity_id},
......@@ -2474,9 +2474,11 @@ std::string Structure::createNonpoly(const std::string &entity_id, const std::ve
for (auto& atom: atoms)
{
atom_site.emplace({
auto atom_id = atom_site.getUniqueID("");
auto &&[row, inserted ] = atom_site.emplace({
{ "group_PDB", atom.property<std::string>("group_PDB") },
{ "id", atom_site.getUniqueID("") },
{ "id", atom_id },
{ "type_symbol", atom.property<std::string>("type_symbol") },
{ "label_atom_id", atom.property<std::string>("label_atom_id") },
{ "label_alt_id", atom.property<std::string>("label_alt_id") },
......@@ -2497,8 +2499,12 @@ std::string Structure::createNonpoly(const std::string &entity_id, const std::ve
{ "auth_atom_id", atom.property<std::string>("label_atom_id") },
{ "pdbx_PDB_model_num", 1 }
});
mAtoms.emplace_back(new AtomImpl(db, atom_id, row));
}
mNonPolymers.emplace_back(*this, comp_id, asym_id);
return asym_id;
}
......
const char kRevision[] = R"(
libzeep-version: @PROJECT_VERSION@
lib@PROJECT_NAME@-version: @PROJECT_VERSION@
@BUILD_VERSION_STRING@
Date: @BUILD_DATE_TIME@
)";
......@@ -45,3 +45,9 @@ fetch_dictionary () {
fetch_dictionary "@CIFPP_CACHE_DIR@/mmcif_pdbx_v50.dic" "https://mmcif.wwpdb.org/dictionaries/ascii/mmcif_pdbx_v50.dic.gz"
fetch_dictionary "@CIFPP_CACHE_DIR@/components.cif" "ftp://ftp.wwpdb.org/pub/pdb/data/monomers/components.cif.gz"
# notify subscribers
if [ -d /etc/libcifpp/cache-update.d ] && [ -x /bin/run-parts ]; then
run-parts --arg "@CIFPP_CACHE_DIR@" -- /etc/libcifpp/cache-update.d
fi
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