FindBullet.cmake 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. # - Try to find the Bullet physics engine
  2. #
  3. # This module defines the following variables
  4. #
  5. # BULLET_FOUND - Was bullet found
  6. # BULLET_INCLUDE_DIRS - the Bullet include directories
  7. # BULLET_LIBRARIES - Link to this, by default it includes
  8. # all bullet components (Dynamics,
  9. # Collision, LinearMath, & SoftBody)
  10. #
  11. # This module accepts the following variables
  12. #
  13. # BULLET_ROOT - Can be set to bullet install path or Windows build path
  14. #
  15. #=============================================================================
  16. # Copyright 2009 Kitware, Inc.
  17. # Copyright 2009 Philip Lowman <[email protected]>
  18. #
  19. # Distributed under the OSI-approved BSD License (the "License");
  20. # see accompanying file Copyright.txt for details.
  21. #
  22. # This software is distributed WITHOUT ANY WARRANTY; without even the
  23. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  24. # See the License for more information.
  25. #=============================================================================
  26. # (To distribute this file outside of CMake, substitute the full
  27. # License text for the above reference.)
  28. macro(_FIND_BULLET_LIBRARY _var)
  29. find_library(${_var}
  30. NAMES
  31. ${ARGN}
  32. HINTS
  33. ${BULLET_ROOT}
  34. ${BULLET_ROOT}/out/release8/libs
  35. ${BULLET_ROOT}/out/debug8/libs
  36. PATH_SUFFIXES lib
  37. )
  38. mark_as_advanced(${_var})
  39. endmacro()
  40. macro(_BULLET_APPEND_LIBRARIES _list _release)
  41. set(_debug ${_release}_DEBUG)
  42. if(${_debug})
  43. set(${_list} ${${_list}} optimized ${${_release}} debug ${${_debug}})
  44. else()
  45. set(${_list} ${${_list}} ${${_release}})
  46. endif()
  47. endmacro()
  48. find_path(BULLET_INCLUDE_DIR NAMES btBulletCollisionCommon.h
  49. HINTS
  50. ${BULLET_ROOT}/include
  51. ${BULLET_ROOT}/src
  52. PATH_SUFFIXES bullet
  53. )
  54. # Find the libraries
  55. _FIND_BULLET_LIBRARY(BULLET_DYNAMICS_LIBRARY BulletDynamics)
  56. _FIND_BULLET_LIBRARY(BULLET_DYNAMICS_LIBRARY_DEBUG BulletDynamics_d)
  57. _FIND_BULLET_LIBRARY(BULLET_COLLISION_LIBRARY BulletCollision)
  58. _FIND_BULLET_LIBRARY(BULLET_COLLISION_LIBRARY_DEBUG BulletCollision_d)
  59. _FIND_BULLET_LIBRARY(BULLET_MATH_LIBRARY LinearMath BulletMath)
  60. _FIND_BULLET_LIBRARY(BULLET_MATH_LIBRARY_DEBUG LinearMath_d BulletMath_d)
  61. _FIND_BULLET_LIBRARY(BULLET_SOFTBODY_LIBRARY BulletSoftBody)
  62. _FIND_BULLET_LIBRARY(BULLET_SOFTBODY_LIBRARY_DEBUG BulletSoftBody_d)
  63. # handle the QUIETLY and REQUIRED arguments and set BULLET_FOUND to TRUE if
  64. # all listed variables are TRUE
  65. include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake")
  66. FIND_PACKAGE_HANDLE_STANDARD_ARGS(Bullet DEFAULT_MSG
  67. BULLET_DYNAMICS_LIBRARY BULLET_COLLISION_LIBRARY BULLET_MATH_LIBRARY
  68. BULLET_SOFTBODY_LIBRARY BULLET_INCLUDE_DIR)
  69. set(BULLET_INCLUDE_DIRS ${BULLET_INCLUDE_DIR})
  70. if(BULLET_FOUND)
  71. _BULLET_APPEND_LIBRARIES(BULLET_LIBRARIES BULLET_DYNAMICS_LIBRARY)
  72. _BULLET_APPEND_LIBRARIES(BULLET_LIBRARIES BULLET_COLLISION_LIBRARY)
  73. _BULLET_APPEND_LIBRARIES(BULLET_LIBRARIES BULLET_MATH_LIBRARY)
  74. _BULLET_APPEND_LIBRARIES(BULLET_LIBRARIES BULLET_SOFTBODY_LIBRARY)
  75. endif()