attempt to let Maya plugin build under Linux using cmake

Thanks redpawfx for the feedback, see http://code.google.com/p/bullet/issues/detail?id=221

improvements in cmake (disable this incremental linking)
This commit is contained in:
erwin.coumans 2010-02-16 04:30:53 +00:00
parent 76681a52ee
commit 729a883b71
6 changed files with 93 additions and 41 deletions

View File

@ -1,5 +1,5 @@
/*
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
Copyright (c) 2003-2010 Erwin Coumans http://continuousphysics.com/Bullet/
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
@ -13,5 +13,6 @@ subject to the following restrictions:
*/
Free for commercial use, but please mail bullet@erwincoumans.com to report projects, and join the forum at
www.continuousphysics.com/Bullet/phpBB2
Free for commercial use, please report projects in the forum at http://www.bulletphysics.org
In case you want to display a Bullet logo in your software: you can download the Bullet logo in various vector formats and high resolution at the download section in http://bullet.googlecode.com

View File

@ -1,6 +1,8 @@
cmake_minimum_required(VERSION 2.4)
#this line has to appear before 'PROJECT' in order to be able to disable incremental linking
SET(MSVC_INCREMENTAL_DEFAULT ON)
PROJECT(BULLET_PHYSICS)
SET(BULLET_VERSION 2.75)
@ -20,36 +22,35 @@ IF (USE_MULTITHREADED_BENCHMARK)
ENDIF()
OPTION(USE_MSVC_RUNTIME_LIBRARY_DLL "Use MSVC Runtime Library DLL (/MD or /MDd)" ON)
OPTION(USE_MSVC_INCREMENTAL_LINKING "Use MSVC Incremental Linking" ON)
OPTION(USE_MSVC_INCREMENTAL_LINKING "Use MSVC Incremental Linking" OFF)
#SET(CMAKE_EXE_LINKER_FLAGS_INIT "/STACK:10000000 /INCREMENTAL:NO")
#SET(CMAKE_EXE_LINKER_FLAGS "/STACK:10000000 /INCREMENTAL:NO")
#MESSAGE("MSVC_INCREMENTAL_YES_FLAG"+${MSVC_INCREMENTAL_YES_FLAG})
IF(MSVC)
IF (NOT USE_MSVC_INCREMENTAL_LINKING)
IF (CMAKE_EXE_LINKER_FLAGS_DEBUG)
#MESSAGE("MSVC_INCREMENTAL_DEFAULT"+${MSVC_INCREMENTAL_DEFAULT})
SET( MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL:NO")
STRING(REPLACE "INCREMENTAL:YES" "INCREMENTAL:NO" replacementFlags ${CMAKE_EXE_LINKER_FLAGS_DEBUG})
message (${replacementFlags})
SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG ${replacementFlags})
STRING(REPLACE "INCREMENTAL:YES" "INCREMENTAL:NO" replacementFlags2 ${CMAKE_EXE_LINKER_FLAGS})
message (${replacementFlags2})
SET(CMAKE_EXE_LINKER_FLAGS ${replacementFlag2})
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "/INCREMENTAL:NO ${replacementFlags}" )
MESSAGE("CMAKE_EXE_LINKER_FLAGS_DEBUG=${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
# STRING(REPLACE "INCREMENTAL:YES" "INCREMENTAL:NO" replacementFlags2 ${CMAKE_EXE_LINKER_FLAGS})
# SET(CMAKE_EXE_LINKER_FLAGS ${replacementFlag2})
# STRING(REPLACE "INCREMENTAL:YES" "" replacementFlags3 ${CMAKE_EXTRA_LINK_FLAGS})
# SET(CMAKE_EXTRA_LINK_FLAGS ${replacementFlag3})
# STRING(REPLACE "INCREMENTAL:YES" "INCREMENTAL:NO" replacementFlags1 ${CMAKE_SHARED_LINKER_FLAGS_DEBUG})
# SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG ${replacementFlags1})
# STRING(REPLACE "INCREMENTAL:YES" "INCREMENTAL:NO" replacementFlags2 ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO})
# SET(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO ${replacementFlags2})
ENDIF (CMAKE_EXE_LINKER_FLAGS_DEBUG)
STRING(REPLACE "INCREMENTAL:YES" "INCREMENTAL:NO" replacementFlags3 ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO})
SET(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO ${replacementFlags3})
SET(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "/INCREMENTAL:NO ${replacementFlags3}" )
ENDIF (NOT USE_MSVC_INCREMENTAL_LINKING)
IF (NOT USE_MSVC_RUNTIME_LIBRARY_DLL)
@ -80,11 +81,14 @@ IF (WIN32)
OPTION(INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES "Create MSVC projectfiles that can be distributed" OFF)
IF (INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES)
SET (LIBRARY_OUTPUT_PATH ${BULLET_PHYSICS_SOURCE_DIR}/lib CACHE PATH "Single output directory for building all libraries.")
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${BULLET_PHYSICS_SOURCE_DIR})
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${BULLET_PHYSICS_SOURCE_DIR})
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${BULLET_PHYSICS_SOURCE_DIR})
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${BULLET_PHYSICS_SOURCE_DIR})
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${BULLET_PHYSICS_SOURCE_DIR})
ELSE()
SET (LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib CACHE PATH "Single output directory for building all libraries.")
ENDIF()
OPTION(INTERNAL_CREATE_MSVC_RELATIVE_PATH_PROJECTFILES "Create MSVC projectfiles with relative paths" OFF)

