Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[cmake] cleanup the detection of graphviz
authorMartin Quinson <martin.quinson@loria.fr>
Sun, 6 Mar 2016 23:27:47 +0000 (00:27 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Sun, 6 Mar 2016 23:39:08 +0000 (00:39 +0100)
src/simdag/sd_dotloader.cpp
tools/cmake/Modules/FindGraphviz.cmake
tools/cmake/src/internal_config.h.in

index d33cb25..2a93172 100644 (file)
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(sd_dotparse, sd, "Parsing DOT files");
 
-#ifdef HAVE_CGRAPH_H
+#ifdef HAVE_GRAPHVIZ
 #include <graphviz/cgraph.h>
-#elif HAVE_AGRAPH_H
-#include <graphviz/agraph.h>
-#define agnxtnode(dot, node)    agnxtnode(node)
-#define agfstout(dot, node)     agfstout(node)
-#define agnxtout(dot, edge)     agnxtout(edge)
 #endif
 
 typedef enum {
index c2c6c95..4c5d7ac 100644 (file)
 find_path(HAVE_CGRAPH_H cgraph.h
-  HINTS
-  $ENV{LD_LIBRARY_PATH}
+  HINTS  $ENV{LD_LIBRARY_PATH}
   PATH_SUFFIXES include/graphviz include
-  PATHS
-  /opt
-  /opt/local
-  /opt/csw
-  /sw
-  /usr
-  )
-
-find_path(HAVE_AGRAPH_H agraph.h
-  HINTS
-  $ENV{LD_LIBRARY_PATH}
-  PATH_SUFFIXES include/graphviz include
-  PATHS
-  /opt
-  /opt/local
-  /opt/csw
-  /sw
-  /usr
-  )
-
-find_path(HAVE_GRAPH_H graph.h
-  HINTS
-  $ENV{LD_LIBRARY_PATH}
-  PATH_SUFFIXES include/graphviz include
-  PATHS
-  /opt
-  /opt/local
-  /opt/csw
-  /sw
-  /usr
-  )
+  PATHS         /opt;/opt/local;/opt/csw;/sw;/usr
+)
 
 find_library(HAVE_CGRAPH_LIB
-  NAME cgraph
-  HINTS
-  $ENV{LD_LIBRARY_PATH}
-  PATH_SUFFIXES lib/graphviz lib
-  PATHS
-  /opt
-  /opt/local
-  /opt/csw
-  /sw
-  /usr
-  )
-
-find_library(HAVE_AGRAPH_LIB
-  NAME agraph
-  HINTS
-  $ENV{LD_LIBRARY_PATH}
-  PATH_SUFFIXES lib/graphviz lib
-  PATHS
-  /opt
-  /opt/local
-  /opt/csw
-  /sw
-  /usr
-  )
-
-find_library(HAVE_GRAPH_LIB
-  NAME graph
-  HINTS
-  $ENV{LD_LIBRARY_PATH}
+  NAME          cgraph
+  HINTS         $ENV{LD_LIBRARY_PATH}
   PATH_SUFFIXES lib/graphviz lib
-  PATHS
-  /opt
-  /opt/local
-  /opt/csw
-  /sw
-  /usr
-  )
+  PATHS         /opt;/opt/local;/opt/csw;/sw;/usr)
 
 find_library(HAVE_CDT_LIB
-  NAME cdt
-  HINTS
-  $ENV{LD_LIBRARY_PATH}
+  NAME          cdt
+  HINTS         $ENV{LD_LIBRARY_PATH}
   PATH_SUFFIXES lib/graphviz lib
-  PATHS
-  /opt
-  /opt/local
-  /opt/csw
-  /sw
-  /usr
-  )
-
-mark_as_advanced(HAVE_AGRAPH_H)
-mark_as_advanced(HAVE_CGRAPH_H)
-mark_as_advanced(HAVE_GRAPH_H)
-mark_as_advanced(HAVE_GRAPH_LIB)
-mark_as_advanced(HAVE_CGRAPH_LIB)
-mark_as_advanced(HAVE_AGRAPH_LIB)
-mark_as_advanced(HAVE_CDT_LIB)
-
-### Initialize of cgraph
-if(HAVE_CDT_LIB)
-  if(HAVE_CGRAPH_LIB OR HAVE_AGRAPH_LIB)
-
-    if(HAVE_AGRAPH_LIB)
-      string(REGEX REPLACE "/libagraph.*" "" lib_graphviz ${HAVE_AGRAPH_LIB})
-    else()
-      if(HAVE_CGRAPH_LIB)
-       string(REGEX REPLACE "/libcgraph.*" "" lib_graphviz ${HAVE_CGRAPH_LIB})
-      endif()
-    endif()
-
-    if(HAVE_GRAPH_H OR HAVE_AGRAPH_H OR HAVE_CGRAPH_H)
-
-      if(HAVE_GRAPH_H)
-       string(REPLACE "/graphviz/graph.h" "" file_graphviz_h ${HAVE_GRAPH_H})
-       string(REPLACE "/graphviz" "" file_graphviz_h ${file_graphviz_h})
-       set(GRAPH_H 1)
-      endif()
-
-      if(HAVE_AGRAPH_H)
-       string(REPLACE "/graphviz/agraph.h" "" file_graphviz_h ${HAVE_AGRAPH_H})
-       string(REPLACE "/graphviz" "" file_graphviz_h ${file_graphviz_h})
-       set(AGRAPH_H 1)
-      endif()
-
-      if(HAVE_CGRAPH_H)
-       string(REPLACE "/graphviz/cgraph.h" "" file_graphviz_h ${HAVE_CGRAPH_H})
-       string(REPLACE "/graphviz" "" file_graphviz_h ${file_graphviz_h})
-       set(CGRAPH_H 1)
-      endif()
-
-      include_directories(${file_graphviz_h} ${file_graphviz_h}/graphviz)
-      link_directories(${lib_graphviz})
+  PATHS         /opt;/opt/local;/opt/csw;/sw;/usr)
 
