CMake: Add option to enable -Werror cflag in some areas
[blender.git] / source / blender / blenkernel / 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) 2006, Blender Foundation
18 # All rights reserved.
19 #
20 # The Original Code is: all of this file.
21 #
22 # Contributor(s): Jacques Beaurain.
23 #
24 # ***** END GPL LICENSE BLOCK *****
25
26 set(INC
27         .
28         ../blenfont
29         ../blenlib
30         ../blenloader
31         ../depsgraph
32         ../gpu
33         ../ikplugin
34         ../imbuf
35         ../makesdna
36         ../makesrna
37         ../bmesh
38         ../modifiers
39         ../nodes
40         ../physics
41         ../render/extern/include
42         ../../../intern/ghost
43         ../../../intern/guardedalloc
44         ../../../intern/glew-mx
45         ../../../intern/iksolver/extern
46         ../../../intern/memutil
47         ../../../intern/mikktspace
48         ../../../intern/raskter
49         ../../../intern/smoke/extern
50         ../../../intern/atomic
51         ../../../extern/libmv
52
53         # XXX - BAD LEVEL CALL WM_api.h
54         ../windowmanager
55 )
56
57 set(INC_SYS
58         ${GLEW_INCLUDE_PATH}
59         ${ZLIB_INCLUDE_DIRS}
60 )
61
62 set(SRC
63         intern/CCGSubSurf.c
64         intern/DerivedMesh.c
65         intern/action.c
66         intern/addon.c
67         intern/anim.c
68         intern/anim_sys.c
69         intern/appdir.c
70         intern/armature.c
71         intern/armature_update.c
72         intern/autoexec.c
73         intern/blender.c
74         intern/bmfont.c
75         intern/boids.c
76         intern/bpath.c
77         intern/brush.c
78         intern/bullet.c
79         intern/bvhutils.c
80         intern/camera.c
81         intern/cdderivedmesh.c
82         intern/cloth.c
83         intern/collision.c
84         intern/colortools.c
85         intern/constraint.c
86         intern/context.c
87         intern/crazyspace.c
88         intern/curve.c
89         intern/customdata.c
90         intern/customdata_file.c
91         intern/data_transfer.c
92         intern/deform.c
93         intern/depsgraph.c
94         intern/displist.c
95         intern/dynamicpaint.c
96         intern/editderivedmesh.c
97         intern/editmesh.c
98         intern/editmesh_bvh.c
99         intern/effect.c
100         intern/fcurve.c
101         intern/fluidsim.c
102         intern/fmodifier.c
103         intern/font.c
104         intern/freestyle.c
105         intern/gpencil.c
106         intern/group.c
107         intern/icons.c
108         intern/idcode.c
109         intern/idprop.c
110         intern/image.c
111         intern/image_gen.c
112         intern/ipo.c
113         intern/key.c
114         intern/lamp.c
115         intern/lattice.c
116         intern/library.c
117         intern/library_query.c
118         intern/linestyle.c
119         intern/mask.c
120         intern/mask_evaluate.c
121         intern/mask_rasterize.c
122         intern/material.c
123         intern/mball.c
124         intern/mball_tessellate.c
125         intern/mesh.c
126         intern/mesh_evaluate.c
127         intern/mesh_mapping.c
128         intern/mesh_remap.c
129         intern/mesh_validate.c
130         intern/modifier.c
131         intern/modifiers_bmesh.c
132         intern/movieclip.c
133         intern/multires.c
134         intern/nla.c
135         intern/node.c
136         intern/object.c
137         intern/object_deform.c
138         intern/object_dupli.c
139         intern/object_update.c
140         intern/ocean.c
141         intern/outliner_treehash.c
142         intern/packedFile.c
143         intern/paint.c
144         intern/particle.c
145         intern/particle_child.c
146         intern/particle_distribute.c
147         intern/particle_system.c
148         intern/pbvh.c
149         intern/pbvh_bmesh.c
150         intern/pointcache.c
151         intern/property.c
152         intern/report.c
153         intern/rigidbody.c
154         intern/sca.c
155         intern/scene.c
156         intern/screen.c
157         intern/seqcache.c
158         intern/seqeffects.c
159         intern/seqmodifier.c
160         intern/sequencer.c
161         intern/shrinkwrap.c
162         intern/sketch.c
163         intern/smoke.c
164         intern/softbody.c
165         intern/sound.c
166         intern/speaker.c
167         intern/subsurf_ccg.c
168         intern/suggestions.c
169         intern/text.c
170         intern/texture.c
171         intern/tracking.c
172         intern/tracking_auto.c
173         intern/tracking_detect.c
174         intern/tracking_plane_tracker.c
175         intern/tracking_region_tracker.c
176         intern/tracking_solver.c
177         intern/tracking_stabilize.c
178         intern/tracking_util.c
179         intern/unit.c
180         intern/world.c
181         intern/writeavi.c
182         intern/writeframeserver.c
183
184         BKE_DerivedMesh.h
185         BKE_action.h
186         BKE_addon.h
187         BKE_anim.h
188         BKE_animsys.h
189         BKE_appdir.h
190         BKE_armature.h
191         BKE_autoexec.h
192         BKE_blender.h
193         BKE_bmfont.h
194         BKE_bmfont_types.h
195         BKE_boids.h
196         BKE_bpath.h
197         BKE_brush.h
198         BKE_bullet.h
199         BKE_bvhutils.h
200         BKE_camera.h
201         BKE_ccg.h
202         BKE_cdderivedmesh.h
203         BKE_cloth.h
204         BKE_collision.h
205         BKE_colortools.h
206         BKE_constraint.h
207         BKE_context.h
208         BKE_crazyspace.h
209         BKE_curve.h
210         BKE_customdata.h
211         BKE_customdata_file.h
212         BKE_data_transfer.h
213         BKE_deform.h
214         BKE_depsgraph.h
215         BKE_displist.h
216         BKE_dynamicpaint.h
217         BKE_editmesh.h
218         BKE_editmesh_bvh.h
219         BKE_effect.h
220         BKE_fcurve.h
221         BKE_fluidsim.h
222         BKE_font.h
223         BKE_freestyle.h
224         BKE_global.h
225         BKE_gpencil.h
226         BKE_group.h
227         BKE_icons.h
228         BKE_idcode.h
229         BKE_idprop.h
230         BKE_image.h
231         BKE_ipo.h
232         BKE_key.h
233         BKE_lamp.h
234         BKE_lattice.h
235         BKE_library.h
236         BKE_library_query.h
237         BKE_linestyle.h
238         BKE_main.h
239         BKE_mask.h
240         BKE_material.h
241         BKE_mball.h
242         BKE_mball_tessellate.h
243         BKE_mesh.h
244         BKE_mesh_mapping.h
245         BKE_mesh_remap.h
246         BKE_modifier.h
247         BKE_movieclip.h
248         BKE_multires.h
249         BKE_nla.h
250         BKE_node.h
251         BKE_object.h
252         BKE_object_deform.h
253         BKE_ocean.h
254         BKE_outliner_treehash.h
255         BKE_packedFile.h
256         BKE_paint.h
257         BKE_particle.h
258         BKE_pbvh.h
259         BKE_pointcache.h
260         BKE_property.h
261         BKE_report.h
262         BKE_rigidbody.h
263         BKE_sca.h
264         BKE_scene.h
265         BKE_screen.h
266         BKE_sequencer.h
267         BKE_shrinkwrap.h
268         BKE_sketch.h
269         BKE_smoke.h
270         BKE_softbody.h
271         BKE_sound.h
272         BKE_speaker.h
273         BKE_subsurf.h
274         BKE_suggestions.h
275         BKE_text.h
276         BKE_texture.h
277         BKE_tracking.h
278         BKE_unit.h
279         BKE_utildefines.h
280         BKE_world.h
281         BKE_writeavi.h
282         BKE_writeframeserver.h
283
284         depsgraph_private.h
285         nla_private.h
286         tracking_private.h
287         intern/CCGSubSurf.h
288         intern/pbvh_intern.h
289         intern/data_transfer_intern.h
290 )
291
292 if(WITH_BINRELOC)
293         list(APPEND INC_SYS
294                 ${BINRELOC_INCLUDE_DIRS}
295         )
296         add_definitions(-DWITH_BINRELOC)
297 endif()
298
299 add_definitions(${GL_DEFINITIONS})
300
301 if(WIN32)
302         list(APPEND INC
303                 ../../../intern/utfconv
304         )
305 endif()
306
307 if(WITH_AUDASPACE)
308         list(APPEND INC
309                 ../../../intern/audaspace/intern
310         )
311         add_definitions(-DWITH_AUDASPACE)
312 endif()
313
314 if(WITH_BULLET)
315         list(APPEND INC_SYS
316                 ${BULLET_INCLUDE_DIRS}
317         )
318         list(APPEND INC
319                 ../../../intern/rigidbody
320         )
321         add_definitions(-DWITH_BULLET)
322 endif()
323
324 #if(WITH_MOD_CLOTH_ELTOPO)
325 #       list(APPEND INC
326 #               ../../../extern/eltopo
327 #               ../../../extern/eltopo/eltopo3d
328 #       )
329 #       add_definitions(-DWITH_ELTOPO)
330 #endif()
331
332 if(WITH_IMAGE_OPENEXR)
333         add_definitions(-DWITH_OPENEXR)
334 endif()
335
336 if(WITH_IMAGE_TIFF)
337         add_definitions(-DWITH_TIFF)
338 endif()
339
340 if(WITH_OPENIMAGEIO)
341         add_definitions(-DWITH_OPENIMAGEIO)
342 endif()
343
344 if(WITH_IMAGE_OPENJPEG)
345         add_definitions(-DWITH_OPENJPEG)
346 endif()
347
348 if(WITH_IMAGE_DDS)
349         add_definitions(-DWITH_DDS)
350 endif()
351
352 if(WITH_IMAGE_CINEON)
353         add_definitions(-DWITH_CINEON)
354 endif()
355
356 if(WITH_IMAGE_FRAMESERVER)
357         add_definitions(-DWITH_FRAMESERVER)
358 endif()
359
360 if(WITH_IMAGE_HDR)
361         add_definitions(-DWITH_HDR)
362 endif()
363
364 if(WITH_CODEC_AVI)
365         list(APPEND INC
366                 ../avi
367         )
368         add_definitions(-DWITH_AVI)
369 endif()
370
371 if(WITH_CODEC_QUICKTIME)
372         list(APPEND INC
373                 ../quicktime
374         )
375         list(APPEND INC_SYS
376                 ${QUICKTIME_INCLUDE_DIRS}
377         )
378         add_definitions(-DWITH_QUICKTIME)
379 endif()
380
381 if(WITH_CODEC_FFMPEG)
382         list(APPEND SRC
383                 intern/writeffmpeg.c
384                 BKE_writeffmpeg.h
385         )
386         list(APPEND INC
387                 ../../../intern/ffmpeg
388         )
389         list(APPEND INC_SYS
390                 ${FFMPEG_INCLUDE_DIRS}
391         )
392         add_definitions(-DWITH_FFMPEG)
393
394         remove_strict_flags_file(
395                 intern/writeffmpeg.c
396         )
397 endif()
398
399 if(WITH_PYTHON)
400         list(APPEND INC
401                 ../python
402         )
403         add_definitions(-DWITH_PYTHON)
404
405         if(WITH_PYTHON_SECURITY)
406                 add_definitions(-DWITH_PYTHON_SECURITY)
407         endif()
408 endif()
409
410 if(WITH_MOD_FLUID)
411         list(APPEND INC
412                 ../../../intern/elbeem/extern
413         )
414         add_definitions(-DWITH_MOD_FLUID)
415 endif()
416
417 if(WITH_MOD_SMOKE)
418         add_definitions(-DWITH_SMOKE)
419 endif()
420
421 if(WITH_MOD_OCEANSIM)
422         add_definitions(-DWITH_OCEANSIM)
423 endif()
424
425 if(WITH_JACK)
426         add_definitions(-DWITH_JACK)
427 endif()
428
429 if(WITH_LZO)
430         if(WITH_SYSTEM_LZO)
431                 list(APPEND INC_SYS
432                         ${LZO_INCLUDE_DIR}
433                 )
434                 add_definitions(-DWITH_SYSTEM_LZO)
435         else()
436                 list(APPEND INC_SYS
437                         ../../../extern/lzo/minilzo
438                 )
439         endif()
440         add_definitions(-DWITH_LZO)
441 endif()
442
443 if(WITH_LZMA)
444         list(APPEND INC_SYS
445                 ../../../extern/lzma
446         )
447         add_definitions(-DWITH_LZMA)
448 endif()
449
450 if(WITH_GAMEENGINE)
451         list(APPEND INC_SYS
452                 ../../../extern/recastnavigation
453         )
454         list(APPEND SRC
455                 intern/navmesh_conversion.c
456                 BKE_navmesh_conversion.h
457         )
458
459         add_definitions(-DWITH_GAMEENGINE)
460 endif()
461
462 if(WITH_LIBMV)
463         add_definitions(-DWITH_LIBMV)
464 endif()
465
466 if(WITH_LIBMV_WERROR)
467         if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
468                 set_source_files_properties(intern/tracking.c
469                                             intern/tracking_auto.c
470                                             intern/tracking_detect.c
471                                             intern/tracking_plane_tracker.c
472                                             intern/tracking_region_tracker.c
473                                             intern/tracking_solver.c
474                                             intern/tracking_stabilize.c
475                                             intern/tracking_util.c
476                                             PROPERTIES COMPILE_FLAGS -Werror)
477         endif()
478 endif()
479
480 if(WITH_FFTW3)
481         list(APPEND INC_SYS
482                 ${FFTW3_INCLUDE_DIRS}
483         )
484         add_definitions(-DFFTW3=1)
485 endif()
486
487 if(WITH_INTERNATIONAL)
488         add_definitions(-DWITH_INTERNATIONAL)
489 endif()
490
491 if(WITH_FREESTYLE)
492         add_definitions(-DWITH_FREESTYLE)
493 endif()
494
495 ## Warnings as errors, this is too strict!
496 #if(MSVC)
497 #       set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX")
498 #endif()
499
500 if(WITH_LEGACY_DEPSGRAPH)
501         add_definitions(-DWITH_LEGACY_DEPSGRAPH)
502 endif()
503
504 blender_add_lib(bf_blenkernel "${SRC}" "${INC}" "${INC_SYS}")