[nemiver] Use c++11 when we use glibmm24 version >= 2.46
- From: Dodji Seketeli <dodji src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nemiver] Use c++11 when we use glibmm24 version >= 2.46
- Date: Sat, 26 Sep 2015 11:44:11 +0000 (UTC)
commit 086fdb95452eedb5a008125cf425a2c322c59c7d
Author: Dodji Seketeli <dodji seketeli org>
Date: Wed Sep 23 19:52:06 2015 +0200
Use c++11 when we use glibmm24 version >= 2.46
Now that we can use glibmm24 version >= 26, we need c++11 to compile
against that version of glibmm. So we are building the code
conditionally with c++11 if the version of glibmm24 we use is >= 2.46.
* configure.ac: If c++11 is required by the fact that we use a
version of glibmm24 >= 2.46, then use c++11.
* src/persp/dbgperspective/nmv-dbg-perspective-default-layout.cc
(DBGPerspectiveDefaultLayout::Priv::views): Make this be a
map<int, Gtk::Widget*> rather than a map<int, Gtk::Widget&>, to
keep the compiler happy.
(DBGPerspectiveDefaultLayout::{activate,append}_view): Adjust.
* src/persp/dbgperspective/nmv-dbg-perspective-two-pane-layout.cc
(DBGPerspectiveTwoPaneLayout::Priv::views): Make this be a
map<int, Gtk::Widget*> rather than a map<int, Gtk::Widget&>, to
keep the compiler happy.
(DBGPerspectiveTwoPaneLayout::{activate,append}_view): Adjust.
* src/persp/dbgperspective/nmv-dbg-perspective-wide-layout.cc
(DBGPerspectiveWideLayout::Priv::views): Make this be a map<int,
Gtk::Widget*> rather than a map<int, Gtk::Widget&>, to keep the
compiler happy.
Signed-off-by: Dodji Seketeli <dodji seketeli org>
configure.ac | 18 +++++++++++++-----
.../nmv-dbg-perspective-default-layout.cc | 10 +++++-----
.../nmv-dbg-perspective-two-pane-layout.cc | 9 +++++----
.../nmv-dbg-perspective-wide-layout.cc | 8 ++++----
4 files changed, 27 insertions(+), 18 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 16ad2f1..86f7c97 100644
--- a/configure.ac
+++ b/configure.ac
@@ -270,6 +270,11 @@ if test x$GLIBMM_USES_DEPRECATED_GLIB_FUNCS = xyes; then
AC_MSG_NOTICE(glibmm uses deprecated glib functions!)
fi
+dnl detect if c++11 is required, because of glibmm-24 >= 2.46
+PKG_CHECK_EXISTS([glibmm-2.4 >= 2.46],
+ [CXX11_IS_REQUIRED=yes],
+ [CXX11_IS_REQUIRED=no])
+
dnl Check for tr1 headers
AC_CHECK_HEADERS([tr1/unordered_map boost/tr1/unordered_map.hpp])
AC_CHECK_HEADERS([tr1/memory boost/tr1/memory.hpp])
@@ -441,12 +446,14 @@ AC_SUBST(NEMIVER_INCLUDE_DIR)
AC_SUBST(NEMIVER_LIB_DIR_NAME)
AC_SUBST(NEMIVER_LIBDIR)
-
if test x$ENABLE_GCC_SYMBOLS_VISIBILITY = xyes && test x$host_cpu != xx86_64 ; then
AC_DEFINE(HAS_GCC_VISIBILITY_SUPPORT,1,[gcc visibility support])
- REQUIRED_FLAGS="-fvisibility=hidden -fvisibility-inlines-hidden"
-else
- REQUIRED_FLAGS=""
+ REQUIRED_FLAGS="$REQUIRED_FLAGS -fvisibility=hidden -fvisibility-inlines-hidden"
+fi
+
+dnl Use c++11, if required (for glibmm)
+if test x$CXX11_IS_REQUIRED = xyes; then
+ CXXFLAGS="-std=c++11 $CXXFLAGS"
fi
dnl ***************************
@@ -459,7 +466,7 @@ if test "x$NEMIVER_DEVEL" = "xon" ; then
fi
DODJI_CXXFLAGS="$DODJI_CFLAGS -fuse-cxa-atexit"
ENABLE_DEBUG=yes
- CXXFLAGS="$DODJI_CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS $DODJI_CXXFLAGS"
CFLAGS="$DODJI_CFLAGS"
else
DODJI_CFLAGS="$REQUIRED_FLAGS"
@@ -553,6 +560,7 @@ AC_MSG_NOTICE([
Source code location : ${srcdir}
C Compiler : ${CC}
C++ Compiler : ${CXX}
+ C++11 is required : ${CXX11_IS_REQUIRED}
NEMIVER_DEVEL env var : ${NEMIVER_DEVEL}
NEMIVER_ALLOW_WARNINGS env var : ${NEMIVER_ALLOW_WARNINGS}
diff --git a/src/persp/dbgperspective/nmv-dbg-perspective-default-layout.cc
b/src/persp/dbgperspective/nmv-dbg-perspective-default-layout.cc
index cb46de3..ed9bad5 100644
--- a/src/persp/dbgperspective/nmv-dbg-perspective-default-layout.cc
+++ b/src/persp/dbgperspective/nmv-dbg-perspective-default-layout.cc
@@ -46,7 +46,7 @@ NEMIVER_BEGIN_NAMESPACE (nemiver)
struct DBGPerspectiveDefaultLayout::Priv {
SafePtr<Gtk::Paned> body_main_paned;
SafePtr<Gtk::Notebook> statuses_notebook;
- map<int, Gtk::Widget&> views;
+ map<int, Gtk::Widget*> views;
IDBGPerspective &dbg_perspective;
Priv (IDBGPerspective &a_dbg_perspective) :
@@ -155,7 +155,7 @@ DBGPerspectiveDefaultLayout::activate_view (int a_view)
THROW_IF_FAIL (m_priv->statuses_notebook);
int page_num =
- m_priv->statuses_notebook->page_num (m_priv->views.at (a_view));
+ m_priv->statuses_notebook->page_num (*m_priv->views.at (a_view));
THROW_IF_FAIL (page_num >= 0);
m_priv->statuses_notebook->set_current_page (page_num);
}
@@ -190,8 +190,8 @@ DBGPerspectiveDefaultLayout::append_view (Gtk::Widget &a_widget,
}
a_widget.show_all ();
- m_priv->views.insert (std::make_pair<int, Gtk::Widget&> (a_index,
- a_widget));
+ m_priv->views[a_index] = &a_widget;
+
int page_num = m_priv->statuses_notebook->append_page (a_widget, a_title);
m_priv->statuses_notebook->set_current_page (page_num);
}
@@ -206,7 +206,7 @@ DBGPerspectiveDefaultLayout::remove_view (int a_index)
return;
}
- m_priv->statuses_notebook->remove_page (m_priv->views.at (a_index));
+ m_priv->statuses_notebook->remove_page (*m_priv->views.at (a_index));
m_priv->views.erase (a_index);
}
diff --git a/src/persp/dbgperspective/nmv-dbg-perspective-two-pane-layout.cc
b/src/persp/dbgperspective/nmv-dbg-perspective-two-pane-layout.cc
index f5e2cc2..762061e 100644
--- a/src/persp/dbgperspective/nmv-dbg-perspective-two-pane-layout.cc
+++ b/src/persp/dbgperspective/nmv-dbg-perspective-two-pane-layout.cc
@@ -54,7 +54,7 @@ struct DBGPerspectiveTwoPaneLayout::Priv {
SafePtr<Gtk::Paned> horizontal_paned;
SafePtr<Gtk::Notebook> horizontal_statuses_notebook;
SafePtr<Gtk::Notebook> vertical_statuses_notebook;
- map<int, Gtk::Widget&> views;
+ map<int, Gtk::Widget*> views;
IDBGPerspective &dbg_perspective;
Priv (IDBGPerspective &a_dbg_perspective) :
@@ -196,7 +196,7 @@ DBGPerspectiveTwoPaneLayout::activate_view (int a_view)
THROW_IF_FAIL (m_priv->views.count (a_view));
Gtk::Notebook &status_notebook = m_priv->statuses_notebook (a_view);
- int page_num = status_notebook.page_num (m_priv->views.at (a_view));
+ int page_num = status_notebook.page_num (*m_priv->views.at (a_view));
THROW_IF_FAIL (page_num >= 0);
status_notebook.set_current_page (page_num);
}
@@ -231,7 +231,7 @@ DBGPerspectiveTwoPaneLayout::append_view (Gtk::Widget &a_widget,
return;
}
- m_priv->views.insert (std::make_pair<int, Gtk::Widget&> (a_index, a_widget));
+ m_priv->views[a_index] = &a_widget;
a_widget.show_all ();
Gtk::Notebook &statuses_notebook = m_priv->statuses_notebook (a_index);
int page_num = statuses_notebook.append_page (a_widget, a_title);
@@ -246,7 +246,8 @@ DBGPerspectiveTwoPaneLayout::remove_view (int a_index)
return;
}
- m_priv->statuses_notebook (a_index).remove_page (m_priv->views.at (a_index));
+ m_priv->statuses_notebook (a_index).remove_page
+ (*m_priv->views.at (a_index));
m_priv->views.erase (a_index);
}
diff --git a/src/persp/dbgperspective/nmv-dbg-perspective-wide-layout.cc
b/src/persp/dbgperspective/nmv-dbg-perspective-wide-layout.cc
index 04eb1d7..17333cb 100644
--- a/src/persp/dbgperspective/nmv-dbg-perspective-wide-layout.cc
+++ b/src/persp/dbgperspective/nmv-dbg-perspective-wide-layout.cc
@@ -45,7 +45,7 @@ NEMIVER_BEGIN_NAMESPACE (nemiver)
struct DBGPerspectiveWideLayout::Priv {
SafePtr<Gtk::Paned> body_main_paned;
SafePtr<Gtk::Notebook> statuses_notebook;
- map<int, Gtk::Widget&> views;
+ map<int, Gtk::Widget*> views;
IDBGPerspective &dbg_perspective;
Priv (IDBGPerspective &a_dbg_perspective) :
@@ -152,7 +152,7 @@ DBGPerspectiveWideLayout::activate_view (int a_view)
THROW_IF_FAIL (m_priv->statuses_notebook);
int page_num =
- m_priv->statuses_notebook->page_num (m_priv->views.at (a_view));
+ m_priv->statuses_notebook->page_num (*m_priv->views.at (a_view));
THROW_IF_FAIL (page_num >= 0);
m_priv->statuses_notebook->set_current_page (page_num);
}
@@ -186,7 +186,7 @@ DBGPerspectiveWideLayout::append_view (Gtk::Widget &a_widget,
return;
}
- m_priv->views.insert (std::make_pair<int, Gtk::Widget&> (a_index, a_widget));
+ m_priv->views[a_index] = &a_widget;
a_widget.show_all ();
int page_num = m_priv->statuses_notebook->append_page (a_widget, a_title);
m_priv->statuses_notebook->set_current_page (page_num);
@@ -202,7 +202,7 @@ DBGPerspectiveWideLayout::remove_view (int a_index)
return;
}
- m_priv->statuses_notebook->remove_page (m_priv->views.at (a_index));
+ m_priv->statuses_notebook->remove_page (*m_priv->views.at (a_index));
m_priv->views.erase (a_index);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]