PyBullet setup.py: only enable BT_USE_EGL on Linux, but allow to run the eglPlugin on Windows and Mac as well (using their default opengl window).

postpone the 'loadPlugin' for static eglPlugin, so that the init and exit happen in the same thread.
When you don't call unloadPlugin, the program may crash when exiting in SHARED_MEMORY_SERVER mode.
This commit is contained in:
erwincoumans
2018-09-09 21:08:47 -07:00
parent 2744e84592
commit 9698c3d600
6 changed files with 59 additions and 13 deletions

View File

@@ -43,7 +43,7 @@ CXX_FLAGS += '-DBT_ENABLE_ENET '
CXX_FLAGS += '-DBT_ENABLE_CLSOCKET '
CXX_FLAGS += '-DB3_DUMP_PYTHON_VERSION '
CXX_FLAGS += '-DSTATIC_EGLRENDERER_PLUGIN ' #comment to disable static egl plugin
CXX_FLAGS += '-DBT_USE_EGL ' # uncomment for EGL (old EGL versions fail)
@@ -412,9 +412,10 @@ if 'STATIC_EGLRENDERER_PLUGIN' in CXX_FLAGS:
sources += ['examples/SharedMemory/plugins/eglPlugin/eglRendererPlugin.cpp']\
+ ['examples/SharedMemory/plugins/eglPlugin/eglRendererVisualShapeConverter.cpp']
if _platform == "linux" or _platform == "linux2":
print("linux!")
libraries += ['dl','pthread']
CXX_FLAGS += '-DBT_USE_EGL '
CXX_FLAGS += '-D_LINUX '
CXX_FLAGS += '-DGLEW_STATIC '
CXX_FLAGS += '-DGLEW_INIT_OPENGL11_FUNCTIONS=1 '
@@ -430,8 +431,8 @@ if _platform == "linux" or _platform == "linux2":
if 'BT_USE_EGL' in CXX_FLAGS:
# linking with bullet's Glew libraries causes segfault
# for some reason.
sources += ['examples/ThirdPartyLibs/glad/egl.c']
sources += ['examples/OpenGLWindow/EGLOpenGLWindow.cpp']
sources += ['examples/ThirdPartyLibs/glad/egl.c']\
+ ['examples/OpenGLWindow/EGLOpenGLWindow.cpp']
elif _platform == "win32":
print("win32!")
@@ -503,7 +504,7 @@ setup(
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"]
include_dirs = include_dirs + ["src","examples", "examples/ThirdPartyLibs","examples/ThirdPartyLibs/glad", "examples/ThirdPartyLibs/enet/include","examples/ThirdPartyLibs/clsocket/src"]
) ],
classifiers=['Development Status :: 5 - Production/Stable',
'License :: OSI Approved :: zlib/libpng License',