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