You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
87 lines
2.9 KiB
CMake
87 lines
2.9 KiB
CMake
# - Try to find the Bullet physics engine
|
|
#
|
|
# This module defines the following variables
|
|
#
|
|
# 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
|
|
#
|
|
# BULLET_ROOT - Can be set to bullet install path or Windows build path
|
|
#
|
|
|
|
# Copyright (c) 2009, Philip Lowman <philip at yhbt.com>
|
|
# Modified for OpenMW to parse BT_BULLET_VERSION.
|
|
#
|
|
# Redistribution AND use is allowed according to the terms of the New
|
|
# BSD license.
|
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
|
|
|
include(PreprocessorUtils)
|
|
|
|
set(BULLET_ROOT $ENV{BULLET_ROOT})
|
|
|
|
macro(_FIND_BULLET_LIBRARY _var)
|
|
find_library(${_var}
|
|
NAMES
|
|
${ARGN}
|
|
PATHS
|
|
${BULLET_ROOT}
|
|
${BULLET_ROOT}/lib/Debug
|
|
${BULLET_ROOT}/lib/Release
|
|
${BULLET_ROOT}/out/release8/libs
|
|
${BULLET_ROOT}/out/debug8/libs
|
|
PATH_SUFFIXES lib
|
|
)
|
|
mark_as_advanced(${_var})
|
|
endmacro()
|
|
|
|
macro(_BULLET_APPEND_LIBRARIES _list _release)
|
|
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
|
|
PATHS
|
|
${BULLET_ROOT}/include
|
|
${BULLET_ROOT}/src
|
|
PATH_SUFFIXES bullet
|
|
)
|
|
|
|
# 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)
|
|
|
|
|
|
# handle the QUIETLY and REQUIRED arguments and set BULLET_FOUND to TRUE if
|
|
# all listed variables are TRUE
|
|
include(FindPackageHandleStandardArgs)
|
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Bullet DEFAULT_MSG
|
|
#BULLET_DYNAMICS_LIBRARY
|
|
BULLET_COLLISION_LIBRARY BULLET_MATH_LIBRARY
|
|
BULLET_INCLUDE_DIR)
|
|
|
|
set(BULLET_INCLUDE_DIRS ${BULLET_INCLUDE_DIR})
|
|
if(BULLET_FOUND)
|
|
#_BULLET_APPEND_LIBRARIES(BULLET_LIBRARIES BULLET_DYNAMICS_LIBRARY)
|
|
_BULLET_APPEND_LIBRARIES(BULLET_LIBRARIES BULLET_COLLISION_LIBRARY)
|
|
_BULLET_APPEND_LIBRARIES(BULLET_LIBRARIES BULLET_MATH_LIBRARY)
|
|
|
|
find_file(BULLET_BTSCALAR_FILE NAMES btScalar.h PATHS "${BULLET_INCLUDE_DIR}/LinearMath")
|
|
file(READ ${BULLET_BTSCALAR_FILE} BULLET_BTSCALAR_CONTENT)
|
|
get_preprocessor_entry(BULLET_BTSCALAR_CONTENT BT_BULLET_VERSION BULLET_VERSION)
|
|
message(STATUS "Bullet version: ${BULLET_VERSION}")
|
|
endif()
|