[PATCH] cmake: Find xdot or xdot.py

Matt Arsenault Matthew.Arsenault at amd.com
Tue Apr 23 15:12:08 PDT 2013


The Ubuntu package installs this as /usr/bin/xdot, so finding xdot.py fails

http://llvm-reviews.chandlerc.com/D715

Files:
  cmake/config-ix.cmake
  include/llvm/Config/config.h.cmake
  lib/Support/GraphWriter.cpp

Index: cmake/config-ix.cmake
===================================================================
--- cmake/config-ix.cmake
+++ cmake/config-ix.cmake
@@ -260,9 +260,17 @@
 llvm_find_program(fdp)
 llvm_find_program(dot)
 llvm_find_program(dotty)
-llvm_find_program(xdot.py)
 llvm_find_program(Graphviz)
 
+llvm_find_program(xdot)
+
+if(NOT LLVM_HAVE_XDOT)
+  llvm_find_program(xdot.py)
+  set(HAVE_XDOT 1 CACHE INTERNAL "Is xdot available ?")
+  set(LLVM_PATH_XDOT ${LLVM_PATH_XDOT_PY})
+endif()
+
+
 if( LLVM_ENABLE_FFI )
   find_path(FFI_INCLUDE_PATH ffi.h PATHS ${FFI_INCLUDE_DIR})
   if( FFI_INCLUDE_PATH )
Index: include/llvm/Config/config.h.cmake
===================================================================
--- include/llvm/Config/config.h.cmake
+++ include/llvm/Config/config.h.cmake
@@ -642,8 +642,8 @@
 /* Define to path to twopi program if found or 'echo twopi' otherwise */
 #cmakedefine LLVM_PATH_TWOPI "${LLVM_PATH_TWOPI}"
 
-/* Define to path to xdot.py program if found or 'echo xdot.py' otherwise */
-#cmakedefine LLVM_PATH_XDOT_PY "${LLVM_PATH_XDOT_PY}"
+/* Define to path to xdot.py program if found or 'echo xdot' otherwise */
+#cmakedefine LLVM_PATH_XDOT "${LLVM_PATH_XDOT}"
 
 /* Installation prefix directory */
 #cmakedefine LLVM_PREFIX "${LLVM_PREFIX}"
Index: lib/Support/GraphWriter.cpp
===================================================================
--- lib/Support/GraphWriter.cpp
+++ lib/Support/GraphWriter.cpp
@@ -99,9 +99,9 @@
   if (!ExecGraphViewer(Graphviz, args, Filename, wait, ErrMsg))
     return;
 
-#elif HAVE_XDOT_PY
+#elif HAVE_XDOT
   std::vector<const char*> args;
-  args.push_back(LLVM_PATH_XDOT_PY);
+  args.push_back(LLVM_PATH_XDOT);
   args.push_back(Filename.c_str());
 
   switch (program) {
@@ -114,8 +114,8 @@
 
   args.push_back(0);
 
-  errs() << "Running 'xdot.py' program... ";
-  if (!ExecGraphViewer(sys::Path(LLVM_PATH_XDOT_PY), args, Filename, wait, ErrMsg))
+  errs() << "Running 'xdot' program... ";
+  if (!ExecGraphViewer(sys::Path(LLVM_PATH_XDOT), args, Filename, wait, ErrMsg))
     return;
 
 #elif (HAVE_GV && (HAVE_DOT || HAVE_FDP || HAVE_NEATO || \
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D715.1.patch
Type: text/x-patch
Size: 2130 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130423/cbdbf4c5/attachment.bin>


More information about the llvm-commits mailing list