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