Build: Make OpenImageIO a required dependency

During the discussion for #101413 there was consensus that we could make
OIIO a mandatory dependency. This patch does just that.

The `idiff` testing tool remains optional.

Pull Request #105111
This commit is contained in:
2023-03-03 21:53:34 +01:00
committed by Jesse Yurkovich
parent d0eeb3d155
commit a95eaf0ec1
19 changed files with 26 additions and 166 deletions

View File

@@ -11,9 +11,7 @@
#include "../generic/py_capi_utils.h"
#ifdef WITH_OPENIMAGEIO
# include "openimageio_api.h"
#endif
#include "openimageio_api.h"
static PyTypeObject BlenderAppOIIOType;
@@ -36,32 +34,20 @@ static PyObject *make_oiio_info(void)
PyObject *oiio_info;
int pos = 0;
#ifdef WITH_OPENIMAGEIO
int curversion;
#endif
oiio_info = PyStructSequence_New(&BlenderAppOIIOType);
if (oiio_info == NULL) {
return NULL;
}
#ifndef WITH_OPENIMAGEIO
# define SetStrItem(str) PyStructSequence_SET_ITEM(oiio_info, pos++, PyUnicode_FromString(str))
#endif
#define SetObjItem(obj) PyStructSequence_SET_ITEM(oiio_info, pos++, obj)
#ifdef WITH_OPENIMAGEIO
curversion = OIIO_getVersionHex();
SetObjItem(PyBool_FromLong(1));
SetObjItem(PyC_Tuple_Pack_I32(curversion / 10000, (curversion / 100) % 100, curversion % 100));
SetObjItem(PyUnicode_FromFormat(
"%2d, %2d, %2d", curversion / 10000, (curversion / 100) % 100, curversion % 100));
#else
SetObjItem(PyBool_FromLong(0));
SetObjItem(PyC_Tuple_Pack_I32(0, 0, 0));
SetStrItem("Unknown");
#endif
if (UNLIKELY(PyErr_Occurred())) {
Py_DECREF(oiio_info);