Dominique Leuenberger 2021-02-07 14:16:49 +00:00 committed by Git OBS Bridge
commit e96e606f8b
6 changed files with 78 additions and 665 deletions

View File

@ -0,0 +1,33 @@
From 11a50ae5b80b3e03694a19e84513345d0794e563 Mon Sep 17 00:00:00 2001
From: Thomas Jarosch <thomas.jarosch@intra2net.com>
Date: Mon, 24 Aug 2020 19:27:22 +0200
Subject: [PATCH] Fix building unit tests without FTDIPP
Needed to run the baudrate unit tests.
Probably another fallout from:
****************************
commit 0209a3633dc877a577af07d883eb5059e22f6a91
cmake: do not check for g++ when FTDIPP is disabled
****************************
---
CMakeLists.txt | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3b0b87c..58f664a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -150,6 +150,7 @@ if ( EXAMPLES )
endif ()
add_subdirectory(packages)
if ( BUILD_TESTS )
+ project(libftdi1 C CXX)
add_subdirectory(test)
endif ()
--
1.7.1

View File

@ -1,652 +0,0 @@
From 68d2167bc5ed5b87c4e41896647b7a25ca7c4062 Mon Sep 17 00:00:00 2001
From: Yegor Yefremov <yegorslists@googlemail.com>
Date: Wed, 3 Jan 2018 13:46:23 +0100
Subject: [PATCH] CMake: move options to a dedicated file
Also disable all options having extra dependencies.
If an option is selected makes its dependencies as REQUIRED.
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
---
CMakeLists.txt | 62 ++++++++++++----------
CMakeOptions.txt | 8 +++
examples/CMakeLists.txt | 98 ++++++++++++++++--------------------
ftdi_eeprom/CMakeLists.txt | 63 ++++++++++--------------
ftdipp/CMakeLists.txt | 91 +++++++++++++--------------------
python/CMakeLists.txt | 120 ++++++++++++++++++++------------------------
test/CMakeLists.txt | 41 +++------------
7 files changed, 209 insertions(+), 274 deletions(-)
create mode 100644 CMakeOptions.txt
Index: libftdi1-1.4/CMakeLists.txt
===================================================================
--- libftdi1-1.4.orig/CMakeLists.txt
+++ libftdi1-1.4/CMakeLists.txt
@@ -16,6 +16,8 @@ cmake_minimum_required(VERSION 2.6 FATAL
add_definitions(-Wall)
+include(CMakeOptions.txt)
+
# Debug build
message("-- Build type: ${CMAKE_BUILD_TYPE}")
if(${CMAKE_BUILD_TYPE} STREQUAL Debug)
@@ -26,8 +28,10 @@ endif(${CMAKE_BUILD_TYPE} STREQUAL Debug
find_package ( USB1 REQUIRED )
include_directories ( ${LIBUSB_INCLUDE_DIR} )
-# Find Boost (optional package)
-find_package(Boost)
+# Find Boost
+if (FTDIPP OR BUILD_TESTS)
+ find_package( Boost REQUIRED )
+endif()
# Set components
set(CPACK_COMPONENTS_ALL sharedlibs staticlibs headers)
@@ -46,8 +50,6 @@ set(CPACK_COMPONENT_SHAREDLIBS_GROUP "De
set(CPACK_COMPONENT_STATICLIBS_GROUP "Development")
set(CPACK_COMPONENT_HEADERS_GROUP "Development")
-option ( STATICLIBS "Build static libraries" ON )
-
# guess LIB_SUFFIX, don't take debian multiarch into account
if ( NOT DEFINED LIB_SUFFIX )
if( CMAKE_SYSTEM_NAME MATCHES "Linux"
@@ -113,18 +115,8 @@ add_custom_target(dist
| bzip2 > ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.bz2
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
-# Tests
-option ( BUILD_TESTS "Build unit tests with Boost Unit Test framework" ON )
-
-# Documentation
-option ( DOCUMENTATION "Generate API documentation with Doxygen" ON )
-
-
-find_package ( Doxygen )
-if ( DOCUMENTATION AND DOXYGEN_FOUND )
-
- # Find doxy config
- message(STATUS "Doxygen found.")
+if ( DOCUMENTATION )
+ find_package ( Doxygen REQUIRED)
# Copy doxy.config.in
set(top_srcdir ${CMAKE_SOURCE_DIR})
@@ -140,19 +132,25 @@ if ( DOCUMENTATION AND DOXYGEN_FOUND )
)
add_custom_target(docs ALL DEPENDS ${CMAKE_BINARY_DIR}/doc/html/index.html)
-
- message(STATUS "Generating API documentation with Doxygen")
-else(DOCUMENTATION AND DOXYGEN_FOUND)
- message(STATUS "Not generating API documentation")
-endif(DOCUMENTATION AND DOXYGEN_FOUND)
+endif ()
add_subdirectory(src)
-add_subdirectory(ftdipp)
+if ( FTDIPP )
+ add_subdirectory(ftdipp)
+endif ()
+if ( PYTHON_BINDINGS )
add_subdirectory(python)
-add_subdirectory(ftdi_eeprom)
-add_subdirectory(examples)
+endif ()
+if ( FTDI_EEPROM )
+ add_subdirectory(ftdi_eeprom)
+endif ()
+if ( EXAMPLES )
+ add_subdirectory(examples)
+endif ()
add_subdirectory(packages)
-add_subdirectory(test)
+if ( BUILD_TESTS )
+ add_subdirectory(test)
+endif ()
# PkgConfig
set(prefix ${CMAKE_INSTALL_PREFIX})
@@ -191,7 +189,7 @@ list ( APPEND LIBFTDI_LIBRARIES ${LIBUSB
set ( LIBFTDI_STATIC_LIBRARY ftdi1.a )
set ( LIBFTDI_STATIC_LIBRARIES ${LIBFTDI_STATIC_LIBRARY} )
list ( APPEND LIBFTDI_STATIC_LIBRARIES ${LIBUSB_LIBRARIES} )
-if (FTDI_BUILD_CPP)
+if ( FTDIPP )
set ( LIBFTDIPP_LIBRARY ftdipp1 )
set ( LIBFTDIPP_LIBRARIES ${LIBFTDIPP_LIBRARY} )
list ( APPEND LIBFTDIPP_LIBRARIES ${LIBUSB_LIBRARIES} )
@@ -238,7 +236,15 @@ install ( FILES
DESTINATION ${LIBFTDI_CMAKE_CONFIG_DIR}
)
+include(CPack)
+message (STATUS "Summary of build options:
-
-include(CPack)
+ Build static libs: ${STATICLIBS}
+ Build C++ bindings: ${FTDIPP}
+ Build Python bindings: ${PYTHON_BINDINGS}
+ Build ftdi_eeprom: ${FTDI_EEPROM}
+ Build examples: ${EXAMPLES}
+ Build tests: ${BUILD_TESTS}
+ Build API documentation: ${DOCUMENTATION}
+")
Index: libftdi1-1.4/CMakeOptions.txt
===================================================================
--- /dev/null
+++ libftdi1-1.4/CMakeOptions.txt
@@ -0,0 +1,8 @@
+option ( STATICLIBS "Build static libraries" ON )
+option ( BUILD_TESTS "Build unit tests with Boost Unit Test framework" OFF )
+option ( DOCUMENTATION "Generate API documentation with Doxygen" OFF )
+option ( EXAMPLES "Build example programs" ON )
+option ( FTDIPP "Build C++ binding library libftdi1++" OFF )
+option ( FTDI_EEPROM "Build ftdi_eeprom" OFF )
+option ( PYTHON_BINDINGS "Build python bindings via swig" OFF )
+option ( LINK_PYTHON_LIBRARY "Link against python libraries" OFF )
Index: libftdi1-1.4/examples/CMakeLists.txt
===================================================================
--- libftdi1-1.4.orig/examples/CMakeLists.txt
+++ libftdi1-1.4/examples/CMakeLists.txt
@@ -1,55 +1,43 @@
-option(EXAMPLES "Build example programs" ON)
+# Includes
+include_directories( ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}
+ )
+
+# Targets
+add_executable(simple simple.c)
+add_executable(bitbang bitbang.c)
+add_executable(bitbang2 bitbang2.c)
+add_executable(bitbang_cbus bitbang_cbus.c)
+add_executable(bitbang_ft2232 bitbang_ft2232.c)
+add_executable(find_all find_all.c)
+add_executable(serial_test serial_test.c)
+add_executable(baud_test baud_test.c)
+add_executable(stream_test stream_test.c)
+add_executable(eeprom eeprom.c)
+
+# Linkage
+target_link_libraries(simple ftdi1)
+target_link_libraries(bitbang ftdi1)
+target_link_libraries(bitbang2 ftdi1)
+target_link_libraries(bitbang_cbus ftdi1)
+target_link_libraries(bitbang_ft2232 ftdi1)
+target_link_libraries(find_all ftdi1)
+target_link_libraries(serial_test ftdi1)
+target_link_libraries(baud_test ftdi1)
+target_link_libraries(stream_test ftdi1)
+target_link_libraries(eeprom ftdi1)
+
+# libftdi++ examples
+if( FTDIPP )
+ include_directories(BEFORE ${CMAKE_SOURCE_DIR}/ftdipp
+ ${Boost_INCLUDE_DIRS})
+
+ # Target
+ add_executable(find_all_pp find_all_pp.cpp)
+
+ # Linkage
+ target_link_libraries(find_all_pp ftdipp1)
+endif( FTDIPP )
-if (EXAMPLES)
- # Includes
- include_directories( ${CMAKE_CURRENT_SOURCE_DIR}
- ${CMAKE_CURRENT_BINARY_DIR}
- )
-
- message(STATUS "Building example programs.")
-
- # Targets
- add_executable(simple simple.c)
- add_executable(bitbang bitbang.c)
- add_executable(bitbang2 bitbang2.c)
- add_executable(bitbang_cbus bitbang_cbus.c)
- add_executable(bitbang_ft2232 bitbang_ft2232.c)
- add_executable(find_all find_all.c)
- add_executable(serial_test serial_test.c)
- add_executable(baud_test baud_test.c)
- add_executable(stream_test stream_test.c)
- add_executable(eeprom eeprom.c)
-
- # Linkage
- target_link_libraries(simple ftdi1)
- target_link_libraries(bitbang ftdi1)
- target_link_libraries(bitbang2 ftdi1)
- target_link_libraries(bitbang_cbus ftdi1)
- target_link_libraries(bitbang_ft2232 ftdi1)
- target_link_libraries(find_all ftdi1)
- target_link_libraries(serial_test ftdi1)
- target_link_libraries(baud_test ftdi1)
- target_link_libraries(stream_test ftdi1)
- target_link_libraries(eeprom ftdi1)
-
- # libftdi++ examples
- if(FTDI_BUILD_CPP)
- if(Boost_FOUND)
- message(STATUS "Building libftdi++ examples.")
- include_directories(BEFORE ${CMAKE_SOURCE_DIR}/ftdipp
- ${Boost_INCLUDE_DIRS})
-
- # Target
- add_executable(find_all_pp find_all_pp.cpp)
-
- # Linkage
- target_link_libraries(find_all_pp ftdipp1)
- endif(Boost_FOUND)
- endif(FTDI_BUILD_CPP)
-
- # Source includes
- include_directories(BEFORE ${CMAKE_SOURCE_DIR}/src)
-
-else(EXAMPLES)
- message(STATUS "Not building example programs.")
-endif(EXAMPLES)
+# Source includes
+include_directories(BEFORE ${CMAKE_SOURCE_DIR}/src)
Index: libftdi1-1.4/ftdi_eeprom/CMakeLists.txt
===================================================================
--- libftdi1-1.4.orig/ftdi_eeprom/CMakeLists.txt
+++ libftdi1-1.4/ftdi_eeprom/CMakeLists.txt
@@ -1,3 +1,6 @@
+find_package ( Confuse REQUIRED )
+find_package ( Libintl )
+
# determine docdir
include(GNUInstallDirs)
if(NOT CMAKE_INSTALL_DOCDIR)
@@ -8,48 +11,34 @@ if(NOT CMAKE_INSTALL_DOCDIR)
endif(WIN32)
endif(NOT CMAKE_INSTALL_DOCDIR)
-option(FTDI_EEPROM "Build ftdi_eeprom" ON)
-
-if ( FTDI_EEPROM )
- find_package ( Confuse )
- find_package ( Libintl )
-else(FTDI_EEPROM)
- message(STATUS "ftdi_eeprom build is disabled")
-endif ()
+message(STATUS "Building ftdi_eeprom")
+include_directories ( ${CONFUSE_INCLUDE_DIRS} )
+list ( APPEND libs ${CONFUSE_LIBRARIES} )
-if ( CONFUSE_FOUND )
- message(STATUS "Building ftdi_eeprom")
+if ( LIBINTL_FOUND )
+ include_directories ( ${LIBINTL_INCLUDE_DIR} )
+ list ( APPEND libs ${LIBINTL_LIBRARIES} )
+endif ()
- include_directories ( ${CONFUSE_INCLUDE_DIRS} )
- list ( APPEND libs ${CONFUSE_LIBRARIES} )
- if ( LIBINTL_FOUND )
- include_directories ( ${LIBINTL_INCLUDE_DIR} )
- list ( APPEND libs ${LIBINTL_LIBRARIES} )
- endif ()
-
-
- # Version defines
- set ( EEPROM_MAJOR_VERSION 0 )
- set ( EEPROM_MINOR_VERSION 17 )
- set ( EEPROM_VERSION_STRING ${EEPROM_MAJOR_VERSION}.${EEPROM_MINOR_VERSION} )
-
- include_directories ( BEFORE ${CMAKE_SOURCE_DIR}/src )
- include_directories ( BEFORE ${CMAKE_CURRENT_BINARY_DIR} )
-
- configure_file(
- ftdi_eeprom_version.h.in
- ${CMAKE_CURRENT_BINARY_DIR}/ftdi_eeprom_version.h
- )
-
- add_executable ( ftdi_eeprom main.c )
- target_link_libraries ( ftdi_eeprom ftdi1 ${CONFUSE_LIBRARIES} )
- if ( LIBINTL_FOUND )
- target_link_libraries ( ftdi_eeprom ${LIBINTL_LIBRARIES} )
- endif ()
- install ( TARGETS ftdi_eeprom DESTINATION bin )
- install ( FILES example.conf DESTINATION ${CMAKE_INSTALL_DOCDIR} )
-else ()
- message ( STATUS "libConfuse not found, won't build ftdi_eeprom" )
+# Version defines
+set ( EEPROM_MAJOR_VERSION 0 )
+set ( EEPROM_MINOR_VERSION 17 )
+set ( EEPROM_VERSION_STRING ${EEPROM_MAJOR_VERSION}.${EEPROM_MINOR_VERSION} )
+
+include_directories ( BEFORE ${CMAKE_SOURCE_DIR}/src )
+include_directories ( BEFORE ${CMAKE_CURRENT_BINARY_DIR} )
+
+configure_file(
+ ftdi_eeprom_version.h.in
+ ${CMAKE_CURRENT_BINARY_DIR}/ftdi_eeprom_version.h
+)
+
+add_executable ( ftdi_eeprom main.c )
+target_link_libraries ( ftdi_eeprom ftdi1 ${CONFUSE_LIBRARIES} )
+if ( LIBINTL_FOUND )
+ target_link_libraries ( ftdi_eeprom ${LIBINTL_LIBRARIES} )
endif ()
+install ( TARGETS ftdi_eeprom DESTINATION bin )
+install ( FILES example.conf DESTINATION ${CMAKE_INSTALL_DOCDIR} )
Index: libftdi1-1.4/ftdipp/CMakeLists.txt
===================================================================
--- libftdi1-1.4.orig/ftdipp/CMakeLists.txt
+++ libftdi1-1.4/ftdipp/CMakeLists.txt
@@ -1,68 +1,47 @@
-# Check
-set(FTDI_BUILD_CPP False PARENT_SCOPE)
-
-option ( FTDIPP "Build C++ binding library libftdi1++" ON )
+# vim: ts=2:sw=2:sts=2
# Targets
-set(cpp_sources ${CMAKE_CURRENT_SOURCE_DIR}/ftdi.cpp CACHE INTERNAL "List of cpp sources" )
-set(cpp_headers ${CMAKE_CURRENT_SOURCE_DIR}/ftdi.hpp CACHE INTERNAL "List of cpp headers" )
-
-if (FTDIPP)
-
- if(Boost_FOUND)
-
- # Includes
- include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${CMAKE_SOURCE_DIR}/src)
-
- include_directories(${Boost_INCLUDE_DIRS})
-
-
+set(cpp_sources ${CMAKE_CURRENT_SOURCE_DIR}/ftdi.cpp CACHE INTERNAL "List of cpp sources" )
+set(cpp_headers ${CMAKE_CURRENT_SOURCE_DIR}/ftdi.hpp CACHE INTERNAL "List of cpp headers" )
- set(FTDI_BUILD_CPP True PARENT_SCOPE)
- message(STATUS "Building libftdi1++")
-
- # Shared library
- add_library(ftdipp1 SHARED ${cpp_sources})
-
- math(EXPR VERSION_FIXUP "${MAJOR_VERSION} + 1") # Compatiblity with previous releases
- set_target_properties(ftdipp1 PROPERTIES VERSION ${VERSION_FIXUP}.${MINOR_VERSION}.0 SOVERSION 3)
-
- # 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})
-
-
- install ( TARGETS ftdipp1
- RUNTIME DESTINATION bin
- LIBRARY DESTINATION lib${LIB_SUFFIX}
- ARCHIVE DESTINATION lib${LIB_SUFFIX}
- )
-
- # Static library
- if ( STATICLIBS )
- add_library(ftdipp1-static STATIC ${cpp_sources})
- set_target_properties(ftdipp1-static PROPERTIES OUTPUT_NAME "ftdipp1")
- set_target_properties(ftdipp1-static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
-
- install ( TARGETS ftdipp1-static
- ARCHIVE DESTINATION lib${LIB_SUFFIX}
- COMPONENT staticlibs
- )
- endif ()
-
- install ( FILES ${cpp_headers}
- DESTINATION include/${PROJECT_NAME}
- COMPONENT headers
- )
-
- else ()
- message(STATUS "Boost not found, won't build libftdi1++")
- endif ()
-
-else ()
- message(STATUS "Not building libftdi1++")
+# Includes
+include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_SOURCE_DIR}/src)
+
+include_directories(${Boost_INCLUDE_DIRS})
+
+# Shared library
+add_library(ftdipp1 SHARED ${cpp_sources})
+
+math(EXPR VERSION_FIXUP "${MAJOR_VERSION} + 1") # Compatiblity with previous releases
+set_target_properties(ftdipp1 PROPERTIES VERSION ${VERSION_FIXUP}.${MINOR_VERSION}.0 SOVERSION 3)
+
+# 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})
+
+install ( TARGETS ftdipp1
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib${LIB_SUFFIX}
+ ARCHIVE DESTINATION lib${LIB_SUFFIX}
+ )
+
+# Static library
+if ( STATICLIBS )
+ add_library(ftdipp1-static STATIC ${cpp_sources})
+ set_target_properties(ftdipp1-static PROPERTIES OUTPUT_NAME "ftdipp1")
+ set_target_properties(ftdipp1-static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
+
+ install ( TARGETS ftdipp1-static
+ ARCHIVE DESTINATION lib${LIB_SUFFIX}
+ COMPONENT staticlibs
+ )
endif ()
+
+install ( FILES ${cpp_headers}
+ DESTINATION include/${PROJECT_NAME}
+ COMPONENT headers
+ )
Index: libftdi1-1.4/python/CMakeLists.txt
===================================================================
--- libftdi1-1.4.orig/python/CMakeLists.txt
+++ libftdi1-1.4/python/CMakeLists.txt
@@ -1,81 +1,66 @@
-option ( PYTHON_BINDINGS "Build python bindings via swig" ON )
-option ( LINK_PYTHON_LIBRARY "Link against python libraries" ON )
-
-if ( PYTHON_BINDINGS )
- # workaround for cmake bug #0013449
- if ( NOT DEFINED CMAKE_FIND_ROOT_PATH )
- find_package ( SWIG )
- else ()
- find_program ( SWIG_EXECUTABLE NAMES swig2.0 swig )
- if ( SWIG_EXECUTABLE )
- set ( SWIG_USE_FILE ${CMAKE_ROOT}/Modules/UseSWIG.cmake )
- set ( SWIG_FOUND TRUE )
- endif ()
+# workaround for cmake bug #0013449
+if ( NOT DEFINED CMAKE_FIND_ROOT_PATH )
+ find_package ( SWIG REQUIRED )
+else ()
+ find_program ( SWIG_EXECUTABLE NAMES swig2.0 swig )
+ if ( SWIG_EXECUTABLE )
+ set ( SWIG_USE_FILE ${CMAKE_ROOT}/Modules/UseSWIG.cmake )
+ set ( SWIG_FOUND TRUE )
endif ()
- find_package ( PythonLibs )
- find_package ( PythonInterp )
endif ()
+find_package ( PythonLibs REQUIRED )
+find_package ( PythonInterp REQUIRED )
-if ( SWIG_FOUND AND PYTHONLIBS_FOUND AND PYTHONINTERP_FOUND )
- include ( UseSWIG )
- include_directories ( BEFORE ${CMAKE_SOURCE_DIR}/src )
- include_directories ( ${PYTHON_INCLUDE_DIRS} )
- link_directories ( ${CMAKE_CURRENT_BINARY_DIR}/../src )
-
- if ( DOCUMENTATION AND DOXYGEN_FOUND )
- set(CMAKE_SWIG_FLAGS -DDOXYGEN=${DOXYGEN_FOUND})
- endif()
- swig_add_module ( ftdi1 python ftdi1.i )
- swig_link_libraries ( ftdi1 ftdi1 )
-
- if ( LINK_PYTHON_LIBRARY )
- swig_link_libraries ( ftdi1 ${PYTHON_LIBRARIES} )
- elseif( APPLE )
- set_target_properties ( ${SWIG_MODULE_ftdi1_REAL_NAME} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup" )
- endif ()
+include ( UseSWIG )
+include_directories ( BEFORE ${CMAKE_SOURCE_DIR}/src )
+include_directories ( ${PYTHON_INCLUDE_DIRS} )
+link_directories ( ${CMAKE_CURRENT_BINARY_DIR}/../src )
+
+# set(CMAKE_SWIG_FLAGS -DDOXYGEN=${DOXYGEN_FOUND})
+ set_property(SOURCE ftdi1.i PROPERTY DEPENDS doc_i)
+swig_add_library( ftdi1 LANGUAGE python SOURCES ftdi1.i)
+swig_link_libraries ( ftdi1 ftdi1 )
+
+if ( LINK_PYTHON_LIBRARY )
+ swig_link_libraries ( ftdi1 ${PYTHON_LIBRARIES} )
+elseif( APPLE )
+ set_target_properties ( ${SWIG_MODULE_ftdi1_REAL_NAME} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup" )
+endif ()
- set_target_properties ( ${SWIG_MODULE_ftdi1_REAL_NAME} PROPERTIES NO_SONAME ON )
+set_target_properties ( ${SWIG_MODULE_ftdi1_REAL_NAME} PROPERTIES NO_SONAME ON )
- execute_process ( COMMAND ${PYTHON_EXECUTABLE} -c "from distutils import sysconfig; print( sysconfig.get_python_lib( plat_specific=True, prefix='${CMAKE_INSTALL_PREFIX}' ) )"
- OUTPUT_VARIABLE _ABS_PYTHON_MODULE_PATH
- OUTPUT_STRIP_TRAILING_WHITESPACE )
-
- get_filename_component ( _ABS_PYTHON_MODULE_PATH ${_ABS_PYTHON_MODULE_PATH} ABSOLUTE )
- file ( RELATIVE_PATH _REL_PYTHON_MODULE_PATH ${CMAKE_INSTALL_PREFIX} ${_ABS_PYTHON_MODULE_PATH} )
-
- set ( PYTHON_MODULE_PATH
- ${_REL_PYTHON_MODULE_PATH}
- )
-
- install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/ftdi1.py DESTINATION ${PYTHON_MODULE_PATH} )
- install ( TARGETS ${SWIG_MODULE_ftdi1_REAL_NAME} LIBRARY DESTINATION ${PYTHON_MODULE_PATH} )
-
- if ( DOCUMENTATION AND DOXYGEN_FOUND )
- # Run doxygen to only generate the xml
- add_custom_command ( OUTPUT ${CMAKE_BINARY_DIR}/doc/xml/ftdi_8c.xml
- COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/doc
- COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/Doxyfile.xml
- WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
- DEPENDS ${c_headers};${c_sources};${cpp_sources};${cpp_headers}
- )
-
- # generate .i from doxygen .xml
- add_custom_command ( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ftdi1_doc.i
- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/doxy2swig.py -n
- ${CMAKE_BINARY_DIR}/doc/xml/ftdi_8c.xml
- ${CMAKE_CURRENT_BINARY_DIR}/ftdi1_doc.i
- DEPENDS ${CMAKE_BINARY_DIR}/doc/xml/ftdi_8c.xml
- )
- add_custom_target ( doc_i DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/ftdi1_doc.i )
- add_dependencies( ${SWIG_MODULE_ftdi1_REAL_NAME} doc_i )
+execute_process ( COMMAND ${PYTHON_EXECUTABLE} -c "from distutils import sysconfig; print( sysconfig.get_python_lib( plat_specific=True, prefix='${CMAKE_INSTALL_PREFIX}' ) )"
+ OUTPUT_VARIABLE _ABS_PYTHON_MODULE_PATH
+ OUTPUT_STRIP_TRAILING_WHITESPACE )
+
+get_filename_component ( _ABS_PYTHON_MODULE_PATH ${_ABS_PYTHON_MODULE_PATH} ABSOLUTE )
+file ( RELATIVE_PATH _REL_PYTHON_MODULE_PATH ${CMAKE_INSTALL_PREFIX} ${_ABS_PYTHON_MODULE_PATH} )
+
+set ( PYTHON_MODULE_PATH ${_REL_PYTHON_MODULE_PATH} )
+
+install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/ftdi1.py DESTINATION ${PYTHON_MODULE_PATH} )
+install ( TARGETS ${SWIG_MODULE_ftdi1_REAL_NAME} LIBRARY DESTINATION ${PYTHON_MODULE_PATH} )
+
+ # Run doxygen to only generate the xml
+ add_custom_command ( OUTPUT ${CMAKE_BINARY_DIR}/doc/xml/ftdi_8c.xml
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/doc
+ COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/Doxyfile.xml
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+ DEPENDS ${c_headers};${c_sources};${cpp_sources};${cpp_headers}
+ )
+
+ # generate .i from doxygen .xml
+ add_custom_command ( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ftdi1_doc.i
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/doxy2swig.py -n
+ ${CMAKE_BINARY_DIR}/doc/xml/ftdi_8c.xml
+ ${CMAKE_CURRENT_BINARY_DIR}/ftdi1_doc.i
+ DEPENDS ${CMAKE_BINARY_DIR}/doc/xml/ftdi_8c.xml
+ )
+ add_custom_target ( doc_i DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/ftdi1_doc.i )
+ add_dependencies( ${SWIG_MODULE_ftdi1_REAL_NAME} doc_i )
- endif ()
- set ( LIBFTDI_PYTHON_MODULE_PATH ${CMAKE_INSTALL_PREFIX}/${PYTHON_MODULE_PATH} )
- set ( LIBFTDI_PYTHON_MODULE_PATH ${LIBFTDI_PYTHON_MODULE_PATH} PARENT_SCOPE ) # for ftdiconfig.cmake
- message(STATUS "Building python bindings via swig. Will be installed under ${LIBFTDI_PYTHON_MODULE_PATH}")
+set ( LIBFTDI_PYTHON_MODULE_PATH ${CMAKE_INSTALL_PREFIX}/${PYTHON_MODULE_PATH} )
+set ( LIBFTDI_PYTHON_MODULE_PATH ${LIBFTDI_PYTHON_MODULE_PATH} PARENT_SCOPE ) # for ftdiconfig.cmake
- add_subdirectory ( examples )
-else ()
- message(STATUS "Not building python bindings")
-endif ()
+add_subdirectory ( examples )
Index: libftdi1-1.4/test/CMakeLists.txt
===================================================================
--- libftdi1-1.4.orig/test/CMakeLists.txt
+++ libftdi1-1.4/test/CMakeLists.txt
@@ -1,38 +1,15 @@
-# Optional unit test
+find_package(Boost COMPONENTS unit_test_framework REQUIRED)
-if(BUILD_TESTS)
+enable_testing()
- find_package(Boost COMPONENTS unit_test_framework)
+INCLUDE_DIRECTORIES(BEFORE ${CMAKE_SOURCE_DIR}/src ${Boost_INCLUDE_DIRS})
- if(Boost_UNIT_TEST_FRAMEWORK_FOUND)
+set(cpp_tests basic.cpp baudrate.cpp)
- message(STATUS "Building unit test")
+add_executable(test_libftdi1 ${cpp_tests})
+target_link_libraries(test_libftdi1 ftdi1 ${Boost_UNIT_TEST_FRAMEWORK_LIBRARIES})
- enable_testing()
+add_test(test_libftdi1 test_libftdi1)
- INCLUDE_DIRECTORIES(BEFORE ${CMAKE_SOURCE_DIR}/src ${Boost_INCLUDE_DIRS})
-
- set(cpp_tests
- basic.cpp
- baudrate.cpp
- )
-
- add_executable(test_libftdi1 ${cpp_tests})
- target_link_libraries(test_libftdi1 ftdi1 ${Boost_UNIT_TEST_FRAMEWORK_LIBRARIES})
-
- add_test(test_libftdi1 test_libftdi1)
-
- # Add custom target so we run easily run "make check"
- add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} DEPENDS test_libftdi1)
-
- else(Boost_UNIT_TEST_FRAMEWORK_FOUND)
-
- message(STATUS "NOT building unit test (requires boost unit test framework)")
-
- endif(Boost_UNIT_TEST_FRAMEWORK_FOUND)
-
-else(BUILD_TESTS)
-
- message(STATUS "NOT building unit test")
-
-endif(BUILD_TESTS)
+# Add custom target so we run easily run "make check"
+add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} DEPENDS test_libftdi1)

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ec36fb49080f834690c24008328a5ef42d3cf584ef4060f3a35aa4681cb31b74
size 109521

3
libftdi1-1.5.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7c7091e9c86196148bd41177b4590dccb1510bfe6cea5bf7407ff194482eb049
size 116297

View File

@ -1,3 +1,33 @@
-------------------------------------------------------------------
Fri Jan 15 14:06:47 UTC 2021 - Stefan Brüns <stefan.bruens@rwth-aachen.de>
- Update to version 1.5:
* Implement tc[io]flush methods & deprecate broken
purge_buffers methods
* Add program to test buffer flush (purge) functionality
* Add kernel driver auto attach/detach.
See new AUTO_DETACH_REATACH_SIO_MODULE option
* Add ftdi_setflowctrl_xonxoff()
* ftdi_eeprom / eeprom handling:
+ Unify handling of all boolean eeprom flags
+ Add device release number support
+ Add channel_a_driver support for type xxR chips
+ Add support for group0 drive levels on x232H chips
+ Fix handling of high_current_drive parameter
+ Fix inverted handling of VCP driver field for TYPE_R chips
+ New --verbose option for eeprom decode operation
* Add example code for async mode
* Add SPDX license identifiers to the core library &
ftdi_eeprom
* Various python SWIG wrapper improvements
* Various cmake file improvements
* Fix small bugs in error code paths
- Drop upstream libftdi-cmake.patch
- Correct License, the library is LGPL-2.1-only (see SPDX headers),
while various other parts are GPL-2.0-only (with and without
linking exceptions).
- Add Fix-building-unit-tests-without-FTDIPP.patch
-------------------------------------------------------------------
Wed Mar 25 08:53:42 UTC 2020 - Martin Pluskal <mpluskal@suse.com>

View File

@ -1,7 +1,7 @@
#
# spec file for package libftdi1
#
# Copyright (c) 2020 SUSE LLC
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -19,15 +19,15 @@
%define sover -2
%define libname %{name}%{sover}
Name: libftdi1
Version: 1.4
Version: 1.5
Release: 0
Summary: Library to program and control the FTDI USB controller
License: LGPL-2.1-or-later AND GPL-2.0-with-classpath-exception
License: LGPL-2.1-only AND GPL-2.0-only AND GPL-2.0-with-classpath-exception
Group: Hardware/Other
URL: https://www.intra2net.com/en/developer/libftdi
Source: http://www.intra2net.com/en/developer/libftdi/download/libftdi1-%{version}.tar.bz2
# PATCH-FIX-UPSTREAM libftdi-cmake.patch -- CMake: move options to a dedicated file
Patch1: libftdi-cmake.patch
Source: https://www.intra2net.com/en/developer/libftdi/download/libftdi1-%{version}.tar.bz2
# PATCH-FIX-UPSTREAM -- http://developer.intra2net.com/git/?p=libftdi;a=patch;h=11a50ae5b80b3e03694a19e84513345d0794e563
Patch0: Fix-building-unit-tests-without-FTDIPP.patch
BuildRequires: cmake >= 2.8
BuildRequires: doxygen
BuildRequires: gcc-c++
@ -46,6 +46,7 @@ This library is used by many programs accessing FTDI USB-to-RS232 converters.
%package -n %{libname}
Summary: Library to program and control the FTDI USB controller
License: LGPL-2.1-only
Group: System/Libraries
%description -n %{libname}
@ -54,6 +55,7 @@ This library is used by many programs accessing FTDI USB-to-RS232 converters.
%package -n python3-%{name}
Summary: Python 3 binding for libftdi1
License: LGPL-2.1-only AND GPL-2.0-only AND GPL-2.0-with-classpath-exception
Group: Development/Languages/Python
%description -n python3-%{name}
@ -63,7 +65,8 @@ This library is used by many programs accessing FTDI USB-to-RS232 converters.
This package provides the python binding for libftdi.
%package devel
Summary: Header files and static libraries for libftdi
Summary: Header files for libftdi1
License: LGPL-2.1-only AND GPL-2.0-only AND GPL-2.0-with-classpath-exception
Group: Development/Libraries/C and C++
Requires: %{libname} = %{version}
Requires: pkgconfig(libusb-1.0)
@ -73,8 +76,7 @@ Header files and static libraries for libftdi.
This library is used by many programs accessing FTDI USB-to-RS232 converters.
%prep
%setup -q
%patch1 -p1
%autosetup -p1
%build
%cmake \
@ -94,7 +96,7 @@ install -pm 0644 build/doc/man/man3/[^_]*.3 \
%{buildroot}%{_mandir}/man3
%check
make -C build check
%ctest
%post -n %{libname} -p /sbin/ldconfig
%postun -n %{libname} -p /sbin/ldconfig