mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-13 16:46:47 +00:00
Fallback to <boost/filesystem> on GCC 7
This commit is contained in:
parent
77bf12c8e8
commit
ea9aede652
|
@ -203,6 +203,13 @@ macro(set_fairmq_defaults)
|
||||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE})
|
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE})
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if( CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
|
||||||
|
AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8)
|
||||||
|
set(FAIRMQ_HAS_STD_FILESYSTEM 0)
|
||||||
|
else()
|
||||||
|
set(FAIRMQ_HAS_STD_FILESYSTEM 1)
|
||||||
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
function(join VALUES GLUE OUTPUT)
|
function(join VALUES GLUE OUTPUT)
|
||||||
|
|
|
@ -283,6 +283,7 @@ if(BUILD_FAIRMQ)
|
||||||
if(BUILD_OFI_TRANSPORT)
|
if(BUILD_OFI_TRANSPORT)
|
||||||
target_compile_definitions(${_target} PRIVATE BUILD_OFI_TRANSPORT)
|
target_compile_definitions(${_target} PRIVATE BUILD_OFI_TRANSPORT)
|
||||||
endif()
|
endif()
|
||||||
|
target_compile_definitions(${_target} PUBLIC FAIRMQ_HAS_STD_FILESYSTEM=${FAIRMQ_HAS_STD_FILESYSTEM})
|
||||||
|
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
|
@ -384,6 +385,7 @@ if(BUILD_FAIRMQ)
|
||||||
$<$<PLATFORM_ID:Linux>:rt>
|
$<$<PLATFORM_ID:Linux>:rt>
|
||||||
Boost::boost
|
Boost::boost
|
||||||
Boost::date_time
|
Boost::date_time
|
||||||
|
$<$<NOT:${FAIRMQ_HAS_STD_FILESYSTEM}>:Boost::filesystem>
|
||||||
Boost::program_options
|
Boost::program_options
|
||||||
FairLogger::FairLogger
|
FairLogger::FairLogger
|
||||||
PicoSHA2
|
PicoSHA2
|
||||||
|
@ -391,6 +393,7 @@ if(BUILD_FAIRMQ)
|
||||||
target_include_directories(fairmq-shmmonitor PUBLIC
|
target_include_directories(fairmq-shmmonitor PUBLIC
|
||||||
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}>
|
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}>
|
||||||
)
|
)
|
||||||
|
target_compile_definitions(fairmq-shmmonitor PUBLIC FAIRMQ_HAS_STD_FILESYSTEM=${FAIRMQ_HAS_STD_FILESYSTEM})
|
||||||
|
|
||||||
add_executable(fairmq-uuid-gen tools/runUuidGenerator.cxx)
|
add_executable(fairmq-uuid-gen tools/runUuidGenerator.cxx)
|
||||||
target_link_libraries(fairmq-uuid-gen PUBLIC
|
target_link_libraries(fairmq-uuid-gen PUBLIC
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||||
|
|
||||||
#include <csignal>
|
#include <csignal>
|
||||||
#include <filesystem>
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
@ -32,6 +31,14 @@
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
|
|
||||||
|
#if FAIRMQ_HAS_STD_FILESYSTEM
|
||||||
|
#include <filesystem>
|
||||||
|
namespace fs = std::filesystem;
|
||||||
|
#else
|
||||||
|
#include <boost/filesystem.hpp>
|
||||||
|
namespace fs = ::boost::filesystem;
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using bie = ::boost::interprocess::interprocess_exception;
|
using bie = ::boost::interprocess::interprocess_exception;
|
||||||
namespace bipc = ::boost::interprocess;
|
namespace bipc = ::boost::interprocess;
|
||||||
|
@ -275,12 +282,12 @@ bool Monitor::PrintShm(const ShmId& shmId)
|
||||||
void Monitor::ListAll(const std::string& path)
|
void Monitor::ListAll(const std::string& path)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if (std::filesystem::is_empty(path)) {
|
if (fs::is_empty(path)) {
|
||||||
LOG(info) << "directory " << filesystem::path(path) << " is empty.";
|
LOG(info) << "directory " << fs::path(path) << " is empty.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto& entry : filesystem::directory_iterator(path)) {
|
for (const auto& entry : fs::directory_iterator(path)) {
|
||||||
string filename = entry.path().filename().string();
|
string filename = entry.path().filename().string();
|
||||||
// LOG(info) << filename << ", size: " << entry.file_size() << " bytes";
|
// LOG(info) << filename << ", size: " << entry.file_size() << " bytes";
|
||||||
if (tools::StrStartsWith(filename, "fmq_") || tools::StrStartsWith(filename, "sem.fmq_")) {
|
if (tools::StrStartsWith(filename, "fmq_") || tools::StrStartsWith(filename, "sem.fmq_")) {
|
||||||
|
@ -296,7 +303,7 @@ void Monitor::ListAll(const std::string& path)
|
||||||
LOG(info) << "The file '" << filename << "' does not belong to FairMQ, skipping...";
|
LOG(info) << "The file '" << filename << "' does not belong to FairMQ, skipping...";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (filesystem::filesystem_error& fse) {
|
} catch (fs::filesystem_error& fse) {
|
||||||
LOG(error) << "error: " << fse.what();
|
LOG(error) << "error: " << fse.what();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user