mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 15:29:55 +00:00
Remove support for single-precision Bullet, fail during configuration instead of during linking.
This commit is contained in:
parent
74ce9ffb85
commit
6fd04cb8f6
6 changed files with 60 additions and 30 deletions
|
@ -73,9 +73,6 @@ CONFIGURATIONS=()
|
||||||
TEST_FRAMEWORK=""
|
TEST_FRAMEWORK=""
|
||||||
GOOGLE_INSTALL_ROOT=""
|
GOOGLE_INSTALL_ROOT=""
|
||||||
INSTALL_PREFIX="."
|
INSTALL_PREFIX="."
|
||||||
BULLET_DOUBLE=true
|
|
||||||
BULLET_DBL=""
|
|
||||||
BULLET_DBL_DISPLAY="Single precision"
|
|
||||||
|
|
||||||
ACTIVATE_MSVC=""
|
ACTIVATE_MSVC=""
|
||||||
SINGLE_CONFIG=""
|
SINGLE_CONFIG=""
|
||||||
|
@ -99,9 +96,6 @@ while [ $# -gt 0 ]; do
|
||||||
d )
|
d )
|
||||||
SKIP_DOWNLOAD=true ;;
|
SKIP_DOWNLOAD=true ;;
|
||||||
|
|
||||||
D )
|
|
||||||
BULLET_DOUBLE=true ;;
|
|
||||||
|
|
||||||
e )
|
e )
|
||||||
SKIP_EXTRACT=true ;;
|
SKIP_EXTRACT=true ;;
|
||||||
|
|
||||||
|
@ -149,8 +143,6 @@ Options:
|
||||||
For single-config generators, several configurations can be set up at once by specifying -c multiple times.
|
For single-config generators, several configurations can be set up at once by specifying -c multiple times.
|
||||||
-d
|
-d
|
||||||
Skip checking the downloads.
|
Skip checking the downloads.
|
||||||
-D
|
|
||||||
Use double-precision Bullet
|
|
||||||
-e
|
-e
|
||||||
Skip extracting dependencies.
|
Skip extracting dependencies.
|
||||||
-h
|
-h
|
||||||
|
@ -433,9 +425,6 @@ if [ -n "$SINGLE_CONFIG" ]; then
|
||||||
if [ -n "$SKIP_DOWNLOAD" ]; then
|
if [ -n "$SKIP_DOWNLOAD" ]; then
|
||||||
RECURSIVE_OPTIONS+=("-d")
|
RECURSIVE_OPTIONS+=("-d")
|
||||||
fi
|
fi
|
||||||
if [ -n "$BULLET_DOUBLE" ]; then
|
|
||||||
RECURSIVE_OPTIONS+=("-D")
|
|
||||||
fi
|
|
||||||
if [ -n "$SKIP_EXTRACT" ]; then
|
if [ -n "$SKIP_EXTRACT" ]; then
|
||||||
RECURSIVE_OPTIONS+=("-e")
|
RECURSIVE_OPTIONS+=("-e")
|
||||||
fi
|
fi
|
||||||
|
@ -508,12 +497,6 @@ if ! [ -z $UNITY_BUILD ]; then
|
||||||
add_cmake_opts "-DOPENMW_UNITY_BUILD=True"
|
add_cmake_opts "-DOPENMW_UNITY_BUILD=True"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$BULLET_DOUBLE" ]; then
|
|
||||||
BULLET_DBL="-double"
|
|
||||||
BULLET_DBL_DISPLAY="Double precision"
|
|
||||||
add_cmake_opts "-DBULLET_USE_DOUBLES=True"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "==================================="
|
echo "==================================="
|
||||||
echo "Starting prebuild on MSVC${MSVC_DISPLAY_YEAR} WIN${BITS}"
|
echo "Starting prebuild on MSVC${MSVC_DISPLAY_YEAR} WIN${BITS}"
|
||||||
|
@ -538,9 +521,9 @@ if [ -z $SKIP_DOWNLOAD ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Bullet
|
# Bullet
|
||||||
download "Bullet 2.89 (${BULLET_DBL_DISPLAY})" \
|
download "Bullet 2.89" \
|
||||||
"https://gitlab.com/OpenMW/openmw-deps/-/raw/main/windows/Bullet-2.89-msvc${MSVC_YEAR}-win${BITS}${BULLET_DBL}.7z" \
|
"https://gitlab.com/OpenMW/openmw-deps/-/raw/main/windows/Bullet-2.89-msvc${MSVC_YEAR}-win${BITS}-double.7z" \
|
||||||
"Bullet-2.89-msvc${MSVC_YEAR}-win${BITS}${BULLET_DBL}.7z"
|
"Bullet-2.89-msvc${MSVC_YEAR}-win${BITS}-double.7z"
|
||||||
|
|
||||||
# FFmpeg
|
# FFmpeg
|
||||||
download "FFmpeg 4.2.2" \
|
download "FFmpeg 4.2.2" \
|
||||||
|
@ -680,15 +663,15 @@ fi
|
||||||
cd $DEPS
|
cd $DEPS
|
||||||
echo
|
echo
|
||||||
# Bullet
|
# Bullet
|
||||||
printf "Bullet 2.89 (${BULLET_DBL_DISPLAY})... "
|
printf "Bullet 2.89... "
|
||||||
{
|
{
|
||||||
cd $DEPS_INSTALL
|
cd $DEPS_INSTALL
|
||||||
if [ -d Bullet ]; then
|
if [ -d Bullet ]; then
|
||||||
printf -- "Exists. (No version checking) "
|
printf -- "Exists. (No version checking) "
|
||||||
elif [ -z $SKIP_EXTRACT ]; then
|
elif [ -z $SKIP_EXTRACT ]; then
|
||||||
rm -rf Bullet
|
rm -rf Bullet
|
||||||
eval 7z x -y "${DEPS}/Bullet-2.89-msvc${MSVC_YEAR}-win${BITS}${BULLET_DBL}.7z" $STRIP
|
eval 7z x -y "${DEPS}/Bullet-2.89-msvc${MSVC_YEAR}-win${BITS}-double.7z" $STRIP
|
||||||
mv "Bullet-2.89-msvc${MSVC_YEAR}-win${BITS}${BULLET_DBL}" Bullet
|
mv "Bullet-2.89-msvc${MSVC_YEAR}-win${BITS}-double" Bullet
|
||||||
fi
|
fi
|
||||||
add_cmake_opts -DBULLET_ROOT="$(real_pwd)/Bullet"
|
add_cmake_opts -DBULLET_ROOT="$(real_pwd)/Bullet"
|
||||||
echo Done.
|
echo Done.
|
||||||
|
|
|
@ -25,6 +25,5 @@ cmake \
|
||||||
-D BUILD_BSATOOL=TRUE \
|
-D BUILD_BSATOOL=TRUE \
|
||||||
-D BUILD_ESSIMPORTER=TRUE \
|
-D BUILD_ESSIMPORTER=TRUE \
|
||||||
-D BUILD_NIFTEST=TRUE \
|
-D BUILD_NIFTEST=TRUE \
|
||||||
-D BULLET_USE_DOUBLES=TRUE \
|
|
||||||
-G"Unix Makefiles" \
|
-G"Unix Makefiles" \
|
||||||
..
|
..
|
||||||
|
|
|
@ -35,7 +35,6 @@ option(BUILD_DOCS "Build documentation." OFF )
|
||||||
option(BUILD_WITH_CODE_COVERAGE "Enable code coverage with gconv" OFF)
|
option(BUILD_WITH_CODE_COVERAGE "Enable code coverage with gconv" OFF)
|
||||||
option(BUILD_UNITTESTS "Enable Unittests with Google C++ Unittest" OFF)
|
option(BUILD_UNITTESTS "Enable Unittests with Google C++ Unittest" OFF)
|
||||||
option(BUILD_BENCHMARKS "Build benchmarks with Google Benchmark" OFF)
|
option(BUILD_BENCHMARKS "Build benchmarks with Google Benchmark" OFF)
|
||||||
option(BULLET_USE_DOUBLES "Use double precision for Bullet" ON)
|
|
||||||
|
|
||||||
set(OpenGL_GL_PREFERENCE LEGACY) # Use LEGACY as we use GL2; GLNVD is for GL3 and up.
|
set(OpenGL_GL_PREFERENCE LEGACY) # Use LEGACY as we use GL2; GLNVD is for GL3 and up.
|
||||||
|
|
||||||
|
@ -314,6 +313,12 @@ if(OPENMW_USE_SYSTEM_BULLET)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(Bullet ${REQUIRED_BULLET_VERSION} REQUIRED COMPONENTS BulletCollision LinearMath)
|
find_package(Bullet ${REQUIRED_BULLET_VERSION} REQUIRED COMPONENTS BulletCollision LinearMath)
|
||||||
|
include(cmake/CheckBulletPrecision.cmake)
|
||||||
|
if (HAS_DOUBLE_PRECISION_BULLET)
|
||||||
|
message(STATUS "Bullet uses double precision")
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Bullet does not uses double precision")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT WIN32 AND BUILD_WIZARD) # windows users can just run the morrowind installer
|
if (NOT WIN32 AND BUILD_WIZARD) # windows users can just run the morrowind installer
|
||||||
|
|
45
cmake/CheckBulletPrecision.cmake
Normal file
45
cmake/CheckBulletPrecision.cmake
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
set(TMP_ROOT ${CMAKE_BINARY_DIR}/try-compile)
|
||||||
|
file(MAKE_DIRECTORY ${TMP_ROOT})
|
||||||
|
|
||||||
|
file(WRITE ${TMP_ROOT}/checkbullet.cpp
|
||||||
|
"
|
||||||
|
#include <BulletCollision/CollisionShapes/btSphereShape.h>
|
||||||
|
int main(int argc, char** argv)
|
||||||
|
{
|
||||||
|
btSphereShape shape(1.0);
|
||||||
|
btScalar mass(1.0);
|
||||||
|
btVector3 inertia;
|
||||||
|
shape.calculateLocalInertia(mass, inertia);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
")
|
||||||
|
|
||||||
|
file(WRITE ${TMP_ROOT}/CMakeLists.txt
|
||||||
|
"
|
||||||
|
cmake_minimum_required(VERSION 3.1.0)
|
||||||
|
project(checkbullet)
|
||||||
|
add_executable(checkbullet checkbullet.cpp)
|
||||||
|
find_package(Bullet REQUIRED COMPONENTS BulletCollision LinearMath)
|
||||||
|
target_compile_definitions(checkbullet PUBLIC BT_USE_DOUBLE_PRECISION)
|
||||||
|
include_directories(\$\{BULLET_INCLUDE_DIRS\})
|
||||||
|
include(${CMAKE_SOURCE_DIR}/cmake/OSIdentity.cmake)
|
||||||
|
if (UBUNTU_FOUND OR DEBIAN_FOUND)
|
||||||
|
target_link_libraries(checkbullet BulletCollision-float64 LinearMath-float64)
|
||||||
|
else()
|
||||||
|
target_link_libraries(checkbullet \$\{BULLET_LIBRARIES\})
|
||||||
|
endif()
|
||||||
|
")
|
||||||
|
|
||||||
|
if (DEFINED BULLET_ROOT)
|
||||||
|
set(ROOT "-DBULLET_ROOT=${BULLET_ROOT}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
message(STATUS "Checking if Bullet uses double precision")
|
||||||
|
|
||||||
|
try_compile(RESULT_VAR
|
||||||
|
${CMAKE_BINARY_DIR}/temp
|
||||||
|
${TMP_ROOT}
|
||||||
|
checkbullet
|
||||||
|
CMAKE_FLAGS "${ROOT}"
|
||||||
|
)
|
||||||
|
set(HAS_DOUBLE_PRECISION_BULLET ${RESULT_VAR})
|
|
@ -254,7 +254,7 @@ target_link_libraries(components
|
||||||
RecastNavigation::Recast
|
RecastNavigation::Recast
|
||||||
)
|
)
|
||||||
|
|
||||||
if (BULLET_USE_DOUBLES AND (UBUNTU_FOUND OR DEBIAN_FOUND) AND OPENMW_USE_SYSTEM_BULLET)
|
if ((UBUNTU_FOUND OR DEBIAN_FOUND) AND OPENMW_USE_SYSTEM_BULLET)
|
||||||
target_link_libraries(components BulletCollision-float64 LinearMath-float64)
|
target_link_libraries(components BulletCollision-float64 LinearMath-float64)
|
||||||
else()
|
else()
|
||||||
target_link_libraries(components ${BULLET_LIBRARIES})
|
target_link_libraries(components ${BULLET_LIBRARIES})
|
||||||
|
@ -292,6 +292,4 @@ endif()
|
||||||
# Make the variable accessible for other subdirectories
|
# Make the variable accessible for other subdirectories
|
||||||
set(COMPONENT_FILES ${COMPONENT_FILES} PARENT_SCOPE)
|
set(COMPONENT_FILES ${COMPONENT_FILES} PARENT_SCOPE)
|
||||||
|
|
||||||
if (BULLET_USE_DOUBLES)
|
target_compile_definitions(components PUBLIC BT_USE_DOUBLE_PRECISION)
|
||||||
target_compile_definitions(components PUBLIC BT_USE_DOUBLE_PRECISION)
|
|
||||||
endif()
|
|
||||||
|
|
2
extern/CMakeLists.txt
vendored
2
extern/CMakeLists.txt
vendored
|
@ -28,7 +28,7 @@ if(NOT OPENMW_USE_SYSTEM_BULLET)
|
||||||
set(BUILD_CPU_DEMOS OFF CACHE BOOL "")
|
set(BUILD_CPU_DEMOS OFF CACHE BOOL "")
|
||||||
set(BUILD_EGL OFF CACHE BOOL "")
|
set(BUILD_EGL OFF CACHE BOOL "")
|
||||||
|
|
||||||
set(USE_DOUBLE_PRECISION ${BULLET_USE_DOUBLES} CACHE BOOL "")
|
set(USE_DOUBLE_PRECISION ON CACHE BOOL "")
|
||||||
set(BULLET2_MULTITHREADING ON CACHE BOOL "")
|
set(BULLET2_MULTITHREADING ON CACHE BOOL "")
|
||||||
|
|
||||||
if(BULLET_STATIC)
|
if(BULLET_STATIC)
|
||||||
|
|
Loading…
Reference in a new issue