Fix build error on Windows 32 bit.
[blender-staging.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_actuator.c
36         rna_animation.c
37         rna_animviz.c
38         rna_armature.c
39         rna_boid.c
40         rna_brush.c
41         rna_cachefile.c
42         rna_camera.c
43         rna_cloth.c
44         rna_color.c
45         rna_constraint.c
46         rna_context.c
47         rna_controller.c
48         rna_curve.c
49         rna_depsgraph.c
50         rna_dynamicpaint.c
51         rna_fcurve.c
52         rna_fluidsim.c
53         rna_gpencil.c
54         rna_group.c
55         rna_image.c
56         rna_key.c
57         rna_lamp.c
58         rna_lattice.c
59         rna_linestyle.c
60         rna_main.c
61         rna_mask.c
62         rna_material.c
63         rna_mesh.c
64         rna_meta.c
65         rna_modifier.c
66         rna_movieclip.c
67         rna_nla.c
68         rna_nodetree.c
69         rna_object.c
70         rna_object_force.c
71         rna_packedfile.c
72         rna_palette.c
73         rna_particle.c
74         rna_pose.c
75         rna_property.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_sensor.c
83         rna_sequencer.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_world.c
98 )
99
100 set(APISRC
101         rna_action_api.c
102         rna_actuator_api.c
103         rna_animation_api.c
104         rna_armature_api.c
105         rna_camera_api.c
106         rna_controller_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_sensor_api.c
120         rna_sequencer_api.c
121         rna_sound_api.c
122         rna_space_api.c
123         rna_text_api.c
124         rna_ui_api.c
125         rna_vfont_api.c
126         rna_wm_api.c
127 )
128
129 string(REGEX REPLACE "rna_([a-zA-Z0-9_-]*).c" "${CMAKE_CURRENT_BINARY_DIR}/rna_\\1_gen.c" GENSRC "${DEFSRC}")
130 list(APPEND GENSRC
131         "${CMAKE_CURRENT_BINARY_DIR}/rna_prototypes_gen.h"
132 )
133 set_source_files_properties(${GENSRC} PROPERTIES GENERATED TRUE)
134
135 # --------------------------
136 # CFLAGS for Generated Files
137 #
138 # less strict flags for generated source
139 set(GENSRC_CFLAGS)
140 if(CMAKE_COMPILER_IS_GNUCC OR (CMAKE_C_COMPILER_ID MATCHES "Clang"))
141         set(GENSRC_CFLAGS "-Wno-missing-prototypes")
142 endif()
143 if(CMAKE_C_COMPILER_ID MATCHES "Clang")
144         set(GENSRC_CFLAGS "${GENSRC_CFLAGS} -Wno-missing-variable-declarations")
145 endif()
146
147 if(GENSRC_CFLAGS)
148         set_source_files_properties(${GENSRC} PROPERTIES COMPILE_FLAGS "${GENSRC_CFLAGS}")
149 endif()
150 unset(GENSRC_CFLAGS)
151
152
153 set(SRC_RNA_INC
154         ../RNA_access.h
155         ../RNA_define.h
156         ../RNA_documentation.h
157         ../RNA_enum_types.h
158         ../RNA_types.h
159 )
160
161 set(SRC
162         makesrna.c
163         rna_define.c
164         ${DEFSRC}
165         ${APISRC}
166         ../../../../intern/guardedalloc/intern/mallocn.c
167         ../../../../intern/guardedalloc/intern/mallocn_guarded_impl.c
168         ../../../../intern/guardedalloc/intern/mallocn_lockfree_impl.c
169         ../../../../intern/guardedalloc/intern/mmap_win.c
170 )
171
172 set(INC
173
174 )
175
176 set(INC_SYS
177
178 )
179
180 if(WITH_CYCLES)
181         add_definitions(-DWITH_CYCLES)
182 endif()
183
184 if(WITH_PYTHON)
185         add_definitions(-DWITH_PYTHON)
186         list(APPEND INC
187                 ../../python
188         )
189 endif()
190
191 if(WITH_GAMEENGINE)
192         add_definitions(-DWITH_GAMEENGINE)
193 endif()
194
195 if(WITH_IMAGE_OPENEXR)
196         add_definitions(-DWITH_OPENEXR)
197 endif()
198
199 if(WITH_OPENIMAGEIO)
200         add_definitions(-DWITH_OPENIMAGEIO)
201 endif()
202
203 if(WITH_IMAGE_TIFF)
204         add_definitions(-DWITH_TIFF)
205 endif()
206
207 if(WITH_IMAGE_OPENJPEG)
208         add_definitions(-DWITH_OPENJPEG)
209 endif()
210
211 if(WITH_IMAGE_DDS)
212         add_definitions(-DWITH_DDS)
213 endif()
214
215 if(WITH_IMAGE_CINEON)
216         add_definitions(-DWITH_CINEON)
217 endif()
218
219 if(WITH_IMAGE_HDR)
220         add_definitions(-DWITH_HDR)
221 endif()
222
223 if(WITH_IMAGE_FRAMESERVER)
224         add_definitions(-DWITH_FRAMESERVER)
225 endif()
226
227 if(WITH_AUDASPACE)
228         add_definitions(${AUDASPACE_DEFINITIONS})
229
230         list(APPEND INC_SYS
231                 ${AUDASPACE_C_INCLUDE_DIRS}
232         )
233 endif()
234
235 if(WITH_CODEC_FFMPEG)
236         list(APPEND INC
237                 ../../../../intern/ffmpeg
238         )
239         list(APPEND INC_SYS
240                 ${FFMPEG_INCLUDE_DIRS}
241         )
242         add_definitions(-DWITH_FFMPEG)
243 endif()
244
245 if(WITH_MOD_FLUID)
246         add_definitions(-DWITH_MOD_FLUID)
247 endif()
248
249 if(WITH_FFTW3)
250         add_definitions(-DWITH_FFTW3)
251 endif()
252
253 if(WITH_MOD_SMOKE)
254         add_definitions(-DWITH_SMOKE)
255 endif()
256
257 if(WITH_MOD_OCEANSIM)
258         add_definitions(-DWITH_OCEANSIM)
259 endif()
260
261 if(WITH_SDL)
262         if(WITH_SDL_DYNLOAD)
263                 add_definitions(-DWITH_SDL_DYNLOAD)
264                 list(APPEND INC
265                         ../../../../extern/sdlew/include
266                 )
267         endif()
268         add_definitions(-DWITH_SDL)
269 endif()
270
271 if(WITH_OPENAL)
272         add_definitions(-DWITH_OPENAL)
273 endif()
274
275 if(WITH_JACK)
276         add_definitions(-DWITH_JACK)
277 endif()
278
279 if(WITH_OPENCOLLADA)
280         add_definitions(-DWITH_COLLADA)
281 endif()
282
283 if(WITH_INTERNATIONAL)
284         add_definitions(-DWITH_INTERNATIONAL)
285 endif()
286
287 if(WITH_ALEMBIC)
288         list(APPEND INC
289                 ../../alembic
290         )
291         add_definitions(-DWITH_ALEMBIC)
292 endif()
293
294 if(WITH_BULLET)
295         list(APPEND INC
296                 ../../../../intern/rigidbody
297         )
298         add_definitions(-DWITH_BULLET)
299 endif()
300
301 if(WITH_FREESTYLE)
302         list(APPEND INC
303                 ../../freestyle
304         )
305         add_definitions(-DWITH_FREESTYLE)
306 endif()
307
308 if(WITH_OPENSUBDIV)
309         list(APPEND INC
310                 ../../../../intern/opensubdiv
311         )
312         add_definitions(-DWITH_OPENSUBDIV)
313 endif()
314
315 if(WITH_OPENVDB)
316         add_definitions(-DWITH_OPENVDB)
317
318         if(WITH_OPENVDB_BLOSC)
319                 add_definitions(-DWITH_OPENVDB_BLOSC)
320         endif()
321 endif()
322
323 if(WITH_INPUT_NDOF)
324         add_definitions(-DWITH_INPUT_NDOF)
325 endif()
326
327 # Build makesrna executable
328 blender_include_dirs(
329         .
330         ..
331         ../../blenfont
332         ../../blenkernel
333         ../../blenlib
334         ../../bmesh
335         ../../blentranslation
336         ../../depsgraph
337         ../../gpu
338         ../../imbuf
339         ../../ikplugin
340         ../../makesdna
341         ../../nodes/
342         ../../physics
343         ../../windowmanager
344         ../../editors/include
345         ../../render/extern/include
346         ../../../../intern/cycles/blender
347         ../../../../intern/guardedalloc
348         ../../../../intern/glew-mx
349         ../../../../intern/atomic
350         ../../../../intern/memutil
351         ../../../../intern/smoke/extern
352 )
353
354 blender_include_dirs_sys(
355         "${GLEW_INCLUDE_PATH}"
356 )
357
358 add_cc_flags_custom_test(makesrna)
359
360 add_executable(makesrna ${SRC} ${SRC_RNA_INC} ${SRC_DNA_INC})
361
362 target_link_libraries(makesrna bf_dna)
363 target_link_libraries(makesrna bf_dna_blenlib)
364
365 # Output rna_*_gen.c
366 # note (linux only): with crashes try add this after COMMAND: valgrind --leak-check=full --track-origins=yes
367 add_custom_command(
368         OUTPUT ${GENSRC}
369         COMMAND "$<TARGET_FILE:makesrna>" ${CMAKE_CURRENT_BINARY_DIR}/
370         DEPENDS makesrna
371 )
372
373 # Build bf_rna
374 set(SRC
375         rna_access.c
376         ${GENSRC}
377
378         ${SRC_RNA_INC}
379         rna_internal.h
380         rna_internal_types.h
381         rna_mesh_utils.h
382 )
383
384 add_definitions(${GL_DEFINITIONS})
385
386 blender_add_lib(bf_rna "${SRC}" "${INC}" "${INC_SYS}")