-      set(HAVE_GRAPHVIZ "1")
-    else()
-      set(HAVE_GRAPHVIZ "0")
-    endif()
 
-  else()
-    set(HAVE_GRAPHVIZ "0")
-  endif()
+if(HAVE_CDT_LIB AND HAVE_CGRAPH_LIB AND HAVE_CGRAPH_H)
+  string(REGEX REPLACE "/libcgraph.*" "" lib_graphviz ${HAVE_CGRAPH_LIB})
 
-endif()
-
-mark_as_advanced(HAVE_GRAPHVIZ)
-
-message(STATUS "Looking for agraph.h")
-if(HAVE_AGRAPH_H)
-  message(STATUS "Looking for agraph.h - found")
-else()
-  message(STATUS "Looking for agraph.h - not found")
-endif()
-
-message(STATUS "Looking for cgraph.h")
-if(HAVE_CGRAPH_H)
-  message(STATUS "Looking for cgraph.h - found")
-else()
-  message(STATUS "Looking for cgraph.h - not found")
-endif()
+  string(REPLACE "/graphviz/cgraph.h" "" file_graphviz_h ${HAVE_CGRAPH_H})
+  string(REPLACE "/graphviz" "" file_graphviz_h ${file_graphviz_h})
 
-message(STATUS "Looking for graph.h")
-if(HAVE_GRAPH_H)
-  message(STATUS "Looking for graph.h - found")
-else()
-  message(STATUS "Looking for graph.h - not found")
-endif()
+  include_directories(${file_graphviz_h} ${file_graphviz_h}/graphviz)
+  link_directories(${lib_graphviz})
 
-message(STATUS "Looking for lib agraph")
-if(HAVE_AGRAPH_LIB)
-  message(STATUS "Looking for lib agraph - found")
+  set(HAVE_GRAPHVIZ "1")
 else()
-  message(STATUS "Looking for lib agraph - not found")
+  set(HAVE_GRAPHVIZ "0")
 endif()
 
-message(STATUS "Looking for lib cgraph")
-if(HAVE_CGRAPH_LIB)
-  message(STATUS "Looking for lib cgraph - found")
-else()
-  message(STATUS "Looking for lib cgraph - not found")
-endif()
+mark_as_advanced(HAVE_GRAPHVIZ)
+unset(HAVE_CGRAPH_H)
+unset(HAVE_CGRAPH_LIB)
+unset(HAVE_CDT_LIB)
 
-message(STATUS "Looking for lib graph")
-if(HAVE_GRAPH_LIB)
-  message(STATUS "Looking for lib graph - found")
+message(STATUS "Looking for graphviz")
+if(HAVE_GRAPHVIZ)
+  message(STATUS "Looking for graphviz - found")
 else()
-  message(STATUS "Looking for lib graph - not found")
+  message(STATUS "Looking for graphviz - not found")
 endif()
-
-message(STATUS "Looking for lib cdt")
-if(HAVE_CDT_LIB)
-  message(STATUS "Looking for lib cdt - found")
-else()
-  message(STATUS "Looking for lib cdt - not found")
-endif()
\ No newline at end of file
index 4bd72e6..b3e571d 100644 (file)
 #cmakedefine SMPI_FORTRAN       @SMPI_FORTRAN@
 #cmakedefine HAVE_PRIVATIZATION @HAVE_PRIVATIZATION@ /* We have mmap and objdump to handle privatization */
 
-/* graphviz variables */
-#cmakedefine HAVE_GRAPHVIZ @HAVE_GRAPHVIZ@
-#cmakedefine HAVE_GRAPH_H  @GRAPH_H@
-#cmakedefine HAVE_CGRAPH_H @CGRAPH_H@
-#cmakedefine HAVE_AGRAPH_H @AGRAPH_H@
-
 /* Other function checks */
 #cmakedefine HAVE_MMAP      @HAVE_MMAP@ /* Function mmap */
 #cmakedefine HAVE_SEM_INIT  @HAVE_SEM_INIT@ /* Function sem_init (part of XPG6 standard only) */
@@ -65,5 +59,6 @@
 #cmakedefine HAVE_VASPRINTF @HAVE_VASPRINTF@ /* Function vasprintf */
 
 /* Other checks */
+#cmakedefine ADDR2LINE       "@ADDR2LINE@"     /* Path to the addr2line tool */
+#cmakedefine HAVE_GRAPHVIZ   @HAVE_GRAPHVIZ@   /* The graphviz library */
 #cmakedefine PTH_STACKGROWTH @PTH_STACKGROWTH@ /* Does the stack growth upward, or downward? */
-#cmakedefine ADDR2LINE "@ADDR2LINE@" /* Path to the addr2line tool */