View File

@ -1,7 +1,16 @@
Bullet Continuous Collision Detection and Physics Library
Primary author and maintainer: Erwin Coumans
Please see http://code.google.com/p/bullet/source/list for more complete log in Subversion
This ChangeLog is incomplete, for an up-to-date list of all fixed issues see http://bullet.googlecode.com
using http://tinyurl.com/yabmjjj
2010 February
- Bullet 2.76 release, revision 2010
- support for the .bullet binary file format
- btInternalEdgeUtility to adjust unwanted collisions against internal triangle edges
- Improved Maya Dynamica plugin with better constraint authoring and .bullet file export
2009 September 17
- Minor update to Bullet 2.75 release, revision 1776

View File

@ -17,8 +17,10 @@ subject to the following restrictions:
#include "DemoApplication.h"
#include "LinearMath/btIDebugDraw.h"
#include "BulletDynamics/Dynamics/btDynamicsWorld.h"
//#define USE_6DOF 1
#include "BulletDynamics/ConstraintSolver/btPoint2PointConstraint.h"//picking
#include "BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.h"//picking
#include "BulletCollision/CollisionShapes/btCollisionShape.h"
#include "BulletCollision/CollisionShapes/btBoxShape.h"
#include "BulletCollision/CollisionShapes/btSphereShape.h"
@ -778,11 +780,31 @@ void DemoApplication::mouseFunc(int button, int state, int x, int y)
btVector3 localPivot = body->getCenterOfMassTransform().inverse() * pickPos;
btPoint2PointConstraint* p2p = new btPoint2PointConstraint(*body,localPivot);
p2p->m_setting.m_impulseClamp = mousePickClamping;
#ifdef USE_6DOF
btTransform tr;
tr.setIdentity();
tr.setOrigin(localPivot);
btGeneric6DofConstraint* dof6 = new btGeneric6DofConstraint(*body, tr,false);
dof6->setLinearLowerLimit(btVector3(0,0,0));
dof6->setLinearUpperLimit(btVector3(0,0,0));
dof6->setAngularLowerLimit(btVector3(0,0,0));
dof6->setAngularUpperLimit(btVector3(0,0,0));
m_dynamicsWorld->addConstraint(dof6);
m_pickConstraint = dof6;
#else
btPoint2PointConstraint* p2p = new btPoint2PointConstraint(*body,localPivot);
m_dynamicsWorld->addConstraint(p2p);
m_pickConstraint = p2p;
p2p->m_setting.m_impulseClamp = mousePickClamping;
//very weak constraint for picking
p2p->m_setting.m_tau = 0.1f;
#endif
//save mouse position for dragging
gOldPickingPos = rayTo;
@ -790,8 +812,7 @@ void DemoApplication::mouseFunc(int button, int state, int x, int y)
gOldPickingDist = (pickPos-rayFrom).length();
//very weak constraint for picking
p2p->m_setting.m_tau = 0.1f;
}
}
}
@ -830,14 +851,24 @@ void DemoApplication::mouseMotionFunc(int x,int y)
if (m_pickConstraint)
{
//move the constraint pivot
btPoint2PointConstraint* p2p = static_cast<btPoint2PointConstraint*>(m_pickConstraint);
if (p2p)
#ifdef USE_6DOF
btGeneric6DofConstraint* pickCon = static_cast<btGeneric6DofConstraint*>(m_pickConstraint);
#else
btPoint2PointConstraint* pickCon = static_cast<btPoint2PointConstraint*>(m_pickConstraint);
#endif
if (pickCon)
{
//keep it at the same picking distance
btVector3 newRayTo = getRayTo(x,y);
btVector3 rayFrom;
btVector3 oldPivotInB = p2p->getPivotInB();
#ifdef USE_6DOF
btVector3 oldPivotInB = pickCon->getFrameOffsetA().getOrigin();
#else
btVector3 oldPivotInB = pickCon->getPivotInB();
#endif
btVector3 newPivotB;
if (m_ortho)
{
@ -853,10 +884,12 @@ void DemoApplication::mouseMotionFunc(int x,int y)
newPivotB = rayFrom + dir;
}
#ifdef USE_6DOF
pickCon->getFrameOffsetA().setOrigin(newPivotB);
#else
pickCon->setPivotB(newPivotB);
#endif
p2p->setPivotB(newPivotB);
}
}

