Use C++17 to compile 0 A.D.

Supported compilers are Clang 5, GCC 7, Visual Studio 17, Xcode 9.3

Update Atlas alongside since the replacement APIs are c++17 only.
De-activate the StyledTextCtrl module of WxWidgets on mac, since that is
a wrapper around the Scintilla Text editor and doesn't compile with
C++17 (as it uses auto_ptr). We don't use the editor, so this is also a
win on the compilation time front.

Closes #5862

Differential Revision: https://code.wildfiregames.com/D3166
This was SVN commit r24308.
This commit is contained in:
wraitii 2020-12-01 14:17:12 +00:00
parent f78d3ddf71
commit 7e91806be3
4 changed files with 11 additions and 16 deletions

View File

@ -199,11 +199,11 @@ function project_set_build_flags()
-- being used as a DLL (which is currently not the case in 0ad)
defines { "LIB_STATIC_LINK" }
-- Enable C++14 standard.
-- Enable C++17 standard.
filter "action:vs*"
buildoptions { "/std:c++14" }
buildoptions { "/std:c++17" }
filter "action:not vs*"
buildoptions { "-std=c++14" }
buildoptions { "-std=c++17" }
filter {}
-- various platform-specific build flags

View File

@ -86,7 +86,7 @@ if [[ $MIN_OSX_VERSION && ${MIN_OSX_VERSION-_} ]]; then
fi
CFLAGS="$CFLAGS $C_FLAGS -fvisibility=hidden"
CXXFLAGS="$CXXFLAGS $C_FLAGS -stdlib=libc++ -std=c++14 -msse4.1"
CXXFLAGS="$CXXFLAGS $C_FLAGS -stdlib=libc++ -std=c++17 -msse4.1"
OBJCFLAGS="$OBJCFLAGS $C_FLAGS"
OBJCXXFLAGS="$OBJCXXFLAGS $C_FLAGS"
@ -427,6 +427,7 @@ then
--without-libtiff
--without-sdl
--without-x
--disable-stc
--disable-webview
--disable-webkit
--disable-webviewwebkit

View File

@ -23,8 +23,8 @@ void ObservableScopedConnections::Add(const ObservableConnection& conn)
{
// Clean up any disconnected connections that might be left in here
m_Conns.erase(
remove_if(m_Conns.begin(), m_Conns.end(),
not1(std::mem_fun_ref(&ObservableConnection::connected))),
std::remove_if(m_Conns.begin(), m_Conns.end(),
std::not_fn(std::mem_fn(&ObservableConnection::connected))),
m_Conns.end()
);
@ -35,5 +35,5 @@ void ObservableScopedConnections::Add(const ObservableConnection& conn)
ObservableScopedConnections::~ObservableScopedConnections()
{
// Disconnect all connections that we hold
for_each(m_Conns.begin(), m_Conns.end(), std::mem_fun_ref(&ObservableConnection::disconnect));
for_each(m_Conns.begin(), m_Conns.end(), std::mem_fn(&ObservableConnection::disconnect));
}

View File

@ -39,15 +39,9 @@ variable_to_be_watched.NotifyObservers();
*/
#include <boost/bind.hpp>
#include <boost/version.hpp>
#if BOOST_VERSION >= 104000
# include <boost/signals2.hpp>
#include <boost/signals2.hpp>
typedef boost::signals2::connection ObservableConnection;
typedef boost::signals2::scoped_connection ObservableScopedConnection;
#else
# error Atlas requires Boost 1.40 or later
#endif
template <typename T> class Observable : public T
{
@ -63,7 +57,7 @@ public:
template<typename C> ObservableConnection RegisterObserver(int order, void (C::*callback) (const T&), C* obj)
{
return m_Signal.connect(order, boost::bind(std::mem_fun(callback), obj, _1));
return m_Signal.connect(order, std::bind(std::mem_fn(callback), obj, std::placeholders::_1));
}
ObservableConnection RegisterObserver(int order, void (*callback) (const T&))
@ -135,7 +129,7 @@ public:
template<typename C> ObservableConnection RegisterObserver(int order, void (C::*callback) (T*), C* obj)
{
return m_Signal.connect(order, boost::bind(std::mem_fun(callback), obj, _1));
return m_Signal.connect(order, std::bind(std::mem_fn(callback), obj, std::placeholders::_1));
}
ObservableConnection RegisterObserver(int order, void (*callback) (T*))