This commit is contained in:
erwincoumans 2018-09-21 17:33:31 -07:00
commit 64a7a3d82f
2 changed files with 56 additions and 13 deletions

View File

@ -62,6 +62,28 @@ B3_SHARED_API struct UrdfRenderingInterface* getRenderInterface_eglRendererPlugi
#ifdef EGL_ADD_PYTHON_INIT
static PyMethodDef eglMethods[] = {
{NULL, NULL, 0, NULL} /* Sentinel */
};
#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT, "eglRenderer", /* m_name */
"eglRenderer for PyBullet "
, /* m_doc */
-1, /* m_size */
eglMethods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
#endif
PyMODINIT_FUNC
#if PY_MAJOR_VERSION >= 3
PyInit_eglRenderer(void)
@ -69,8 +91,20 @@ PyInit_eglRenderer(void)
initeglRenderer(void)
#endif
{
PyObject* m;
#if PY_MAJOR_VERSION >= 3
return 0;
m = PyModule_Create(&moduledef);
#else
m = Py_InitModule3("eglRenderer", eglMethods, "eglRenderer for PyBullet");
#endif
#if PY_MAJOR_VERSION >= 3
if (m == NULL) return m;
#else
if (m == NULL) return;
#endif
}
#endif //EGL_ADD_PYTHON_INIT

View File

@ -42,7 +42,7 @@ CXX_FLAGS += '-DBT_USE_DOUBLE_PRECISION '
CXX_FLAGS += '-DBT_ENABLE_ENET '
CXX_FLAGS += '-DBT_ENABLE_CLSOCKET '
CXX_FLAGS += '-DB3_DUMP_PYTHON_VERSION '
CXX_FLAGS += '-DEGL_ADD_PYTHON_INIT '
EGL_CXX_FLAGS = ''
@ -535,12 +535,26 @@ print("packages")
print(find_packages('examples/pybullet/gym'))
print("-----")
eglRender = Extension("eglRenderer",
sources = egl_renderer_sources,
extensions = []
pybullet_ext = Extension("pybullet",
sources = sources,
libraries = libraries,
extra_compile_args=(CXX_FLAGS+EGL_CXX_FLAGS ).split(),
include_dirs = include_dirs + ["src","examples", "examples/ThirdPartyLibs","examples/ThirdPartyLibs/glad", "examples/ThirdPartyLibs/enet/include","examples/ThirdPartyLibs/clsocket/src"]
extra_compile_args=CXX_FLAGS.split(),
include_dirs = include_dirs + ["src","examples/ThirdPartyLibs","examples/ThirdPartyLibs/glad", "examples/ThirdPartyLibs/enet/include","examples/ThirdPartyLibs/clsocket/src"]
)
extensions.append(pybullet_ext)
if 'BT_USE_EGL' in EGL_CXX_FLAGS:
eglRender = Extension("eglRenderer",
sources = egl_renderer_sources,
libraries = libraries,
extra_compile_args=(CXX_FLAGS+EGL_CXX_FLAGS ).split(),
include_dirs = include_dirs + ["src","examples", "examples/ThirdPartyLibs","examples/ThirdPartyLibs/glad", "examples/ThirdPartyLibs/enet/include","examples/ThirdPartyLibs/clsocket/src"])
extensions.append(eglRender)
setup(
@ -554,13 +568,8 @@ setup(
license='zlib',
platforms='any',
keywords=['game development', 'virtual reality', 'physics simulation', 'robotics', 'collision detection', 'opengl'],
ext_modules = [eglRender, Extension("pybullet",
sources = sources,
libraries = libraries,
extra_compile_args=CXX_FLAGS.split(),
include_dirs = include_dirs + ["src","examples/ThirdPartyLibs","examples/ThirdPartyLibs/glad", "examples/ThirdPartyLibs/enet/include","examples/ThirdPartyLibs/clsocket/src"]
) ],
classifiers=['Development Status :: 5 - Production/Stable',
ext_modules = extensions,
classifiers=['Development Status :: 5 - Production/Stable',
'License :: OSI Approved :: zlib/libpng License',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX :: Linux',