add App_SharedMemoryPhysics and App_SharedMemoryPhysics_GUI to cmake
fix 'connection' detection for shared memory (due to multiple shmem blocks) add link to pybullet.so
This commit is contained in:
@@ -2,5 +2,9 @@
|
|||||||
rm CMakeCache.txt
|
rm CMakeCache.txt
|
||||||
mkdir build_cmake
|
mkdir build_cmake
|
||||||
cd build_cmake
|
cd build_cmake
|
||||||
cmake -DBUILD_PYBULLET=ON -DBUILD_PYBULLET_NUMPY=ON -DUSE_DOUBLE_PRECISION=ON -DCMAKE_BUILD_TYPE=Release ..
|
cmake -DBUILD_PYBULLET=ON -DBUILD_PYBULLET_NUMPY=OFF -DUSE_DOUBLE_PRECISION=ON -DCMAKE_BUILD_TYPE=Release ..
|
||||||
make -j12
|
make -j12
|
||||||
|
cd examples
|
||||||
|
cd pybullet
|
||||||
|
ln -s pybullet.dylib pybullet.so
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
SUBDIRS( HelloWorld BasicDemo )
|
SUBDIRS( HelloWorld BasicDemo )
|
||||||
IF(BUILD_BULLET3)
|
IF(BUILD_BULLET3)
|
||||||
SUBDIRS( ExampleBrowser ThirdPartyLibs/Gwen ThirdPartyLibs/BussIK OpenGLWindow )
|
SUBDIRS( ExampleBrowser SharedMemory ThirdPartyLibs/Gwen ThirdPartyLibs/BussIK OpenGLWindow )
|
||||||
ENDIF()
|
ENDIF()
|
||||||
IF(BUILD_PYBULLET)
|
IF(BUILD_PYBULLET)
|
||||||
SUBDIRS(pybullet)
|
SUBDIRS(pybullet)
|
||||||
|
|||||||
205
examples/SharedMemory/CMakeLists.txt
Normal file
205
examples/SharedMemory/CMakeLists.txt
Normal file
@@ -0,0 +1,205 @@
|
|||||||
|
|
||||||
|
|
||||||
|
SET(SharedMemory_SRCS
|
||||||
|
IKTrajectoryHelper.cpp
|
||||||
|
IKTrajectoryHelper.h
|
||||||
|
PhysicsClient.cpp
|
||||||
|
PhysicsClientSharedMemory.cpp
|
||||||
|
PhysicsClientExample.cpp
|
||||||
|
PhysicsServerExample.cpp
|
||||||
|
PhysicsServerSharedMemory.cpp
|
||||||
|
PhysicsServerSharedMemory.h
|
||||||
|
PhysicsServer.cpp
|
||||||
|
PhysicsServer.h
|
||||||
|
PhysicsClientC_API.cpp
|
||||||
|
SharedMemoryCommands.h
|
||||||
|
SharedMemoryPublic.h
|
||||||
|
PhysicsServer.cpp
|
||||||
|
PosixSharedMemory.cpp
|
||||||
|
Win32SharedMemory.cpp
|
||||||
|
InProcessMemory.cpp
|
||||||
|
PhysicsDirect.cpp
|
||||||
|
PhysicsDirect.h
|
||||||
|
PhysicsDirectC_API.cpp
|
||||||
|
PhysicsDirectC_API.h
|
||||||
|
PhysicsLoopBack.cpp
|
||||||
|
PhysicsLoopBack.h
|
||||||
|
PhysicsLoopBackC_API.cpp
|
||||||
|
PhysicsLoopBackC_API.h
|
||||||
|
PhysicsClientSharedMemory_C_API.cpp
|
||||||
|
PhysicsClientSharedMemory_C_API.h
|
||||||
|
PhysicsClientSharedMemory2_C_API.cpp
|
||||||
|
PhysicsClientSharedMemory2_C_API.h
|
||||||
|
PhysicsClientSharedMemory2.cpp
|
||||||
|
PhysicsClientSharedMemory2.h
|
||||||
|
SharedMemoryCommandProcessor.cpp
|
||||||
|
SharedMemoryCommandProcessor.h
|
||||||
|
PhysicsServerCommandProcessor.cpp
|
||||||
|
PhysicsServerCommandProcessor.h
|
||||||
|
TinyRendererVisualShapeConverter.cpp
|
||||||
|
TinyRendererVisualShapeConverter.h
|
||||||
|
../TinyRenderer/geometry.cpp
|
||||||
|
../TinyRenderer/model.cpp
|
||||||
|
../TinyRenderer/tgaimage.cpp
|
||||||
|
../TinyRenderer/our_gl.cpp
|
||||||
|
../TinyRenderer/TinyRenderer.cpp
|
||||||
|
../OpenGLWindow/SimpleCamera.cpp
|
||||||
|
../OpenGLWindow/SimpleCamera.h
|
||||||
|
../Importers/ImportURDFDemo/ConvertRigidBodies2MultiBody.h
|
||||||
|
../Importers/ImportURDFDemo/MultiBodyCreationInterface.h
|
||||||
|
../Importers/ImportURDFDemo/MyMultiBodyCreator.cpp
|
||||||
|
../Importers/ImportURDFDemo/MyMultiBodyCreator.h
|
||||||
|
../Importers/ImportURDFDemo/BulletUrdfImporter.cpp
|
||||||
|
../Importers/ImportURDFDemo/BulletUrdfImporter.h
|
||||||
|
../Importers/ImportURDFDemo/UrdfParser.cpp
|
||||||
|
../Importers/ImportURDFDemo/urdfStringSplit.cpp
|
||||||
|
../Importers/ImportURDFDemo/UrdfParser.cpp
|
||||||
|
../Importers/ImportURDFDemo/UrdfParser.h
|
||||||
|
../Importers/ImportURDFDemo/URDF2Bullet.cpp
|
||||||
|
../Importers/ImportURDFDemo/URDF2Bullet.h
|
||||||
|
../Importers/ImportMJCFDemo/BulletMJCFImporter.cpp
|
||||||
|
../Importers/ImportMJCFDemo/BulletMJCFImporter.h
|
||||||
|
../Utils/b3ResourcePath.cpp
|
||||||
|
../Utils/b3Clock.cpp
|
||||||
|
../Importers/ImportURDFDemo/URDFImporterInterface.h
|
||||||
|
../Importers/ImportURDFDemo/URDFJointTypes.h
|
||||||
|
../Importers/ImportObjDemo/Wavefront2GLInstanceGraphicsShape.cpp
|
||||||
|
../Importers/ImportObjDemo/LoadMeshFromObj.cpp
|
||||||
|
../Importers/ImportSTLDemo/ImportSTLSetup.h
|
||||||
|
../Importers/ImportSTLDemo/LoadMeshFromSTL.h
|
||||||
|
../Importers/ImportColladaDemo/LoadMeshFromCollada.cpp
|
||||||
|
../Importers/ImportColladaDemo/ColladaGraphicsInstance.h
|
||||||
|
../ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp
|
||||||
|
../ThirdPartyLibs/tinyxml/tinystr.cpp
|
||||||
|
../ThirdPartyLibs/tinyxml/tinyxml.cpp
|
||||||
|
../ThirdPartyLibs/tinyxml/tinyxmlerror.cpp
|
||||||
|
../ThirdPartyLibs/tinyxml/tinyxmlparser.cpp
|
||||||
|
../Importers/ImportMeshUtility/b3ImportMeshUtility.cpp
|
||||||
|
../ThirdPartyLibs/stb_image/stb_image.cpp
|
||||||
|
../MultiThreading/b3ThreadSupportInterface.cpp
|
||||||
|
../MultiThreading/b3ThreadSupportInterface.h
|
||||||
|
)
|
||||||
|
|
||||||
|
INCLUDE_DIRECTORIES(
|
||||||
|
${BULLET_PHYSICS_SOURCE_DIR}/src
|
||||||
|
${BULLET_PHYSICS_SOURCE_DIR}/examples/ThirdPartyLibs
|
||||||
|
)
|
||||||
|
|
||||||
|
LINK_LIBRARIES(
|
||||||
|
Bullet3Common BulletWorldImporter BulletInverseDynamicsUtils BulletInverseDynamics BulletDynamics BulletCollision LinearMath BussIK
|
||||||
|
)
|
||||||
|
|
||||||
|
IF (WIN32)
|
||||||
|
ADD_EXECUTABLE(App_SharedMemoryPhysics
|
||||||
|
${SharedMemory_SRCS}
|
||||||
|
main.cpp
|
||||||
|
../MultiThreading/b3Win32ThreadSupport.cpp
|
||||||
|
../MultiThreading/b3Win32ThreadSupport.h
|
||||||
|
${BULLET_PHYSICS_SOURCE_DIR}/build3/bullet.rc
|
||||||
|
)
|
||||||
|
ELSE(WIN32)
|
||||||
|
IF(APPLE)
|
||||||
|
LINK_LIBRARIES( pthread dl )
|
||||||
|
ADD_EXECUTABLE(App_SharedMemoryPhysics
|
||||||
|
${SharedMemory_SRCS}
|
||||||
|
../MultiThreading/b3PosixThreadSupport.cpp
|
||||||
|
../MultiThreading/b3PosixThreadSupport.h
|
||||||
|
main.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
ELSE(APPLE)
|
||||||
|
LINK_LIBRARIES( pthread dl )
|
||||||
|
ADD_EXECUTABLE(App_SharedMemoryPhysics
|
||||||
|
${SharedMemory_SRCS}
|
||||||
|
../MultiThreading/b3PosixThreadSupport.cpp
|
||||||
|
../MultiThreading/b3PosixThreadSupport.h
|
||||||
|
main.cpp
|
||||||
|
)
|
||||||
|
ENDIF(APPLE)
|
||||||
|
ENDIF(WIN32)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
IF (INTERNAL_ADD_POSTFIX_EXECUTABLE_NAMES)
|
||||||
|
SET_TARGET_PROPERTIES(App_SharedMemoryPhysics PROPERTIES DEBUG_POSTFIX "_Debug")
|
||||||
|
SET_TARGET_PROPERTIES(App_SharedMemoryPhysics PROPERTIES MINSIZEREL_POSTFIX "_MinsizeRel")
|
||||||
|
SET_TARGET_PROPERTIES(App_SharedMemoryPhysics PROPERTIES RELWITHDEBINFO_POSTFIX "_RelWithDebugInfo")
|
||||||
|
ENDIF(INTERNAL_ADD_POSTFIX_EXECUTABLE_NAMES)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
INCLUDE_DIRECTORIES(
|
||||||
|
${BULLET_PHYSICS_SOURCE_DIR}/src
|
||||||
|
${BULLET_PHYSICS_SOURCE_DIR}/examples/ThirdPartyLibs
|
||||||
|
)
|
||||||
|
|
||||||
|
ADD_DEFINITIONS(-DB3_USE_STANDALONE_EXAMPLE)
|
||||||
|
|
||||||
|
LINK_LIBRARIES(
|
||||||
|
Bullet3Common BulletWorldImporter BulletInverseDynamicsUtils BulletInverseDynamics BulletDynamics BulletCollision LinearMath BussIK OpenGLWindow
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
IF (WIN32)
|
||||||
|
ADD_DEFINITIONS(-DGLEW_STATIC)
|
||||||
|
LINK_LIBRARIES( ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} )
|
||||||
|
|
||||||
|
ADD_EXECUTABLE(App_SharedMemoryPhysics_GUI
|
||||||
|
${SharedMemory_SRCS}
|
||||||
|
../StandaloneMain/main_opengl_single_example.cpp
|
||||||
|
../ExampleBrowser/OpenGLGuiHelper.cpp
|
||||||
|
../ExampleBrowser/GL_ShapeDrawer.cpp
|
||||||
|
../ExampleBrowser/CollisionShape2TriangleMesh.cpp
|
||||||
|
../MultiThreading/b3Win32ThreadSupport.cpp
|
||||||
|
../MultiThreading/b3Win32ThreadSupport.h
|
||||||
|
${BULLET_PHYSICS_SOURCE_DIR}/build3/bullet.rc
|
||||||
|
)
|
||||||
|
ELSE(WIN32)
|
||||||
|
IF(APPLE)
|
||||||
|
LINK_LIBRARIES( pthread dl )
|
||||||
|
FIND_LIBRARY(COCOA NAMES Cocoa)
|
||||||
|
MESSAGE(${COCOA})
|
||||||
|
LINK_LIBRARIES(${COCOA} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY})
|
||||||
|
|
||||||
|
ADD_EXECUTABLE(App_SharedMemoryPhysics_GUI
|
||||||
|
${SharedMemory_SRCS}
|
||||||
|
../StandaloneMain/main_opengl_single_example.cpp
|
||||||
|
../ExampleBrowser/OpenGLGuiHelper.cpp
|
||||||
|
../ExampleBrowser/GL_ShapeDrawer.cpp
|
||||||
|
../ExampleBrowser/CollisionShape2TriangleMesh.cpp
|
||||||
|
../MultiThreading/b3PosixThreadSupport.cpp
|
||||||
|
../MultiThreading/b3PosixThreadSupport.h
|
||||||
|
)
|
||||||
|
|
||||||
|
ELSE(APPLE)
|
||||||
|
LINK_LIBRARIES( pthread dl )
|
||||||
|
ADD_DEFINITIONS("-DGLEW_INIT_OPENGL11_FUNCTIONS=1")
|
||||||
|
ADD_DEFINITIONS("-DGLEW_STATIC")
|
||||||
|
ADD_DEFINITIONS("-DGLEW_DYNAMIC_LOAD_ALL_GLX_FUNCTIONS=1")
|
||||||
|
|
||||||
|
ADD_EXECUTABLE(App_SharedMemoryPhysics_GUI
|
||||||
|
${SharedMemory_SRCS}
|
||||||
|
../StandaloneMain/main_opengl_single_example.cpp
|
||||||
|
../ExampleBrowser/OpenGLGuiHelper.cpp
|
||||||
|
../ExampleBrowser/GL_ShapeDrawer.cpp
|
||||||
|
../ExampleBrowser/CollisionShape2TriangleMesh.cpp
|
||||||
|
../MultiThreading/b3PosixThreadSupport.cpp
|
||||||
|
../MultiThreading/b3PosixThreadSupport.h
|
||||||
|
)
|
||||||
|
ENDIF(APPLE)
|
||||||
|
ENDIF(WIN32)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
IF (INTERNAL_ADD_POSTFIX_EXECUTABLE_NAMES)
|
||||||
|
SET_TARGET_PROPERTIES(App_SharedMemoryPhysics_GUI PROPERTIES DEBUG_POSTFIX "_Debug")
|
||||||
|
SET_TARGET_PROPERTIES(App_SharedMemoryPhysics_GUI PROPERTIES MINSIZEREL_POSTFIX "_MinsizeRel")
|
||||||
|
SET_TARGET_PROPERTIES(App_SharedMemoryPhysics_GUI PROPERTIES RELWITHDEBINFO_POSTFIX "_RelWithDebugInfo")
|
||||||
|
ENDIF(INTERNAL_ADD_POSTFIX_EXECUTABLE_NAMES)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -128,10 +128,7 @@ bool PhysicsServerSharedMemory::connectSharedMemory( struct GUIHelperInterface*
|
|||||||
|
|
||||||
bool allowCreation = true;
|
bool allowCreation = true;
|
||||||
bool allConnected = false;
|
bool allConnected = false;
|
||||||
|
int numConnected = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
@@ -140,6 +137,7 @@ bool PhysicsServerSharedMemory::connectSharedMemory( struct GUIHelperInterface*
|
|||||||
if (m_data->m_areConnected[block])
|
if (m_data->m_areConnected[block])
|
||||||
{
|
{
|
||||||
allConnected = true;
|
allConnected = true;
|
||||||
|
numConnected++;
|
||||||
b3Warning("connectSharedMemory, while already connected");
|
b3Warning("connectSharedMemory, while already connected");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -163,6 +161,7 @@ bool PhysicsServerSharedMemory::connectSharedMemory( struct GUIHelperInterface*
|
|||||||
b3Printf("Created and initialized shared memory block\n");
|
b3Printf("Created and initialized shared memory block\n");
|
||||||
}
|
}
|
||||||
m_data->m_areConnected[block] = true;
|
m_data->m_areConnected[block] = true;
|
||||||
|
numConnected++;
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
m_data->m_sharedMemory->releaseSharedMemory(m_data->m_sharedMemoryKey+block, SHARED_MEMORY_SIZE);
|
m_data->m_sharedMemory->releaseSharedMemory(m_data->m_sharedMemoryKey+block, SHARED_MEMORY_SIZE);
|
||||||
@@ -181,6 +180,8 @@ bool PhysicsServerSharedMemory::connectSharedMemory( struct GUIHelperInterface*
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
allConnected = (numConnected==MAX_SHARED_MEMORY_BLOCKS);
|
||||||
|
|
||||||
return allConnected;
|
return allConnected;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -81,6 +81,8 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
|
|
||||||
example->initPhysics();
|
example->initPhysics();
|
||||||
|
|
||||||
|
|
||||||
while (example->isConnected() && !(example->wantsTermination() || interrupted))
|
while (example->isConnected() && !(example->wantsTermination() || interrupted))
|
||||||
{
|
{
|
||||||
example->stepSimulation(1.f/60.f);
|
example->stepSimulation(1.f/60.f);
|
||||||
|
|||||||
Reference in New Issue
Block a user