mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
Require C++17
Add a test that requires <any> header. Update documentation. Remove test for C++14. Typical gcc version we have in mind is gcc 8.
This commit is contained in:
parent
4155452ce4
commit
c916bd1502
2
INSTALL
2
INSTALL
@ -52,7 +52,7 @@ You will also probably need GNU m4 (perhaps installed as gm4).
|
|||||||
Requirements
|
Requirements
|
||||||
------------
|
------------
|
||||||
|
|
||||||
First of all, you will need a C++11 standard conforming compiler, like
|
First of all, you will need a C++17 standard conforming compiler, like
|
||||||
g++ (at least 5.0, to have proper std::regex & std::string) or
|
g++ (at least 5.0, to have proper std::regex & std::string) or
|
||||||
clang++.
|
clang++.
|
||||||
|
|
||||||
|
@ -161,12 +161,12 @@ fi
|
|||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
dnl Usage: LYX_CXX_CXX11_FLAGS(VERSION): add to AM_CXXFLAGS the best flag that
|
dnl Usage: LYX_CXX_CXX17_FLAGS(VERSION): add to AM_CXXFLAGS the best flag that
|
||||||
dnl selects C++11 mode; gives an error when C++11 mode is not found.
|
dnl selects C++17 mode; gives an error when C++17 mode is not found.
|
||||||
dnl VERSION is a list of years to try (e.g. 11 or {14,11}).
|
dnl VERSION is a list of years to try (e.g. 17 or {20,17}).
|
||||||
AC_DEFUN([LYX_CXX_CXX11_FLAGS],
|
AC_DEFUN([LYX_CXX_CXX17_FLAGS],
|
||||||
[AC_CACHE_CHECK([for a good C++ mode], [lyx_cv_cxx11_flags],
|
[AC_CACHE_CHECK([for a good C++ mode], [lyx_cv_cxx17_flags],
|
||||||
[lyx_cv_cxx11_flags=none
|
[lyx_cv_cxx17_flags=none
|
||||||
for flag in `eval echo -std=c++$1 default -std=gnu++$1` ; do
|
for flag in `eval echo -std=c++$1 default -std=gnu++$1` ; do
|
||||||
if test $flag = default ; then
|
if test $flag = default ; then
|
||||||
flag=
|
flag=
|
||||||
@ -199,14 +199,17 @@ AC_DEFUN([LYX_CXX_CXX11_FLAGS],
|
|||||||
check_type c;
|
check_type c;
|
||||||
check_type&& cr = static_cast<check_type&&>(c);
|
check_type&& cr = static_cast<check_type&&>(c);
|
||||||
|
|
||||||
auto d = a;]], [[]])],[lyx_cv_cxx11_flags=$flag; break],[])
|
auto d = a;
|
||||||
|
|
||||||
|
#include <any>
|
||||||
|
std::any any_var = 10;]], [[]])],[lyx_cv_cxx17_flags=$flag; break],[])
|
||||||
CXXFLAGS=$save_CXXFLAGS
|
CXXFLAGS=$save_CXXFLAGS
|
||||||
CPPFLAGS=$save_CPPFLAGS
|
CPPFLAGS=$save_CPPFLAGS
|
||||||
done])
|
done])
|
||||||
if test x$lyx_cv_cxx11_flags = xnone ; then
|
if test x$lyx_cv_cxx17_flags = xnone ; then
|
||||||
AC_MSG_ERROR([Cannot find suitable mode for compiler $CXX])
|
AC_MSG_ERROR([Cannot find suitable mode for compiler $CXX])
|
||||||
fi
|
fi
|
||||||
AM_CXXFLAGS="$lyx_cv_cxx11_flags $AM_CXXFLAGS"
|
AM_CXXFLAGS="$lyx_cv_cxx17_flags $AM_CXXFLAGS"
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
@ -228,13 +231,13 @@ AC_REQUIRE([AC_PROG_CXXCPP])
|
|||||||
|
|
||||||
### We might want to force the C++ standard.
|
### We might want to force the C++ standard.
|
||||||
AC_ARG_ENABLE(cxx-mode,
|
AC_ARG_ENABLE(cxx-mode,
|
||||||
AS_HELP_STRING([--enable-cxx-mode],[choose C++ standard (default: 17, 14, then 11)]),,
|
AS_HELP_STRING([--enable-cxx-mode],[choose C++ standard (default: 17)]),,
|
||||||
[enable_cxx_mode={17,14,11}]
|
[enable_cxx_mode={17}]
|
||||||
)
|
)
|
||||||
|
|
||||||
AC_LANG_PUSH(C++)
|
AC_LANG_PUSH(C++)
|
||||||
LYX_PROG_CLANG
|
LYX_PROG_CLANG
|
||||||
LYX_CXX_CXX11_FLAGS($enable_cxx_mode)
|
LYX_CXX_CXX17_FLAGS($enable_cxx_mode)
|
||||||
LYX_LIB_STDCXX
|
LYX_LIB_STDCXX
|
||||||
AC_LANG_POP(C++)
|
AC_LANG_POP(C++)
|
||||||
|
|
||||||
|
@ -80,13 +80,7 @@ Changer MetricsBase::changeFontSet(string const & name)
|
|||||||
&& ((isTextFont(oldname) && oldcolor != Color_foreground)
|
&& ((isTextFont(oldname) && oldcolor != Color_foreground)
|
||||||
|| (isMathFont(oldname) && oldcolor != Color_math)))
|
|| (isMathFont(oldname) && oldcolor != Color_math)))
|
||||||
font.setColor(oldcolor);
|
font.setColor(oldcolor);
|
||||||
#if __cplusplus >= 201402L
|
|
||||||
return rc;
|
return rc;
|
||||||
#else
|
|
||||||
/** In theory, this is not needed with C++11, and modern compilers
|
|
||||||
* will complain in C++11 mode, but gcc 4.9 requires this. */
|
|
||||||
return std::move(rc);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user