Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.2:Staging:N
libftdi1
libftdi-cmake.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File libftdi-cmake.patch of Package libftdi1
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)
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor