The C++ wrapper relies on boost::shared_ptr, likely due to the lack of a
standard smart pointer at the time of the C++ wrapper implementation.
However, std::shared_ptr has been available by default in GCC since
version 6.1, and even with GCC 4.7 when explicitely using the -std=c++11
option.
This commit replaces all usages of boost::shared_ptr with
std::shared_ptr, eliminating the dependency on the Boost library. Since
the smart pointer is only used in private member variables and both
types have the same size, this change does not affect the ABI.
Signed-off-by: Aurelien Jarno <aurelien@xxxxxxxxxxx>
---
CMakeLists.txt | 2 +-
README.build | 2 +-
examples/CMakeLists.txt | 1 -
ftdipp/CMakeLists.txt | 4 +---
ftdipp/ftdi.hpp | 8 ++++----
5 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5494357..385952e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -45,7 +45,7 @@ find_package ( LibUSB REQUIRED )
include_directories ( ${LIBUSB_INCLUDE_DIR} )
# Find Boost
-if (FTDIPP OR BUILD_TESTS)
+if (BUILD_TESTS)
find_package( Boost REQUIRED )
endif()
diff --git a/README.build b/README.build
index e130ca0..54c253f 100644
--- a/README.build
+++ b/README.build
@@ -14,7 +14,7 @@ earlier, it is recommended you build libusbx-1.0.14 or later).
sudo apt-get install libconfuse-dev (for ftdi-eeprom) (yum install
libconfuse-devel)
sudo apt-get install swig python-dev (for python bindings) (yum install swig
python-devel)
-sudo apt-get install libboost-all-dev (for C++ binding and unit test) (yum
install boost-devel)
+sudo apt-get install libboost-all-dev (for unit test) (yum install boost-devel)
3) Clone the git repository
mkdir libftdi
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 9ec7bff..bda84e0 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -38,7 +38,6 @@ endif(NOT MINGW)
# libftdi++ examples
if( FTDIPP )
include_directories(BEFORE ${PROJECT_SOURCE_DIR}/ftdipp
- ${Boost_INCLUDE_DIRS}
)
# Target
diff --git a/ftdipp/CMakeLists.txt b/ftdipp/CMakeLists.txt
index 360a831..71e6055 100644
--- a/ftdipp/CMakeLists.txt
+++ b/ftdipp/CMakeLists.txt
@@ -8,8 +8,6 @@ include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}
${PROJECT_SOURCE_DIR}/src
)
-include_directories(${Boost_INCLUDE_DIRS})
-
# Shared library
add_library(ftdipp1 SHARED ${cpp_sources})
@@ -20,7 +18,7 @@ set_target_properties(ftdipp1 PROPERTIES VERSION
${VERSION_FIXUP}.${MINOR_VERSIO
set_target_properties(ftdipp1 PROPERTIES CLEAN_DIRECT_OUTPUT 1)
# Dependencies
-target_link_libraries(ftdipp1 ftdi1 ${LIBUSB_LIBRARIES} ${BOOST_LIBRARIES})
+target_link_libraries(ftdipp1 ftdi1 ${LIBUSB_LIBRARIES})
install ( TARGETS ftdipp1
RUNTIME DESTINATION bin
diff --git a/ftdipp/ftdi.hpp b/ftdipp/ftdi.hpp
index f569cce..2458327 100644
--- a/ftdipp/ftdi.hpp
+++ b/ftdipp/ftdi.hpp
@@ -31,7 +31,7 @@ on this file might be covered by the GNU General Public
License.
#include <list>
#include <string>
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include <ftdi.h>
namespace Ftdi
@@ -145,7 +145,7 @@ protected:
private:
class Private;
- boost::shared_ptr<Private> d;
+ std::shared_ptr<Private> d;
};
/*! \brief Device EEPROM.
@@ -168,7 +168,7 @@ public:
private:
class Private;
- boost::shared_ptr<Private> d;
+ std::shared_ptr<Private> d;
};
/*! \brief Device list.
@@ -214,7 +214,7 @@ public:
private:
class Private;
- boost::shared_ptr<Private> d;
+ std::shared_ptr<Private> d;
};
}
--
2.47.2
--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx
|