Revision: 8552 http://playerstage.svn.sourceforge.net/playerstage/?rev=8552&view=rev Author: hsujohnhsu Date: 2010-02-11 21:39:00 +0000 (Thu, 11 Feb 2010)
Log Message: ----------- * replacing bullet cmake setup, going * from bullet_dynamics_dirs, bullet_collision_dirs, bullet_soft_body_dirs, bullet_math_dirs * to bullet_include_dirs, bullet_library_dirs and bullet_libraries * added set ( FLTK_LIBRARIES and FLTK_INCLUDE_DIRS ) * added gazebo_lflags so user can set things such as rpath while building gazebo-executable Modified Paths: -------------- code/gazebo/trunk/cmake/SearchForStuff.cmake code/gazebo/trunk/server/CMakeLists.txt code/gazebo/trunk/server/physics/bullet/CMakeLists.txt Modified: code/gazebo/trunk/cmake/SearchForStuff.cmake =================================================================== --- code/gazebo/trunk/cmake/SearchForStuff.cmake 2010-02-11 19:18:35 UTC (rev 8551) +++ code/gazebo/trunk/cmake/SearchForStuff.cmake 2010-02-11 21:39:00 UTC (rev 8552) @@ -24,13 +24,20 @@ set (boost_include_dirs "" CACHE STRING "Boost include paths. Use this to override automatic detection.") set (boost_library_dirs "" CACHE STRING "Boost library paths. Use this to override automatic detection.") set (boost_libraries "" CACHE STRING "Boost libraries. Use this to override automatic detection.") -set (bullet_dynamics_dirs "" CACHE STRING "Bullet Dynamics libraries. Use this to override automatic detection.") -set (bullet_collision_dirs "" CACHE STRING "Bullet Collision libraries. Use this to override automatic detection.") -set (bullet_softbody_dirs "" CACHE STRING "Bullet Softbody libraries. Use this to override automatic detection.") -set (bullet_math_dirs "" CACHE STRING "Bullet LinearMath libraries. Use this to override automatic detection.") + +set (bullet_include_dirs "" CACHE STRING "Bullet include paths. Use this to override automatic detection.") +set (bullet_library_dirs "" CACHE STRING "Bullet library paths. Use this to override automatic detection.") +set (bullet_lflags "" CACHE STRING "Bullet libraries Use this to override automatic detection.") set (bullet_cflags "-DBT_USE_DOUBLE_PRECISION -DBT_EULER_DEFAULT_ZYX" CACHE STRING "Bullet Dynamics C compile flags exported by rospack.") + set (threadpool_include_dirs "" CACHE STRING "Threadpool include paths. Use this to override automatic detection.") +SET (gazebo_lflags "" CACHE STRING "Linker flags such as rpath for gazebo executable.") + +set (FLTK_LIBRARIES "" CACHE STRING "Threadpool include paths. Use this to override automatic detection.") +set (FLTK_INCLUDE_DIR "" CACHE STRING "Threadpool include paths. Use this to override automatic detection.") + + ######################################## # Find packages if (PKG_CONFIG_FOUND) @@ -392,68 +399,38 @@ ######################################## # Find bullet -FIND_PATH( bullet_include_dir btBulletDynamicsCommon.h ${bullet_include_dirs} ENV CPATH) -IF (NOT bullet_include_dir) - MESSAGE (STATUS "Looking for btBulletDynamicsCommon.h - not found") - SET (bullet_include_dir /usr/include) -ELSE (NOT bullet_include_dir) - MESSAGE (STATUS "Looking for btBulletDynamicsCommon.h - found") -ENDIF (NOT bullet_include_dir) +if (NOT bullet_include_dirs AND NOT bullet_library_dirs AND NOT bullet_lflags ) -FIND_LIBRARY(bullet_dynamics_library NAMES BulletDynamics - PATHS ${bullet_dynamics_dirs} ENV LD_LIBRARY_PATH) -FIND_LIBRARY(bullet_collision_library NAMES BulletCollision - PATHS ${bullet_collision_dirs} ENV LD_LIBRARY_PATH) -FIND_LIBRARY(bullet_softbody_library NAMES BulletSoftBody - PATHS ${bullet_softbody_dirs} ENV LD_LIBRARY_PATH) -FIND_LIBRARY(bullet_math_library NAMES LinearMath - PATHS ${bullet_math_dirs} ENV LD_LIBRARY_PATH) + find_path(bullet_include_dir btBulletDynamicsCommon.h ${bullet_include_dirs} ENV CPATH) + + if (NOT bullet_include_dir) + #BUILD_ERROR("bullet not found. See the following website for installation instructions: http://bullet.sourceforge.net") + message (STATUS "Looking for btBulletDynamicsCommon.h - not found. Using built in version.") + set (bullet_include_dirs /usr/include CACHE STRING + "bullet include paths. Use this to override automatic detection.") + else (NOT bullet_include_dir) + message (STATUS "Looking for btBulletDynamicsCommon.h - found") + set (assim_include_dirs ${bullet_include_dir} CACHE STRING + "bullet include paths. Use this to override automatic detection.") + endif (NOT bullet_include_dir) + + find_library(bullet_library BulletDynamics ENV LD_LIBRARY_PATH) + + if (NOT bullet_library) + message (STATUS "Looking for libBulletDynamics - not found. Using builtin version.") + #BUILD_ERROR("libbullet not found. See the following website for installation instructions: http://bullet.sourceforge.net") + else (NOT bullet_library) + message (STATUS "Looking for libBulletDynamics - found") + APPEND_TO_CACHED_LIST(bullet_lflags + "bullet libraries Use this to override automatic detection." + ${bullet_library}) + endif (NOT bullet_library) + + if (NOT bullet_include_dir OR NOT bullet_library) + message (STATUS "bullet not found") + endif (NOT bullet_include_dir OR NOT bullet_library) -IF (NOT bullet_dynamics_library OR - NOT bullet_collision_library OR - NOT bullet_softbody_library OR - NOT bullet_math_library) - MESSAGE (STATUS "Looking for bullet libraries - not found") -ELSE (NOT bullet_dynamics_library OR - NOT bullet_collision_library OR - NOT bullet_softbody_library OR - NOT bullet_math_library) - MESSAGE (STATUS "Looking for bullet libraries - found") -ENDIF (NOT bullet_dynamics_library OR - NOT bullet_collision_library OR - NOT bullet_softbody_library OR - NOT bullet_math_library) +endif (NOT bullet_include_dirs AND NOT bullet_library_dirs AND NOT bullet_lflags ) -IF (bullet_dynamics_library AND - bullet_collision_library AND - bullet_softbody_library AND - bullet_math_library AND - bullet_include_dir) - SET (INCLUDE_BULLET TRUE CACHE BOOL "Include support for Bullet") +set (INCLUDE_BULLET ON BOOL) - APPEND_TO_CACHED_LIST(bullet_link_libs - ${bullet_link_libs_desc} - ${bullet_dynamics_library}) - APPEND_TO_CACHED_LIST(bullet_link_libs - ${bullet_link_libs_desc} - ${bullet_collision_library}) - APPEND_TO_CACHED_LIST(bullet_link_libs - ${bullet_link_libs_desc} - ${bullet_softbody_library}) - APPEND_TO_CACHED_LIST(bullet_link_libs - ${bullet_link_libs_desc} - ${bullet_math_library}) - - -ELSE (bullet_dynamics_library AND - bullet_collision_library AND - bullet_softbody_library AND - bullet_math_library AND - bullet_include_dir) - SET (INCLUDE_BULLET FALSE CACHE BOOL "Include support for Bullet") - MESSAGE (STATUS "Warning: Unable to find bullet. The bullet physics engine will not be supported.") -ENDIF (bullet_dynamics_library AND - bullet_collision_library AND - bullet_softbody_library AND - bullet_math_library AND - bullet_include_dir) Modified: code/gazebo/trunk/server/CMakeLists.txt =================================================================== --- code/gazebo/trunk/server/CMakeLists.txt 2010-02-11 19:18:35 UTC (rev 8551) +++ code/gazebo/trunk/server/CMakeLists.txt 2010-02-11 21:39:00 UTC (rev 8552) @@ -2,8 +2,16 @@ ######################################## # Include all the search paths for headers +STRING (REPLACE " " ";" boost_include_dirs_split "${boost_include_dirs}") +STRING (REPLACE " " ";" assimp_include_dirs_split "${assimp_include_dirs}") +STRING (REPLACE " " ";" bullet_include_dirs_split "${bullet_include_dirs}") STRING (REPLACE " " ";" threadpool_include_dirs_split "${threadpool_include_dirs}") +STRING (REPLACE " " ";" boost_library_dirs_split "${boost_library_dirs}") +STRING (REPLACE " " ";" assimp_library_dirs_split "${assimp_library_dirs}") +STRING (REPLACE " " ";" bullet_library_dirs_split "${bullet_library_dirs}") + + INCLUDE_DIRECTORIES( . ${CMAKE_SOURCE_DIR}/libgazebo @@ -24,10 +32,10 @@ ${LIBAVFORMAT_PATH} ${libtool_include_path} ${gazeboserver_include_dirs} - ${boost_include_dirs} - ${assimp_include_dirs} + ${boost_include_dirs_split} + ${assimp_include_dirs_split} ${freeimage_include_dir} - ${bullet_include_dir} + ${bullet_include_dirs_split} ${threadpool_include_dirs_split} ${FLTK_INCLUDE_DIR} ) @@ -36,12 +44,9 @@ ${CMAKE_BINARY_DIR}/libgazebo ${CMAKE_BINARY_DIR}/server/gui ${CMAKE_BINARY_DIR}/server/physics/bullet - ${boost_library_dirs} - ${assimp_library_dirs} - ${bullet_dynamics_dirs} - ${bullet_collision_dirs} - ${bullet_softbody_dirs} - ${bullet_math_dirs} + ${boost_library_dirs_split} + ${assimp_library_dirs_split} + ${bullet_library_dirs_split} ${freeimage_library_dir} ${gazeboserver_link_dirs} ) @@ -145,6 +150,8 @@ ${CMAKE_LINK_FLAGS_${CMAKE_BUILD_TYPE}}) ENDIF (CMAKE_LINK_FLAGS_${CMAKE_BUILD_TYPE}) +SET_TARGET_PROPERTIES( gazebo-exec PROPERTIES LINK_FLAGS "${LINK_FLAGS} ${gazebo_lflags}") + target_link_libraries( gazebo-exec ${libtool_library} ${gazeboserver_link_libs} ${boost_libraries} @@ -162,9 +169,8 @@ target_link_libraries( gazebo_server ${libtool_library} ${freeimage_library} gazebo gazebo_rendering gazebo_physics ) if (INCLUDE_BULLET) - target_link_libraries(gazebo-exec gazebo_physics_bullet ${bullet_link_libs}) - target_link_libraries(gazebo-exec BulletDynamics) - target_link_libraries(gazebo_server gazebo_physics_bullet ${bullet_link_libs}) + target_link_libraries(gazebo-exec gazebo_physics_bullet ${bullet_lflags}) + target_link_libraries(gazebo_server gazebo_physics_bullet ${bullet_lflags}) endif (INCLUDE_BULLET) if (INCLUDE_ODE) Modified: code/gazebo/trunk/server/physics/bullet/CMakeLists.txt =================================================================== --- code/gazebo/trunk/server/physics/bullet/CMakeLists.txt 2010-02-11 19:18:35 UTC (rev 8551) +++ code/gazebo/trunk/server/physics/bullet/CMakeLists.txt 2010-02-11 21:39:00 UTC (rev 8552) @@ -1,5 +1,13 @@ include (${gazebo_cmake_dir}/GazeboUtils.cmake) +######################################## +# Include all the search paths for headers +STRING (REPLACE " " ";" boost_include_dirs_split "${boost_include_dirs}") +STRING (REPLACE " " ";" bullet_include_dirs_split "${bullet_include_dirs}") +STRING (REPLACE " " ";" threadpool_include_dirs_split "${threadpool_include_dirs}") +STRING (REPLACE " " ";" boost_library_dirs_split "${boost_library_dirs}") +STRING (REPLACE " " ";" bullet_library_dirs_split "${bullet_library_dirs}") + INCLUDE_DIRECTORIES( . ${CMAKE_SOURCE_DIR}/libgazebo @@ -20,9 +28,9 @@ ${LIBAVFORMAT_PATH} ${libtool_include_path} ${gazeboserver_include_dirs} - ${boost_include_dirs} + ${boost_include_dirs_split} ${freeimage_include_dir} - ${bullet_include_dir} + ${bullet_include_dirs_split} ${threadpool_include_dirs_split} ${FLTK_INCLUDE_DIR} ) @@ -31,11 +39,8 @@ ${CMAKE_BINARY_DIR}/libgazebo ${CMAKE_BINARY_DIR}/server/gui ${CMAKE_BINARY_DIR}/server/physics/bullet - ${boost_library_dirs} - ${bullet_dynamics_dirs} - ${bullet_collision_dirs} - ${bullet_softbody_dirs} - ${bullet_math_dirs} + ${boost_library_dirs_split} + ${bullet_library_dirs_split} ${freeimage_library_dir} ${gazeboserver_link_dirs} ) @@ -54,8 +59,10 @@ #BulletRayGeom.cc ) + + add_definitions(${bullet_cflags}) #add_definitions(mDBT_USE_DOUBLE_PRECISION -DBT_EULER_DEFAULT_ZYX) ADD_LIBRARY(gazebo_physics_bullet SHARED ${sources}) -TARGET_LINK_LIBRARIES( gazebo_physics_bullet BulletDynamics BulletCollision LinearMath ) +TARGET_LINK_LIBRARIES( gazebo_physics_bullet ${bullet_lflags} ) INSTALL( TARGETS gazebo_physics_bullet DESTINATION ${CMAKE_INSTALL_PREFIX}/lib ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev _______________________________________________ Playerstage-commit mailing list Playerstage-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/playerstage-commit