libftdi Archives

Subject: [PATCH 06/10] ftdipp: use stl instead of boost for shared_ptr

From: Shawn Hoffman <business@xxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Cc: Shawn Hoffman <godisgovernment@xxxxxxxxx>
Date: Wed, 10 Apr 2024 07:15:45 -0700
From: Shawn Hoffman <godisgovernment@xxxxxxxxx>

---
 CMakeLists.txt          |  2 +-
 README.build            |  2 +-
 examples/CMakeLists.txt |  4 ----
 ftdipp/CMakeLists.txt   | 11 +++++++----
 ftdipp/ftdi.hpp         |  8 ++++----
 5 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5afda1b..b495f6d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -51,7 +51,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 fafd99f..1c70a9e 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -39,10 +39,6 @@ endif(NOT MINGW)
 
 # libftdi++ examples
 if(FTDIPP)
-  include_directories(BEFORE ${PROJECT_SOURCE_DIR}/ftdipp
-    ${Boost_INCLUDE_DIRS}
-  )
-
   # Target
   add_executable(find_all_pp find_all_pp.cpp)
 
diff --git a/ftdipp/CMakeLists.txt b/ftdipp/CMakeLists.txt
index 5369a29..c107fd7 100644
--- a/ftdipp/CMakeLists.txt
+++ b/ftdipp/CMakeLists.txt
@@ -8,19 +8,22 @@ include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}
   ${PROJECT_SOURCE_DIR}/src
 )
 
-include_directories(${Boost_INCLUDE_DIRS})
-
 # Shared library
 add_library(ftdipp1 SHARED ${cpp_sources})
 
 math(EXPR VERSION_FIXUP "${MAJOR_VERSION} + 1") # Compatibility with previous 
releases
-set_target_properties(ftdipp1 PROPERTIES VERSION 
${VERSION_FIXUP}.${MINOR_VERSION}.0 SOVERSION 3)
+set_target_properties(ftdipp1 PROPERTIES
+  VERSION ${VERSION_FIXUP}.${MINOR_VERSION}.0
+  SOVERSION 3)
+set_target_properties(ftdipp1 PROPERTIES
+  CXX_STANDARD 11
+  CXX_STANDARD_REQUIRED TRUE)
 
 # Prevent clobbering each other during the build
 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 481c44c..36c3cbc 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
@@ -144,7 +144,7 @@ protected:
 
 private:
     class Private;
-    boost::shared_ptr<Private> d;
+    std::shared_ptr<Private> d;
 };
 
 /*! \brief Device EEPROM.
@@ -167,7 +167,7 @@ public:
 
 private:
     class Private;
-    boost::shared_ptr<Private> d;
+    std::shared_ptr<Private> d;
 };
 
 /*! \brief Device list.
@@ -213,7 +213,7 @@ public:
 
 private:
     class Private;
-    boost::shared_ptr<Private> d;
+    std::shared_ptr<Private> d;
 };
 
 }
-- 
2.44.0.windows.1


--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Current Thread