diff --git a/CMakeLists.txt b/CMakeLists.txt index e42117b6..7a46e855 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,7 +58,7 @@ endif() find_package(GMP REQUIRED) find_package(Threads REQUIRED) -find_package(Boost 1.66.0 REQUIRED COMPONENTS thread system) +find_package(Boost 1.66.0 REQUIRED COMPONENTS filesystem thread system) add_subdirectory(src/abycore) diff --git a/src/abycore/CMakeLists.txt b/src/abycore/CMakeLists.txt index d25f5295..196d7fd6 100644 --- a/src/abycore/CMakeLists.txt +++ b/src/abycore/CMakeLists.txt @@ -28,15 +28,8 @@ target_include_directories(aby $ ) -# This assumes that libstdc++ is used and should not be required for e.g. -# libc++. Linking to libstdc++fs is currently required when using the -# std::filesystem library. -# cf. https://gitlab.kitware.com/cmake/cmake/issues/17834 -target_link_libraries(aby - PRIVATE stdc++fs -) - target_link_libraries(aby + PRIVATE Boost::filesystem PUBLIC OTExtension::otextension PUBLIC ENCRYPTO_utils::encrypto_utils PUBLIC GMP::GMP diff --git a/src/abycore/sharing/boolsharing.cpp b/src/abycore/sharing/boolsharing.cpp index 513925d3..653f035a 100644 --- a/src/abycore/sharing/boolsharing.cpp +++ b/src/abycore/sharing/boolsharing.cpp @@ -19,15 +19,8 @@ #include "../aby/abysetup.h" #include -#if __has_include() -#include -namespace filesystem = std::filesystem; -#elif __has_include() -#include -namespace filesystem = std::experimental::filesystem; -#else -#error "C++17 filesystem library not found" -#endif +#include +namespace filesystem = boost::filesystem; void BoolSharing::Init() { diff --git a/src/abycore/sharing/sharing.cpp b/src/abycore/sharing/sharing.cpp index 1b973b7d..3ffe80cc 100644 --- a/src/abycore/sharing/sharing.cpp +++ b/src/abycore/sharing/sharing.cpp @@ -23,15 +23,9 @@ #include #include -#if __has_include() -#include -namespace filesystem = std::filesystem; -#elif __has_include() -#include -namespace filesystem = std::experimental::filesystem; -#else -#error "C++17 filesystem library not found" -#endif +#include +#include +namespace filesystem = boost::filesystem; #include #include @@ -94,7 +88,7 @@ void Sharing::PreCompFileDelete() { } else { truncation_size = filesystem::file_size(filename) - m_nFilePos; - std::error_code ec; + boost::system::error_code ec; filesystem::resize_file(filename, truncation_size, ec); if(ec) { std::cout << "Error occured in truncate:" << ec.message() << std::endl;