pybullet: add option to use NumPy to speed up, thanks to moof2k

option is disabled by default. When using cmake, use
cmake -DBUILD_PYBULLET=ON -DBUILD_PYBULLET_NUMPY=ON
then both testrender.py and testrender_np.py will work
without numpy only testrender.py works.
The numpy.reshape is likely a no-op when using numpy array,
so we could remove testrender_np.py...

See https://github.com/bulletphysics/bullet3/pull/774
This commit is contained in:
Erwin Coumans
2016-09-11 11:35:12 +01:00
parent 5c76b01659
commit 7df9b69039
5 changed files with 70 additions and 3 deletions

View File

@@ -194,11 +194,28 @@ ENDIF()
OPTION(BUILD_BULLET3 "Set when you want to build Bullet 3" ON)
FIND_PACKAGE(PythonLibs)
OPTION(BUILD_PYBULLET "Set when you want to build pybullet (experimental Python bindings for Bullet)" OFF)
IF(BUILD_PYBULLET)
FIND_PACKAGE(PythonLibs)
OPTION(BUILD_PYBULLET_NUMPY "Set when you want to build pybullet with NumPy support" OFF)
IF(BUILD_PYBULLET_NUMPY)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_LIST_DIR}/build3/cmake)
#include(FindNumPy)
FIND_PACKAGE(NumPy)
if (PYTHON_NUMPY_FOUND)
message("NumPy found")
add_definitions(-DPYBULLET_USE_NUMPY)
else()
message("NumPy not found")
endif()
ENDIF()
OPTION(BUILD_PYBULLET "Set when you want to build pybullet (experimental Python bindings for Bullet)" OFF)
IF(WIN32)
SET(BUILD_SHARED_LIBS OFF CACHE BOOL "Shared Libs" FORCE)
ELSE(WIN32)