First step for rulechecker -- not working yet
authorfca <fca@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 4 Feb 2011 15:17:29 +0000 (15:17 +0000)
committerfca <fca@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 4 Feb 2011 15:17:29 +0000 (15:17 +0000)
CMakeLists.txt
cmake/ALICE_CMake.cmake
cmake/FindRuleChecker.cmake

index e911c68..a23c7dc 100644 (file)
@@ -1,3 +1,5 @@
+# -*- mode: cmake -*-
+
 # Top level CMakeList.txt file for the AliRoot Build System
 #
 # Author: Johny Jose (johny.jose@cern.ch)
@@ -211,7 +213,10 @@ set(EXPORTFILES)
 add_custom_target(alilibs-static)
 add_custom_target(include-headers)
 add_custom_target(DA-all)
-add_custom_target(check-all)
+#  if(RULECHECKER_FOUND)
+  add_custom_target(check-all)
+  add_dependencies(check-all ${FACTFILE})
+#  endif(RULECHECKER_FOUND)
 add_custom_target(par-all)
 add_custom_target(test-par-all)
 
@@ -224,7 +229,9 @@ foreach(MODULE ${MODDIRS})
   add_custom_target(${MODULE}-check-all)
   add_custom_target(${MODULE}-par-all)
   add_custom_target(test-${MODULE}-par-all)
+#  if(RULECHECKER_FOUND)
   add_dependencies(check-all "${MODULE}-check-all")
+#  endif(RULECHECKER_FOUND)
   add_custom_target(${MODULE}-all-static)
   add_dependencies(alilibs-static "${MODULE}-static")
   add_subdirectory(${MODULE})
@@ -234,6 +241,13 @@ if(DATE_FOUND AND AMORE_FOUND)
   include (CMakeDA)
 endif(DATE_FOUND AND AMORE_FOUND)
 
+#if(RULECHECKER_FOUND)
+    add_custom_command( OUTPUT ${FACTFILE}
+                        COMMAND ${JAVA_RUNTIME} -jar ${FACTEXTRACTOR_JAR} ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}
+                       DEPENDS ${_factfile_deps}
+                        WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
+#endif(RULECHECKER_FOUND)
+
 #--------------------------------------------------------------------------------#
 # Additional Targets                                                             #
 #--------------------------------------------------------------------------------#
index d43d206..32d883c 100644 (file)
@@ -1,3 +1,5 @@
+# -*- mode: cmake -*-
+
 # AliRoot Build System Utility Macro and Function definitions
 #
 # Author: Johny Jose (johny.jose@cern.ch)
@@ -477,7 +479,7 @@ macro(ALICE_BuildExecutable)
 
   ALICE_Format(PELIBSDIR "-L" "" "${PELIBSDIR}")
   ALICE_CheckLibraries(PBLIBS "${PBLIBS}")
-  #ALICE_CheckLibraries(PELIBS "${PELIBS}")
+  ALICE_CheckLibraries(PELIBS "${PELIBS}")
 
   ALICE_CorrectPaths(EINCLUDE "${EINCLUDE}")
   ALICE_CorrectPaths(PINC "${PINC}")
index 8a02bb5..e506832 100644 (file)
@@ -1,3 +1,5 @@
+# -*- mode: cmake -*-
+
 # AliRoot Build System Module to find and configure IRST ALICE Coding Coventions RuleChecker
 #
 # Author: Johny Jose (johny.jose@cern.ch)
@@ -28,6 +30,24 @@ if(IRST_INSTALLDIR)
     message(STATUS "RuleChecker rules : ${RULECHECKER_RULES}")
     message(STATUS "RuleChecker factextractor : ${FACTEXTRACTOR_JAR}")
     message(STATUS "RuleChecker found on the system")
