|
|
@ -1,18 +1,20 @@
|
|
|
|
# - Try to find the Bullet physics engine
|
|
|
|
# - Try to find the Bullet physics engine
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# This module defines the following variables
|
|
|
|
# This module accepts the following env variables
|
|
|
|
#
|
|
|
|
# BULLET_ROOT - Can be set to bullet install path or Windows build path
|
|
|
|
# BULLET_FOUND - Was bullet found
|
|
|
|
|
|
|
|
# BULLET_INCLUDE_DIRS - the Bullet include directories
|
|
|
|
|
|
|
|
# BULLET_LIBRARIES - Link to this, by default it includes
|
|
|
|
|
|
|
|
# all bullet components (Dynamics,
|
|
|
|
|
|
|
|
# Collision, LinearMath, & SoftBody)
|
|
|
|
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# This module accepts the following variables
|
|
|
|
# Once done this will define
|
|
|
|
|
|
|
|
# Bullet_FOUND - System has the all required components.
|
|
|
|
|
|
|
|
# Bullet_INCLUDE_DIRS - Include directory necessary for using the required components headers.
|
|
|
|
|
|
|
|
# Bullet_LIBRARIES - Link these to use the required bullet components.
|
|
|
|
|
|
|
|
# Bullet_VERSION - Version of libbullet
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# BULLET_ROOT - Can be set to bullet install path or Windows build path
|
|
|
|
# For each of the components
|
|
|
|
|
|
|
|
# - LinearMath
|
|
|
|
|
|
|
|
# - BulletCollision
|
|
|
|
|
|
|
|
# - BulletSoftBody
|
|
|
|
|
|
|
|
# - BulletDynamics
|
|
|
|
#
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
# Copyright (c) 2009, Philip Lowman <philip at yhbt.com>
|
|
|
|
# Copyright (c) 2009, Philip Lowman <philip at yhbt.com>
|
|
|
|
# Modified for OpenMW to parse BT_BULLET_VERSION.
|
|
|
|
# Modified for OpenMW to parse BT_BULLET_VERSION.
|
|
|
|
#
|
|
|
|
#
|
|
|
@ -20,67 +22,52 @@
|
|
|
|
# BSD license.
|
|
|
|
# BSD license.
|
|
|
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
|
|
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
|
|
|
|
|
|
|
|
|
|
|
include(PreprocessorUtils)
|
|
|
|
include(LibFindMacros)
|
|
|
|
|
|
|
|
|
|
|
|
set(BULLET_ROOT $ENV{BULLET_ROOT})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
macro(_FIND_BULLET_LIBRARY _var)
|
|
|
|
# Macro: _internal_find_bullet_library
|
|
|
|
find_library(${_var}
|
|
|
|
# Checks for the given component by invoking pkgconfig etc.
|
|
|
|
NAMES
|
|
|
|
macro(_internal_find_bullet_library _lib)
|
|
|
|
${ARGN}
|
|
|
|
libfind_pkg_detect(Bullet_${_lib} bullet
|
|
|
|
PATHS
|
|
|
|
FIND_LIBRARY ${_lib}
|
|
|
|
${BULLET_ROOT}
|
|
|
|
HINTS $ENV{BULLET_ROOT}
|
|
|
|
${BULLET_ROOT}/lib/Debug
|
|
|
|
PATH_SUFFIXES lib
|
|
|
|
${BULLET_ROOT}/lib/Release
|
|
|
|
)
|
|
|
|
${BULLET_ROOT}/out/release8/libs
|
|
|
|
libfind_process(Bullet_${_lib})
|
|
|
|
${BULLET_ROOT}/out/debug8/libs
|
|
|
|
|
|
|
|
PATH_SUFFIXES lib
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
mark_as_advanced(${_var})
|
|
|
|
|
|
|
|
endmacro()
|
|
|
|
endmacro()
|
|
|
|
|
|
|
|
|
|
|
|
macro(_BULLET_APPEND_LIBRARIES _list _release)
|
|
|
|
set(_known_components LinearMath BulletCollision BulletSoftBody BulletDynamics)
|
|
|
|
set(_debug ${_release}_DEBUG)
|
|
|
|
|
|
|
|
if(${_debug})
|
|
|
|
|
|
|
|
set(${_list} ${${_list}} optimized ${${_release}} debug ${${_debug}})
|
|
|
|
|
|
|
|
else()
|
|
|
|
|
|
|
|
set(${_list} ${${_list}} ${${_release}})
|
|
|
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
endmacro()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
find_path(BULLET_INCLUDE_DIR NAMES btBulletCollisionCommon.h
|
|
|
|
# Check if the required components were found and add their stuff to the Bullet_* vars.
|
|
|
|
PATHS
|
|
|
|
foreach (_component ${Bullet_FIND_COMPONENTS})
|
|
|
|
${BULLET_ROOT}/include
|
|
|
|
list(FIND _known_components ${_component} _known_component)
|
|
|
|
${BULLET_ROOT}/src
|
|
|
|
if (_known_component EQUAL -1)
|
|
|
|
PATH_SUFFIXES bullet
|
|
|
|
message(FATAL_ERROR "Unknown component '${_component}'")
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
# Find the libraries
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#_FIND_BULLET_LIBRARY(BULLET_DYNAMICS_LIBRARY BulletDynamics)
|
|
|
|
|
|
|
|
#_FIND_BULLET_LIBRARY(BULLET_DYNAMICS_LIBRARY_DEBUG BulletDynamics_Debug BulletDynamics_d)
|
|
|
|
|
|
|
|
_FIND_BULLET_LIBRARY(BULLET_COLLISION_LIBRARY BulletCollision)
|
|
|
|
|
|
|
|
_FIND_BULLET_LIBRARY(BULLET_COLLISION_LIBRARY_DEBUG BulletCollision_Debug BulletCollision_d)
|
|
|
|
|
|
|
|
_FIND_BULLET_LIBRARY(BULLET_MATH_LIBRARY BulletMath LinearMath)
|
|
|
|
|
|
|
|
_FIND_BULLET_LIBRARY(BULLET_MATH_LIBRARY_DEBUG BulletMath_Debug BulletMath_d LinearMath_debug LinearMath_d)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
set(Bullet_${_component}_Debug_FIND_QUIETLY TRUE) # don't spam messages with optional Debug component
|
|
|
|
|
|
|
|
_internal_find_bullet_library(${_component})
|
|
|
|
|
|
|
|
_internal_find_bullet_library(${_component}_Debug)
|
|
|
|
|
|
|
|
|
|
|
|
# handle the QUIETLY and REQUIRED arguments and set BULLET_FOUND to TRUE if
|
|
|
|
if (Bullet_${_component}_Debug_FOUND)
|
|
|
|
# all listed variables are TRUE
|
|
|
|
set(Bullet_LIBRARIES ${Bullet_LIBRARIES} optimized ${Bullet_${_component}_LIBRARIES} debug ${Bullet_${_component}_Debug_LIBRARIES})
|
|
|
|
include(FindPackageHandleStandardArgs)
|
|
|
|
else()
|
|
|
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Bullet DEFAULT_MSG
|
|
|
|
set(Bullet_LIBRARIES ${Bullet_LIBRARIES} ${Bullet_${_component}_LIBRARIES})
|
|
|
|
#BULLET_DYNAMICS_LIBRARY
|
|
|
|
endif()
|
|
|
|
BULLET_COLLISION_LIBRARY BULLET_MATH_LIBRARY
|
|
|
|
endforeach()
|
|
|
|
BULLET_INCLUDE_DIR)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
set(BULLET_INCLUDE_DIRS ${BULLET_INCLUDE_DIR})
|
|
|
|
libfind_pkg_detect(Bullet bullet
|
|
|
|
if(BULLET_FOUND)
|
|
|
|
FIND_PATH btBulletCollisionCommon.h
|
|
|
|
#_BULLET_APPEND_LIBRARIES(BULLET_LIBRARIES BULLET_DYNAMICS_LIBRARY)
|
|
|
|
HINTS $ENV{BULLET_ROOT}
|
|
|
|
_BULLET_APPEND_LIBRARIES(BULLET_LIBRARIES BULLET_COLLISION_LIBRARY)
|
|
|
|
PATH_SUFFIXES include/bullet
|
|
|
|
_BULLET_APPEND_LIBRARIES(BULLET_LIBRARIES BULLET_MATH_LIBRARY)
|
|
|
|
)
|
|
|
|
|
|
|
|
set(Bullet_INCLUDE_DIRS ${Bullet_INCLUDE_DIR})
|
|
|
|
|
|
|
|
libfind_version_header(Bullet LinearMath/btScalar.h BT_BULLET_VERSION)
|
|
|
|
|
|
|
|
|
|
|
|
find_file(BULLET_BTSCALAR_FILE NAMES btScalar.h PATHS "${BULLET_INCLUDE_DIR}/LinearMath")
|
|
|
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Bullet
|
|
|
|
file(READ ${BULLET_BTSCALAR_FILE} BULLET_BTSCALAR_CONTENT)
|
|
|
|
FOUND_VAR Bullet_FOUND
|
|
|
|
get_preprocessor_entry(BULLET_BTSCALAR_CONTENT BT_BULLET_VERSION BULLET_VERSION)
|
|
|
|
VERSION_VAR Bullet_VERSION
|
|
|
|
message(STATUS "Bullet version: ${BULLET_VERSION}")
|
|
|
|
HANDLE_COMPONENTS
|
|
|
|
endif()
|
|
|
|
REQUIRED_VARS
|
|
|
|
|
|
|
|
Bullet_LIBRARIES
|
|
|
|
|
|
|
|
Bullet_INCLUDE_DIR
|
|
|
|
|
|
|
|
)
|
|
|
|