1
1
# - Try to find the Bullet physics engine
3
# This module defines the following variables
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)
11
# This module accepts the following variables
3
# This module accepts the following env variables
13
4
# BULLET_ROOT - Can be set to bullet install path or Windows build path
6
# Once done this will define
7
# Bullet_FOUND - System has the all required components.
8
# Bullet_INCLUDE_DIRS - Include directory necessary for using the required components headers.
9
# Bullet_LIBRARIES - Link these to use the required bullet components.
10
# Bullet_VERSION - Version of libbullet
12
# For each of the components
16
18
# Copyright (c) 2009, Philip Lowman <philip at yhbt.com>
17
19
# Modified for OpenMW to parse BT_BULLET_VERSION.
21
23
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
23
include(PreprocessorUtils)
25
set(BULLET_ROOT $ENV{BULLET_ROOT})
27
macro(_FIND_BULLET_LIBRARY _var)
33
${BULLET_ROOT}/lib/Debug
34
${BULLET_ROOT}/lib/Release
35
${BULLET_ROOT}/out/release8/libs
36
${BULLET_ROOT}/out/debug8/libs
39
mark_as_advanced(${_var})
42
macro(_BULLET_APPEND_LIBRARIES _list _release)
43
set(_debug ${_release}_DEBUG)
45
set(${_list} ${${_list}} optimized ${${_release}} debug ${${_debug}})
47
set(${_list} ${${_list}} ${${_release}})
51
find_path(BULLET_INCLUDE_DIR NAMES btBulletCollisionCommon.h
53
${BULLET_ROOT}/include
60
#_FIND_BULLET_LIBRARY(BULLET_DYNAMICS_LIBRARY BulletDynamics)
61
#_FIND_BULLET_LIBRARY(BULLET_DYNAMICS_LIBRARY_DEBUG BulletDynamics_Debug BulletDynamics_d)
62
_FIND_BULLET_LIBRARY(BULLET_COLLISION_LIBRARY BulletCollision)
63
_FIND_BULLET_LIBRARY(BULLET_COLLISION_LIBRARY_DEBUG BulletCollision_Debug BulletCollision_d)
64
_FIND_BULLET_LIBRARY(BULLET_MATH_LIBRARY BulletMath LinearMath)
65
_FIND_BULLET_LIBRARY(BULLET_MATH_LIBRARY_DEBUG BulletMath_Debug BulletMath_d LinearMath_debug LinearMath_d)
68
# handle the QUIETLY and REQUIRED arguments and set BULLET_FOUND to TRUE if
69
# all listed variables are TRUE
70
include(FindPackageHandleStandardArgs)
71
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Bullet DEFAULT_MSG
72
#BULLET_DYNAMICS_LIBRARY
73
BULLET_COLLISION_LIBRARY BULLET_MATH_LIBRARY
76
set(BULLET_INCLUDE_DIRS ${BULLET_INCLUDE_DIR})
78
#_BULLET_APPEND_LIBRARIES(BULLET_LIBRARIES BULLET_DYNAMICS_LIBRARY)
79
_BULLET_APPEND_LIBRARIES(BULLET_LIBRARIES BULLET_COLLISION_LIBRARY)
80
_BULLET_APPEND_LIBRARIES(BULLET_LIBRARIES BULLET_MATH_LIBRARY)
82
find_file(BULLET_BTSCALAR_FILE NAMES btScalar.h PATHS "${BULLET_INCLUDE_DIR}/LinearMath")
83
file(READ ${BULLET_BTSCALAR_FILE} BULLET_BTSCALAR_CONTENT)
84
get_preprocessor_entry(BULLET_BTSCALAR_CONTENT BT_BULLET_VERSION BULLET_VERSION)
85
message(STATUS "Bullet version: ${BULLET_VERSION}")
25
include(LibFindMacros)
27
# Macro: _internal_find_bullet_library
28
# Checks for the given component by invoking pkgconfig etc.
29
macro(_internal_find_bullet_library _lib)
30
libfind_pkg_detect(Bullet_${_lib} bullet
32
HINTS $ENV{BULLET_ROOT}
35
libfind_process(Bullet_${_lib})
38
set(_known_components LinearMath BulletCollision BulletSoftBody BulletDynamics)
40
# Check if the required components were found and add their stuff to the Bullet_* vars.
41
foreach (_component ${Bullet_FIND_COMPONENTS})
42
list(FIND _known_components ${_component} _known_component)
43
if (_known_component EQUAL -1)
44
message(FATAL_ERROR "Unknown component '${_component}'")
47
set(Bullet_${_component}_Debug_FIND_QUIETLY TRUE) # don't spam messages with optional Debug component
48
_internal_find_bullet_library(${_component})
49
_internal_find_bullet_library(${_component}_Debug)
51
if (Bullet_${_component}_Debug_FOUND)
52
set(Bullet_LIBRARIES ${Bullet_LIBRARIES} optimized ${Bullet_${_component}_LIBRARIES} debug ${Bullet_${_component}_Debug_LIBRARIES})
54
set(Bullet_LIBRARIES ${Bullet_LIBRARIES} ${Bullet_${_component}_LIBRARIES})
58
libfind_pkg_detect(Bullet bullet
59
FIND_PATH btBulletCollisionCommon.h
60
HINTS $ENV{BULLET_ROOT}
61
PATH_SUFFIXES include/bullet
63
set(Bullet_INCLUDE_DIRS ${Bullet_INCLUDE_DIR})
64
libfind_version_header(Bullet LinearMath/btScalar.h BT_BULLET_VERSION)
66
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Bullet
67
FOUND_VAR Bullet_FOUND
68
VERSION_VAR Bullet_VERSION