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