+
+    set(FACTFILE ${CMAKE_BINARY_DIR}/factFile.xml)
+    set(_factfile_deps)
+
+    file(GLOB_RECURSE _root_headers  ${ROOTSYS}/include/*.h)
+    foreach(_root_header ${_root_headers})
+      string (REGEX REPLACE "${ROOTSYS}/include/" "" _rel_root_header ${_root_header})
+      string (REGEX REPLACE "h$" "h.xml" _rel_root_hxml ${_rel_root_header})
+      get_filename_component(_rel_root_header_path ${_rel_root_hxml} PATH)
+      set(_root_hxml roothxml/${_rel_root_hxml})
+      if(NOT EXISTS roothxml/${_rel_root_header_path})
+       file(MAKE_DIRECTORY roothxml/${_rel_root_header_path})
+      endif(NOT EXISTS roothxml/${_rel_root_header_path})
+      list(APPEND _factfile_deps ${_root_hxml})
+      add_custom_command(OUTPUT  ${_root_hxml}
+                         COMMAND ${RULECHECKER_SRCML} ${_root_header} ${_root_hxml}
+                         DEPENDS ${_root_header})
+    endforeach(_root_header ${_root_headers})
   else()
     message(STATUS "RuleChecker not found on this system")
   endif(RULECHECKER_JAR AND RULECHECKER_RULES AND RULECHECKER_SRCML AND JAVA_RUNTIME)
@@ -39,11 +59,6 @@ macro(ALICE_CheckModule)
   if(RULECHECKER_FOUND)
     set(CHECKDIR ${CMAKE_BINARY_DIR}/${MODULE}/check)
     set(violFiles)
-    add_custom_command( OUTPUT ${MODULE}-${PACKAGE}-factFile
-                        COMMAND ${CMAKE_COMMAND} -E make_directory ${CHECKDIR}
-                        COMMAND ${CMAKE_COMMAND} -E make_directory ${CHECKDIR}/viols
-                        COMMAND ${JAVA_RUNTIME} -jar ${FACTEXTRACTOR_JAR} ${CHECKDIR} ${CHECKDIR} 
-                        WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
 
     foreach(_srcfile ${SRCS})
       string (REGEX REPLACE "cxx$" "h" _header ${_srcfile})
@@ -52,21 +67,22 @@ macro(ALICE_CheckModule)
       string (REGEX REPLACE "cxx$" "cxx.xml" _srcxml ${_srcname})
       string (REGEX REPLACE "cxx$" "h.xml" _hxml ${_srcname})
       string (REGEX REPLACE ".cxx$" "" _class ${_srcname})
-      set(_depends ${_srcfile} ${MODULE}-${PACKAGE}-factFile)
+      set(_depends ${_srcfile})
 
       if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_header})
-        list(APPEND depends ${_header})
+        list(APPEND _depends ${_header})
+       list(APPEND _factfile_deps ${_hxml})
         add_custom_command( OUTPUT ${_viol}
                           COMMAND ${RULECHECKER_SRCML} ${_srcfile} ${CHECKDIR}/${_srcxml}
                           COMMAND ${RULECHECKER_SRCML} ${_header} ${CHECKDIR}/${_hxml}
-                          COMMAND ${JAVA_RUNTIME} -jar ${RULECHECKER_JAR} ${CHECKDIR}/${_srcxml} ${CHECKDIR}/${_hxml} ${CHECKDIR}/factFile.xml ${RULECHECKER_RULES} > ${CHECKDIR}/viols/${_viol}
+                          COMMAND ${JAVA_RUNTIME} -jar ${RULECHECKER_JAR} ${CHECKDIR}/${_srcxml} ${CHECKDIR}/${_hxml} ${FACTFILE} ${RULECHECKER_RULES} > ${CHECKDIR}/viols/${_viol}
                           DEPENDS ${_depends}
                           WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
         list(APPEND violFiles ${_viol})
       else()
         add_custom_command( OUTPUT ${_viol}
                           COMMAND ${RULECHECKER_SRCML} ${_srcfile} ${CHECKDIR}/${_srcxml}
-                          COMMAND ${JAVA_RUNTIME} -jar ${RULECHECKER_JAR} ${CHECKDIR}/${_srcxml} ${CHECKDIR}/${_hxml} ${CHECKDIR}/factFile.xml ${RULECHECKER_RULES} > ${CHECKDIR}/viols/${_viol}
+                          COMMAND ${JAVA_RUNTIME} -jar ${RULECHECKER_JAR} ${CHECKDIR}/${_srcxml} ${CHECKDIR}/${_hxml} ${FACTFILE} ${RULECHECKER_RULES} > ${CHECKDIR}/viols/${_viol}
                           DEPENDS ${_depends}
                           WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
         list(APPEND violFiles ${_viol})
@@ -76,8 +92,8 @@ macro(ALICE_CheckModule)
       endif(CLASSCHECK STREQUAL "YES")
     endforeach(_srcfile ${SRCS})
     if(violFiles)
-      add_custom_target(${PACKAGE}-check DEPENDS ${violFiles})
-      add_dependencies(${PACKAGE}-check ${violFiles})
+      add_custom_target(${PACKAGE}-check DEPENDS ${FACTFILE} ${violFiles})
+#      add_dependencies(${PACKAGE}-check ${FACTFILE} ${violFiles})
       add_dependencies(${MODULE}-check-all ${PACKAGE}-check)
     endif(violFiles)
     add_custom_command(TARGET clean