From: Aurelien Jarno Date: Tue, 13 May 2025 21:40:40 +0000 (+0200) Subject: C++ wrapper: get rid of the Boost dependency X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=cfaec73e0a5ad9d05d62f1f5c393ab1c59ba771b;p=libftdi C++ wrapper: get rid of the Boost dependency 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 --- 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 #include -#include +#include #include namespace Ftdi @@ -145,7 +145,7 @@ protected: private: class Private; - boost::shared_ptr d; + std::shared_ptr d; }; /*! \brief Device EEPROM. @@ -168,7 +168,7 @@ public: private: class Private; - boost::shared_ptr d; + std::shared_ptr d; }; /*! \brief Device list. @@ -214,7 +214,7 @@ public: private: class Private; - boost::shared_ptr d; + std::shared_ptr d; }; }