~ubuntu-branches/ubuntu/lucid/cmake/lucid

« back to all changes in this revision

Viewing changes to Modules/FindBullet.cmake

  • Committer: Bazaar Package Importer
  • Author(s): Artur Rona
  • Date: 2009-12-16 11:11:54 UTC
  • mfrom: (3.1.9 sid)
  • Revision ID: james.westby@ubuntu.com-20091216111154-6accvv6yq86h2hkc
Tags: 2.8.0-5ubuntu1
* Merge from debian testing (LP: #497349). Remaining changes:
  - Keep the Replaces: on cmake-data to cover the Kubuntu version from
    Jaunty in case someone decides to do an (unsupported) Jaunty->Lucid
    upgrade.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
#=============================================================================
 
17
# Copyright 2009 Kitware, Inc.
 
18
# Copyright 2009 Philip Lowman <philip@yhbt.com>
 
19
#
 
20
# Distributed under the OSI-approved BSD License (the "License");
 
21
# see accompanying file Copyright.txt for details.
 
22
#
 
23
# This software is distributed WITHOUT ANY WARRANTY; without even the
 
24
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
25
# See the License for more information.
 
26
#=============================================================================
 
27
# (To distributed this file outside of CMake, substitute the full
 
28
#  License text for the above reference.)
 
29
 
 
30
macro(_FIND_BULLET_LIBRARY _var)
 
31
  find_library(${_var}
 
32
     NAMES 
 
33
        ${ARGN}
 
34
     PATHS
 
35
        ${BULLET_ROOT}
 
36
        ${BULLET_ROOT}/out/release8/libs
 
37
        ${BULLET_ROOT}/out/debug8/libs
 
38
     PATH_SUFFIXES lib
 
39
  )
 
40
  mark_as_advanced(${_var})
 
41
endmacro()
 
42
 
 
43
macro(_BULLET_APPEND_LIBRARIES _list _release)
 
44
   set(_debug ${_release}_DEBUG)
 
45
   if(${_debug})
 
46
      set(${_list} ${${_list}} optimized ${${_release}} debug ${${_debug}})
 
47
   else()
 
48
      set(${_list} ${${_list}} ${${_release}})
 
49
   endif()
 
50
endmacro()
 
51
 
 
52
find_path(BULLET_INCLUDE_DIR NAMES btBulletCollisionCommon.h
 
53
  PATHS
 
54
    ${BULLET_ROOT}/include
 
55
    ${BULLET_ROOT}/src
 
56
)
 
57
 
 
58
# Find the libraries
 
59
 
 
60
_FIND_BULLET_LIBRARY(BULLET_DYNAMICS_LIBRARY        BulletDynamics)
 
61
_FIND_BULLET_LIBRARY(BULLET_DYNAMICS_LIBRARY_DEBUG  BulletDynamics_d)
 
62
_FIND_BULLET_LIBRARY(BULLET_COLLISION_LIBRARY       BulletCollision)
 
63
_FIND_BULLET_LIBRARY(BULLET_COLLISION_LIBRARY_DEBUG BulletCollision_d)
 
64
_FIND_BULLET_LIBRARY(BULLET_MATH_LIBRARY            LinearMath BulletMath)
 
65
_FIND_BULLET_LIBRARY(BULLET_MATH_LIBRARY_DEBUG      LinearMath_d BulletMath_d)
 
66
_FIND_BULLET_LIBRARY(BULLET_SOFTBODY_LIBRARY        BulletSoftBody)
 
67
_FIND_BULLET_LIBRARY(BULLET_SOFTBODY_LIBRARY_DEBUG  BulletSoftBody_d)
 
68
 
 
69
 
 
70
# handle the QUIETLY and REQUIRED arguments and set BULLET_FOUND to TRUE if 
 
71
# all listed variables are TRUE
 
72
include(FindPackageHandleStandardArgs)
 
73
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Bullet DEFAULT_MSG
 
74
    BULLET_DYNAMICS_LIBRARY BULLET_COLLISION_LIBRARY BULLET_MATH_LIBRARY
 
75
    BULLET_SOFTBODY_LIBRARY BULLET_INCLUDE_DIR)
 
76
 
 
77
set(BULLET_INCLUDE_DIRS ${BULLET_INCLUDE_DIR})
 
78
if(BULLET_FOUND)
 
79
   _BULLET_APPEND_LIBRARIES(BULLET_LIBRARIES BULLET_DYNAMICS_LIBRARY)
 
80
   _BULLET_APPEND_LIBRARIES(BULLET_LIBRARIES BULLET_COLLISION_LIBRARY)
 
81
   _BULLET_APPEND_LIBRARIES(BULLET_LIBRARIES BULLET_MATH_LIBRARY)
 
82
   _BULLET_APPEND_LIBRARIES(BULLET_LIBRARIES BULLET_SOFTBODY_LIBRARY)
 
83
endif()