From 9eb96b9cb6af2643b21617e391d317c605cf7c7d Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 15 Feb 2016 14:34:59 +0100 Subject: [PATCH] Parse the bullet version in FindBullet.cmake --- CMakeLists.txt | 3 +++ cmake/FindBullet.cmake | 8 ++++++++ components/resource/bulletshapemanager.hpp | 6 ------ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 520279e50..f5c468114 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -304,6 +304,9 @@ find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS}) find_package(SDL2 REQUIRED) find_package(OpenAL REQUIRED) find_package(Bullet REQUIRED) +if (NOT BULLET_FOUND OR BULLET_VERSION VERSION_LESS 283) + message(FATAL_ERROR "OpenMW requires Bullet version 2.83 or later") +endif() include_directories("." SYSTEM diff --git a/cmake/FindBullet.cmake b/cmake/FindBullet.cmake index 6d5c517af..d70815dd5 100644 --- a/cmake/FindBullet.cmake +++ b/cmake/FindBullet.cmake @@ -14,11 +14,14 @@ # # Copyright (c) 2009, Philip Lowman +# 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) @@ -75,4 +78,9 @@ 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() diff --git a/components/resource/bulletshapemanager.hpp b/components/resource/bulletshapemanager.hpp index 3fe351f90..14b26962b 100644 --- a/components/resource/bulletshapemanager.hpp +++ b/components/resource/bulletshapemanager.hpp @@ -6,15 +6,9 @@ #include -#include - #include "bulletshape.hpp" #include "resourcemanager.hpp" -#if BT_BULLET_VERSION < 283 -#error "OpenMW requires Bullet version 2.83 or later" -#endif - namespace Resource { class SceneManager;