Debian Codegraph @

debian/patches/modify_cmake_for_debian

raw symbols SCIP
1 Description: Modify CmakeLists for Debian
2 Avoid using the boundled libraries but link the system ones.
3 Author: Don Armstrong <[email protected]>
4 Author: Mattia Rizzolo <[email protected]>
5 Author: Francois Mazen <[email protected]>
6 Forwarded: not-needed
7 Last-Update: 2018-05-02
8
9
10
11 --- a/CMakeLists.txt
12 +++ b/CMakeLists.txt
13 @@ -42,7 +42,6 @@
14
15 # The parsing order is significant!
16
17 -add_subdirectory( src/BoostParts )
18 # Set these so zipios doesn't complain.
19 set( Boost_DATE_TIME_LIBRARY 1 )
20 set( Boost_FILESYSTEM_LIBRARY 1 )
21 @@ -51,21 +50,14 @@
22 set( Boost_SYSTEM_LIBRARY 1 )
23 set( Boost_THREAD_LIBRARY 1 )
24 set( BOOST_LIBS BoostParts )
25 -set( BOOST_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/src/BoostParts )
26
27 -add_subdirectory( src/Xerces )
28 set( XERCES_LIBRARIES Xerces )
29 -set( XERCES_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/src/Xerces )
30
31 add_subdirectory( src/XercesExtensions )
32 set( XERCESEXTENSIONS_LIBRARIES XercesExtensions )
33 set( XERCESEXTENSIONS_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/src/XercesExtensions )
34
35 -add_subdirectory( src/zlib )
36 add_subdirectory( src/zipios )
37 -if( NOT MINGW )
38 - add_subdirectory( src/googlemock )
39 -endif()
40
41 add_subdirectory( src/FlightCrew )
42 set( FLIGHTCREW_LIBRARIES FlightCrew )
43 --- a/src/FlightCrew-cli/CMakeLists.txt
44 +++ b/src/FlightCrew-cli/CMakeLists.txt
45 @@ -63,6 +63,7 @@
46 # "Print all warnings" flag for GCC
47 elseif( CMAKE_COMPILER_IS_GNUCXX )
48 add_definitions( -Wall )
49 + set_target_properties( ${PROJECT_NAME} PROPERTIES LINK_FLAGS -Wl,--as-needed )
50 endif()
51
52 set_source_files_properties( main.cpp PROPERTIES COMPILE_DEFINITIONS FLIGHTCREW_FULL_VERSION="${FLIGHTCREW_FULL_VERSION}" )
53 --- a/src/FlightCrew/CMakeLists.txt
54 +++ b/src/FlightCrew/CMakeLists.txt
55 @@ -52,9 +52,7 @@
56
57 # creating PCH's for MSVC and GCC on Linux
58 include( ${CMAKE_SOURCE_DIR}/cmake_extras/CustomPCH.cmake )
59 -set( ALL_INCLUDES ${BoostParts_SOURCE_DIR}
60 - ${Xerces_SOURCE_DIR}
61 - ${zipios_SOURCE_DIR} )
62 +set( ALL_INCLUDES ${zipios_SOURCE_DIR} )
63 set( GCC_PCH_TARGET gccPCH_fc )
64
65 if( NOT SKIP_PCH )
66 @@ -67,8 +65,6 @@
67 # and the headers for the linked-to libraries
68 include_directories( ${CMAKE_CURRENT_SOURCE_DIR}
69 ../zipios
70 - ../BoostParts
71 - ../Xerces
72 ../XercesExtensions
73 ../utf8-cpp
74 )
75 @@ -85,11 +81,28 @@
76 # when they want a dll, but NOT FC_DLL_EXPORTING
77 add_definitions( -DFC_DLL_EXPORTING -DFC_BUILT_AS_DLL )
78 add_library( ${PROJECT_NAME} SHARED ${SOURCES} )
79 + SET_TARGET_PROPERTIES(
80 + ${PROJECT_NAME}
81 + PROPERTIES
82 + SOVERSION 0
83 + VERSION 0.9.3
84 + )
85 else()
86 add_library( ${PROJECT_NAME} STATIC ${SOURCES} )
87 endif()
88
89 -target_link_libraries( ${PROJECT_NAME} zipios BoostParts XercesExtensions )
90 +find_library(LIB_ZLIB z)
91 +find_library(BOOST_DT boost_date_time)
92 +find_library(BOOST_FS boost_filesystem)
93 +find_library(BOOST_PO boost_program_options)
94 +find_library(BOOST_RE boost_regex)
95 +find_library(BOOST_T boost_thread)
96 +find_library(LIB_XERCES xerces-c)
97 +find_library(PTHREAD pthread)
98 +SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES LINK_FLAGS -Wl,--as-needed)
99 +target_link_libraries( ${PROJECT_NAME} ${LIB_ZLIB} ${BOOST_DT} ${BOOST_FS} ${BOOST_PO} ${BOOST_RE} ${BOOST_T} zipios ${LIB_XERCES} XercesExtensions ${PTHREAD} )
100 +INSTALL(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION lib COMPONENT libraries)
101 +INSTALL(FILES flightcrew.h exception.h DllExporting.h Result.h Misc/ErrorResultCollector.h ResultId.h ResultType.h ../XercesExtensions/NodeLocationInfo.h DESTINATION include/${PROJECT_NAME})
102
103 #############################################################################
104
105 @@ -126,8 +139,6 @@
106 endif()
107 endif()
108
109 -# needed for correct Xerces header inclusion
110 -add_definitions( -DXERCES_STATIC_LIBRARY )
111
112 #############################################################################
113
114 --- a/src/FlightCrew-gui/CMakeLists.txt
115 +++ b/src/FlightCrew-gui/CMakeLists.txt
116 @@ -82,7 +82,6 @@
117 include_directories( BEFORE
118 ${CMAKE_CURRENT_SOURCE_DIR}
119 ${CMAKE_CURRENT_BINARY_DIR}
120 - ${BoostParts_SOURCE_DIR}
121 ${FlightCrew_SOURCE_DIR}
122 ${XercesExtensions_SOURCE_DIR}
123 )
124 @@ -134,6 +133,7 @@
125 # "Print all warnings" flag for GCC
126 elseif( CMAKE_COMPILER_IS_GNUCXX )
127 add_definitions( -Wall )
128 + set_target_properties( ${PROJECT_NAME} PROPERTIES LINK_FLAGS -Wl,--as-needed )
129 endif()
130
131 set_source_files_properties( MainWindow.cpp PROPERTIES COMPILE_DEFINITIONS FLIGHTCREW_FULL_VERSION="${FLIGHTCREW_FULL_VERSION}" )
132 @@ -159,6 +159,10 @@
133 WORKING_DIRECTORY ${WORK_DIR}
134 DEPENDS addframeworks )
135
136 +elseif(DEBIAN)
137 + # these rules are so that we don't do any crazy installer
138 + # building which we've stripped out anyway
139 + set( WORK_DIR "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" )
140 # For Linux and Windows, provide binary installers.
141 # For this to work on Linux, InstallJammer needs to be installed and on the system path.
142 # For this to work on Windows, Inno Setup's iscc compiler needs to be installed and on the system path.
143 --- a/src/FlightCrew/tests/CMakeLists.txt
144 +++ b/src/FlightCrew/tests/CMakeLists.txt
145 @@ -41,12 +41,12 @@
146 # That means that subdirs inherit the include_directories of their parents.
147 # So techincally we don't need to include Xerces etc.
148 include_directories( ${CMAKE_CURRENT_BINARY_DIR}
149 - ${CMAKE_CURRENT_SOURCE_DIR}
150 - ../../BoostParts
151 - ../../Xerces
152 ../../XercesExtensions
153 - ../../googlemock/include
154 - ../../googlemock/gtest/include
155 + /usr/src/googletest/googlemock/include
156 + /usr/src/googletest/googlemock
157 + /usr/src/googletest/googletest/include
158 + /usr/src/googletest/googletest
159 + ${CMAKE_CURRENT_SOURCE_DIR}
160 )
161
162 link_directories ( ${PROJECT_BINARY_DIR}/lib )
163 @@ -55,7 +55,7 @@
164
165 # creating PCH's for MSVC and GCC on Linux
166 include( ${CMAKE_SOURCE_DIR}/cmake_extras/CustomPCH.cmake )
167 -set( ALL_INCLUDES ${gtest_SOURCE_DIR}/include ${BoostParts_SOURCE_DIR} )
168 +set( ALL_INCLUDES /usr/src/googletest/googletest/include ${BoostParts_SOURCE_DIR} )
169
170 set( GCC_PCH_TARGET gccPCH_tests )
171
172 @@ -65,7 +65,12 @@
173
174 add_executable( ${PROJECT_NAME} ${TEST_SOURCES} )
175
176 -target_link_libraries( ${PROJECT_NAME} FlightCrew gmock )
177 +add_library( GOOGLE_MOCK_LIB STATIC
178 + /usr/src/googletest/googlemock/src/gmock-all.cc
179 + /usr/src/googletest/googletest/src/gtest-all.cc
180 +)
181 +
182 +target_link_libraries( ${PROJECT_NAME} FlightCrew GOOGLE_MOCK_LIB )
183
184 #############################################################################
185
186 @@ -100,9 +105,6 @@
187 add_dependencies( ${PROJECT_NAME} ${GCC_PCH_TARGET} )
188 endif()
189
190 -# needed for correct Xerces header inclusion
191 -add_definitions( -DXERCES_STATIC_LIBRARY )
192 -
193 #############################################################################
194
195 # The test executable expects a "test_data" dir in its working directory.
196 --- a/src/XercesExtensions/CMakeLists.txt
197 +++ b/src/XercesExtensions/CMakeLists.txt
198 @@ -15,15 +15,14 @@
199
200 # We need to pick up the stdafx.h file
201 # and the headers for the linked-to libraries
202 -include_directories( ${CMAKE_CURRENT_SOURCE_DIR}
203 - ${XERCES_INCLUDE_DIRS}
204 - ${BOOST_INCLUDE_DIRS} )
205 +include_directories( ${CMAKE_CURRENT_SOURCE_DIR})
206
207 link_directories ( ${PROJECT_BINARY_DIR}/lib )
208
209 add_library( ${PROJECT_NAME} STATIC ${SOURCES} )
210
211 -target_link_libraries( ${PROJECT_NAME} ${XERCES_LIBRARIES} )
212 +find_library(LIB_XERCES xerces-c)
213 +target_link_libraries( ${PROJECT_NAME} ${LIB_XERCES} )
214
215 #############################################################################
216
217 @@ -45,11 +44,7 @@
218
219 # "Print all warnings" flag for GCC
220 elseif( CMAKE_COMPILER_IS_GNUCXX )
221 + SET_TARGET_PROPERTIES( ${PROJECT_NAME} PROPERTIES COMPILE_FLAGS -fPIC)
222 add_definitions( -Wall )
223 endif()
224
225 -# needed for correct Xerces header inclusion
226 -if( FORCE_BUNDLED_COPIES OR NOT XERCES_FOUND)
227 - add_definitions( -DXERCES_STATIC_LIBRARY )
228 -endif()
229 -
230 --- a/src/zipios/CMakeLists.txt
231 +++ b/src/zipios/CMakeLists.txt
232 @@ -25,7 +25,13 @@
233
234 add_library( ${PROJECT_NAME} STATIC ${SOURCES} )
235
236 -target_link_libraries( ${PROJECT_NAME} zlib BoostParts )
237 +find_library(LIB_ZLIB z)
238 +find_library(BOOST_DT boost_date_time)
239 +find_library(BOOST_FS boost_filesystem)
240 +find_library(BOOST_PO boost_program_options)
241 +find_library(BOOST_RE boost_regex)
242 +find_library(BOOST_T boost_thread)
243 +target_link_libraries( ${PROJECT_NAME} ${LIB_ZLIB} ${BOOST_DT} ${BOOST_FS} ${BOOST_PO} ${BOOST_RE} ${BOOST_T})
244
245 #############################################################################
246
247 @@ -44,6 +50,7 @@
248
249 # "Print all warnings" flag for GCC
250 elseif( CMAKE_COMPILER_IS_GNUCXX )
251 + SET_TARGET_PROPERTIES( ${PROJECT_NAME} PROPERTIES COMPILE_FLAGS -fPIC)
252 add_definitions( -Wall )
253 endif()
254