[dia] OGDF based automatic layout plug-in build on Linux, too.



commit 870662906841a0060a2cd38ff75f81f3f19438d5
Author: Hans Breuer <hans breuer org>
Date:   Sun Oct 9 16:29:57 2011 +0200

    OGDF based automatic layout plug-in build on Linux, too.
    
    The auto-* integration is still rough, though.
    E.g. it depends on specific placement in ~/devel/OGDF.
    Improvements from distributors/auto-experts accepted ...

 configure.in                    |   25 +++++++++++++++++++++++++
 plug-ins/Makefile.am            |    2 +-
 plug-ins/layout/Makefile.am     |   33 +++++++++++++++++++++++++++++++++
 plug-ins/layout/layout.cpp      |   10 +++++-----
 plug-ins/layout/ogdf-simple.cpp |    2 ++
 plug-ins/layout/readme.txt      |   15 +++++++++++----
 po/POTFILES.in                  |    1 +
 po/POTFILES.skip                |    2 ++
 8 files changed, 80 insertions(+), 10 deletions(-)
---
diff --git a/configure.in b/configure.in
index 1a2ab48..61beb8a 100644
--- a/configure.in
+++ b/configure.in
@@ -269,6 +269,30 @@ AC_SUBST(LIBEMF_CFLAGS)
 AC_SUBST(LIBEMF_LIBS)
 AM_CONDITIONAL(WITH_LIBEMF, test "$emf_ok" = yes)
 
+dnl Not necessarily installed somewhere in a typical place
+AC_ARG_ENABLE([ogdf],
+	AS_HELP_STRING([--enable-ogdf], [enable plugin using OGDF (www.ogdf.net)]),
+	,
+	enable_ogdf=yes)
+if test "$enable_ogdf" = "yes"; then
+	dnl FIXME: get prefix from command line
+	ogdf_prefix=~/devel/OGDF
+	CPPFLAGS="${CPPFLAGS} -I $ogdf_prefix"
+	AC_LANG_PUSH([C++])
+	AC_CHECK_HEADER(ogdf/basic/Graph.h, ogdf_ok=yes, ogdf_ok=no)
+	AC_LANG_POP([C++])
+	if test "$ogdf_ok" = yes; then
+		OGDF_CFLAGS="-I ${ogdf_prefix}"
+		OGDF_LIBS="-L${ogdf_prefix}/_release -lOGDF -lstdc++"
+		AC_DEFINE(HAVE_OGDF,1,[OGDF library available])
+	fi
+else
+	ogdf_ok=no
+fi
+AC_SUBST(OGDF_CFLAGS)
+AC_SUBST(OGDF_LIBS)
+AM_CONDITIONAL(HAVE_OGDF, test "$ogdf_ok" = yes)
+
 dnl
 dnl Debugging
 dnl
@@ -647,6 +671,7 @@ plug-ins/cairo/Makefile
 plug-ins/drs/Makefile
 plug-ins/dxf/Makefile
 plug-ins/hpgl/Makefile
+plug-ins/layout/Makefile
 plug-ins/libart/Makefile
 plug-ins/metapost/Makefile
 plug-ins/pixbuf/Makefile
diff --git a/plug-ins/Makefile.am b/plug-ins/Makefile.am
index c29ffec..c0705f5 100644
--- a/plug-ins/Makefile.am
+++ b/plug-ins/Makefile.am
@@ -1,7 +1,7 @@
 # Remember to also add subdirs in configure.in
 SUBDIRS = cgm cairo pstricks hpgl wpg svg shape dxf python xfig \
 	  wmf libart metapost xslt pixbuf pgf vdx postscript \
-	  drs stress
+	  drs stress layout
 
 EXTRA_DIST = \
 	makefile.msc objects.def
