diff --git a/setup.py b/setup.py index bfdcea0a75478b677ac4525a4cef5dd31a49ce7d..69d357ac4d9550b5058c0cea2e89e4c3d91cdc11 100644 --- a/setup.py +++ b/setup.py @@ -68,7 +68,7 @@ include_dirs = [package_dir] # Define package version version = '2.0.0a0' define_macros += [ - ("XBOB_CORE_VERSION", version), + ("XBOB_IO_VERSION", version), ] setup( @@ -98,7 +98,7 @@ setup( ext_modules = [ Extension("xbob.io._library", [ - "xbob/io/file.cpp", + "xbob/io/main.cpp", ], define_macros=define_macros, include_dirs=include_dirs + bob_pkg.include_directories(), diff --git a/xbob/io/__init__.py b/xbob/io/__init__.py index 5841825331cf3d1b4f6beba6601f9e0f234203f1..b7e77707a3cadeb6e5e49db7bec3bb7516ca42e8 100644 --- a/xbob/io/__init__.py +++ b/xbob/io/__init__.py @@ -1,3 +1,5 @@ +from ._library import __version__, __api_version__ + def get_include(): """Returns the directory containing the C/C++ API include directives""" diff --git a/xbob/io/main.cpp b/xbob/io/main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7526754b43469e774915b69c7d9a77166d36032d --- /dev/null +++ b/xbob/io/main.cpp @@ -0,0 +1,44 @@ +/** + * @author Andre Anjos <andre.anjos@idiap.ch> + * @date Fri 25 Oct 16:54:55 2013 + * + * @brief Bindings to bob::io + */ + +#define XBOB_IO_MODULE +#include <xbob.io/config.h> +#include <boost/preprocessor/stringize.hpp> + +#define XBOB_IO_MODULE_PREFIX xbob.io +#define XBOB_IO_MODULE_NAME _library + +#ifdef NO_IMPORT_ARRAY +#undef NO_IMPORT_ARRAY +#endif +#include <blitz.array/capi.h> + +static PyMethodDef module_methods[] = { + {0} /* Sentinel */ +}; + +PyDoc_STRVAR(module_docstr, "bob::io classes and methods"); + +#define ENTRY_FUNCTION_INNER(a) init ## a +#define ENTRY_FUNCTION(a) ENTRY_FUNCTION_INNER(a) + +PyMODINIT_FUNC ENTRY_FUNCTION(XBOB_IO_MODULE_NAME) (void) { + + PyObject* m = Py_InitModule3(BOOST_PP_STRINGIZE(XBOB_IO_MODULE_NAME), + module_methods, module_docstr); + + /* register some constants */ + PyModule_AddIntConstant(m, "__api_version__", XBOB_IO_API_VERSION); + PyModule_AddStringConstant(m, "__version__", BOOST_PP_STRINGIZE(XBOB_IO_VERSION)); + + /* imports the NumPy C-API */ + import_array(); + + /* imports blitz.array C-API */ + import_blitz_array(); + +}