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