Merge branch 'master' into soc-2018-npr Fix errors
[blender.git] / source / blender / makesrna / intern / 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 # ***** END GPL LICENSE BLOCK *****
20
21 if(CMAKE_COMPILER_IS_GNUCC)
22   # add here so we fail early.
23   set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=implicit-function-declaration")
24 endif()
25
26 # files rna_access.c rna_define.c makesrna.c intentionally excluded.
27 set(DEFSRC
28         rna_ID.c
29         rna_action.c
30         rna_animation.c
31         rna_animviz.c
32         rna_armature.c
33         rna_boid.c
34         rna_brush.c
35         rna_cachefile.c
36         rna_camera.c
37         rna_cloth.c
38         rna_collection.c
39         rna_color.c
40         rna_constraint.c
41         rna_context.c
42         rna_curve.c
43         rna_depsgraph.c
44         rna_dynamicpaint.c
45         rna_fcurve.c
46         rna_fluidsim.c
47         rna_gpencil.c
48         rna_gpencil_modifier.c
49         rna_image.c
50         rna_key.c
51         rna_lattice.c
52         rna_layer.c
53         rna_light.c
54         rna_lightprobe.c
55         rna_linestyle.c
56         rna_lanpr.c
57         rna_main.c
58         rna_mask.c
59         rna_material.c
60         rna_mesh.c
61         rna_meta.c
62         rna_modifier.c
63         rna_movieclip.c
64         rna_nla.c
65         rna_nodetree.c
66         rna_object.c
67         rna_object_force.c
68         rna_packedfile.c
69         rna_palette.c
70         rna_particle.c
71         rna_pose.c
72         rna_render.c
73         rna_rigidbody.c
74         rna_rna.c
75         rna_scene.c
76         rna_screen.c
77         rna_sculpt_paint.c
78         rna_sequencer.c
79         rna_shader_fx.c
80         rna_smoke.c
81         rna_sound.c
82         rna_space.c
83         rna_speaker.c
84         rna_test.c
85         rna_text.c
86         rna_texture.c
87         rna_timeline.c
88         rna_tracking.c
89         rna_ui.c
90         rna_userdef.c
91         rna_vfont.c
92         rna_wm.c
93         rna_wm_gizmo.c
94         rna_workspace.c
95         rna_world.c
96 )
97
98 set(APISRC
99   rna_action_api.c
100   rna_animation_api.c
101   rna_armature_api.c
102   rna_camera_api.c
103   rna_curve_api.c
104   rna_fcurve_api.c
105   rna_image_api.c
106   rna_lattice_api.c
107   rna_main_api.c
108   rna_material_api.c
109   rna_mesh_api.c
110   rna_meta_api.c
111   rna_object_api.c
112   rna_pose_api.c
113   rna_scene_api.c
114   rna_sequencer_api.c
115   rna_sound_api.c
116   rna_space_api.c
117   rna_text_api.c
118   rna_texture_api.c
119   rna_ui_api.c
120   rna_vfont_api.c
121   rna_wm_api.c
122   rna_wm_gizmo_api.c
123   rna_workspace_api.c
124 )
125
126 string(REGEX REPLACE "rna_([a-zA-Z0-9_-]*).c" "${CMAKE_CURRENT_BINARY_DIR}/rna_\\1_gen.c" GENSRC "${DEFSRC}")
127 list(APPEND GENSRC
128   "${CMAKE_CURRENT_BINARY_DIR}/rna_prototypes_gen.h"
129 )
130 set_source_files_properties(${GENSRC} PROPERTIES GENERATED TRUE)
131
132 # --------------------------
133 # CFLAGS for Generated Files
134 #
135 # less strict flags for generated source
136 set(GENSRC_CFLAGS)
137 if(CMAKE_COMPILER_IS_GNUCC OR (CMAKE_C_COMPILER_ID MATCHES "Clang"))
138   set(GENSRC_CFLAGS "-Wno-missing-prototypes")
139 endif()
140 if(CMAKE_C_COMPILER_ID MATCHES "Clang")
141   set(GENSRC_CFLAGS "${GENSRC_CFLAGS} -Wno-missing-variable-declarations")
142 endif()
143
144 if(GENSRC_CFLAGS)
145   set_source_files_properties(${GENSRC} PROPERTIES COMPILE_FLAGS "${GENSRC_CFLAGS}")
146 endif()
147 unset(GENSRC_CFLAGS)
148
149
150 set(SRC_RNA_INC
151   ../RNA_access.h
152   ../RNA_define.h
153   ../RNA_documentation.h
154   ../RNA_enum_types.h
155   ../RNA_types.h
156 )
157
158 set(SRC
159   makesrna.c
160   rna_define.c
161   ${DEFSRC}
162   ${APISRC}
163   ../../../../intern/clog/clog.c
164   ../../../../intern/guardedalloc/intern/mallocn.c
165   ../../../../intern/guardedalloc/intern/mallocn_guarded_impl.c
166   ../../../../intern/guardedalloc/intern/mallocn_lockfree_impl.c
167   ../../../../intern/guardedalloc/intern/mmap_win.c
168 )
169
170 set(INC
171     ../../../../intern/clog
172 )
173
174 set(INC_SYS
175
176 )
177
178 if(WITH_CYCLES)
179   add_definitions(-DWITH_CYCLES)
180 endif()
181
182 if(WITH_PYTHON)
183   add_definitions(-DWITH_PYTHON)
184   list(APPEND INC
185     ../../python
186   )
187 endif()
188
189 if(WITH_IMAGE_OPENEXR)
190   add_definitions(-DWITH_OPENEXR)
191 endif()
192
193 if(WITH_OPENIMAGEIO)
194   add_definitions(-DWITH_OPENIMAGEIO)
195 endif()
196
197 if(WITH_IMAGE_TIFF)
198   add_definitions(-DWITH_TIFF)
199 endif()
200
201 if(WITH_IMAGE_OPENJPEG)
202   add_definitions(-DWITH_OPENJPEG)
203 endif()
204
205 if(WITH_IMAGE_DDS)
206   add_definitions(-DWITH_DDS)
207 endif()
208
209 if(WITH_IMAGE_CINEON)
210   add_definitions(-DWITH_CINEON)
211 endif()
212
213 if(WITH_IMAGE_HDR)
214   add_definitions(-DWITH_HDR)
215 endif()
216
217 if(WITH_AUDASPACE)
218   add_definitions(-DWITH_AUDASPACE)
219
220   list(APPEND INC_SYS
221     ${AUDASPACE_C_INCLUDE_DIRS}
222   )
223 endif()
224
225 if(WITH_CODEC_FFMPEG)
226   list(APPEND INC
227     ../../../../intern/ffmpeg
228   )
229   list(APPEND INC_SYS
230     ${FFMPEG_INCLUDE_DIRS}
231   )
232   add_definitions(-DWITH_FFMPEG)
233 endif()
234
235 if(WITH_MOD_FLUID)
236   add_definitions(-DWITH_MOD_FLUID)
237 endif()
238
239 if(WITH_FFTW3)
240   add_definitions(-DWITH_FFTW3)
241 endif()
242
243 if(WITH_MOD_SMOKE)
244   add_definitions(-DWITH_SMOKE)
245 endif()
246
247 if(WITH_MOD_OCEANSIM)
248   add_definitions(-DWITH_OCEANSIM)
249 endif()
250
251 if(WITH_SDL)
252   if(WITH_SDL_DYNLOAD)
253     add_definitions(-DWITH_SDL_DYNLOAD)
254     list(APPEND INC
255       ../../../../extern/sdlew/include
256     )
257   endif()
258   add_definitions(-DWITH_SDL)
259 endif()
260
261 if(WITH_OPENAL)
262   add_definitions(-DWITH_OPENAL)
263 endif()
264
265 if(WITH_JACK)
266   add_definitions(-DWITH_JACK)
267 endif()
268
269 if(WITH_OPENCOLLADA)
270   add_definitions(-DWITH_COLLADA)
271 endif()
272
273 if(WITH_INTERNATIONAL)
274   add_definitions(-DWITH_INTERNATIONAL)
275 endif()
276
277 if(WITH_ALEMBIC)
278   list(APPEND INC
279     ../../alembic
280   )
281   add_definitions(-DWITH_ALEMBIC)
282 endif()
283
284 if(WITH_BULLET)
285   list(APPEND INC
286     ../../../../intern/rigidbody
287   )
288   add_definitions(-DWITH_BULLET)
289 endif()
290
291 if(WITH_FREESTYLE)
292   list(APPEND INC
293     ../../freestyle
294   )
295   add_definitions(-DWITH_FREESTYLE)
296 endif()
297
298 if(WITH_OPENSUBDIV)
299   list(APPEND INC
300     ../../../../intern/opensubdiv
301   )
302   add_definitions(-DWITH_OPENSUBDIV)
303 endif()
304
305 if(WITH_OPENVDB)
306   add_definitions(-DWITH_OPENVDB)
307
308   if(WITH_OPENVDB_BLOSC)
309     add_definitions(-DWITH_OPENVDB_BLOSC)
310   endif()
311 endif()
312
313 if(WITH_INPUT_NDOF)
314   add_definitions(-DWITH_INPUT_NDOF)
315 endif()
316
317 # Build makesrna executable
318 blender_include_dirs(
319   .
320   ..
321   ../../blenfont
322   ../../blenkernel
323   ../../blenlib
324   ../../bmesh
325   ../../blentranslation
326   ../../depsgraph
327   ../../draw
328   ../../gpu
329   ../../imbuf
330   ../../ikplugin
331   ../../makesdna
332   ../../nodes/
333   ../../physics
334   ../../windowmanager
335   ../../editors/include
336   ../../render/extern/include
337   ../../../../intern/cycles/blender
338   ../../../../intern/guardedalloc
339   ../../../../intern/glew-mx
340   ../../../../intern/atomic
341   ../../../../intern/memutil
342   ../../../../intern/smoke/extern
343 )
344
345 blender_include_dirs_sys(
346   "${GLEW_INCLUDE_PATH}"
347 )
348
349 add_cc_flags_custom_test(makesrna)
350 setup_platform_linker_flags()
351
352 add_executable(makesrna ${SRC} ${SRC_RNA_INC} ${SRC_DNA_INC})
353
354 target_link_libraries(makesrna bf_dna)
355 target_link_libraries(makesrna bf_dna_blenlib)
356
357 # Output rna_*_gen.c
358 # note (linux only): with crashes try add this after COMMAND: valgrind --leak-check=full --track-origins=yes
359 add_custom_command(
360   OUTPUT ${GENSRC}
361   COMMAND "$<TARGET_FILE:makesrna>" ${CMAKE_CURRENT_BINARY_DIR}/
362   DEPENDS makesrna
363 )
364
365 # Build bf_rna
366 set(SRC
367   rna_access.c
368   ${GENSRC}
369
370   ${SRC_RNA_INC}
371   rna_internal.h
372   rna_internal_types.h
373   rna_mesh_utils.h
374 )
375
376 set(LIB
377   bf_dna
378   bf_editor_armature
379   bf_editor_curve
380   bf_editor_gizmo_library
381   bf_editor_gpencil
382   bf_editor_mesh
383   bf_editor_object
384   bf_editor_physics
385   bf_editor_render
386   bf_editor_scene
387   bf_editor_sculpt_paint
388   bf_editor_space_clip
389   bf_editor_space_file
390   bf_editor_space_image
391   bf_editor_space_info
392   bf_editor_space_node
393   bf_editor_space_view3d
394   bf_editor_transform
395 )
396
397 add_definitions(${GL_DEFINITIONS})
398
399 blender_add_lib(bf_rna "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")