CMake: Add option to enable -Werror cflag in some areas
[blender.git] / extern / libmv / CMakeLists.txt
1 # ***** BEGIN GPL LICENSE BLOCK *****
2 #
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 #
17 # The Original Code is Copyright (C) 2011, Blender Foundation
18 # All rights reserved.
19 #
20 # Contributor(s): Blender Foundation,
21 #                 Sergey Sharybin
22 #
23 # ***** END GPL LICENSE BLOCK *****
24
25 # NOTE: This file is automatically generated by bundle.sh script
26 #       If you're doing changes in this file, please update template
27 #       in that script too
28
29 set(INC
30         .
31 )
32
33 set(INC_SYS
34 )
35
36 set(SRC
37         libmv-capi.h
38 )
39
40 if(WITH_LIBMV_WERROR)
41         ADD_CHECK_C_COMPILER_FLAG(CMAKE_C_FLAGS C_WERROR -Werror)
42         ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS C_WERROR -Werror)
43 endif()
44
45 if(WITH_LIBMV OR WITH_GTESTS OR (WITH_CYCLES AND WITH_CYCLES_LOGGING))
46         list(APPEND INC
47                 third_party/gflags
48                 third_party/gflags/gflags
49                 third_party/glog/src
50                 third_party/ceres/include
51                 third_party/ceres/config
52                 ../../intern/guardedalloc
53         )
54
55         list(APPEND INC_SYS
56                 ${EIGEN3_INCLUDE_DIRS}
57                 ${PNG_INCLUDE_DIRS}
58                 ${ZLIB_INCLUDE_DIRS}
59         )
60
61         if(WIN32)
62                 list(APPEND INC
63                         third_party/glog/src/windows
64                 )
65
66                 if(NOT MINGW)
67                         list(APPEND INC
68                                 third_party/msinttypes
69                         )
70                 endif()
71         endif()
72
73         add_definitions(
74                 -DWITH_LIBMV_GUARDED_ALLOC
75                 -DGOOGLE_GLOG_DLL_DECL=
76                 -DLIBMV_NO_FAST_DETECTOR=
77         )
78 endif()
79
80 if(WITH_LIBMV)
81         TEST_SHARED_PTR_SUPPORT()
82         if(SHARED_PTR_FOUND)
83                 if(SHARED_PTR_TR1_MEMORY_HEADER)
84                         add_definitions(-DCERES_TR1_MEMORY_HEADER)
85                 endif()
86                 if(SHARED_PTR_TR1_NAMESPACE)
87                         add_definitions(-DCERES_TR1_SHARED_PTR)
88                 endif()
89         else()
90                 message(FATAL_ERROR "Unable to find shared_ptr.")
91         endif()
92
93         list(APPEND SRC
94                 intern/autotrack.cc
95                 intern/camera_intrinsics.cc
96                 intern/detector.cc
97                 intern/frame_accessor.cc
98                 intern/homography.cc
99                 intern/image.cc
100                 intern/logging.cc
101                 intern/reconstruction.cc
102                 intern/track_region.cc
103                 intern/tracks.cc
104                 intern/tracksN.cc
105                 libmv/autotrack/autotrack.cc
106                 libmv/autotrack/predict_tracks.cc
107                 libmv/autotrack/tracks.cc
108                 libmv/base/aligned_malloc.cc
109                 libmv/image/array_nd.cc
110                 libmv/image/convolve.cc
111                 libmv/multiview/conditioning.cc
112                 libmv/multiview/euclidean_resection.cc
113                 libmv/multiview/fundamental.cc
114                 libmv/multiview/homography.cc
115                 libmv/multiview/panography.cc
116                 libmv/multiview/panography_kernel.cc
117                 libmv/multiview/projection.cc
118                 libmv/multiview/triangulation.cc
119                 libmv/numeric/numeric.cc
120                 libmv/numeric/poly.cc
121                 libmv/simple_pipeline/bundle.cc
122                 libmv/simple_pipeline/camera_intrinsics.cc
123                 libmv/simple_pipeline/detect.cc
124                 libmv/simple_pipeline/distortion_models.cc
125                 libmv/simple_pipeline/initialize_reconstruction.cc
126                 libmv/simple_pipeline/intersect.cc
127                 libmv/simple_pipeline/keyframe_selection.cc
128                 libmv/simple_pipeline/modal_solver.cc
129                 libmv/simple_pipeline/pipeline.cc
130                 libmv/simple_pipeline/reconstruction.cc
131                 libmv/simple_pipeline/reconstruction_scale.cc
132                 libmv/simple_pipeline/resect.cc
133                 libmv/simple_pipeline/tracks.cc
134                 libmv/tracking/brute_region_tracker.cc
135                 libmv/tracking/hybrid_region_tracker.cc
136                 libmv/tracking/klt_region_tracker.cc
137                 libmv/tracking/pyramid_region_tracker.cc
138                 libmv/tracking/retrack_region_tracker.cc
139                 libmv/tracking/track_region.cc
140                 libmv/tracking/trklt_region_tracker.cc
141
142
143                 intern/autotrack.h
144                 intern/camera_intrinsics.h
145                 intern/detector.h
146                 intern/frame_accessor.h
147                 intern/homography.h
148                 intern/image.h
149                 intern/logging.h
150                 intern/reconstruction.h
151                 intern/track_region.h
152                 intern/tracks.h
153                 intern/tracksN.h
154                 libmv/autotrack/autotrack.h
155                 libmv/autotrack/callbacks.h
156                 libmv/autotrack/frame_accessor.h
157                 libmv/autotrack/marker.h
158                 libmv/autotrack/model.h
159                 libmv/autotrack/predict_tracks.h
160                 libmv/autotrack/quad.h
161                 libmv/autotrack/reconstruction.h
162                 libmv/autotrack/region.h
163                 libmv/autotrack/tracks.h
164                 libmv/base/aligned_malloc.h
165                 libmv/base/id_generator.h
166                 libmv/base/scoped_ptr.h
167                 libmv/base/vector.h
168                 libmv/base/vector_utils.h
169                 libmv/image/array_nd.h
170                 libmv/image/convolve.h
171                 libmv/image/correlation.h
172                 libmv/image/image_converter.h
173                 libmv/image/image_drawing.h
174                 libmv/image/image.h
175                 libmv/image/sample.h
176                 libmv/image/tuple.h
177                 libmv/logging/logging.h
178                 libmv/multiview/conditioning.h
179                 libmv/multiview/euclidean_resection.h
180                 libmv/multiview/fundamental.h
181                 libmv/multiview/homography_error.h
182                 libmv/multiview/homography.h
183                 libmv/multiview/homography_parameterization.h
184                 libmv/multiview/nviewtriangulation.h
185                 libmv/multiview/panography.h
186                 libmv/multiview/panography_kernel.h
187                 libmv/multiview/projection.h
188                 libmv/multiview/resection.h
189                 libmv/multiview/triangulation.h
190                 libmv/multiview/two_view_kernel.h
191                 libmv/numeric/dogleg.h
192                 libmv/numeric/function_derivative.h
193                 libmv/numeric/levenberg_marquardt.h
194                 libmv/numeric/numeric.h
195                 libmv/numeric/poly.h
196                 libmv/simple_pipeline/bundle.h
197                 libmv/simple_pipeline/callbacks.h
198                 libmv/simple_pipeline/camera_intrinsics.h
199                 libmv/simple_pipeline/camera_intrinsics_impl.h
200                 libmv/simple_pipeline/detect.h
201                 libmv/simple_pipeline/distortion_models.h
202                 libmv/simple_pipeline/initialize_reconstruction.h
203                 libmv/simple_pipeline/intersect.h
204                 libmv/simple_pipeline/keyframe_selection.h
205                 libmv/simple_pipeline/modal_solver.h
206                 libmv/simple_pipeline/pipeline.h
207                 libmv/simple_pipeline/reconstruction.h
208                 libmv/simple_pipeline/reconstruction_scale.h
209                 libmv/simple_pipeline/resect.h
210                 libmv/simple_pipeline/tracks.h
211                 libmv/tracking/brute_region_tracker.h
212                 libmv/tracking/hybrid_region_tracker.h
213                 libmv/tracking/kalman_filter.h
214                 libmv/tracking/klt_region_tracker.h
215                 libmv/tracking/pyramid_region_tracker.h
216                 libmv/tracking/region_tracker.h
217                 libmv/tracking/retrack_region_tracker.h
218                 libmv/tracking/track_region.h
219                 libmv/tracking/trklt_region_tracker.h
220
221                 third_party/msinttypes/inttypes.h
222                 third_party/msinttypes/stdint.h
223         )
224
225
226         if(WITH_GTESTS)
227                 blender_add_lib(libmv_test_dataset "./libmv/multiview/test_data_sets.cc" "" "")
228
229                 BLENDER_SRC_GTEST("libmv_predict_tracks" "./libmv/autotrack/predict_tracks_test.cc" "libmv_test_dataset;extern_libmv;extern_ceres")
230                 BLENDER_SRC_GTEST("libmv_tracks" "./libmv/autotrack/tracks_test.cc" "libmv_test_dataset;extern_libmv;extern_ceres")
231                 BLENDER_SRC_GTEST("libmv_scoped_ptr" "./libmv/base/scoped_ptr_test.cc" "libmv_test_dataset;extern_libmv;extern_ceres")
232                 BLENDER_SRC_GTEST("libmv_vector" "./libmv/base/vector_test.cc" "libmv_test_dataset;extern_libmv;extern_ceres")
233                 BLENDER_SRC_GTEST("libmv_array_nd" "./libmv/image/array_nd_test.cc" "libmv_test_dataset;extern_libmv;extern_ceres")
234                 BLENDER_SRC_GTEST("libmv_convolve" "./libmv/image/convolve_test.cc" "libmv_test_dataset;extern_libmv;extern_ceres")
235                 BLENDER_SRC_GTEST("libmv_image" "./libmv/image/image_test.cc" "libmv_test_dataset;extern_libmv;extern_ceres")
236                 BLENDER_SRC_GTEST("libmv_sample" "./libmv/image/sample_test.cc" "libmv_test_dataset;extern_libmv;extern_ceres")
237                 BLENDER_SRC_GTEST("libmv_tuple" "./libmv/image/tuple_test.cc" "libmv_test_dataset;extern_libmv;extern_ceres")
238                 BLENDER_SRC_GTEST("libmv_euclidean_resection" "./libmv/multiview/euclidean_resection_test.cc" "libmv_test_dataset;extern_libmv;extern_ceres")
239                 BLENDER_SRC_GTEST("libmv_fundamental" "./libmv/multiview/fundamental_test.cc" "libmv_test_dataset;extern_libmv;extern_ceres")
240                 BLENDER_SRC_GTEST("libmv_homography" "./libmv/multiview/homography_test.cc" "libmv_test_dataset;extern_libmv;extern_ceres")
241                 BLENDER_SRC_GTEST("libmv_nviewtriangulation" "./libmv/multiview/nviewtriangulation_test.cc" "libmv_test_dataset;extern_libmv;extern_ceres")
242                 BLENDER_SRC_GTEST("libmv_panography" "./libmv/multiview/panography_test.cc" "libmv_test_dataset;extern_libmv;extern_ceres")
243                 BLENDER_SRC_GTEST("libmv_projection" "./libmv/multiview/projection_test.cc" "libmv_test_dataset;extern_libmv;extern_ceres")
244                 BLENDER_SRC_GTEST("libmv_resection" "./libmv/multiview/resection_test.cc" "libmv_test_dataset;extern_libmv;extern_ceres")
245                 BLENDER_SRC_GTEST("libmv_triangulation" "./libmv/multiview/triangulation_test.cc" "libmv_test_dataset;extern_libmv;extern_ceres")
246                 BLENDER_SRC_GTEST("libmv_dogleg" "./libmv/numeric/dogleg_test.cc" "libmv_test_dataset;extern_libmv;extern_ceres")
247                 BLENDER_SRC_GTEST("libmv_function_derivative" "./libmv/numeric/function_derivative_test.cc" "libmv_test_dataset;extern_libmv;extern_ceres")
248                 BLENDER_SRC_GTEST("libmv_levenberg_marquardt" "./libmv/numeric/levenberg_marquardt_test.cc" "libmv_test_dataset;extern_libmv;extern_ceres")
249                 BLENDER_SRC_GTEST("libmv_numeric" "./libmv/numeric/numeric_test.cc" "libmv_test_dataset;extern_libmv;extern_ceres")
250                 BLENDER_SRC_GTEST("libmv_poly" "./libmv/numeric/poly_test.cc" "libmv_test_dataset;extern_libmv;extern_ceres")
251                 BLENDER_SRC_GTEST("libmv_camera_intrinsics" "./libmv/simple_pipeline/camera_intrinsics_test.cc" "libmv_test_dataset;extern_libmv;extern_ceres")
252                 BLENDER_SRC_GTEST("libmv_detect" "./libmv/simple_pipeline/detect_test.cc" "libmv_test_dataset;extern_libmv;extern_ceres")
253                 BLENDER_SRC_GTEST("libmv_intersect" "./libmv/simple_pipeline/intersect_test.cc" "libmv_test_dataset;extern_libmv;extern_ceres")
254                 BLENDER_SRC_GTEST("libmv_keyframe_selection" "./libmv/simple_pipeline/keyframe_selection_test.cc" "libmv_test_dataset;extern_libmv;extern_ceres")
255                 BLENDER_SRC_GTEST("libmv_modal_solver" "./libmv/simple_pipeline/modal_solver_test.cc" "libmv_test_dataset;extern_libmv;extern_ceres")
256                 BLENDER_SRC_GTEST("libmv_resect" "./libmv/simple_pipeline/resect_test.cc" "libmv_test_dataset;extern_libmv;extern_ceres")
257                 BLENDER_SRC_GTEST("libmv_brute_region_tracker" "./libmv/tracking/brute_region_tracker_test.cc" "libmv_test_dataset;extern_libmv;extern_ceres")
258                 BLENDER_SRC_GTEST("libmv_klt_region_tracker" "./libmv/tracking/klt_region_tracker_test.cc" "libmv_test_dataset;extern_libmv;extern_ceres")
259                 BLENDER_SRC_GTEST("libmv_pyramid_region_tracker" "./libmv/tracking/pyramid_region_tracker_test.cc" "libmv_test_dataset;extern_libmv;extern_ceres")
260         endif()
261 else()
262         list(APPEND SRC
263                 intern/stub.cc
264         )
265 endif()
266
267 blender_add_lib(extern_libmv "${SRC}" "${INC}" "${INC_SYS}")
268
269 if(WITH_LIBMV)
270         add_subdirectory(third_party)
271 endif()
272
273 # make GLog a separate target, so it can be used for gtest as well.
274 if(WITH_LIBMV OR WITH_GTESTS OR (WITH_CYCLES AND WITH_CYCLES_LOGGING))
275         # We compile GLog together with GFlag so we don't worry about
276         # adding extra lib to linker.
277         set(GLOG_SRC
278                 third_party/gflags/gflags.cc
279                 third_party/gflags/gflags_completions.cc
280                 third_party/gflags/gflags_reporting.cc
281
282                 third_party/gflags/config.h
283                 third_party/gflags/gflags/gflags_completions.h
284                 third_party/gflags/gflags/gflags_declare.h
285                 third_party/gflags/gflags/gflags.h
286                 third_party/gflags/mutex.h
287                 third_party/gflags/util.h
288         )
289
290         if(WIN32)
291                 list(APPEND GLOG_SRC
292                         third_party/glog/src/logging.cc
293                         third_party/glog/src/raw_logging.cc
294                         third_party/glog/src/utilities.cc
295                         third_party/glog/src/vlog_is_on.cc
296                         third_party/glog/src/windows/port.cc
297
298                         third_party/glog/src/utilities.h
299                         third_party/glog/src/stacktrace_generic-inl.h
300                         third_party/glog/src/stacktrace.h
301                         third_party/glog/src/stacktrace_x86_64-inl.h
302                         third_party/glog/src/base/googleinit.h
303                         third_party/glog/src/base/mutex.h
304                         third_party/glog/src/base/commandlineflags.h
305                         third_party/glog/src/stacktrace_powerpc-inl.h
306                         third_party/glog/src/stacktrace_x86-inl.h
307                         third_party/glog/src/config.h
308                         third_party/glog/src/stacktrace_libunwind-inl.h
309                         third_party/glog/src/windows/glog/raw_logging.h
310                         third_party/glog/src/windows/glog/vlog_is_on.h
311                         third_party/glog/src/windows/glog/logging.h
312                         third_party/glog/src/windows/glog/log_severity.h
313                         third_party/glog/src/windows/port.h
314                         third_party/glog/src/windows/config.h
315
316                         third_party/gflags/windows_port.cc
317                         third_party/gflags/windows_port.h
318                 )
319         else()
320                 list(APPEND GLOG_SRC
321                         third_party/glog/src/demangle.cc
322                         third_party/glog/src/logging.cc
323                         third_party/glog/src/raw_logging.cc
324                         third_party/glog/src/signalhandler.cc
325                         third_party/glog/src/symbolize.cc
326                         third_party/glog/src/utilities.cc
327                         third_party/glog/src/vlog_is_on.cc
328
329                         third_party/glog/src/base/commandlineflags.h
330                         third_party/glog/src/base/googleinit.h
331                         third_party/glog/src/base/mutex.h
332                         third_party/glog/src/config_freebsd.h
333                         third_party/glog/src/config.h
334                         third_party/glog/src/config_hurd.h
335                         third_party/glog/src/config_linux.h
336                         third_party/glog/src/config_mac.h
337                         third_party/glog/src/demangle.h
338                         third_party/glog/src/glog/logging.h
339                         third_party/glog/src/glog/log_severity.h
340                         third_party/glog/src/glog/raw_logging.h
341                         third_party/glog/src/glog/vlog_is_on.h
342                         third_party/glog/src/stacktrace_generic-inl.h
343                         third_party/glog/src/stacktrace.h
344                         third_party/glog/src/stacktrace_libunwind-inl.h
345                         third_party/glog/src/stacktrace_powerpc-inl.h
346                         third_party/glog/src/stacktrace_x86_64-inl.h
347                         third_party/glog/src/stacktrace_x86-inl.h
348                         third_party/glog/src/symbolize.h
349                         third_party/glog/src/utilities.h
350                 )
351         endif()
352
353         blender_add_lib(extern_glog "${GLOG_SRC}" "${INC}" "${INC_SYS}")
354 endif()