View File

@ -6,11 +6,15 @@ if(COMMAND cmake_policy)
endif(COMMAND cmake_policy)
IF ( UNIX AND NOT APPLE )
ADD_DEFINITIONS(-DLINUX)
ENDIF()
SET(CMAKE_CXX_WARNING_LEVEL 4)
#SET (CMAKE_VERBOSE_MAKEFILE TRUE)
FIND_PATH(MAYA_BASE_DIR include/maya/MFn.h PATH
/usr/autodesk/maya2009-x64
/usr/autodesk/maya2008-x64
/usr/autodesk/maya
"C:/Program Files/Autodesk/Maya2008"

View File

@ -22,6 +22,7 @@ subject to the following restrictions:
*
* Bullet is a Collision Detection and Rigid Body Dynamics Library. The Library is Open Source and free for commercial use, under the ZLib license ( http://opensource.org/licenses/zlib-license.php ).
*
* The main documentation is Bullet_User_Manual.pdf, included in the source code distribution.
* There is the Physics Forum for feedback and general Collision Detection and Physics discussions.
* Please visit http://www.bulletphysics.com
*
@ -29,14 +30,16 @@ subject to the following restrictions:
*
* @subsection step1 Step 1: Download
* You can download the Bullet Physics Library from the Google Code repository: http://code.google.com/p/bullet/downloads/list
*
* @subsection step2 Step 2: Building
* Bullet comes with autogenerated Project Files for Microsoft Visual Studio 6, 7, 7.1 and 8.
* The main Workspace/Solution is located in Bullet/msvc/8/wksbullet.sln (replace 8 with your version).
*
* Under other platforms, like Linux or Mac OS-X, Bullet can be build using either using make, cmake, http://www.cmake.org , or jam, http://www.perforce.com/jam/jam.html . cmake can autogenerate Xcode, KDevelop, MSVC and other build systems. just run cmake . in the root of Bullet.
* So if you are not using MSVC or cmake, you can run ./autogen.sh ./configure to create both Makefile and Jamfile and then run make or jam.
* Jam is a build system that can build the library, demos and also autogenerate the MSVC Project Files.
* If you don't have jam installed, you can make jam from the included jam-2.5 sources, or download jam from ftp://ftp.perforce.com/jam
* Bullet main build system for all platforms is cmake, you can download http://www.cmake.org
* cmake can autogenerate projectfiles for Microsoft Visual Studio, Apple Xcode, KDevelop and Unix Makefiles.
* The easiest is to run the CMake cmake-gui graphical user interface and choose the options and generate projectfiles.
* You can also use cmake in the command-line. Here are some examples for various platforms:
* cmake . -G "Visual Studio 9 2008"
* cmake . -G Xcode
* cmake . -G "Unix Makefiles"
* Although cmake is recommended, you can also use autotools for UNIX: ./autogen.sh ./configure to create a Makefile and then run make.
*
* @subsection step3 Step 3: Testing demos
* Try to run and experiment with BasicDemo executable as a starting point.
@ -53,9 +56,7 @@ subject to the following restrictions:
* Bullet has been designed in a modular way keeping dependencies to a minimum. The ConvexHullDistance demo demonstrates direct use of btGjkPairDetector.
*
* @section copyright Copyright
* Copyright (C) 2005-2008 Erwin Coumans, some contributions Copyright Gino van den Bergen, Christer Ericson, Simon Hobbs, Ricardo Padrela, F Richter(res), Stephane Redon
* Special thanks to all visitors of the Bullet Physics forum, and in particular above contributors, John McCutchan, Nathanael Presson, Dave Eberle, Dirk Gregorius, Erin Catto, Dave Eberle, Adam Moravanszky,
* Pierre Terdiman, Kenny Erleben, Russell Smith, Oliver Strunk, Jan Paul van Waveren, Marten Svanfeldt.
* For up-to-data information and copyright and contributors list check out the Bullet_User_Manual.pdf
*
*/