CMake: fix building without libmv
[blender.git] / extern / ceres / 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) 2012, Blender Foundation
18 # All rights reserved.
19 # ***** END GPL LICENSE BLOCK *****
20
21 # NOTE: This file is automatically generated by bundle.sh script
22 #       If you're doing changes in this file, please update template
23 #       in that script too
24
25 set(INC
26         .
27         include
28         internal
29         config
30         ../gflags/src
31 )
32
33 set(INC_SYS
34         ${EIGEN3_INCLUDE_DIRS}
35         ${GFLAGS_INCLUDE_DIRS}
36         ${GLOG_INCLUDE_DIRS}
37 )
38
39 set(SRC
40         internal/ceres/array_utils.cc
41         internal/ceres/blas.cc
42         internal/ceres/block_evaluate_preparer.cc
43         internal/ceres/block_jacobian_writer.cc
44         internal/ceres/block_jacobi_preconditioner.cc
45         internal/ceres/block_random_access_dense_matrix.cc
46         internal/ceres/block_random_access_diagonal_matrix.cc
47         internal/ceres/block_random_access_matrix.cc
48         internal/ceres/block_random_access_sparse_matrix.cc
49         internal/ceres/block_sparse_matrix.cc
50         internal/ceres/block_structure.cc
51         internal/ceres/callbacks.cc
52         internal/ceres/c_api.cc
53         internal/ceres/cgnr_solver.cc
54         internal/ceres/compressed_col_sparse_matrix_utils.cc
55         internal/ceres/compressed_row_jacobian_writer.cc
56         internal/ceres/compressed_row_sparse_matrix.cc
57         internal/ceres/conditioned_cost_function.cc
58         internal/ceres/conjugate_gradients_solver.cc
59         internal/ceres/coordinate_descent_minimizer.cc
60         internal/ceres/corrector.cc
61         internal/ceres/covariance.cc
62         internal/ceres/covariance_impl.cc
63         internal/ceres/dense_normal_cholesky_solver.cc
64         internal/ceres/dense_qr_solver.cc
65         internal/ceres/dense_sparse_matrix.cc
66         internal/ceres/detect_structure.cc
67         internal/ceres/dogleg_strategy.cc
68         internal/ceres/dynamic_compressed_row_jacobian_writer.cc
69         internal/ceres/dynamic_compressed_row_sparse_matrix.cc
70         internal/ceres/evaluator.cc
71         internal/ceres/file.cc
72         internal/ceres/generated/partitioned_matrix_view_d_d_d.cc
73         internal/ceres/generated/schur_eliminator_d_d_d.cc
74         internal/ceres/gradient_checker.cc
75         internal/ceres/gradient_checking_cost_function.cc
76         internal/ceres/gradient_problem.cc
77         internal/ceres/gradient_problem_solver.cc
78         internal/ceres/implicit_schur_complement.cc
79         internal/ceres/is_close.cc
80         internal/ceres/iterative_schur_complement_solver.cc
81         internal/ceres/lapack.cc
82         internal/ceres/levenberg_marquardt_strategy.cc
83         internal/ceres/linear_least_squares_problems.cc
84         internal/ceres/linear_operator.cc
85         internal/ceres/linear_solver.cc
86         internal/ceres/line_search.cc
87         internal/ceres/line_search_direction.cc
88         internal/ceres/line_search_minimizer.cc
89         internal/ceres/line_search_preprocessor.cc
90         internal/ceres/local_parameterization.cc
91         internal/ceres/loss_function.cc
92         internal/ceres/low_rank_inverse_hessian.cc
93         internal/ceres/minimizer.cc
94         internal/ceres/normal_prior.cc
95         internal/ceres/parameter_block_ordering.cc
96         internal/ceres/partitioned_matrix_view.cc
97         internal/ceres/polynomial.cc
98         internal/ceres/preconditioner.cc
99         internal/ceres/preprocessor.cc
100         internal/ceres/problem.cc
101         internal/ceres/problem_impl.cc
102         internal/ceres/program.cc
103         internal/ceres/reorder_program.cc
104         internal/ceres/residual_block.cc
105         internal/ceres/residual_block_utils.cc
106         internal/ceres/schur_complement_solver.cc
107         internal/ceres/schur_eliminator.cc
108         internal/ceres/schur_jacobi_preconditioner.cc
109         internal/ceres/scratch_evaluate_preparer.cc
110         internal/ceres/solver.cc
111         internal/ceres/solver_utils.cc
112         internal/ceres/sparse_matrix.cc
113         internal/ceres/sparse_normal_cholesky_solver.cc
114         internal/ceres/split.cc
115         internal/ceres/stringprintf.cc
116         internal/ceres/triplet_sparse_matrix.cc
117         internal/ceres/trust_region_minimizer.cc
118         internal/ceres/trust_region_preprocessor.cc
119         internal/ceres/trust_region_step_evaluator.cc
120         internal/ceres/trust_region_strategy.cc
121         internal/ceres/types.cc
122         internal/ceres/wall_time.cc
123
124         include/ceres/autodiff_cost_function.h
125         include/ceres/autodiff_local_parameterization.h
126         include/ceres/c_api.h
127         include/ceres/ceres.h
128         include/ceres/conditioned_cost_function.h
129         include/ceres/cost_function.h
130         include/ceres/cost_function_to_functor.h
131         include/ceres/covariance.h
132         include/ceres/crs_matrix.h
133         include/ceres/dynamic_autodiff_cost_function.h
134         include/ceres/dynamic_cost_function_to_functor.h
135         include/ceres/dynamic_numeric_diff_cost_function.h
136         include/ceres/fpclassify.h
137         include/ceres/gradient_checker.h
138         include/ceres/gradient_problem.h
139         include/ceres/gradient_problem_solver.h
140         include/ceres/internal/autodiff.h
141         include/ceres/internal/disable_warnings.h
142         include/ceres/internal/eigen.h
143         include/ceres/internal/fixed_array.h
144         include/ceres/internal/macros.h
145         include/ceres/internal/manual_constructor.h
146         include/ceres/internal/numeric_diff.h
147         include/ceres/internal/port.h
148         include/ceres/internal/reenable_warnings.h
149         include/ceres/internal/scoped_ptr.h
150         include/ceres/internal/variadic_evaluate.h
151         include/ceres/iteration_callback.h
152         include/ceres/jet.h
153         include/ceres/local_parameterization.h
154         include/ceres/loss_function.h
155         include/ceres/normal_prior.h
156         include/ceres/numeric_diff_cost_function.h
157         include/ceres/numeric_diff_options.h
158         include/ceres/ordered_groups.h
159         include/ceres/problem.h
160         include/ceres/rotation.h
161         include/ceres/sized_cost_function.h
162         include/ceres/solver.h
163         include/ceres/types.h
164         include/ceres/version.h
165         internal/ceres/array_utils.h
166         internal/ceres/blas.h
167         internal/ceres/block_evaluate_preparer.h
168         internal/ceres/block_jacobian_writer.h
169         internal/ceres/block_jacobi_preconditioner.h
170         internal/ceres/block_random_access_dense_matrix.h
171         internal/ceres/block_random_access_diagonal_matrix.h
172         internal/ceres/block_random_access_matrix.h
173         internal/ceres/block_random_access_sparse_matrix.h
174         internal/ceres/block_sparse_matrix.h
175         internal/ceres/block_structure.h
176         internal/ceres/callbacks.h
177         internal/ceres/casts.h
178         internal/ceres/cgnr_linear_operator.h
179         internal/ceres/cgnr_solver.h
180         internal/ceres/collections_port.h
181         internal/ceres/compressed_col_sparse_matrix_utils.h
182         internal/ceres/compressed_row_jacobian_writer.h
183         internal/ceres/compressed_row_sparse_matrix.h
184         internal/ceres/conjugate_gradients_solver.h
185         internal/ceres/coordinate_descent_minimizer.h
186         internal/ceres/corrector.h
187         internal/ceres/covariance_impl.h
188         internal/ceres/cxsparse.h
189         internal/ceres/dense_jacobian_writer.h
190         internal/ceres/dense_normal_cholesky_solver.h
191         internal/ceres/dense_qr_solver.h
192         internal/ceres/dense_sparse_matrix.h
193         internal/ceres/detect_structure.h
194         internal/ceres/dogleg_strategy.h
195         internal/ceres/dynamic_compressed_row_finalizer.h
196         internal/ceres/dynamic_compressed_row_jacobian_writer.h
197         internal/ceres/dynamic_compressed_row_sparse_matrix.h
198         internal/ceres/evaluator.h
199         internal/ceres/execution_summary.h
200         internal/ceres/file.h
201         internal/ceres/gradient_checking_cost_function.h
202         internal/ceres/gradient_problem_evaluator.h
203         internal/ceres/graph_algorithms.h
204         internal/ceres/graph.h
205         internal/ceres/householder_vector.h
206         internal/ceres/implicit_schur_complement.h
207         internal/ceres/integral_types.h
208         internal/ceres/is_close.h
209         internal/ceres/iterative_schur_complement_solver.h
210         internal/ceres/lapack.h
211         internal/ceres/levenberg_marquardt_strategy.h
212         internal/ceres/linear_least_squares_problems.h
213         internal/ceres/linear_operator.h
214         internal/ceres/linear_solver.h
215         internal/ceres/line_search_direction.h
216         internal/ceres/line_search.h
217         internal/ceres/line_search_minimizer.h
218         internal/ceres/line_search_preprocessor.h
219         internal/ceres/low_rank_inverse_hessian.h
220         internal/ceres/map_util.h
221         internal/ceres/minimizer.h
222         internal/ceres/mutex.h
223         internal/ceres/parameter_block.h
224         internal/ceres/parameter_block_ordering.h
225         internal/ceres/partitioned_matrix_view.h
226         internal/ceres/partitioned_matrix_view_impl.h
227         internal/ceres/polynomial.h
228         internal/ceres/preconditioner.h
229         internal/ceres/preprocessor.h
230         internal/ceres/problem_impl.h
231         internal/ceres/program_evaluator.h
232         internal/ceres/program.h
233         internal/ceres/random.h
234         internal/ceres/reorder_program.h
235         internal/ceres/residual_block.h
236         internal/ceres/residual_block_utils.h
237         internal/ceres/schur_complement_solver.h
238         internal/ceres/schur_eliminator.h
239         internal/ceres/schur_eliminator_impl.h
240         internal/ceres/schur_jacobi_preconditioner.h
241         internal/ceres/scratch_evaluate_preparer.h
242         internal/ceres/small_blas.h
243         internal/ceres/solver_utils.h
244         internal/ceres/sparse_matrix.h
245         internal/ceres/sparse_normal_cholesky_solver.h
246         internal/ceres/split.h
247         internal/ceres/stl_util.h
248         internal/ceres/stringprintf.h
249         internal/ceres/suitesparse.h
250         internal/ceres/triplet_sparse_matrix.h
251         internal/ceres/trust_region_minimizer.h
252         internal/ceres/trust_region_preprocessor.h
253         internal/ceres/trust_region_step_evaluator.h
254         internal/ceres/trust_region_strategy.h
255         internal/ceres/visibility_based_preconditioner.h
256         internal/ceres/wall_time.h
257 )
258
259 set(LIB
260 )
261
262 if(WITH_LIBMV OR WITH_GTESTS OR (WITH_CYCLES AND WITH_CYCLES_LOGGING))
263         list(APPEND LIB
264                 extern_glog
265         )
266 endif()
267
268 if(WITH_LIBMV_SCHUR_SPECIALIZATIONS)
269         list(APPEND SRC
270                 internal/ceres/generated/partitioned_matrix_view_2_2_2.cc
271                 internal/ceres/generated/partitioned_matrix_view_2_2_3.cc
272                 internal/ceres/generated/partitioned_matrix_view_2_2_4.cc
273                 internal/ceres/generated/partitioned_matrix_view_2_2_d.cc
274                 internal/ceres/generated/partitioned_matrix_view_2_3_3.cc
275                 internal/ceres/generated/partitioned_matrix_view_2_3_4.cc
276                 internal/ceres/generated/partitioned_matrix_view_2_3_6.cc
277                 internal/ceres/generated/partitioned_matrix_view_2_3_9.cc
278                 internal/ceres/generated/partitioned_matrix_view_2_3_d.cc
279                 internal/ceres/generated/partitioned_matrix_view_2_4_3.cc
280                 internal/ceres/generated/partitioned_matrix_view_2_4_4.cc
281                 internal/ceres/generated/partitioned_matrix_view_2_4_8.cc
282                 internal/ceres/generated/partitioned_matrix_view_2_4_9.cc
283                 internal/ceres/generated/partitioned_matrix_view_2_4_d.cc
284                 internal/ceres/generated/partitioned_matrix_view_2_d_d.cc
285                 internal/ceres/generated/partitioned_matrix_view_4_4_2.cc
286                 internal/ceres/generated/partitioned_matrix_view_4_4_3.cc
287                 internal/ceres/generated/partitioned_matrix_view_4_4_4.cc
288                 internal/ceres/generated/partitioned_matrix_view_4_4_d.cc
289                 internal/ceres/generated/schur_eliminator_2_2_2.cc
290                 internal/ceres/generated/schur_eliminator_2_2_3.cc
291                 internal/ceres/generated/schur_eliminator_2_2_4.cc
292                 internal/ceres/generated/schur_eliminator_2_2_d.cc
293                 internal/ceres/generated/schur_eliminator_2_3_3.cc
294                 internal/ceres/generated/schur_eliminator_2_3_4.cc
295                 internal/ceres/generated/schur_eliminator_2_3_6.cc
296                 internal/ceres/generated/schur_eliminator_2_3_9.cc
297                 internal/ceres/generated/schur_eliminator_2_3_d.cc
298                 internal/ceres/generated/schur_eliminator_2_4_3.cc
299                 internal/ceres/generated/schur_eliminator_2_4_4.cc
300                 internal/ceres/generated/schur_eliminator_2_4_8.cc
301                 internal/ceres/generated/schur_eliminator_2_4_9.cc
302                 internal/ceres/generated/schur_eliminator_2_4_d.cc
303                 internal/ceres/generated/schur_eliminator_2_d_d.cc
304                 internal/ceres/generated/schur_eliminator_4_4_2.cc
305                 internal/ceres/generated/schur_eliminator_4_4_3.cc
306                 internal/ceres/generated/schur_eliminator_4_4_4.cc
307                 internal/ceres/generated/schur_eliminator_4_4_d.cc
308         )
309 else()
310         add_definitions(-DCERES_RESTRICT_SCHUR_SPECIALIZATION)
311 endif()
312
313 add_definitions(${GFLAGS_DEFINES})
314 add_definitions(${GLOG_DEFINES})
315 add_definitions(${CERES_DEFINES})
316
317 add_definitions(
318         -DCERES_HAVE_PTHREAD
319         -DCERES_NO_SUITESPARSE
320         -DCERES_NO_CXSPARSE
321         -DCERES_NO_LAPACK
322         -DCERES_HAVE_RWLOCK
323 )
324
325 if(WITH_OPENMP)
326         add_definitions(
327                 -DCERES_USE_OPENMP
328         )
329 endif()
330
331 blender_add_lib(extern_ceres "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")