|
| 1 | +diff -Naur a/CMakeLists.txt b/CMakeLists.txt |
| 2 | +--- a/CMakeLists.txt 2020-03-07 12:26:19.922659700 +0800 |
| 3 | ++++ b/CMakeLists.txt 2020-03-07 15:11:57.839140900 +0800 |
| 4 | +@@ -46,6 +46,7 @@ |
| 5 | + set(CPACK_COMPONENT_STATICLIBS_GROUP "Development") |
| 6 | + set(CPACK_COMPONENT_HEADERS_GROUP "Development") |
| 7 | + |
| 8 | ++option ( SHAREDLIBS "Build ㄎ libraries" ON ) |
| 9 | + option ( STATICLIBS "Build static libraries" ON ) |
| 10 | + |
| 11 | + # guess LIB_SUFFIX, don't take debian multiarch into account |
| 12 | +diff -Naur a/examples/CMakeLists.txt b/examples/CMakeLists.txt |
| 13 | +--- a/examples/CMakeLists.txt 2020-03-07 12:26:20.208196700 +0800 |
| 14 | ++++ b/examples/CMakeLists.txt 2020-03-07 15:18:03.493009700 +0800 |
| 15 | +@@ -8,29 +8,31 @@ |
| 16 | + |
| 17 | + message(STATUS "Building example programs.") |
| 18 | + |
| 19 | +- # Targets |
| 20 | +- add_executable(simple simple.c) |
| 21 | +- add_executable(bitbang bitbang.c) |
| 22 | +- add_executable(bitbang2 bitbang2.c) |
| 23 | +- add_executable(bitbang_cbus bitbang_cbus.c) |
| 24 | +- add_executable(bitbang_ft2232 bitbang_ft2232.c) |
| 25 | +- add_executable(find_all find_all.c) |
| 26 | +- add_executable(serial_test serial_test.c) |
| 27 | +- add_executable(baud_test baud_test.c) |
| 28 | +- add_executable(stream_test stream_test.c) |
| 29 | +- add_executable(eeprom eeprom.c) |
| 30 | +- |
| 31 | +- # Linkage |
| 32 | +- target_link_libraries(simple ftdi1) |
| 33 | +- target_link_libraries(bitbang ftdi1) |
| 34 | +- target_link_libraries(bitbang2 ftdi1) |
| 35 | +- target_link_libraries(bitbang_cbus ftdi1) |
| 36 | +- target_link_libraries(bitbang_ft2232 ftdi1) |
| 37 | +- target_link_libraries(find_all ftdi1) |
| 38 | +- target_link_libraries(serial_test ftdi1) |
| 39 | +- target_link_libraries(baud_test ftdi1) |
| 40 | +- target_link_libraries(stream_test ftdi1) |
| 41 | +- target_link_libraries(eeprom ftdi1) |
| 42 | ++ if ( SHAREDLIBS ) |
| 43 | ++ # Targets |
| 44 | ++ add_executable(simple simple.c) |
| 45 | ++ add_executable(bitbang bitbang.c) |
| 46 | ++ add_executable(bitbang2 bitbang2.c) |
| 47 | ++ add_executable(bitbang_cbus bitbang_cbus.c) |
| 48 | ++ add_executable(bitbang_ft2232 bitbang_ft2232.c) |
| 49 | ++ add_executable(find_all find_all.c) |
| 50 | ++ add_executable(serial_test serial_test.c) |
| 51 | ++ add_executable(baud_test baud_test.c) |
| 52 | ++ add_executable(stream_test stream_test.c) |
| 53 | ++ add_executable(eeprom eeprom.c) |
| 54 | ++ |
| 55 | ++ # Linkage |
| 56 | ++ target_link_libraries(simple ftdi1) |
| 57 | ++ target_link_libraries(bitbang ftdi1) |
| 58 | ++ target_link_libraries(bitbang2 ftdi1) |
| 59 | ++ target_link_libraries(bitbang_cbus ftdi1) |
| 60 | ++ target_link_libraries(bitbang_ft2232 ftdi1) |
| 61 | ++ target_link_libraries(find_all ftdi1) |
| 62 | ++ target_link_libraries(serial_test ftdi1) |
| 63 | ++ target_link_libraries(baud_test ftdi1) |
| 64 | ++ target_link_libraries(stream_test ftdi1) |
| 65 | ++ target_link_libraries(eeprom ftdi1) |
| 66 | ++ endif() |
| 67 | + |
| 68 | + # libftdi++ examples |
| 69 | + if(FTDI_BUILD_CPP) |
| 70 | +@@ -39,11 +41,13 @@ |
| 71 | + include_directories(BEFORE ${CMAKE_SOURCE_DIR}/ftdipp |
| 72 | + ${Boost_INCLUDE_DIRS}) |
| 73 | + |
| 74 | +- # Target |
| 75 | +- add_executable(find_all_pp find_all_pp.cpp) |
| 76 | +- |
| 77 | +- # Linkage |
| 78 | +- target_link_libraries(find_all_pp ftdipp1) |
| 79 | ++ if ( SHAREDLIBS ) |
| 80 | ++ # Target |
| 81 | ++ add_executable(find_all_pp find_all_pp.cpp) |
| 82 | ++ |
| 83 | ++ # Linkage |
| 84 | ++ target_link_libraries(find_all_pp ftdipp1) |
| 85 | ++ endif() |
| 86 | + endif(Boost_FOUND) |
| 87 | + endif(FTDI_BUILD_CPP) |
| 88 | + |
| 89 | +diff -Naur a/ftdipp/CMakeLists.txt b/ftdipp/CMakeLists.txt |
| 90 | +--- a/ftdipp/CMakeLists.txt 2020-03-07 12:26:20.229190200 +0800 |
| 91 | ++++ b/ftdipp/CMakeLists.txt 2020-03-07 15:13:30.150838600 +0800 |
| 92 | +@@ -22,25 +22,26 @@ |
| 93 | + |
| 94 | + set(FTDI_BUILD_CPP True PARENT_SCOPE) |
| 95 | + message(STATUS "Building libftdi1++") |
| 96 | +- |
| 97 | +- # Shared library |
| 98 | +- add_library(ftdipp1 SHARED ${cpp_sources}) |
| 99 | +- |
| 100 | +- math(EXPR VERSION_FIXUP "${MAJOR_VERSION} + 1") # Compatiblity with previous releases |
| 101 | +- set_target_properties(ftdipp1 PROPERTIES VERSION ${VERSION_FIXUP}.${MINOR_VERSION}.0 SOVERSION 3) |
| 102 | +- |
| 103 | +- # Prevent clobbering each other during the build |
| 104 | +- set_target_properties(ftdipp1 PROPERTIES CLEAN_DIRECT_OUTPUT 1) |
| 105 | +- |
| 106 | +- # Dependencies |
| 107 | +- target_link_libraries(ftdipp1 ftdi1 ${LIBUSB_LIBRARIES} ${BOOST_LIBRARIES}) |
| 108 | +- |
| 109 | +- |
| 110 | +- install ( TARGETS ftdipp1 |
| 111 | +- RUNTIME DESTINATION bin |
| 112 | +- LIBRARY DESTINATION lib${LIB_SUFFIX} |
| 113 | +- ARCHIVE DESTINATION lib${LIB_SUFFIX} |
| 114 | +- ) |
| 115 | ++ if ( SHAREDLIBS ) |
| 116 | ++ # Shared library |
| 117 | ++ add_library(ftdipp1 SHARED ${cpp_sources}) |
| 118 | ++ |
| 119 | ++ math(EXPR VERSION_FIXUP "${MAJOR_VERSION} + 1") # Compatiblity with previous releases |
| 120 | ++ set_target_properties(ftdipp1 PROPERTIES VERSION ${VERSION_FIXUP}.${MINOR_VERSION}.0 SOVERSION 3) |
| 121 | ++ |
| 122 | ++ # Prevent clobbering each other during the build |
| 123 | ++ set_target_properties(ftdipp1 PROPERTIES CLEAN_DIRECT_OUTPUT 1) |
| 124 | ++ |
| 125 | ++ # Dependencies |
| 126 | ++ target_link_libraries(ftdipp1 ftdi1 ${LIBUSB_LIBRARIES} ${BOOST_LIBRARIES}) |
| 127 | ++ |
| 128 | ++ |
| 129 | ++ install ( TARGETS ftdipp1 |
| 130 | ++ RUNTIME DESTINATION bin |
| 131 | ++ LIBRARY DESTINATION lib${LIB_SUFFIX} |
| 132 | ++ ARCHIVE DESTINATION lib${LIB_SUFFIX} |
| 133 | ++ ) |
| 134 | ++ endif () |
| 135 | + |
| 136 | + # Static library |
| 137 | + if ( STATICLIBS ) |
| 138 | +diff -Naur a/src/CMakeLists.txt b/src/CMakeLists.txt |
| 139 | +--- a/src/CMakeLists.txt 2020-03-07 12:26:20.257181000 +0800 |
| 140 | ++++ b/src/CMakeLists.txt 2020-03-07 15:13:02.108714300 +0800 |
| 141 | +@@ -21,22 +21,24 @@ |
| 142 | + set(c_sources ${CMAKE_CURRENT_SOURCE_DIR}/ftdi.c ${CMAKE_CURRENT_SOURCE_DIR}/ftdi_stream.c CACHE INTERNAL "List of c sources" ) |
| 143 | + set(c_headers ${CMAKE_CURRENT_SOURCE_DIR}/ftdi.h CACHE INTERNAL "List of c headers" ) |
| 144 | + |
| 145 | +-add_library(ftdi1 SHARED ${c_sources}) |
| 146 | ++if ( SHAREDLIBS ) |
| 147 | ++ add_library(ftdi1 SHARED ${c_sources}) |
| 148 | + |
| 149 | +-math(EXPR VERSION_FIXUP "${MAJOR_VERSION} + 1") # Compatiblity with previous releases |
| 150 | +-set_target_properties(ftdi1 PROPERTIES VERSION ${VERSION_FIXUP}.${MINOR_VERSION}.0 SOVERSION 2) |
| 151 | +-# Prevent clobbering each other during the build |
| 152 | +-set_target_properties ( ftdi1 PROPERTIES CLEAN_DIRECT_OUTPUT 1 ) |
| 153 | +- |
| 154 | +- |
| 155 | +-# Dependencies |
| 156 | +-target_link_libraries(ftdi1 ${LIBUSB_LIBRARIES}) |
| 157 | +- |
| 158 | +-install ( TARGETS ftdi1 |
| 159 | +- RUNTIME DESTINATION bin |
| 160 | +- LIBRARY DESTINATION lib${LIB_SUFFIX} |
| 161 | +- ARCHIVE DESTINATION lib${LIB_SUFFIX} |
| 162 | +- ) |
| 163 | ++ math(EXPR VERSION_FIXUP "${MAJOR_VERSION} + 1") # Compatiblity with previous releases |
| 164 | ++ set_target_properties(ftdi1 PROPERTIES VERSION ${VERSION_FIXUP}.${MINOR_VERSION}.0 SOVERSION 2) |
| 165 | ++ # Prevent clobbering each other during the build |
| 166 | ++ set_target_properties ( ftdi1 PROPERTIES CLEAN_DIRECT_OUTPUT 1 ) |
| 167 | ++ |
| 168 | ++ |
| 169 | ++ # Dependencies |
| 170 | ++ target_link_libraries(ftdi1 ${LIBUSB_LIBRARIES}) |
| 171 | ++ |
| 172 | ++ install ( TARGETS ftdi1 |
| 173 | ++ RUNTIME DESTINATION bin |
| 174 | ++ LIBRARY DESTINATION lib${LIB_SUFFIX} |
| 175 | ++ ARCHIVE DESTINATION lib${LIB_SUFFIX} |
| 176 | ++ ) |
| 177 | ++endif () |
| 178 | + |
| 179 | + if ( STATICLIBS ) |
| 180 | + add_library(ftdi1-static STATIC ${c_sources}) |
0 commit comments