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