pybullet, use eglPlugin statically instead of dynamic loading an Extension -DSTATIC_EGLRENDERER_PLUGIN
Fix compile errors of pybullet on Windows.
This commit is contained in:
66
setup.py
66
setup.py
@@ -42,9 +42,11 @@ CXX_FLAGS += '-DBT_USE_DOUBLE_PRECISION '
|
||||
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)
|
||||
|
||||
|
||||
|
||||
# libraries += [current_python]
|
||||
|
||||
libraries = []
|
||||
@@ -405,6 +407,12 @@ sources = ["examples/pybullet/pybullet.c"]\
|
||||
+["examples/ThirdPartyLibs/Gwen/Platforms/Windows.cpp"]\
|
||||
+["examples/ThirdPartyLibs/Gwen/Renderers/OpenGL_DebugFont.cpp"]\
|
||||
|
||||
|
||||
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":
|
||||
libraries += ['dl','pthread']
|
||||
CXX_FLAGS += '-D_LINUX '
|
||||
@@ -413,8 +421,7 @@ if _platform == "linux" or _platform == "linux2":
|
||||
CXX_FLAGS += '-DGLEW_DYNAMIC_LOAD_ALL_GLX_FUNCTIONS=1 '
|
||||
CXX_FLAGS += '-DDYNAMIC_LOAD_X11_FUNCTIONS '
|
||||
CXX_FLAGS += '-DHAS_SOCKLEN_T '
|
||||
CXX_FLAGS += '-fno-inline-functions-called-once '
|
||||
CXX_FLAGS += '-fPIC ' # for plugins
|
||||
CXX_FLAGS += '-fno-inline-functions-called-once'
|
||||
sources = sources + ["examples/ThirdPartyLibs/enet/unix.c"]\
|
||||
+["examples/OpenGLWindow/X11OpenGLWindow.cpp"]\
|
||||
+["examples/ThirdPartyLibs/glad/gl.c"]\
|
||||
@@ -430,6 +437,7 @@ elif _platform == "win32":
|
||||
print("win32!")
|
||||
libraries += ['Ws2_32','Winmm','User32','Opengl32','kernel32','glu32','Gdi32','Comdlg32']
|
||||
CXX_FLAGS += '-DWIN32 '
|
||||
CXX_FLAGS += '-D_WIN32 '
|
||||
CXX_FLAGS += '-DGLEW_STATIC '
|
||||
sources = sources + ["examples/ThirdPartyLibs/enet/win32.c"]\
|
||||
+["examples/OpenGLWindow/Win32Window.cpp"]\
|
||||
@@ -480,56 +488,6 @@ print("packages")
|
||||
print(find_packages('examples/pybullet/gym'))
|
||||
print("-----")
|
||||
|
||||
egl_renderer_sources = \
|
||||
["examples/SharedMemory/plugins/eglPlugin/eglRendererVisualShapeConverter.cpp"]\
|
||||
+["examples/SharedMemory/plugins/eglPlugin/eglRendererPlugin.cpp"]\
|
||||
+["examples/Importers/ImportColladaDemo/LoadMeshFromCollada.cpp"]\
|
||||
+["examples/Importers/ImportObjDemo/LoadMeshFromObj.cpp"]\
|
||||
+["examples/Importers/ImportMeshUtility/b3ImportMeshUtility.cpp"]\
|
||||
+["examples/Importers/ImportObjDemo/Wavefront2GLInstanceGraphicsShape.cpp"]\
|
||||
+["examples/TinyRenderer/geometry.cpp"]\
|
||||
+["examples/TinyRenderer/model.cpp"]\
|
||||
+["examples/TinyRenderer/tgaimage.cpp"]\
|
||||
+["examples/TinyRenderer/our_gl.cpp"]\
|
||||
+["examples/TinyRenderer/TinyRenderer.cpp"]\
|
||||
+["examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp"]\
|
||||
+["examples/ThirdPartyLibs/stb_image/stb_image.cpp"]\
|
||||
+["examples/ThirdPartyLibs/tinyxml2/tinyxml2.cpp"]\
|
||||
+["examples/OpenGLWindow/SimpleCamera.cpp"]\
|
||||
+["examples/Utils/b3Clock.cpp"]\
|
||||
+["examples/Utils/b3ResourcePath.cpp"]\
|
||||
+["src/BulletCollision/CollisionShapes/btShapeHull.cpp"]\
|
||||
+["src/BulletCollision/CollisionShapes/btConvexHullShape.cpp"]\
|
||||
+["src/BulletCollision/CollisionShapes/btBoxShape.cpp"]\
|
||||
+["src/BulletCollision/CollisionShapes/btSphereShape.cpp"]\
|
||||
+["src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp"]\
|
||||
+["src/BulletCollision/CollisionShapes/btConvexShape.cpp"]\
|
||||
+["src/BulletCollision/CollisionShapes/btCollisionShape.cpp"]\
|
||||
+["src/BulletCollision/CollisionShapes/btConvexPolyhedron.cpp"]\
|
||||
+["src/BulletCollision/CollisionShapes/btConvexInternalShape.cpp"]\
|
||||
+["src/Bullet3Common/b3Logging.cpp"]\
|
||||
+["src/LinearMath/btAlignedAllocator.cpp"]\
|
||||
+["src/LinearMath/btGeometryUtil.cpp"]\
|
||||
+["src/LinearMath/btConvexHull.cpp"]\
|
||||
+["src/LinearMath/btConvexHullComputer.cpp"]\
|
||||
+["src/Bullet3Common/b3AlignedAllocator.cpp"] \
|
||||
+["examples/ThirdPartyLibs/glad/gl.c"]\
|
||||
+['examples/ThirdPartyLibs/glad/egl.c'] \
|
||||
+["examples/ThirdPartyLibs/glad/glx.c"] \
|
||||
+["examples/OpenGLWindow/GLInstancingRenderer.cpp"]\
|
||||
+["examples/OpenGLWindow/EGLOpenGLWindow.cpp"]\
|
||||
+["examples/OpenGLWindow/GLRenderToTexture.cpp"] \
|
||||
+["examples/OpenGLWindow/LoadShader.cpp"] \
|
||||
+["src/LinearMath/btQuickprof.cpp"] \
|
||||
|
||||
eglRender = Extension("eglRenderer",
|
||||
sources = egl_renderer_sources,
|
||||
libraries = libraries,
|
||||
extra_compile_args=(CXX_FLAGS+'-DBT_USE_EGL -DSTB_AGAIN -DB3_DEBUG').split(),
|
||||
include_dirs = include_dirs + ["src","examples/ThirdPartyLibs","examples/ThirdPartyLibs/glad", "examples/ThirdPartyLibs/enet/include","examples/ThirdPartyLibs/clsocket/src"]
|
||||
)
|
||||
|
||||
|
||||
setup(
|
||||
name = 'pybullet',
|
||||
version='2.1.4',
|
||||
@@ -541,7 +499,7 @@ setup(
|
||||
license='zlib',
|
||||
platforms='any',
|
||||
keywords=['game development', 'virtual reality', 'physics simulation', 'robotics', 'collision detection', 'opengl'],
|
||||
ext_modules = [eglRender, Extension("pybullet",
|
||||
ext_modules = [Extension("pybullet",
|
||||
sources = sources,
|
||||
libraries = libraries,
|
||||
extra_compile_args=CXX_FLAGS.split(),
|
||||
@@ -564,4 +522,4 @@ setup(
|
||||
package_dir = { '': 'examples/pybullet/gym'},
|
||||
packages=[x for x in find_packages('examples/pybullet/gym')],
|
||||
package_data = { 'pybullet_data': need_files }
|
||||
)
|
||||
)
|
||||
Reference in New Issue
Block a user