Commit 640552ab by Maarten L. Hekkelman

Remove dependency on libzeep

parent faee1848
...@@ -222,12 +222,6 @@ list(APPEND CIFPP_REQUIRED_LIBRARIES ${STDCPPFS_LIBRARY}) ...@@ -222,12 +222,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(MSVC)
# this dependency can go once MSVC supports std::experimental::is_detected
find_package(zeep 5.1.8 REQUIRED)
list(APPEND CIFPP_REQUIRED_LIBRARIES zeep::zeep)
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/ LIB_NAME "LibCIFPP") write_version_header(${PROJECT_SOURCE_DIR}/src/ LIB_NAME "LibCIFPP")
......
...@@ -87,9 +87,6 @@ Other requirements are: ...@@ -87,9 +87,6 @@ Other requirements are:
is the package `zlib1g-dev`. is the package `zlib1g-dev`.
- [boost](https://www.boost.org). - [boost](https://www.boost.org).
When building using MS Visual Studio, you will also need [libzeep](https://github.com/mhekkel/libzeep)
since MSVC does not yet provide a C++ template required by libcifpp.
The Boost libraries are only needed in case you want to build the test The Boost libraries are only needed in case you want to build the test
code or if you are using GCC. That last condition is due to a long code or if you are using GCC. That last condition is due to a long
standing bug in the implementation of std::regex. It simply crashes standing bug in the implementation of std::regex. It simply crashes
......
...@@ -2,18 +2,11 @@ ...@@ -2,18 +2,11 @@
include("${CMAKE_CURRENT_LIST_DIR}/cifppTargets.cmake") include("${CMAKE_CURRENT_LIST_DIR}/cifppTargets.cmake")
# Note that this set_and_check needs te be executed before
# find_dependency of Eigen3, otherwise the path is
# not found....
set_and_check(CIFPP_SHARE_DIR "@PACKAGE_CIFPP_DATA_DIR@") set_and_check(CIFPP_SHARE_DIR "@PACKAGE_CIFPP_DATA_DIR@")
include(CMakeFindDependencyMacro) include(CMakeFindDependencyMacro)
find_dependency(Threads)
find_dependency(Threads)
find_dependency(ZLIB REQUIRED) find_dependency(ZLIB REQUIRED)
if(MSVC)
find_dependency(zeep REQUIRED)
endif()
check_required_components(cifpp) check_required_components(cifpp)
...@@ -38,10 +38,39 @@ ...@@ -38,10 +38,39 @@
#include <vector> #include <vector>
#if __has_include(<experimental/type_traits>) #if __has_include(<experimental/type_traits>)
#include <experimental/type_traits> #include <experimental/type_traits>
namespace std_experimental = std::experimental;
#else #else
// sub optimal, but replicating the same code is worse
#include <zeep/type-traits.hpp> // A quick hack to work around the missing is_detected in MSVC
namespace std_experimental
{
namespace detail
{
template <class AlwaysVoid, template <class...> class Op, class... Args>
struct detector
{
using value_t = std::false_type;
};
template <template <class...> class Op, class... Args>
struct detector<std::void_t<Op<Args...>>, Op, Args...>
{
using value_t = std::true_type;
};
} // namespace detail
template <template <class...> class Op, class... Args>
using is_detected = typename detail::detector<void, Op, Args...>::value_t;
template <template <class...> class Op, class... Args>
const auto is_detected_v = is_detected<Op, Args...>::value;
} // namespace std_experimental
#endif #endif
/** /**
...@@ -270,7 +299,6 @@ struct iless ...@@ -270,7 +299,6 @@ struct iless
} }
}; };
/// iset is a std::set of std::string but with a comparator that /// iset is a std::set of std::string but with a comparator that
/// ignores character case. /// ignores character case.
using iset = std::set<std::string, iless>; using iset = std::set<std::string, iless>;
...@@ -295,7 +323,7 @@ inline char tolower(int ch) ...@@ -295,7 +323,7 @@ inline char tolower(int ch)
* *
* If no dot character was found, the category name is empty. That's for * If no dot character was found, the category name is empty. That's for
* cif 1.0 formatted data. * cif 1.0 formatted data.
*/ */
std::tuple<std::string, std::string> split_tag_name(std::string_view tag); std::tuple<std::string, std::string> split_tag_name(std::string_view tag);
...@@ -578,6 +606,6 @@ using from_chars_function = decltype(std::from_chars(std::declval<const char *>( ...@@ -578,6 +606,6 @@ using from_chars_function = decltype(std::from_chars(std::declval<const char *>(
* @tparam T The type for which we want to find a from_chars/to_chars function * @tparam T The type for which we want to find a from_chars/to_chars function
*/ */
template <typename T> template <typename T>
using selected_charconv = typename std::conditional_t<std::experimental::is_detected_v<from_chars_function, T>, std_charconv<T>, my_charconv<T>>; using selected_charconv = typename std::conditional_t<std_experimental::is_detected_v<from_chars_function, T>, std_charconv<T>, my_charconv<T>>;
} // namespace cif } // namespace cif
\ 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