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