From 7e56e5ac949155e93f5defba8be30b272745b503 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Tue, 18 Dec 2012 18:02:20 +0000 Subject: Adding "build_options" to bpy.app, a frozenset containing strings matching optional feature's build defines (like 'FFMPEG', 'MOD_BOOLEAN', 'INTERNATIONAL', etc.) for all enabled elements. Note I tried to select all interesting defines, but this might be extended if needed... --- source/blender/python/SConscript | 94 ++++++++++- source/blender/python/intern/CMakeLists.txt | 124 ++++++++++++++- source/blender/python/intern/bpy_app.c | 3 + .../blender/python/intern/bpy_app_build_options.c | 176 +++++++++++++++++++++ .../blender/python/intern/bpy_app_build_options.h | 32 ++++ 5 files changed, 419 insertions(+), 10 deletions(-) create mode 100644 source/blender/python/intern/bpy_app_build_options.c create mode 100644 source/blender/python/intern/bpy_app_build_options.h (limited to 'source/blender') diff --git a/source/blender/python/SConscript b/source/blender/python/SConscript index 6ecc77efb1f..792025458e1 100644 --- a/source/blender/python/SConscript +++ b/source/blender/python/SConscript @@ -71,16 +71,100 @@ if env['WITH_BF_PYTHON_SAFETY']: if env['BF_BUILDINFO']: defs.append('BUILD_DATE') -if env['WITH_BF_INTERNATIONAL']: - defs.append('WITH_INTERNATIONAL') -if env['WITH_BF_CYCLES']: - defs.append('WITH_CYCLES') +# Audaspace is always on currently + +if env['WITH_BF_BULLET']: + defs.append('WITH_BULLET') + +# AVI is always on currently if env['WITH_BF_FFMPEG']: defs.append('WITH_FFMPEG') incs += ' ' + env['BF_FFMPEG_INC'] - + +if env['WITH_BF_QUICKTIME']: + defs.append('WITH_QUICKTIME') + +if env['WITH_BF_SNDFILE']: + defs.append('WITH_SNDFILE') + +if env['WITH_BF_COMPOSITOR']: + defs.append('WITH_COMPOSITOR') + +if env['WITH_BF_CYCLES']: + defs.append('WITH_CYCLES') + +if env['WITH_BF_CYCLES']: + defs.append('WITH_CYCLES') + +if env['WITH_BF_CYCLES_OSL']: + defs.append('WITH_CYCLES_OSL') + +if env['WITH_BF_GAMEENGINE']: + defs.append('WITH_GAMEENGINE') + +if env['WITH_BF_CINEON']: + defs.append('WITH_CINEON') + +if env['WITH_BF_DDS']: + defs.append('WITH_DDS') + +if env['WITH_BF_FRAMESERVER']: + defs.append('WITH_FRAMESERVER') + +if env['WITH_BF_HDR']: + defs.append('WITH_HDR') + +if env['WITH_BF_OPENEXR']: + defs.append('WITH_OPENEXR') + +if env['WITH_BF_OPENJPEG']: + defs.append('WITH_OPENJPEG') + +if env['WITH_BF_REDCODE']: + defs.append('WITH_REDCODE') + +if env['WITH_BF_TIFF']: + defs.append('WITH_TIFF') + +# NDof is always on currently + +if env['WITH_BF_INTERNATIONAL']: + defs.append('WITH_INTERNATIONAL') + +if env['WITH_BF_JACK']: + defs.append('WITH_JACK') + +if env['WITH_BF_LIBMV']: + defs.append('WITH_LIBMV') + +if env['WITH_BF_BOOLEAN']: + defs.append('WITH_MOD_BOOLEAN') + +if env['WITH_BF_FLUID']: + defs.append('WITH_MOD_FLUID') + +if env['WITH_BF_OCEANSIM']: + defs.append('WITH_OCEANSIM') + +if env['WITH_BF_REMESH']: + defs.append('WITH_MOD_REMESH') + +if env['WITH_BF_SMOKE']: + defs.append('WITH_SMOKE') + +if env['WITH_BF_OPENAL']: + defs.append('WITH_OPENAL') + +if env['WITH_BF_COLLADA']: + defs.append('WITH_COLLADA') + +if env['WITH_BF_PLAYER']: + defs.append('WITH_PLAYER') + + + if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-mingw', 'linuxcross', 'win64-vc'): incs += ' ' + env['BF_PTHREADS_INC'] diff --git a/source/blender/python/intern/CMakeLists.txt b/source/blender/python/intern/CMakeLists.txt index 61c49027d9a..6f2c5a75730 100644 --- a/source/blender/python/intern/CMakeLists.txt +++ b/source/blender/python/intern/CMakeLists.txt @@ -47,6 +47,7 @@ set(SRC bpy.c bpy_app.c bpy_app_ffmpeg.c + bpy_app_build_options.c bpy_app_handlers.c bpy_driver.c bpy_interface.c @@ -68,6 +69,7 @@ set(SRC bpy.h bpy_app.h bpy_app_ffmpeg.h + bpy_app_build_options.h bpy_app_handlers.h bpy_driver.h bpy_intern_string.h @@ -96,24 +98,136 @@ if(WITH_PYTHON_SAFETY) add_definitions(-DWITH_PYTHON_SAFETY) endif() + + if(WITH_AUDASPACE) add_definitions(-DWITH_AUDASPACE) endif() -if(WITH_CYCLES) - add_definitions(-DWITH_CYCLES) +if(WITH_BULLET) + add_definitions(-DWITH_BULLET) endif() -if(WITH_INTERNATIONAL) - add_definitions(-DWITH_INTERNATIONAL) +if(WITH_CODEC_AVI) + add_definitions(-DWITH_AVI) endif() if(WITH_CODEC_FFMPEG) list(APPEND INC_SYS ${FFMPEG_INCLUDE_DIRS} ) - add_definitions(-DWITH_FFMPEG) endif() +if(WITH_CODEC_QUICKTIME) + add_definitions(-DWITH_QUICKTIME) +endif() + +if(WITH_CODEC_SNDFILE) + add_definitions(-DWITH_SNDFILE) +endif() + +if(WITH_COMPOSITOR) + add_definitions(-DWITH_COMPOSITOR) +endif() + +if(WITH_CYCLES) + add_definitions(-DWITH_CYCLES) +endif() + +if(WITH_CYCLES_OSL) + add_definitions(-DWITH_CYCLES_OSL) +endif() + +if(WITH_GAMEENGINE) + add_definitions(-DWITH_GAMEENGINE) +endif() + +if(WITH_IMAGE_CINEON) + add_definitions(-DWITH_CINEON) +endif() + +if(WITH_IMAGE_DDS) + add_definitions(-DWITH_DDS) +endif() + +if(WITH_IMAGE_FRAMESERVER) + add_definitions(-DWITH_FRAMESERVER) +endif() + +if(WITH_IMAGE_HDR) + add_definitions(-DWITH_HDR) +endif() + +if(WITH_IMAGE_OPENEXR) + add_definitions(-DWITH_OPENEXR) +endif() + +if(WITH_IMAGE_OPENJPEG) + add_definitions(-DWITH_OPENJPEG) +endif() + +if(WITH_IMAGE_REDCODE) + add_definitions(-DWITH_REDCODE) +endif() + +if(WITH_IMAGE_TIFF) + add_definitions(-DWITH_TIFF) +endif() + +if(WITH_INPUT_NDOF) + add_definitions(-DWITH_INPUT_NDOF) +endif() + +if(WITH_INTERNATIONAL) + add_definitions(-DWITH_INTERNATIONAL) +endif() + +if(WITH_JACK) + add_definitions(-DWITH_JACK) +endif() + +if(WITH_LIBMV) + add_definitions(-DWITH_LIBMV) +endif() + +if(WITH_LIBMV) + add_definitions(-DWITH_LIBMV) +endif() + +if(WITH_MOD_BOOLEAN) + add_definitions(-DWITH_MOD_BOOLEAN) +endif() + +if(WITH_MOD_FLUID) + add_definitions(-DWITH_MOD_FLUID) +endif() + +if(WITH_MOD_OCEANSIM) + add_definitions(-DWITH_OCEANSIM) +endif() + +if(WITH_MOD_REMESH) + add_definitions(-DWITH_MOD_REMESH) +endif() + +if(WITH_MOD_SMOKE) + add_definitions(-DWITH_SMOKE) +endif() + +if(WITH_OPENAL) + add_definitions(-DWITH_OPENAL) +endif() + +if(WITH_OPENCOLLADA) + add_definitions(-DWITH_COLLADA) +endif() + +if(WITH_PLAYER) + add_definitions(-DWITH_PLAYER) +endif() + + + + blender_add_lib(bf_python "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c index b1eeff8b3ae..bea63d2b6e8 100644 --- a/source/blender/python/intern/bpy_app.c +++ b/source/blender/python/intern/bpy_app.c @@ -34,6 +34,7 @@ #include "bpy_app.h" #include "bpy_app_ffmpeg.h" +#include "bpy_app_build_options.h" #include "bpy_app_handlers.h" #include "bpy_driver.h" @@ -83,6 +84,7 @@ static PyStructSequence_Field app_info_fields[] = { /* submodules */ {(char *)"ffmpeg", (char *)"FFmpeg library information backend"}, + {(char *)"build_options", (char *)"A set containing most important enabled optional build features"}, {(char *)"handlers", (char *)"Application handler callbacks"}, {NULL} }; @@ -148,6 +150,7 @@ static PyObject *make_app_info(void) #endif SetObjItem(BPY_app_ffmpeg_struct()); + SetObjItem(BPY_app_build_options_struct()); SetObjItem(BPY_app_handlers_struct()); #undef SetIntItem diff --git a/source/blender/python/intern/bpy_app_build_options.c b/source/blender/python/intern/bpy_app_build_options.c new file mode 100644 index 00000000000..607613b592c --- /dev/null +++ b/source/blender/python/intern/bpy_app_build_options.c @@ -0,0 +1,176 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Bastien Montagne + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/python/intern/bpy_app_build_options.c + * \ingroup pythonintern + */ + +#include +#include "BLI_utildefines.h" + +#include "bpy_app_build_options.h" + +static PyObject *make_build_options(void) +{ + PyObject *build_options = PyFrozenSet_New(NULL); + +#define SetStrItem(str) \ + PySet_Add(build_options, PyUnicode_FromString(str)); + +#ifdef WITH_AUDASPACE + SetStrItem("AUDASPACE"); +#endif + +#ifdef WITH_BULLET + SetStrItem("BULLET"); +#endif + +#ifdef WITH_AVI + SetStrItem("CODEC_AVI"); +#endif + +#ifdef WITH_FFMPEG + SetStrItem("CODEC_FFMPEG"); +#endif + +#ifdef WITH_QUICKTIME + SetStrItem("CODEC_QUICKTIME"); +#endif + +#ifdef WITH_SNDFILE + SetStrItem("CODEC_SNDFILE"); +#endif + +#ifdef WITH_COMPOSITOR + SetStrItem("COMPOSITOR"); +#endif + +#ifdef WITH_CYCLES + SetStrItem("CYCLES"); +#endif + +#ifdef WITH_CYCLES_OSL + SetStrItem("CYCLES_OSL"); +#endif + +#ifdef WITH_GAMEENGINE + SetStrItem("GAMEENGINE"); +#endif + +#ifdef WITH_CINEON + SetStrItem("IMAGE_CINEON"); +#endif + +#ifdef WITH_DDS + SetStrItem("IMAGE_DDS"); +#endif + +#ifdef WITH_FRAMESERVER + SetStrItem("IMAGE_FRAMESERVER"); +#endif + +#ifdef WITH_HDR + SetStrItem("IMAGE_HDR"); +#endif + +#ifdef WITH_OPENEXR + SetStrItem("IMAGE_OPENEXR"); +#endif + +#ifdef WITH_OPENJPEG + SetStrItem("IMAGE_OPENJPEG"); +#endif + +#ifdef WITH_REDCODE + SetStrItem("IMAGE_REDCODE"); +#endif + +#ifdef WITH_TIFF + SetStrItem("IMAGE_TIFF"); +#endif + +#ifdef WITH_INPUT_NDOF + SetStrItem("INPUT_NDOF"); +#endif + +#ifdef WITH_INTERNATIONAL + SetStrItem("INTERNATIONAL"); +#endif + +#ifdef WITH_JACK + SetStrItem("JACK"); +#endif + +#ifdef WITH_LIBMV + SetStrItem("LIBMV"); +#endif + +#ifdef WITH_MOD_BOOLEAN + SetStrItem("MOD_BOOLEAN"); +#endif + +#ifdef WITH_MOD_FLUID + SetStrItem("MOD_FLUID"); +#endif + +#ifdef WITH_OCEANSIM + SetStrItem("MOD_OCEANSIM"); +#endif + +#ifdef WITH_MOD_REMESH + SetStrItem("MOD_REMESH"); +#endif + +#ifdef WITH_SMOKE + SetStrItem("MOD_SMOKE"); +#endif + +#ifdef WITH_OPENAL + SetStrItem("OPENAL"); +#endif + +#ifdef WITH_COLLADA + SetStrItem("COLLADA"); +#endif + +#ifdef WITH_PLAYER + SetStrItem("PLAYER"); +#endif + +#undef SetStrItem + + if (PyErr_Occurred()) { + Py_CLEAR(build_options); + return NULL; + } + + return build_options; +} + +PyObject *BPY_app_build_options_struct(void) +{ + PyObject *ret; + + ret = make_build_options(); + + return ret; +} diff --git a/source/blender/python/intern/bpy_app_build_options.h b/source/blender/python/intern/bpy_app_build_options.h new file mode 100644 index 00000000000..82a1417ea2c --- /dev/null +++ b/source/blender/python/intern/bpy_app_build_options.h @@ -0,0 +1,32 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Bastien Montagne + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/python/intern/bpy_app_build_options.h + * \ingroup pythonintern + */ + +#ifndef __BPY_APP_BUILD_OPTIONS_H__ +#define __BPY_APP_BUILD_OPTIONS_H__ + +PyObject *BPY_app_build_options_struct(void); + +#endif /* __BPY_APP_BUILD_OPTIONS_H__ */ -- cgit v1.2.3