compiling an Bullet/Ogre/OIS program with CMake

charles_west
Posts: 11
Joined: Mon Oct 19, 2009 12:41 am

compiling an Bullet/Ogre/OIS program with CMake

Post by charles_west »

Hello,
I'm new at this and I'm having a little trouble integrating the bullet libraries into my cmake project. I know it can compile with just Ogre and OIS, but I don't know how to setup the CMakeLists.txt file to add the bullet library.

I installed the findBullet.cmake file I found here:
http://www.cmake.org/pipermail/cmake-co ... 06967.html

then I tried to do cmake with this:

Code: Select all

 cmake_minimum_required(VERSION 2.6)
  PROJECT(ogre3dTest)
 
  set(CMAKE_MODULE_PATH 
 	/usr/local/lib/OGRE/cmake
  )
 
  FIND_PACKAGE(OpenGL)
  FIND_PACKAGE(OGRE)
  FIND_PACKAGE(OIS)
  FIND_PACKAGE(BULLET)
 
  INCLUDE_DIRECTORIES(
 	${OpenGL_INCLUDE_DIR}
 	${OGRE_INCLUDE_DIRS}
 	${OIS_INCLUDE_DIRS}
	${BULLET_INCLUDE_DIRS}
  )
  
#  add_subdirectory(${PROJECT_SOURCE_DIR}/../../../../../usr/local/lib)

  FILE(GLOB SRCS src/*.cpp)
  FILE(GLOB HDRS include/*.h)
 
  ADD_EXECUTABLE(ogre3dTest 
 	${SRCS}
 	${HDRS}
  )
 
  TARGET_LINK_LIBRARIES(ogre3dTest
 	${OpenGL_LIBRARIES}
 	${OIS_LIBRARIES}
 	${OGRE_LIBRARIES}
	${BULLET_LIBRARIES}
  )
This is the output I received from cmake:

Code: Select all

-- Looking for OGRE...
-- Found Ogre Cthugha (1.7.0)
-- Found OGRE: optimized;/usr/local/lib/libOgreMain.so;debug;/usr/local/lib/libOgreMain.so
-- Looking for OGRE_Paging...
-- Found OGRE_Paging: optimized;/usr/local/lib/libOgrePaging.so;debug;/usr/local/lib/libOgrePaging.so
-- Looking for OGRE_Terrain...
-- Found OGRE_Terrain: optimized;/usr/local/lib/libOgreTerrain.so;debug;/usr/local/lib/libOgreTerrain.so
-- Looking for OGRE_Property...
-- Could not locate OGRE_Property
-- Looking for OGRE_RTShaderSystem...
-- Found OGRE_RTShaderSystem: optimized;/usr/local/lib/libOgreRTShaderSystem.so;debug;/usr/local/lib/libOgreRTShaderSystem.so
-- Looking for OIS...
-- Found OIS: optimized;/usr/lib/libOIS.so;debug;/usr/lib/libOIS.so
-- Configuring done
-- Generating done
-- Build files have been written to: /home/hewhosurvives/c++/EBE/ogreApp
When I ran make it didn't seem to be able to find the libraries:

Code: Select all

[100%] Building CXX object CMakeFiles/ogre3dTest.dir/src/programSkeletonWithBullet.cpp.o
Linking CXX executable ogre3dTest
CMakeFiles/ogre3dTest.dir/src/programSkeletonWithBullet.cpp.o: In function `Application::setupScene()':
programSkeletonWithBullet.cpp:(.text._ZN11Application10setupSceneEv[Application::setupScene()]+0x340): undefined reference to `btStaticPlaneShape::btStaticPlaneShape(btVector3 const&, float)'
programSkeletonWithBullet.cpp:(.text._ZN11Application10setupSceneEv[Application::setupScene()]+0x354): undefined reference to `btAlignedAllocInternal(unsigned int, int)'
programSkeletonWithBullet.cpp:(.text._ZN11Application10setupSceneEv[Application::setupScene()]+0x35e): undefined reference to `btConvexInternalShape::btConvexInternalShape()'
programSkeletonWithBullet.cpp:(.text._ZN11Application10setupSceneEv[Application::setupScene()]+0x364): undefined reference to `vtable for btSphereShape'
programSkeletonWithBullet.cpp:(.text._ZN11Application10setupSceneEv[Application::setupScene()]+0x6a2): undefined reference to `btAlignedAllocInternal(unsigned int, int)'
programSkeletonWithBullet.cpp:(.text._ZN11Application10setupSceneEv[Application::setupScene()]+0x6b6): undefined reference to `btRigidBody::btRigidBody(btRigidBody::btRigidBodyConstructionInfo const&)'
programSkeletonWithBullet.cpp:(.text._ZN11Application10setupSceneEv[Application::setupScene()]+0xa2a): undefined reference to `btAlignedAllocInternal(unsigned int, int)'
programSkeletonWithBullet.cpp:(.text._ZN11Application10setupSceneEv[Application::setupScene()]+0xa3e): undefined reference to `btRigidBody::btRigidBody(btRigidBody::btRigidBodyConstructionInfo const&)'
programSkeletonWithBullet.cpp:(.text._ZN11Application10setupSceneEv[Application::setupScene()]+0x11aa): undefined reference to `btAlignedFreeInternal(void*)'
programSkeletonWithBullet.cpp:(.text._ZN11Application10setupSceneEv[Application::setupScene()]+0x1271): undefined reference to `btAlignedFreeInternal(void*)'
CMakeFiles/ogre3dTest.dir/src/programSkeletonWithBullet.cpp.o: In function `Application::go()':
programSkeletonWithBullet.cpp:(.text._ZN11Application2goEv[Application::go()]+0x28b): undefined reference to `btDbvtBroadphase::btDbvtBroadphase(btOverlappingPairCache*)'
programSkeletonWithBullet.cpp:(.text._ZN11Application2goEv[Application::go()]+0x2e0): undefined reference to `btDefaultCollisionConfiguration::btDefaultCollisionConfiguration(btDefaultCollisionConstructionInfo const&)'
programSkeletonWithBullet.cpp:(.text._ZN11Application2goEv[Application::go()]+0x2fb): undefined reference to `btCollisionDispatcher::btCollisionDispatcher(btCollisionConfiguration*)'
programSkeletonWithBullet.cpp:(.text._ZN11Application2goEv[Application::go()]+0x315): undefined reference to `btSequentialImpulseConstraintSolver::btSequentialImpulseConstraintSolver()'
programSkeletonWithBullet.cpp:(.text._ZN11Application2goEv[Application::go()]+0x347): undefined reference to `btDiscreteDynamicsWorld::btDiscreteDynamicsWorld(btDispatcher*, btBroadphaseInterface*, btConstraintSolver*, btCollisionConfiguration*)'
collect2: ld returned 1 exit status
make[2]: *** [ogre3dTest] Error 1
make[1]: *** [CMakeFiles/ogre3dTest.dir/all] Error 2
make: *** [all] Error 2
How should I proceed? Thanks.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: compiling an Bullet/Ogre/OIS program with CMake

Post by Erwin Coumans »

I'm not familiar with findBullet.cmake

We are using the Bullet/Ogre/OIS combination with cmake in the OgreKit project. See http://gamekit.googlecode.com

Thanks,
Erwin
jiapei100
Posts: 11
Joined: Tue Nov 17, 2009 4:47 pm

Re: compiling an Bullet/Ogre/OIS program with CMake

Post by jiapei100 »

Same problem here.

Best Regards
JIA
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: compiling an Bullet/Ogre/OIS program with CMake

Post by Erwin Coumans »

jiapei100 wrote:Same problem here.

Best Regards
JIA
What problem?

We don't support findBullet.cmake or system-wide installations.

The intended way of using Bullet is to just copy the src folder in your project and link it statically using the CMakeLists.txt.
You can see how this is done using Bullet+Ogre+IOS in the OgreKitproject.

Is that giving problems?
Thanks,
Erwin