Commit d638d634 by Maarten L. Hekkelman

Remove gxrio and replace it with stripped down version

parent 35196789
build/ build/
.vscode/ .vscode/
.vs/ .vs/
.pc/
tools/symop-map-generator
test/unit-test
test/pdb2cif-test
test/rename-compound-test
tools/update-libcifpp-data tools/update-libcifpp-data
data/components.cif* data/components.cif*
CMakeSettings.json CMakeSettings.json
msvc/ msvc/
Testing/
rsrc/feature-request.txt
test/test-create_sugar_?.cif
test/oprofile_data/
test/perf.data*
src/revision.hpp src/revision.hpp
...@@ -133,14 +133,19 @@ if(GXX_LIBSTDCPP) ...@@ -133,14 +133,19 @@ if(GXX_LIBSTDCPP)
if(STD_REGEX_RUNNING STREQUAL FAILED_TO_RUN) if(STD_REGEX_RUNNING STREQUAL FAILED_TO_RUN)
message(STATUS "You are probably trying to compile using the g++ standard library which contains a crashing std::regex implementation. Will try to use boost::regex instead") message(STATUS "You are probably trying to compile using the g++ standard library which contains a crashing std::regex implementation. Will try to use boost::regex instead")
set(BOOST_REGEX_STANDALONE ON) find_package(Boost COMPONENTS regex QUIET)
find_package(Boost 1.77 COMPONENTS regex QUIET)
if(Boost_FOUND) if(Boost_FOUND)
if(Boost_VERSION VERSION_GREATER_EQUAL 1.77)
set(BOOST_REGEX_STANDALONE ON)
set(BOOST_REGEX_INCLUDE ${Boost_INCLUDE_DIRS}) set(BOOST_REGEX_INCLUDE ${Boost_INCLUDE_DIRS})
else() else()
add_git_submodule(regex EXCLUDE_FROM_ALL) list(APPEND CIFPP_REQUIRED_LIBRARIES Boost::regex)
set(BOOST_REGEX_SYSTEM ON)
endif()
else()
add_git_submodule("https://github.com/boostorg/regex" regex EXCLUDE_FROM_ALL)
set(BOOST_REGEX_STANDALONE ON)
set(BOOST_REGEX_INCLUDE regex/include) set(BOOST_REGEX_INCLUDE regex/include)
endif() endif()
endif() endif()
...@@ -151,7 +156,6 @@ set(THREADS_PREFER_PTHREAD_FLAG) ...@@ -151,7 +156,6 @@ set(THREADS_PREFER_PTHREAD_FLAG)
find_package(Threads) find_package(Threads)
find_package(ZLIB REQUIRED) find_package(ZLIB REQUIRED)
find_package(LibLZMA REQUIRED)
include(FindFilesystem) include(FindFilesystem)
list(APPEND CIFPP_REQUIRED_LIBRARIES ${STDCPPFS_LIBRARY}) list(APPEND CIFPP_REQUIRED_LIBRARIES ${STDCPPFS_LIBRARY})
...@@ -159,14 +163,6 @@ list(APPEND CIFPP_REQUIRED_LIBRARIES ${STDCPPFS_LIBRARY}) ...@@ -159,14 +163,6 @@ list(APPEND CIFPP_REQUIRED_LIBRARIES ${STDCPPFS_LIBRARY})
include(FindAtomic) include(FindAtomic)
list(APPEND CIFPP_REQUIRED_LIBRARIES ${STDCPPATOMIC_LIBRARY}) list(APPEND CIFPP_REQUIRED_LIBRARIES ${STDCPPATOMIC_LIBRARY})
if(NOT PDB_REDO_META)
find_package(gxrio QUIET)
if(NOT gxrio_FOUND)
add_git_submodule(gxrio EXCLUDE_FROM_ALL)
endif()
endif()
# Create a revision file, containing the current git version info # Create a revision file, containing the current git version info
include(VersionString) include(VersionString)
write_version_header(${PROJECT_SOURCE_DIR}/src/ "LibCIFPP") write_version_header(${PROJECT_SOURCE_DIR}/src/ "LibCIFPP")
...@@ -250,7 +246,9 @@ add_library(cifpp::cifpp ALIAS cifpp) ...@@ -250,7 +246,9 @@ add_library(cifpp::cifpp ALIAS cifpp)
set_target_properties(cifpp PROPERTIES POSITION_INDEPENDENT_CODE ON) set_target_properties(cifpp PROPERTIES POSITION_INDEPENDENT_CODE ON)
if(BOOST_REGEX_STANDALONE) if(BOOST_REGEX_STANDALONE)
target_compile_definitions(cifpp PUBLIC USE_BOOST_REGEX=1 BOOST_REGEX_STANDALONE=1) target_compile_definitions(cifpp PRIVATE USE_BOOST_REGEX=1 BOOST_REGEX_STANDALONE=1)
elseif(BOOST_REGEX_SYSTEM)
target_compile_definitions(cifpp PRIVATE USE_BOOST_REGEX=1)
endif() endif()
target_include_directories(cifpp target_include_directories(cifpp
...@@ -259,14 +257,7 @@ target_include_directories(cifpp ...@@ -259,14 +257,7 @@ target_include_directories(cifpp
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>" "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
) )
target_link_libraries(cifpp PUBLIC target_link_libraries(cifpp PUBLIC Threads::Threads ZLIB::ZLIB ${CIFPP_REQUIRED_LIBRARIES})
Threads::Threads
ZLIB::ZLIB
LibLZMA::LibLZMA
${CIFPP_REQUIRED_LIBRARIES})
get_target_property(GXRIO_INCLUDE_DIR gxrio::gxrio INTERFACE_INCLUDE_DIRECTORIES)
target_include_directories(cifpp PRIVATE ${GXRIO_INCLUDE_DIR})
if(BOOST_REGEX_STANDALONE) if(BOOST_REGEX_STANDALONE)
target_include_directories(cifpp PRIVATE ${BOOST_REGEX_INCLUDE}) target_include_directories(cifpp PRIVATE ${BOOST_REGEX_INCLUDE})
...@@ -356,8 +347,14 @@ install(FILES ...@@ -356,8 +347,14 @@ install(FILES
DESTINATION ${CIFPP_DATA_DIR} DESTINATION ${CIFPP_DATA_DIR}
) )
if(BOOST_REGEX_STANDALONE)
set(CONFIG_TEMPLATE_FILE ${PROJECT_SOURCE_DIR}/cmake/cifppConfig.cmake.in)
else()
set(CONFIG_TEMPLATE_FILE ${PROJECT_SOURCE_DIR}/cmake/cifppConfig-boost-regex.cmake.in)
endif()
configure_package_config_file( configure_package_config_file(
${PROJECT_SOURCE_DIR}/cmake/cifppConfig.cmake.in ${CONFIG_TEMPLATE_FILE}
${CMAKE_CURRENT_BINARY_DIR}/cifpp/cifppConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/cifpp/cifppConfig.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/cifpp INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/cifpp
PATH_VARS INCLUDE_INSTALL_DIR LIBRARY_INSTALL_DIR SHARE_INSTALL_DIR PATH_VARS INCLUDE_INSTALL_DIR LIBRARY_INSTALL_DIR SHARE_INSTALL_DIR
...@@ -463,7 +460,7 @@ set(CPACK_SOURCE_TGZ ON) ...@@ -463,7 +460,7 @@ set(CPACK_SOURCE_TGZ ON)
set(CPACK_SOURCE_TBZ2 OFF) set(CPACK_SOURCE_TBZ2 OFF)
set(CPACK_SOURCE_TXZ OFF) set(CPACK_SOURCE_TXZ OFF)
set(CPACK_SOURCE_TZ OFF) set(CPACK_SOURCE_TZ OFF)
set(CPACK_SOURCE_IGNORE_FILES "/data/components.cif;/build;/.vscode;/.git;/test;/.pc;/tools/symop-map-generator;/regex/doc;/regex/example;/regex/meta;/regex/performance;/regex/test") set(CPACK_SOURCE_IGNORE_FILES "/data/components.cif;/build;/.vscode;/.git;/regex")
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}") set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}")
set(CPACK_SOURCE_PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME}) set(CPACK_SOURCE_PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME})
include(CPack) include(CPack)
cmake_minimum_required(VERSION 3.16..3.19) cmake_minimum_required(VERSION 3.16..3.19)
function(add_git_submodule dir) function(add_git_submodule repo dir)
# add a Git submodule directory to CMake, assuming the # add a Git submodule directory to CMake, assuming the
# Git submodule directory is a CMake project. # Git submodule directory is a CMake project.
# #
...@@ -11,9 +11,9 @@ function(add_git_submodule dir) ...@@ -11,9 +11,9 @@ function(add_git_submodule dir)
find_package(Git QUIET) find_package(Git QUIET)
if(NOT EXISTS "${PROJECT_SOURCE_DIR}/${dir}/CMakeLists.txt") if(NOT EXISTS "${PROJECT_SOURCE_DIR}/${dir}/CMakeLists.txt")
if(NOT (GIT_FOUND AND IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/.git")) if(NOT(GIT_FOUND))
message(FATAL_ERROR "${CMAKE_CURRENT_SOURCE_DIR} is not a git repository and the submodule ${dir} is not complete. Cannot continue.") message(FATAL_ERROR "${CMAKE_CURRENT_SOURCE_DIR} is not a git repository and the submodule ${dir} is not complete. Cannot continue.")
else() elseif(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/.git") # We're in a git repo, we can use submodules
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.19) if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.19)
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive -- ${dir} execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive -- ${dir}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
...@@ -22,10 +22,19 @@ function(add_git_submodule dir) ...@@ -22,10 +22,19 @@ function(add_git_submodule dir)
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive -- ${dir} execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive -- ${dir}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
endif() endif()
else()
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.19)
execute_process(COMMAND ${GIT_EXECUTABLE} clone "${repo}" --recursive -- ${dir}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMAND_ERROR_IS_FATAL ANY)
else()
execute_process(COMMAND ${GIT_EXECUTABLE} clone "${repo}" --recursive -- ${dir}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
endif()
endif() endif()
endif() endif()
set(ENABLE_TESTING OFF) set(ENABLE_TESTING OFF)
add_subdirectory(${dir} ${ARGV}) add_subdirectory(${dir} ${ARGV2})
endfunction(add_git_submodule) endfunction(add_git_submodule)
\ No newline at end of file
@PACKAGE_INIT@
include(CMakeFindDependencyMacro)
find_dependency(Threads)
find_dependency(ZLIB REQUIRED)
find_dependency(LibLZMA REQUIRED)
find_dependency(Boost COMPONENTS regex)
INCLUDE("${CMAKE_CURRENT_LIST_DIR}/cifppTargets.cmake")
set_and_check(CIFPP_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@")
set_and_check(CIFPP_LIBRARY_DIR "@PACKAGE_LIBRARY_INSTALL_DIR@")
set_and_check(CIFPP_SHARE_DIR "@PACKAGE_SHARE_INSTALL_DIR@")
check_required_components(cifpp)
Subproject commit a7bb5b5c4b6612215a78267b89e05c39a45429b5
...@@ -24,9 +24,8 @@ ...@@ -24,9 +24,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <gxrio.hpp>
#include <cif++/file.hpp> #include <cif++/file.hpp>
#include <cif++/gzio.hpp>
namespace cif namespace cif
{ {
...@@ -185,7 +184,7 @@ void file::load(const std::filesystem::path &p) ...@@ -185,7 +184,7 @@ void file::load(const std::filesystem::path &p)
{ {
try try
{ {
gxrio::ifstream in(p); gzio::ifstream in(p);
if (not in.is_open()) if (not in.is_open())
throw std::runtime_error("Could not open file " + p.string()); throw std::runtime_error("Could not open file " + p.string());
...@@ -213,7 +212,7 @@ void file::load(std::istream &is) ...@@ -213,7 +212,7 @@ void file::load(std::istream &is)
void file::save(const std::filesystem::path &p) const void file::save(const std::filesystem::path &p) const
{ {
gxrio::ofstream outFile(p); gzio::ofstream outFile(p);
save(outFile); save(outFile);
} }
......
...@@ -31,8 +31,6 @@ ...@@ -31,8 +31,6 @@
#include <iomanip> #include <iomanip>
#include <numeric> #include <numeric>
#include <gxrio.hpp>
namespace fs = std::filesystem; namespace fs = std::filesystem;
extern int VERBOSE; extern int VERBOSE;
...@@ -1193,42 +1191,6 @@ float branch::weight() const ...@@ -1193,42 +1191,6 @@ float branch::weight() const
return sum; }); return sum; });
} }
// // --------------------------------------------------------------------
// // File
// void File::load(const std::filesystem::path &path)
// {
// gxrio::ifstream in(path);
// auto ext = path.extension().string();
// if (ext == ".gz" or ext = ".xz")
// ext = path.stem().extension().string();
// if (ext == ".pdb" or ext == ".ent")
// ReadPDBFile(in, *this);
// else
// file::load(in);
// // validate, otherwise lots of functionality won't work
// loadDictionary("mmcif_pdbx");
// if (not isValid() and VERBOSE >= 0)
// std::cerr << "Invalid mmCIF file" << (VERBOSE > 0 ? "." : " use --verbose option to see errors") << std::endl;
// }
// void File::save(const std::filesystem::path &path)
// {
// gxrio::ostream outFile(path);
// auto ext = path.extension().string();
// if (ext == ".gz" or ext = ".xz")
// ext = path.stem().extension().string();
// if (ext == ".pdb" or ext == ".ent")
// WritePDBFile(outFile, data());
// else
// file::save(outFile);
// }
// -------------------------------------------------------------------- // --------------------------------------------------------------------
// structure // structure
......
...@@ -30,9 +30,9 @@ ...@@ -30,9 +30,9 @@
#include <regex> #include <regex>
#include <set> #include <set>
#include <gxrio.hpp>
#include <cif++.hpp> #include <cif++.hpp>
#include <cif++/pdb/cif2pdb.hpp> #include <cif++/pdb/cif2pdb.hpp>
#include <cif++/gzio.hpp>
namespace cif::pdb namespace cif::pdb
{ {
...@@ -3731,7 +3731,7 @@ void write(std::ostream &os, const datablock &db) ...@@ -3731,7 +3731,7 @@ void write(std::ostream &os, const datablock &db)
void write(const std::filesystem::path &p, const datablock &db) void write(const std::filesystem::path &p, const datablock &db)
{ {
gxrio::ofstream out(p); gzio::ofstream out(p);
bool writePDB = false; bool writePDB = false;
if (p.extension() == ".gz") if (p.extension() == ".gz")
......
...@@ -30,10 +30,10 @@ ...@@ -30,10 +30,10 @@
#include <stack> #include <stack>
#include <cif++.hpp> #include <cif++.hpp>
#include <gxrio.hpp>
#include <cif++/pdb/pdb2cif.hpp> #include <cif++/pdb/pdb2cif.hpp>
#include <cif++/pdb/pdb2cif_remark_3.hpp> #include <cif++/pdb/pdb2cif_remark_3.hpp>
#include <cif++/gzio.hpp>
using cif::category; using cif::category;
using cif::datablock; using cif::datablock;
...@@ -6225,7 +6225,7 @@ file read(const std::filesystem::path &file) ...@@ -6225,7 +6225,7 @@ file read(const std::filesystem::path &file)
{ {
try try
{ {
gxrio::ifstream in(file); gzio::ifstream in(file);
if (not in.is_open()) if (not in.is_open())
throw std::runtime_error("Could not open file " + file.string() + " for input"); throw std::runtime_error("Could not open file " + file.string() + " for input");
......
...@@ -41,12 +41,11 @@ using boost::regex; ...@@ -41,12 +41,11 @@ using boost::regex;
using std::regex; using std::regex;
#endif #endif
#include <gxrio.hpp>
#include <cif++/dictionary_parser.hpp> #include <cif++/dictionary_parser.hpp>
#include <cif++/validate.hpp> #include <cif++/validate.hpp>
#include <cif++/utilities.hpp> #include <cif++/utilities.hpp>
#include <cif++/gzio.hpp>
namespace cif namespace cif
{ {
...@@ -472,7 +471,7 @@ const validator &validator_factory::operator[](std::string_view dictionary_name) ...@@ -472,7 +471,7 @@ const validator &validator_factory::operator[](std::string_view dictionary_name)
if (std::filesystem::exists(p, ec) and not ec) if (std::filesystem::exists(p, ec) and not ec)
{ {
gxrio::ifstream in(p); gzio::ifstream in(p);
if (not in.is_open()) if (not in.is_open())
throw std::runtime_error("Could not open dictionary (" + p.string() + ")"); throw std::runtime_error("Could not open dictionary (" + p.string() + ")");
......
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