use gmp backend for Boost Multiprecision

This commit is contained in:
Moritz Bunkus 2021-07-03 22:59:14 +02:00
parent 409bfbe460
commit 213ed8514a
No known key found for this signature in database
GPG Key ID: 74AF00ADF2E32C85
6 changed files with 40 additions and 6 deletions

View File

@ -86,6 +86,7 @@
* The bundled `fmt` library was updated to v8.0.0.
* The `PCRE2` & `JPCRE2` libraries are not used anymore. The bundled version
of `JPCRE2` was removed.
* The `gmp` library is now required.
# Version 58.0.0 "Supper's Ready" 2021-06-13

View File

@ -1066,6 +1066,7 @@ $common_libs = [
:fmt,
:stdcppfs,
:qt_non_gui,
:gmp,
"-lstdc++",
]

View File

@ -1,9 +1,40 @@
# boost's headers must be present.
AX_BOOST_BASE([1.66.0])
AX_BOOST_CHECK_HEADERS([boost/multiprecision/cpp_int.hpp],,[
AC_MSG_ERROR([Boost's multi-precision library is required but wasn't found])
])
AC_MSG_CHECKING([for Boost's multi-precision library with GMP backend])
saved_CPPFLAGS="$CPPFLAGS"
saved_LDFLAGS="$LDFLAGS"
saved_LIBS="$LIBS"
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
export CPPFLAGS
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
export LDFLAGS
LIBS="$LIBS -lgmp"
export LIBS
AC_LANG_PUSH(C++)
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
#include <boost/multiprecision/gmp.hpp>
]],
[[
boost::multiprecision::mpz_int i{42};
boost::multiprecision::mpq_rational r{42, 54};
]])
],[am_cv_bmp_gmp=yes],[am_cv_bmp_gmp=no])
CPPFLAGS="$saved_CPPFLAGS"
LDFLAGS="$saved_LDFLAGS"
LIBS="$saved_LIBS"
if test "x$am_cv_bmp_gmp" != xyes; then
AC_MSG_RESULT([no: a test program for Boost's multi-precision library with GMP backend could not be linked, probably because the gmp library wasn't found])
exit 1
fi
AC_MSG_RESULT([yes])
AX_BOOST_CHECK_HEADERS([boost/operators.hpp],,[
AC_MSG_ERROR([Boost's Operators library is required but wasn't found])

View File

@ -20,6 +20,7 @@ BuildRequires: flac-devel
BuildRequires: fmt-devel
BuildRequires: gettext-devel
BuildRequires: glibc-devel
BuildRequires: gmp-devel
BuildRequires: gtest-devel
BuildRequires: libdvdread-devel
BuildRequires: libogg-devel

View File

@ -7,7 +7,7 @@ Standards-Version: 3.9.5
Build-Depends:
debhelper (>= 9),
rake (>= 10),
zlib1g-dev, libflac-dev, libogg-dev, libvorbis-dev,
zlib1g-dev, libflac-dev, libogg-dev, libvorbis-dev, libgmp-dev,
libboost-dev (>= 1.66), qtbase5-dev, qtbase5-dev-tools,
qtmultimedia5-dev, qt5-default | base-files (>= 11ubuntu18),
libcmark-dev, libgtest-dev, libfmt-dev (>= 4), libdvdread-dev,

View File

@ -20,7 +20,7 @@
#include <cstring>
#include <unordered_map>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/gmp.hpp>
#include <QRegularExpression>
@ -2199,7 +2199,7 @@ qtmp4_demuxer_c::to_nsecs(int64_t value,
if (!actual_time_scale)
return 0;
auto value128 = static_cast<boost::multiprecision::int128_t>(value);
auto value128 = static_cast<boost::multiprecision::mpz_int>(value);
value128 *= 1'000'000'000ll;
value128 /= actual_time_scale;