diff --git a/plug-ins/layout/Makefile.am b/plug-ins/layout/Makefile.am
new file mode 100644
index 0000000..bbc0a01
--- /dev/null
+++ b/plug-ins/layout/Makefile.am
@@ -0,0 +1,33 @@
+plugin_sources = layout.cpp ogdf-simple.h
+
+if HAVE_OGDF
+plugin_sources += ogdf-simple.cpp
+endif
+
+# Can't do without C++
+if HAVE_CPLUSPLUS
+pkglib_LTLIBRARIES = liblayout_filter.la
+endif
+
+liblayout_filter_la_SOURCES = $(plugin_sources)
+liblayout_filter_la_LDFLAGS = -export-dynamic -module -avoid-version $(NO_UNDEFINED)
+liblayout_filter_la_LIBADD = $(OGDF_LIBS)  $(top_builddir)/lib/libdia.la
+if OS_WIN32
+liblayout_filter_la_LIBADD += -lpsapi
+endif
+
+INCLUDES = -I$(top_srcdir)/intl -I$(top_srcdir)/lib -I$(top_srcdir)/app \
+  $(DEBUG_FLAGS) $(GTK_CFLAGS) $(OGDF_CFLAGS)
+
+EXTRA_DIST = \
+	ogdf-simple.cpp \
+	ogdf-simple.h \
+	makefile.msc \
+	readme.txt
+
+if !HAVE_OGDF
+# Prevent installation
+install-pkglibLTLIBRARIES:
+	:
+endif
+
diff --git a/plug-ins/layout/layout.cpp b/plug-ins/layout/layout.cpp
index e397775..c6a015a 100644
--- a/plug-ins/layout/layout.cpp
+++ b/plug-ins/layout/layout.cpp
@@ -281,7 +281,7 @@ layout_callback (DiagramData *data,
 	    try {
 	      coords.resize (n);
 	    } catch (std::bad_alloc& ex) {
-	      g_warning (ex.what());
+	      g_warning ("%s", ex.what());
 	      continue;
 	    }
 	    g->GetEdgeBends (e, &coords[0], n);
@@ -306,7 +306,7 @@ layout_callback (DiagramData *data,
       N_(#name), \
       "/DisplayMenu/Layout/LayoutFirst", \
       layout_callback, \
-      #name \
+      (void*)#name \
     }
       
 static DiaCallbackFilter cb_layout[] = {
@@ -335,7 +335,7 @@ static DiaCallbackFilter cb_layout[] = {
     AN_ENTRY(UpwardPlanarization),
     //Borked: AN_ENTRY(Visibility),
     AN_ENTRY(NotAvailable),
-    NULL
+    { NULL, }
 };
 
 static gboolean
@@ -361,8 +361,8 @@ dia_plugin_init(PluginInfo *info)
 {
   int i = 0;
 
-  if (!dia_plugin_info_init(info, "OGDF Layout",
-                            _("Layout Algorithms"),
+  if (!dia_plugin_info_init(info, "Layout",
+                            _("OGDF Layout Algorithms"),
                             _plugin_can_unload,
                             _plugin_unload))
     return DIA_PLUGIN_INIT_ERROR;
diff --git a/plug-ins/layout/ogdf-simple.cpp b/plug-ins/layout/ogdf-simple.cpp
index 1f61651..fb78084 100644
--- a/plug-ins/layout/ogdf-simple.cpp
+++ b/plug-ins/layout/ogdf-simple.cpp
@@ -38,7 +38,9 @@
 
 #include <ogdf/orthogonal/OrthoLayout.h>
 
+#ifdef _MSC_VER
 #define DLL_EXPORT __declspec(dllexport)
+#endif
 #include "ogdf-simple.h"
 
 namespace {
diff --git a/plug-ins/layout/readme.txt b/plug-ins/layout/readme.txt
index 2a9e77e..b242387 100644
--- a/plug-ins/layout/readme.txt
+++ b/plug-ins/layout/readme.txt
@@ -35,7 +35,14 @@ OGDF_LIBS = $(TOP)\..\other\ogdf\src\ogdf.lib
 
 Build on *NIX
 -------------
-Makefile.am
-HAVE_OGDF
-OGDF_CFLAGS
-OGDF_LIBS
+ * ogdf_prefix is hard-coded to ~/devel/OGDF
+ * HAVE_OGDF is defined 
+ * OGDF_CFLAGS defined by configure
+ * OGDF_LIBS defined by configure
+
+/~/devel/OGDF/_release/libOGDF.a(CombinatorialEmbedding.o): relocation R_X86_64_32 against `.bss' 
+	can not be used when making a shared object; recompile with -fPIC
+add
+	compilerParams = -fPIC -I.
+to makeMakefile.config, run
+	./makeMakefile.sh	
diff --git a/po/POTFILES.in b/po/POTFILES.in
index d58006f..4060ac3 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -204,6 +204,7 @@ plug-ins/dxf/dxf-export.c
 plug-ins/dxf/dxf-import.c
 plug-ins/dxf/dxf.c
 plug-ins/hpgl/hpgl.c
+plug-ins/layout/layout.cpp
 plug-ins/libart/dialibart.c
 plug-ins/libart/export_png.c
 plug-ins/libart/render_libart.c
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
index 40c06fe..d719412 100644
--- a/po/POTFILES.skip
+++ b/po/POTFILES.skip
@@ -5,6 +5,8 @@ data/sheets-new-dialog.xml
 data/sheets-remove-dialog.xml
 sheets/EML.sheet.in
 po-checktrans.py
+plug-ins/layout/ogdf-simple.cpp
+plug-ins/layout/ogdf-simple.h
 plug-ins/python/otypes.py
 plug-ins/python/autolayoutforce.py
 plug-ins/python/gtkcons.py



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]