Commit 29aac70e by Maarten L. Hekkelman

Changed boost::regex dependency to git submodule, in case it is needed

parent 700575ad
[submodule "regex"]
path = regex
url = https://github.com/boostorg/regex
...@@ -156,17 +156,14 @@ try_run(STD_REGEX_RUNNING STD_REGEX_COMPILING ...@@ -156,17 +156,14 @@ try_run(STD_REGEX_RUNNING STD_REGEX_COMPILING
if(STD_REGEX_RUNNING STREQUAL FAILED_TO_RUN) if(STD_REGEX_RUNNING STREQUAL FAILED_TO_RUN)
message(WARNING "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(WARNING "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(NEED_BOOST_REGEX ON) set(BOOST_REGEX_STANDALONE ON)
add_subdirectory(regex)
endif() endif()
set(CMAKE_THREAD_PREFER_PTHREAD) set(CMAKE_THREAD_PREFER_PTHREAD)
set(THREADS_PREFER_PTHREAD_FLAG) set(THREADS_PREFER_PTHREAD_FLAG)
find_package(Threads) find_package(Threads)
if(NEED_BOOST_REGEX)
find_package(Boost 1.70.0 REQUIRED COMPONENTS system regex)
endif()
find_package(gxrio REQUIRED) find_package(gxrio REQUIRED)
include(FindFilesystem) include(FindFilesystem)
...@@ -215,15 +212,16 @@ set(project_sources ...@@ -215,15 +212,16 @@ set(project_sources
# ${PROJECT_SOURCE_DIR}/src/pdb/PDB2Cif.cpp # ${PROJECT_SOURCE_DIR}/src/pdb/PDB2Cif.cpp
# ${PROJECT_SOURCE_DIR}/src/pdb/PDB2CifRemark3.cpp # ${PROJECT_SOURCE_DIR}/src/pdb/PDB2CifRemark3.cpp
${PROJECT_SOURCE_DIR}/src/structure/AtomType.cpp # ${PROJECT_SOURCE_DIR}/src/structure/AtomType.cpp
${PROJECT_SOURCE_DIR}/src/structure/BondMap.cpp # ${PROJECT_SOURCE_DIR}/src/structure/BondMap.cpp
# ${PROJECT_SOURCE_DIR}/src/structure/Compound.cpp # ${PROJECT_SOURCE_DIR}/src/structure/Compound.cpp
# ${PROJECT_SOURCE_DIR}/src/structure/Secondary.cpp # ${PROJECT_SOURCE_DIR}/src/structure/Secondary.cpp
# ${PROJECT_SOURCE_DIR}/src/structure/Structure.cpp # ${PROJECT_SOURCE_DIR}/src/structure/Structure.cpp
# ${PROJECT_SOURCE_DIR}/src/structure/Symmetry.cpp # ${PROJECT_SOURCE_DIR}/src/structure/Symmetry.cpp
# ${PROJECT_SOURCE_DIR}/src/structure/TlsParser.cpp # ${PROJECT_SOURCE_DIR}/src/structure/TlsParser.cpp
${PROJECT_SOURCE_DIR}/src/utilities.cpp ${PROJECT_SOURCE_DIR}/src/utilities.cpp
${PROJECT_SOURCE_DIR}/src/point.cpp
# ${PROJECT_SOURCE_DIR}/src/point.cpp
) )
set(project_headers set(project_headers
...@@ -258,24 +256,21 @@ set(project_headers ...@@ -258,24 +256,21 @@ set(project_headers
) )
add_library(cifpp ${project_sources} ${project_headers} ${CMAKE_SOURCE_DIR}/src/structure/SymOpTable_data.hpp) add_library(cifpp ${project_sources} ${project_headers} ${CMAKE_SOURCE_DIR}/src/structure/SymOpTable_data.hpp)
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(NEED_BOOST_REGEX) # if(NEED_BOOST_REGEX)
target_compile_definitions(cifpp PUBLIC USE_BOOST_REGEX=1 BOOST_REGEX_STANDALONE=1) target_compile_definitions(cifpp PUBLIC USE_BOOST_REGEX=1 BOOST_REGEX_STANDALONE=1)
endif()
# endif()
target_include_directories(cifpp target_include_directories(cifpp
PUBLIC PUBLIC
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>" "$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>" "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
) )
target_include_directories(cifpp target_link_libraries(cifpp PUBLIC Threads::Threads gxrio::gxrio ${CIFPP_REQUIRED_LIBRARIES} PRIVATE Boost::regex)
PRIVATE
${CMAKE_BINARY_DIR}
)
target_link_libraries(cifpp PUBLIC Threads::Threads Boost::regex gxrio::gxrio ${CIFPP_REQUIRED_LIBRARIES})
# target_link_libraries(cifpp PRIVATE) # target_link_libraries(cifpp PRIVATE)
if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
...@@ -416,7 +411,7 @@ if(CIFPP_BUILD_TESTS) ...@@ -416,7 +411,7 @@ if(CIFPP_BUILD_TESTS)
list(APPEND CIFPP_tests list(APPEND CIFPP_tests
pdb2cif # pdb2cif
# rename-compound # rename-compound
# structure # structure
# sugar # sugar
...@@ -429,12 +424,7 @@ if(CIFPP_BUILD_TESTS) ...@@ -429,12 +424,7 @@ if(CIFPP_BUILD_TESTS)
add_executable(${CIFPP_TEST} ${CIFPP_TEST_SOURCE}) add_executable(${CIFPP_TEST} ${CIFPP_TEST_SOURCE})
target_include_directories(${CIFPP_TEST} PRIVATE target_link_libraries(${CIFPP_TEST} PRIVATE Threads::Threads cifpp::cifpp)
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_BINARY_DIR} # for config.h
)
target_link_libraries(${CIFPP_TEST} PRIVATE Threads::Threads cifpp)
if(CIFPP_USE_RSRC) if(CIFPP_USE_RSRC)
mrc_target_resources(${CIFPP_TEST} ${CMAKE_SOURCE_DIR}/rsrc/mmcif_pdbx_v50.dic) mrc_target_resources(${CIFPP_TEST} ${CMAKE_SOURCE_DIR}/rsrc/mmcif_pdbx_v50.dic)
......
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
include(CMakeFindDependencyMacro) include(CMakeFindDependencyMacro)
find_dependency(Threads) find_dependency(Threads)
find_dependency(Boost 1.70.0 REQUIRED COMPONENTS system regex) find_dependency(gxrio)
find_dependency(gzstream)
INCLUDE("${CMAKE_CURRENT_LIST_DIR}/cifppTargets.cmake") INCLUDE("${CMAKE_CURRENT_LIST_DIR}/cifppTargets.cmake")
......
...@@ -8,5 +8,5 @@ Name: libcifpp ...@@ -8,5 +8,5 @@ Name: libcifpp
Description: C++ library for the manipulation of mmCIF files. Description: C++ library for the manipulation of mmCIF files.
Version: @PACKAGE_VERSION@ Version: @PACKAGE_VERSION@
Libs: -L${libdir} -lcifpp -lboost_regex -lz Libs: -L${libdir} -lcifpp -lz
Cflags: -I${includedir} -pthread Cflags: -I${includedir} -pthread
Subproject commit e5979ae1af2e5e03a46509048269294bfe9a32c7
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
#include <filesystem> #include <filesystem>
#include <zstream/zstream.hpp> #include <gxrio.hpp>
#include <boost/logic/tribool.hpp> #include <boost/logic/tribool.hpp>
...@@ -3448,7 +3448,7 @@ void File::load(const std::filesystem::path &p) ...@@ -3448,7 +3448,7 @@ void File::load(const std::filesystem::path &p)
{ {
fs::path path(p); fs::path path(p);
zstream::ifstream in(p); gxrio::ifstream in(p);
try try
{ {
...@@ -3464,7 +3464,7 @@ void File::load(const std::filesystem::path &p) ...@@ -3464,7 +3464,7 @@ void File::load(const std::filesystem::path &p)
void File::save(const std::filesystem::path &p) void File::save(const std::filesystem::path &p)
{ {
zstream::ofstream outFile(p); gxrio::ofstream outFile(p);
save(outFile); save(outFile);
} }
...@@ -3505,7 +3505,7 @@ void File::load(const char *data, std::size_t length) ...@@ -3505,7 +3505,7 @@ void File::load(const char *data, std::size_t length)
membuf(char *data, size_t length) { this->setg(data, data, data + length); } membuf(char *data, size_t length) { this->setg(data, data, data + length); }
} buffer(const_cast<char *>(data), length); } buffer(const_cast<char *>(data), length);
zstream::istream is(&buffer); gxrio::istream is(&buffer);
load(is); load(is);
} }
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <zstream/zstream.hpp> #include <gxrio.hpp>
#include <cif++/cif/file.hpp> #include <cif++/cif/file.hpp>
...@@ -132,16 +132,8 @@ std::tuple<file::iterator, bool> file::emplace(std::string_view name) ...@@ -132,16 +132,8 @@ std::tuple<file::iterator, bool> file::emplace(std::string_view name)
void file::load(const std::filesystem::path &p) void file::load(const std::filesystem::path &p)
{ {
if (p.extension() == ".gz") gxrio::ifstream in(p);
{ load(in);
gzstream::ifstream in(p);
load(in);
}
else
{
std::ifstream in(p, std::ios::binary);
load(in);
}
} }
void file::load(std::istream &is) void file::load(std::istream &is)
...@@ -161,7 +153,7 @@ void file::load(std::istream &is) ...@@ -161,7 +153,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
{ {
zstream::ofstream outFile(p); gxrio::ofstream outFile(p);
save(outFile); save(outFile);
} }
......
...@@ -435,7 +435,7 @@ const validator &validator_factory::operator[](std::string_view dictionary_name) ...@@ -435,7 +435,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)
{ {
gzstream::ifstream in(p); gxrio::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() + ")");
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#include <iomanip> #include <iomanip>
#include <numeric> #include <numeric>
#include <zstream/zstream.hpp> #include <gxrio.hpp>
#if __cpp_lib_format #if __cpp_lib_format
#include <format> #include <format>
...@@ -1285,7 +1285,7 @@ float Branch::weight() const ...@@ -1285,7 +1285,7 @@ float Branch::weight() const
void File::load(const std::filesystem::path &path) void File::load(const std::filesystem::path &path)
{ {
zstream::ifstream in(path); gxrio::ifstream in(path);
auto ext = path.extension().string(); auto ext = path.extension().string();
if (ext == ".gz" or ext = ".xz") if (ext == ".gz" or ext = ".xz")
...@@ -1304,7 +1304,7 @@ void File::load(const std::filesystem::path &path) ...@@ -1304,7 +1304,7 @@ void File::load(const std::filesystem::path &path)
void File::save(const std::filesystem::path &path) void File::save(const std::filesystem::path &path)
{ {
zstream::ostream outFile(path); gxrio::ostream outFile(path);
auto ext = path.extension().string(); auto ext = path.extension().string();
if (ext == ".gz" or ext = ".xz") if (ext == ".gz" or ext = ".xz")
......
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