mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 03:29:55 +00:00
Simplify the bullet detection. This way we don't need to explicitly pass
all possible variables to the try_compile stuff
This commit is contained in:
parent
0f33734f5d
commit
231780a51d
1 changed files with 5 additions and 29 deletions
|
@ -14,37 +14,13 @@ int main(int argc, char** argv)
|
||||||
}
|
}
|
||||||
")
|
")
|
||||||
|
|
||||||
file(WRITE ${TMP_ROOT}/CMakeLists.txt
|
|
||||||
"
|
|
||||||
cmake_minimum_required(VERSION 3.1.0)
|
|
||||||
project(checkbullet)
|
|
||||||
|
|
||||||
# First, try BulletConfig-float64.cmake which comes with Debian derivatives.
|
|
||||||
find_package(Bullet CONFIGS BulletConfig-float64.cmake QUIET COMPONENTS BulletCollision LinearMath)
|
|
||||||
if (BULLET_FOUND)
|
|
||||||
# Fix the relative include:
|
|
||||||
set(BULLET_INCLUDE_DIRS \"\$\{BULLET_ROOT_DIR\}/\$\{BULLET_INCLUDE_DIRS\}\")
|
|
||||||
else()
|
|
||||||
find_package(Bullet REQUIRED COMPONENTS BulletCollision LinearMath)
|
|
||||||
endif()
|
|
||||||
string(REGEX MATCHALL \"((optimized|debug);)?[^;]*(BulletCollision|LinearMath)[^;]*\" BULLET_LIBRARIES \"$\{BULLET_LIBRARIES\}\")
|
|
||||||
|
|
||||||
add_executable(checkbullet checkbullet.cpp)
|
|
||||||
target_compile_definitions(checkbullet PUBLIC BT_USE_DOUBLE_PRECISION)
|
|
||||||
target_include_directories(checkbullet PUBLIC \$\{BULLET_INCLUDE_DIRS\})
|
|
||||||
target_link_libraries(checkbullet \$\{BULLET_LIBRARIES\})
|
|
||||||
")
|
|
||||||
|
|
||||||
if (DEFINED BULLET_ROOT)
|
|
||||||
set(ROOT "-DBULLET_ROOT=${BULLET_ROOT}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
message(STATUS "Checking if Bullet uses double precision")
|
message(STATUS "Checking if Bullet uses double precision")
|
||||||
|
|
||||||
try_compile(RESULT_VAR
|
try_compile(RESULT_VAR
|
||||||
${CMAKE_BINARY_DIR}/temp
|
${TMP_ROOT}/temp
|
||||||
${TMP_ROOT}
|
${TMP_ROOT}/checkbullet.cpp
|
||||||
checkbullet
|
COMPILE_DEFINITIONS "-DBT_USE_DOUBLE_PRECISION"
|
||||||
CMAKE_FLAGS "${ROOT}"
|
LINK_LIBRARIES ${BULLET_LIBRARIES}
|
||||||
|
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${BULLET_INCLUDE_DIRS}"
|
||||||
)
|
)
|
||||||
set(HAS_DOUBLE_PRECISION_BULLET ${RESULT_VAR})
|
set(HAS_DOUBLE_PRECISION_BULLET ${RESULT_VAR})
|
||||||
|
|
Loading…
Reference in a new issue