|
|
|
|
@@ -1,33 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from setuptools import find_packages
|
|
|
|
|
from sys import platform as _platform
|
|
|
|
|
import sys
|
|
|
|
|
from glob import glob
|
|
|
|
|
import glob
|
|
|
|
|
|
|
|
|
|
from distutils.core import setup
|
|
|
|
|
from distutils.extension import Extension
|
|
|
|
|
from distutils.util import get_platform
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# monkey-patch for parallel compilation
|
|
|
|
|
import multiprocessing
|
|
|
|
|
import multiprocessing.pool
|
|
|
|
|
def parallelCCompile(self, sources, output_dir=None, macros=None, include_dirs=None, debug=0, extra_preargs=None, extra_postargs=None, depends=None):
|
|
|
|
|
# those lines are copied from distutils.ccompiler.CCompiler directly
|
|
|
|
|
macros, objects, extra_postargs, pp_opts, build = self._setup_compile(output_dir, macros, include_dirs, sources, depends, extra_postargs)
|
|
|
|
|
cc_args = self._get_cc_args(pp_opts, debug, extra_preargs)
|
|
|
|
|
# parallel code
|
|
|
|
|
N = 2*multiprocessing.cpu_count()# number of parallel compilations
|
|
|
|
|
def _single_compile(obj):
|
|
|
|
|
try: src, ext = build[obj]
|
|
|
|
|
except KeyError: return
|
|
|
|
|
self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
|
|
|
|
|
# convert to list, imap is evaluated on-demand
|
|
|
|
|
list(multiprocessing.pool.ThreadPool(N).imap(_single_compile,objects))
|
|
|
|
|
return objects
|
|
|
|
|
import distutils.ccompiler
|
|
|
|
|
distutils.ccompiler.CCompiler.compile=parallelCCompile
|
|
|
|
|
|
|
|
|
|
from glob import glob
|
|
|
|
|
|
|
|
|
|
#see http://stackoverflow.com/a/8719066/295157
|
|
|
|
|
import os
|
|
|
|
|
@@ -42,9 +23,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 += '-DSTATIC_EGLRENDERER_PLUGIN ' #comment to disable static egl plugin
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CXX_FLAGS += '-DSTATIC_EGLRENDERER_PLUGIN '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# libraries += [current_python]
|
|
|
|
|
@@ -71,6 +50,8 @@ sources = ["examples/pybullet/pybullet.c"]\
|
|
|
|
|
+["examples/TinyRenderer/tgaimage.cpp"]\
|
|
|
|
|
+["examples/TinyRenderer/our_gl.cpp"]\
|
|
|
|
|
+["examples/TinyRenderer/TinyRenderer.cpp"]\
|
|
|
|
|
+["examples/SharedMemory/plugins/eglPlugin/eglRendererPlugin.cpp"]\
|
|
|
|
|
+["examples/SharedMemory/plugins/eglPlugin/eglRendererVisualShapeConverter.cpp"]\
|
|
|
|
|
+["examples/SharedMemory/plugins/pdControlPlugin/pdControlPlugin.cpp"]\
|
|
|
|
|
+["examples/SharedMemory/plugins/collisionFilterPlugin/collisionFilterPlugin.cpp"]\
|
|
|
|
|
+["examples/SharedMemory/b3RobotSimulatorClientAPI_NoDirect.cpp"]\
|
|
|
|
|
@@ -407,38 +388,28 @@ 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":
|
|
|
|
|
print("linux!")
|
|
|
|
|
libraries += ['dl','pthread']
|
|
|
|
|
CXX_FLAGS += '-DBT_USE_EGL '
|
|
|
|
|
libraries = ['dl','pthread']
|
|
|
|
|
CXX_FLAGS += '-D_LINUX '
|
|
|
|
|
CXX_FLAGS += '-DGLEW_STATIC '
|
|
|
|
|
CXX_FLAGS += '-DGLEW_INIT_OPENGL11_FUNCTIONS=1 '
|
|
|
|
|
CXX_FLAGS += '-DGLEW_DYNAMIC_LOAD_ALL_GLX_FUNCTIONS=1 '
|
|
|
|
|
CXX_FLAGS += '-DDYNAMIC_LOAD_X11_FUNCTIONS '
|
|
|
|
|
CXX_FLAGS += '-DHAS_SOCKLEN_T '
|
|
|
|
|
CXX_FLAGS += '-DBT_USE_EGL '
|
|
|
|
|
CXX_FLAGS += '-fno-inline-functions-called-once'
|
|
|
|
|
sources = sources + ["examples/ThirdPartyLibs/enet/unix.c"]\
|
|
|
|
|
+["examples/OpenGLWindow/X11OpenGLWindow.cpp"]\
|
|
|
|
|
+["examples/ThirdPartyLibs/glad/gl.c"]\
|
|
|
|
|
+["examples/ThirdPartyLibs/glad/glx.c"]
|
|
|
|
|
include_dirs += ["examples/ThirdPartyLibs/optionalX11"]
|
|
|
|
|
if 'BT_USE_EGL' in CXX_FLAGS:
|
|
|
|
|
# linking with bullet's Glew libraries causes segfault
|
|
|
|
|
# for some reason.
|
|
|
|
|
sources += ['examples/ThirdPartyLibs/glad/egl.c']\
|
|
|
|
|
+ ['examples/OpenGLWindow/EGLOpenGLWindow.cpp']
|
|
|
|
|
+["examples/ThirdPartyLibs/glad/glx.c"]\
|
|
|
|
|
+["examples/ThirdPartyLibs/glad/egl.c"]\
|
|
|
|
|
+["examples/OpenGLWindow/EGLOpenGLWindow.cpp"]
|
|
|
|
|
|
|
|
|
|
include_dirs += ["examples/ThirdPartyLibs/optionalX11"]
|
|
|
|
|
elif _platform == "win32":
|
|
|
|
|
print("win32!")
|
|
|
|
|
libraries += ['Ws2_32','Winmm','User32','Opengl32','kernel32','glu32','Gdi32','Comdlg32']
|
|
|
|
|
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"]\
|
|
|
|
|
@@ -457,7 +428,7 @@ elif _platform == "darwin":
|
|
|
|
|
+["examples/OpenGLWindow/MacOpenGLWindowObjC.m"]
|
|
|
|
|
else:
|
|
|
|
|
print("bsd!")
|
|
|
|
|
libraries += ['GL','GLEW','pthread']
|
|
|
|
|
libraries = ['GL','GLEW','pthread']
|
|
|
|
|
os.environ['LDFLAGS'] = '-L/usr/X11R6/lib'
|
|
|
|
|
CXX_FLAGS += '-D_BSD '
|
|
|
|
|
CXX_FLAGS += '-I/usr/X11R6/include '
|
|
|
|
|
@@ -468,7 +439,6 @@ else:
|
|
|
|
|
+["examples/ThirdPartyLibs/glad/gl.c"]\
|
|
|
|
|
+ sources
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setup_py_dir = os.path.dirname(os.path.realpath(__file__))
|
|
|
|
|
|
|
|
|
|
need_files = []
|
|
|
|
|
|