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