[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-extra-gear
Subject:    [Kde-extra-gear] Review Request
From:       Kleag <kleag () free ! fr>
Date:       2009-10-12 21:55:48
Message-ID: 200910122355.48642.kleag () free ! fr
[Download RAW message or body]

Hello all,

It seems that kgraphviewer does not compile with GraphViz prior to version 
2.22. To overcome this problem, I have changed the FindGraphViz.cmake and the 
main extragear-graphics CMakeLists.txt to check the version. But, as I'm 
really not a CMakeLists expert, I'd like to have your feelings about this 
patch before commiting.

Regards,

Gaël

P.S.: I got the version checking code from FindQt4.cmake in the cmake package.
-- 
KsirK - a world domination strategy game 
http://techbase.kde.org/Projects/Games/Tactic_and_Strategy/KsirK

KGraphViewer - a GraphViz dot graphs viewer and editor based on a reusable 
part
http://extragear.kde.org/apps/kgraphviewer

["patch.diff" (text/x-patch)]

Index: cmake/modules/FindGraphViz.cmake
===================================================================
--- cmake/modules/FindGraphViz.cmake	(révision 1009752)
+++ cmake/modules/FindGraphViz.cmake	(copie de travail)
@@ -90,4 +90,60 @@
         endif ( graphviz_INCLUDE_DIRECTORIES AND
         graphviz_GVC_LIBRARY AND graphviz_CDT_LIBRARY AND
         graphviz_GRAPH_LIBRARY AND graphviz_PATHPLAN_LIBRARY )
-        
\ No newline at end of file
+
+
+find_program(DOT dot)
+
+if (DOT)
+
+EXECUTE_PROCESS(COMMAND dot -V
+  OUTPUT_VARIABLE _dot_query_output
+  RESULT_VARIABLE _dot_result
+  ERROR_VARIABLE _dot_query_output )
+
+IF(_dot_result MATCHES 0)
+  STRING(REGEX REPLACE ".*([0-9]+\\.[0-9]+\\.[0-9]+).*" "\\1" GRAPHVIZVERSION \
"${_dot_query_output}" ) +ELSE(_dot_result MATCHES 0)
+  SET(_dot_query_output)
+ENDIF(_dot_result MATCHES 0)
+IF (GRAPHVIZVERSION)
+
+# we need at least version 2.22.0
+IF (NOT GRAPHVIZ_MIN_VERSION)
+SET(GRAPHVIZ_MIN_VERSION "2.22.0")
+ENDIF (NOT GRAPHVIZ_MIN_VERSION)
+
+#now parse the parts of the user given version string into variables
+STRING(REGEX MATCH "^[0-9]+\\.[0-9]+\\.[0-9]+" req_graphviz_major_vers \
"${GRAPHVIZ_MIN_VERSION}") +IF (NOT req_graphviz_major_vers)
+MESSAGE( FATAL_ERROR "Invalid GraphViz version string given: \
\"${GRAPHVIZ_MIN_VERSION}\", expected e.g. \"2.22.0\"") +ENDIF (NOT \
req_graphviz_major_vers) +
+# now parse the parts of the user given version string into variables
+STRING(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" req_graphviz_major_vers \
"${GRAPHVIZ_MIN_VERSION}") +STRING(REGEX REPLACE "^[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" \
req_graphviz_minor_vers "${GRAPHVIZ_MIN_VERSION}") +STRING(REGEX REPLACE \
"^[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" req_graphviz_patch_vers \
"${GRAPHVIZ_MIN_VERSION}") +
+IF (NOT req_graphviz_major_vers EQUAL 2)
+MESSAGE( FATAL_ERROR "Invalid GraphViz version string given: \
\"${GRAPHVIZ_MIN_VERSION}\", major version 4 is required, e.g. \"2.22.0\"") +ENDIF \
(NOT req_graphviz_major_vers EQUAL 2) +
+# and now the version string given by qmake
+STRING(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" GRAPHVIZ_VERSION_MAJOR \
"${GRAPHVIZVERSION}") +STRING(REGEX REPLACE "^[0-9]+\\.([0-9])+\\.[0-9]+.*" "\\1" \
GRAPHVIZ_VERSION_MINOR "${GRAPHVIZVERSION}") +STRING(REGEX REPLACE \
"^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" GRAPHVIZ_VERSION_PATCH "${GRAPHVIZVERSION}") +
+# compute an overall version number which can be compared at once
+MATH(EXPR req_vers "${req_graphviz_major_vers}*10000 + \
${req_graphviz_minor_vers}*100 + ${req_graphviz_patch_vers}") +MATH(EXPR found_vers \
"${GRAPHVIZ_VERSION_MAJOR}*10000 + ${GRAPHVIZ_VERSION_MINOR}*100 + \
${GRAPHVIZ_VERSION_PATCH}") +
+IF (found_vers LESS req_vers)
+SET(graphviz_FOUND FALSE)
+SET(GRAPHVIZ_INSTALLED_VERSION_TOO_OLD TRUE)
+ELSE (found_vers LESS req_vers)
+SET(graphviz_FOUND TRUE)
+ENDIF (found_vers LESS req_vers)
+ENDIF (GRAPHVIZVERSION)
+
+
+endif (DOT)
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt	(révision 1034467)
+++ CMakeLists.txt	(copie de travail)
@@ -61,8 +61,13 @@
 
 if(Boost_FOUND)
   if(graphviz_FOUND)
+    message (STATUS "GraphViz was found, building kgraphviewer")
     macro_optional_add_subdirectory(kgraphviewer)
-  endif(graphviz_FOUND)
+    else(graphviz_FOUND)
+      message (STATUS "GraphViz was not found, cannot build kgraphviewer")
+    endif(graphviz_FOUND)
+else(Boost_FOUND)
+  message (STATUS "Boost was not found, cannot build kgraphviewer")
 endif(Boost_FOUND)
 
 if(OPENGL_FOUND AND OPENGL_GLU_FOUND)



_______________________________________________
Kde-extra-gear mailing list
Kde-extra-gear@kde.org
https://mail.kde.org/mailman/listinfo/kde-extra-gear


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic