summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErwin Coumans <erwincoumans@erwincoumans-macbookpro2.roam.corp.google.com>2018-09-21 09:55:57 -0700
committerErwin Coumans <erwincoumans@erwincoumans-macbookpro2.roam.corp.google.com>2018-09-21 09:55:57 -0700
commit47efe6601763203da21a65f044861fd60c28c9f5 (patch)
treec836c4de1fb6a2fdfa5a0bf523549e2f420863cb
parent3de295ca41a2df09d9229b412c558f593ffd4498 (diff)
downloadbullet3-47efe6601763203da21a65f044861fd60c28c9f5.tar.gz
disable eglPlugin from setup.py / pip pybullet on Windows and Mac (only enable on Linux)
-rw-r--r--examples/SharedMemory/plugins/eglPlugin/eglRendererPlugin.cpp36
-rw-r--r--setup.py33
2 files changed, 56 insertions, 13 deletions
diff --git a/examples/SharedMemory/plugins/eglPlugin/eglRendererPlugin.cpp b/examples/SharedMemory/plugins/eglPlugin/eglRendererPlugin.cpp
index 1bcfc6341..b130bbf99 100644
--- a/examples/SharedMemory/plugins/eglPlugin/eglRendererPlugin.cpp
+++ b/examples/SharedMemory/plugins/eglPlugin/eglRendererPlugin.cpp
@@ -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
diff --git a/setup.py b/setup.py
index ae7e7b4bf..11c383f46 100644
--- a/setup.py
+++ b/setup.py
@@ -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',