Skip to content

Commit

Permalink
Merge pull request #316 from odin-detector/fix-boost-bind
Browse files Browse the repository at this point in the history
Add version-dependent mechanism to avoid boost global placeholder deprecation
  • Loading branch information
GDYendell authored Jun 8, 2023
2 parents b1236c7 + 230db5d commit 4ab601c
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 3 deletions.
12 changes: 12 additions & 0 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,18 @@ find_package(PCAP 1.4.0 REQUIRED)
find_package(Blosc)
find_package(Kafka)

# Check if Boost version has placeholders and set definition accordingly
message("\nChecking Boost version placeholder support")
if (NOT DEFINED Boost_VERSION_STRING)
set(Boost_VERSION_STRING "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
endif ()
if ((Boost_VERSION_STRING EQUAL 1.60.0) OR (Boost_VERSION_STRING GREATER 1.60.0))
message(STATUS "Boost version ${Boost_VERSION_STRING} has placeholders")
ADD_DEFINITIONS(-DBOOST_HAS_PLACEHOLDERS)
else ()
message(STATUS "Boost version ${Boost_VERSION_STRING} does not have placeholders")
endif ()

# find package HDF5
# FindHDF5.cmake is essentially broken and does not allow
# to properly override the search path by setting HDF5_ROOT.
Expand Down
2 changes: 1 addition & 1 deletion cpp/common/include/IpcChannel.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <map>

#include "zmq/zmq.hpp"
#include <boost/bind.hpp>
#include <boost/bind/bind.hpp>
#include <boost/function.hpp>

namespace OdinData
Expand Down
2 changes: 1 addition & 1 deletion cpp/common/include/IpcReactor.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <map>
#include <time.h>

#include <boost/bind.hpp>
#include <boost/bind/bind.hpp>
#include <boost/function.hpp>
#include <boost/ref.hpp>
#include <boost/shared_ptr.hpp>
Expand Down
4 changes: 4 additions & 0 deletions cpp/frameProcessor/src/FileWriterPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
#include "DebugLevelLogger.h"
#include "version.h"

#ifdef BOOST_HAS_PLACEHOLDERS
using namespace boost::placeholders;
#endif

namespace FrameProcessor
{

Expand Down
5 changes: 5 additions & 0 deletions cpp/frameProcessor/test/FrameProcessorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
#include "DebugLevelLogger.h"

#include <boost/test/unit_test.hpp>
#include <boost/bind/bind.hpp>
#ifdef BOOST_HAS_PLACEHOLDERS
using namespace boost::placeholders;
#endif

#include <log4cxx/logger.h>
#include <log4cxx/xml/domconfigurator.h>
#include <log4cxx/simplelayout.h>
Expand Down
4 changes: 4 additions & 0 deletions cpp/frameReceiver/src/FrameReceiverRxThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

#include "FrameReceiverRxThread.h"

#ifdef BOOST_HAS_PLACEHOLDERS
using namespace boost::placeholders;
#endif

using namespace FrameReceiver;

//! Constructor for the FrameReceiverRxThread class.
Expand Down
2 changes: 1 addition & 1 deletion cpp/test/integrationTest/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

set(CMAKE_INCLUDE_CURRENT_DIR on)
ADD_DEFINITIONS(-DBOOST_TEST_DYN_LINK)
ADD_DEFINITIONS(-DBOOST_TEST_DYN_LINK -DBOOST_BIND_GLOBAL_PLACEHOLDERS)

include_directories(${TEST_DIR}/integrationTest/include
${TEST_INCLUDE_DIRS}
Expand Down

0 comments on commit 4ab601c

Please sign in to comment.