Include SDL information in system info text.
[blender.git] / source / blender / python / intern / bpy_app_build_options.c
1 /*
2  * ***** BEGIN GPL LICENSE BLOCK *****
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software Foundation,
16  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  *
18  * Contributor(s): Sergey Sharybin
19  *
20  * ***** END GPL LICENSE BLOCK *****
21  */
22
23 /** \file blender/python/intern/bpy_app_build_options.c
24  *  \ingroup pythonintern
25  */
26
27 #include <Python.h>
28
29 #include "BLI_utildefines.h"
30
31 #include "bpy_app_build_options.h"
32
33 static PyTypeObject BlenderAppBuildOptionsType;
34
35 static PyStructSequence_Field app_builtopts_info_fields[] = {
36         /* names mostly follow CMake options, lowercase, after WITH_ */
37         {(char *)"bullet", NULL},
38         {(char *)"codec_avi", NULL},
39         {(char *)"codec_ffmpeg", NULL},
40         {(char *)"codec_quicktime", NULL},
41         {(char *)"codec_sndfile", NULL},
42         {(char *)"compositor", NULL},
43         {(char *)"cycles", NULL},
44         {(char *)"cycles_osl", NULL},
45         {(char *)"freestyle", NULL},
46         {(char *)"gameengine", NULL},
47         {(char *)"image_cineon", NULL},
48         {(char *)"image_dds", NULL},
49         {(char *)"image_frameserver", NULL},
50         {(char *)"image_hdr", NULL},
51         {(char *)"image_openexr", NULL},
52         {(char *)"image_openjpeg", NULL},
53         {(char *)"image_redcode", NULL},
54         {(char *)"image_tiff", NULL},
55         {(char *)"input_ndof", NULL},
56         {(char *)"audaspace", NULL},
57         {(char *)"international", NULL},
58         {(char *)"openal", NULL},
59         {(char *)"sdl", NULL},
60         {(char *)"sdl_dynload", NULL},
61         {(char *)"jack", NULL},
62         {(char *)"libmv", NULL},
63         {(char *)"mod_boolean", NULL},
64         {(char *)"mod_fluid", NULL},
65         {(char *)"mod_oceansim", NULL},
66         {(char *)"mod_remesh", NULL},
67         {(char *)"mod_smoke", NULL},
68         {(char *)"collada", NULL},
69         {(char *)"opencolorio", NULL},
70         {(char *)"player", NULL},
71         {(char *)"openmp", NULL},
72         {NULL}
73 };
74
75
76 static PyStructSequence_Desc app_builtopts_info_desc = {
77         (char *)"bpy.app.build_options",     /* name */
78         (char *)"This module contains information about options blender is built with",    /* doc */
79         app_builtopts_info_fields,    /* fields */
80         ARRAY_SIZE(app_builtopts_info_fields) - 1
81 };
82
83 static PyObject *make_builtopts_info(void)
84 {
85         PyObject *builtopts_info;
86         int pos = 0;
87
88         builtopts_info = PyStructSequence_New(&BlenderAppBuildOptionsType);
89         if (builtopts_info == NULL) {
90                 return NULL;
91         }
92
93 #define SetObjIncref(item) \
94         PyStructSequence_SET_ITEM(builtopts_info, pos++, (Py_IncRef(item), item))
95
96 #ifdef WITH_BULLET
97         SetObjIncref(Py_True);
98 #else
99         SetObjIncref(Py_False);
100 #endif
101
102 #ifdef WITH_AVI
103         SetObjIncref(Py_True);
104 #else
105         SetObjIncref(Py_False);
106 #endif
107
108 #ifdef WITH_FFMPEG
109         SetObjIncref(Py_True);
110 #else
111         SetObjIncref(Py_False);
112 #endif
113
114 #ifdef WITH_QUICKTIME
115         SetObjIncref(Py_True);
116 #else
117         SetObjIncref(Py_False);
118 #endif
119
120 #ifdef WITH_SNDFILE
121         SetObjIncref(Py_True);
122 #else
123         SetObjIncref(Py_False);
124 #endif
125
126 #ifdef WITH_COMPOSITOR
127         SetObjIncref(Py_True);
128 #else
129         SetObjIncref(Py_False);
130 #endif
131
132 #ifdef WITH_CYCLES
133         SetObjIncref(Py_True);
134 #else
135         SetObjIncref(Py_False);
136 #endif
137
138 #ifdef WITH_CYCLES_OSL
139         SetObjIncref(Py_True);
140 #else
141         SetObjIncref(Py_False);
142 #endif
143
144 #ifdef WITH_FREESTYLE
145         SetObjIncref(Py_True);
146 #else
147         SetObjIncref(Py_False);
148 #endif
149
150 #ifdef WITH_GAMEENGINE
151         SetObjIncref(Py_True);
152 #else
153         SetObjIncref(Py_False);
154 #endif
155
156 #ifdef WITH_CINEON
157         SetObjIncref(Py_True);
158 #else
159         SetObjIncref(Py_False);
160 #endif
161
162 #ifdef WITH_DDS
163         SetObjIncref(Py_True);
164 #else
165         SetObjIncref(Py_False);
166 #endif
167
168 #ifdef WITH_FRAMESERVER
169         SetObjIncref(Py_True);
170 #else
171         SetObjIncref(Py_False);
172 #endif
173
174 #ifdef WITH_HDR
175         SetObjIncref(Py_True);
176 #else
177         SetObjIncref(Py_False);
178 #endif
179
180 #ifdef WITH_OPENEXR
181         SetObjIncref(Py_True);
182 #else
183         SetObjIncref(Py_False);
184 #endif
185
186 #ifdef WITH_OPENJPEG
187         SetObjIncref(Py_True);
188 #else
189         SetObjIncref(Py_False);
190 #endif
191
192 #ifdef WITH_REDCODE
193         SetObjIncref(Py_True);
194 #else
195         SetObjIncref(Py_False);
196 #endif
197
198 #ifdef WITH_TIFF
199         SetObjIncref(Py_True);
200 #else
201         SetObjIncref(Py_False);
202 #endif
203
204 #ifdef WITH_INPUT_NDOF
205         SetObjIncref(Py_True);
206 #else
207         SetObjIncref(Py_False);
208 #endif
209
210 #ifdef WITH_AUDASPACE
211         SetObjIncref(Py_True);
212 #else
213         SetObjIncref(Py_False);
214 #endif
215
216 #ifdef WITH_INTERNATIONAL
217         SetObjIncref(Py_True);
218 #else
219         SetObjIncref(Py_False);
220 #endif
221
222 #ifdef WITH_OPENAL
223         SetObjIncref(Py_True);
224 #else
225         SetObjIncref(Py_False);
226 #endif
227
228 #ifdef WITH_SDL
229         SetObjIncref(Py_True);
230 #else
231         SetObjIncref(Py_False);
232 #endif
233
234 #ifdef WITH_SDL_DYNLOAD
235         SetObjIncref(Py_True);
236 #else
237         SetObjIncref(Py_False);
238 #endif
239
240 #ifdef WITH_JACK
241         SetObjIncref(Py_True);
242 #else
243         SetObjIncref(Py_False);
244 #endif
245
246 #ifdef WITH_LIBMV
247         SetObjIncref(Py_True);
248 #else
249         SetObjIncref(Py_False);
250 #endif
251
252 #ifdef WITH_MOD_BOOLEAN
253         SetObjIncref(Py_True);
254 #else
255         SetObjIncref(Py_False);
256 #endif
257
258 #ifdef WITH_MOD_FLUID
259         SetObjIncref(Py_True);
260 #else
261         SetObjIncref(Py_False);
262 #endif
263
264 #ifdef WITH_OCEANSIM
265         SetObjIncref(Py_True);
266 #else
267         SetObjIncref(Py_False);
268 #endif
269
270 #ifdef WITH_MOD_REMESH
271         SetObjIncref(Py_True);
272 #else
273         SetObjIncref(Py_False);
274 #endif
275
276 #ifdef WITH_SMOKE
277         SetObjIncref(Py_True);
278 #else
279         SetObjIncref(Py_False);
280 #endif
281
282 #ifdef WITH_COLLADA
283         SetObjIncref(Py_True);
284 #else
285         SetObjIncref(Py_False);
286 #endif
287
288 #ifdef WITH_OCIO
289         SetObjIncref(Py_True);
290 #else
291         SetObjIncref(Py_False);
292 #endif
293
294 #ifdef WITH_PLAYER
295         SetObjIncref(Py_True);
296 #else
297         SetObjIncref(Py_False);
298 #endif
299
300 #ifdef _OPENMP
301         SetObjIncref(Py_True);
302 #else
303         SetObjIncref(Py_False);
304 #endif
305
306 #undef SetObjIncref
307
308         return builtopts_info;
309 }
310
311 PyObject *BPY_app_build_options_struct(void)
312 {
313         PyObject *ret;
314
315         PyStructSequence_InitType(&BlenderAppBuildOptionsType, &app_builtopts_info_desc);
316
317         ret = make_builtopts_info();
318
319         /* prevent user from creating new instances */
320         BlenderAppBuildOptionsType.tp_init = NULL;
321         BlenderAppBuildOptionsType.tp_new = NULL;
322         BlenderAppBuildOptionsType.tp_hash = (hashfunc)_Py_HashPointer; /* without this we can't do set(sys.modules) [#29635] */
323
324         return ret;
325 }