[valadoc] Add support for cgraphs
- From: Florian Brosch <flobrosch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [valadoc] Add support for cgraphs
- Date: Tue, 24 Sep 2013 00:43:53 +0000 (UTC)
commit 7b22bc146b318790552aa8ec1ece25a3a06d1316
Author: Florian Brosch <flo brosch gmail com>
Date: Wed Sep 11 00:43:43 2013 +0200
Add support for cgraphs
Based on patch by Richard Schwarting
Fixes bug 703688.
configure.ac | 29 +++++++++++++++++++++++++
src/doclets/devhelp/Makefile.am | 1 +
src/doclets/gtkdoc/Makefile.am | 1 +
src/doclets/htm/Makefile.am | 11 +++++++++
src/libvaladoc/charts/chart.vala | 2 +
src/libvaladoc/charts/chartfactory.vala | 4 +++
src/libvaladoc/charts/simplechartfactory.vala | 4 +++
7 files changed, 52 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 79aa766..d4d6390 100644
--- a/configure.ac
+++ b/configure.ac
@@ -53,6 +53,35 @@ AC_SUBST(LIBGEE_LIBS)
+AC_MSG_CHECKING([for CGRAPH])
+valadoc_tmp_LIBADD="$LIBADD"
+valadoc_tmp_CFLAGS="$CFLAGGS"
+LIBADD="$LIBADD $LIBGVC_LIBS"
+CFLAGS="$CFLAGS $LIBGVC_CFLAGS"
+AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([
+ #include <gvc.h>
+
+ int main(void) {
+ #ifdef WITH_CGRAPH
+ return 0;
+ #else
+ return -1;
+ #endif
+ }
+ ])], [
+ AC_MSG_RESULT([yes])
+ VALAFLAGS="$VALAFLAGS -D WITH_CGRAPH"
+ have_cgraph=yes
+ ], [
+ AC_MSG_RESULT([no])
+ have_cgraph=no
+ ]
+)
+LIBADD="$valadoc_tmp_LIBADD"
+CFLAGS="$valadoc_tmp_CFLAGS"
+AM_CONDITIONAL(HAVE_CGRAPH, test "$have_cgraph" = "yes")
+
##
## Drivers:
diff --git a/src/doclets/devhelp/Makefile.am b/src/doclets/devhelp/Makefile.am
index e7c2446..de82ec1 100644
--- a/src/doclets/devhelp/Makefile.am
+++ b/src/doclets/devhelp/Makefile.am
@@ -4,6 +4,7 @@ NULL =
AM_CFLAGS = -g \
-DPACKAGE_ICONDIR=\"$(datadir)/valadoc/icons/\" \
-I ../../libvaladoc/ \
+ $(LIBGVC_CFLAGS) \
$(GLIB_CFLAGS) \
$(LIBGEE_CFLAGS) \
$(NULL)
diff --git a/src/doclets/gtkdoc/Makefile.am b/src/doclets/gtkdoc/Makefile.am
index 66dcc55..81e3607 100644
--- a/src/doclets/gtkdoc/Makefile.am
+++ b/src/doclets/gtkdoc/Makefile.am
@@ -5,6 +5,7 @@ AM_CFLAGS = -g \
-DPACKAGE_ICONDIR=\"$(datadir)/valadoc/icons/\" \
-I ../../libvaladoc/ \
$(GLIB_CFLAGS) \
+ $(LIBGVC_CFLAGS) \
$(LIBGEE_CFLAGS) \
$(NULL)
diff --git a/src/doclets/htm/Makefile.am b/src/doclets/htm/Makefile.am
index 5f3be83..7127e1d 100644
--- a/src/doclets/htm/Makefile.am
+++ b/src/doclets/htm/Makefile.am
@@ -4,10 +4,21 @@ NULL =
AM_CFLAGS = -g \
-DPACKAGE_ICONDIR=\"$(datadir)/valadoc/icons/\" \
-I ../../libvaladoc/ \
+ $(LIBGVC_CFLAGS) \
$(GLIB_CFLAGS) \
$(LIBGEE_CFLAGS) \
$(NULL)
+# Without the LIBGVC_CFLAGS, we get
+# make[5]: Entering directory `/home/richard/.local/src/valadoc/src/doclets/devhelp'
+# CC doclet.lo
+# In file included from /usr/include/graphviz/gvc.h:17:0,
+# from ../../libvaladoc/valadoc-1.0.h:15,
+# from doclet.c:28:
+# /usr/include/graphviz/types.h:49:20: fatal error: cgraph.h: No such file or directory
+# #include <cgraph.h>
+# ^
+# compilation terminated.
BUILT_SOURCES = libdoclet.vala.stamp
diff --git a/src/libvaladoc/charts/chart.vala b/src/libvaladoc/charts/chart.vala
index f4b9908..03dab30 100644
--- a/src/libvaladoc/charts/chart.vala
+++ b/src/libvaladoc/charts/chart.vala
@@ -27,7 +27,9 @@ public class Valadoc.Charts.Chart : Api.Visitor {
protected Factory factory;
static construct {
+ #if !WITH_CGRAPH
Gvc.init ();
+ #endif
}
public Chart (Factory factory, Api.Node node) {
diff --git a/src/libvaladoc/charts/chartfactory.vala b/src/libvaladoc/charts/chartfactory.vala
index 6a3351a..c2582ab 100644
--- a/src/libvaladoc/charts/chartfactory.vala
+++ b/src/libvaladoc/charts/chartfactory.vala
@@ -23,7 +23,11 @@
public abstract class Valadoc.Charts.Factory : Object {
protected Gvc.Node create_type (Gvc.Graph graph, Api.Node item) {
+ #if WITH_CGRAPH
+ return graph.create_node (item.get_full_name (), 1);
+ #else
return graph.create_node (item.get_full_name ());
+ #endif
}
public abstract Gvc.Graph create_graph (Api.Node item);
diff --git a/src/libvaladoc/charts/simplechartfactory.vala b/src/libvaladoc/charts/simplechartfactory.vala
index a1f09fb..06da97e 100644
--- a/src/libvaladoc/charts/simplechartfactory.vala
+++ b/src/libvaladoc/charts/simplechartfactory.vala
@@ -31,7 +31,11 @@ public class Valadoc.Charts.SimpleFactory : Charts.Factory {
}
public override Gvc.Graph create_graph (Api.Node item) {
+ #if WITH_CGRAPH
+ var graph = new Gvc.Graph (item.get_full_name (), Gvc.Agdirected, 0);
+ #else
var graph = new Gvc.Graph (item.get_full_name (), Gvc.GraphKind.AGDIGRAPH);
+ #endif
return graph;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]