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