Updating CMake files
authorfca <fca@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 14 Oct 2008 15:58:25 +0000 (15:58 +0000)
committerfca <fca@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 14 Oct 2008 15:58:25 +0000 (15:58 +0000)
cmake/modules/ALICEMacros.cmake
cmake/modules/FindROOT.cmake
cmake/modules/FindRuleChecker.cmake

index 5ca45f1..47d4351 100644 (file)
@@ -51,6 +51,7 @@ Function (AddLibrary LIB SRCS DHDRS)
     Set(ASRCS ${SRCS} ${DICT})
     Root_Generate_Dictionary("${DHDRS}" "${LDEF}" "${DICT}" "${INCLUDE_DIRECTORIES}")
   Else(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LDEF})
+    Message(STATUS "${LDEF} not found... probably building empty lib")
     Set(ASRCS ${SRCS})
   Endif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LDEF})
 
@@ -130,8 +131,8 @@ If(ALICE_TARGET STREQUAL macosx64)
 
   Find_Package(fink)
   
-  Set(CMAKE_CXX_COMPILER g++)
-  Set(CMAKE_C_COMPILER gcc)
+#  Set(CMAKE_CXX_COMPILER g++)
+#  Set(CMAKE_C_COMPILER gcc)
 # I found no way to make this work...
 #  Set(CMAKE_CXX_LINK_EXECUTABLE 
 #    "MACOSX_DEPLOYMENT_TARGET=${MACOSX_MAJOR}.${MACOSX_MINOR} ${CMAKE_CXX_LINK_EXECUTABLE}")
index c567fcb..74b47e2 100644 (file)
@@ -25,8 +25,21 @@ Else (${ROOT_CONFIG} MATCHES "ROOT_CONFIG-NOTFOUND")
 
   Execute_process(
     COMMAND root-config --f77 
-    OUTPUT_VARIABLE CMAKE_Fortran_COMPILER 
+    OUTPUT_VARIABLE _f77 
     OUTPUT_STRIP_TRAILING_WHITESPACE)
+  Set(ENV{F77} ${_f77})
+
+  Execute_process(
+    COMMAND root-config --cc
+    OUTPUT_VARIABLE _cc 
+    OUTPUT_STRIP_TRAILING_WHITESPACE)
+  Set(ENV{CC} ${_cc})
+
+  Execute_process(
+    COMMAND root-config --cxx
+    OUTPUT_VARIABLE _cxx
+    OUTPUT_STRIP_TRAILING_WHITESPACE)
+  Set(ENV{CXX} ${_cxx})
 
   Execute_process(
     COMMAND root-config --version 
@@ -48,7 +61,8 @@ Else (${ROOT_CONFIG} MATCHES "ROOT_CONFIG-NOTFOUND")
     Message(FATAL_ERROR "Found ROOT but not rootcint, your ROOT installation is corrupted")
   EndIf(NOT ROOTCINT)
 
-  Set(ROOT_LIBRARIES ${ROOT_LIBRARIES} -lThread -lMinuit -lHtml -lVMC -lEG -lGeom -lTreePlayer -lXMLIO -lProof -lProofPlayer -lMLP -lSpectrum -lEve -lRGL -lGed)
+  Set(ROOT_LIBRARIES ${ROOT_LIBRARIES} -lThread -lMinuit -lHtml -lVMC -lEG -lGeom -lTreePlayer -lXMLIO -lProof)
+  Set(ROOT_LIBRARIES ${ROOT_LIBRARIES} -lProofPlayer -lMLP -lSpectrum -lEve -lRGL -lGed -lXMLParser -lPhysics)
   Set(ROOT_LIBRARY_DIR ${ROOTSYS}/lib)
 
   # Make variables changeble to the advanced user
@@ -112,9 +126,16 @@ Macro(ROOT_GENERATE_DICTIONARY INFILES LINKDEF_FILE OUTFILE INCLUDE_DIRS_IN)
     Set(infiles_nopath ${infiles_nopath} ${name_wo_path})   
   Endforeach (_current_FILE ${INFILES})
 
+  Get_property(_defs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY COMPILE_DEFINITIONS)
+  Set(_ddefs)
+  Foreach (_def ${_defs})
+    Set(_ddefs "${_ddefs} -D${_def}")
+  Endforeach (_def ${_defs})
+  Separate_arguments(_ddefs)
+
   Add_custom_command(OUTPUT ${OUTFILES}
      COMMAND DYLD_LIBRARY_PATH=$ENV{DYLD_LIBRARY_PATH}:${ROOT_LIBRARY_DIR} ${ROOTCINT}
-     ARGS -f ${OUTFILE} -c -DHAVE_CONFIG_H ${_special_settings} ${INCLUDE_DIRS} ${infiles_nopath} ${LINKDEF_FILE} 
+     ARGS -f ${OUTFILE} -c -DHAVE_CONFIG_H ${_ddefs} ${_special_settings} ${INCLUDE_DIRS} ${infiles_nopath} ${LINKDEF_FILE} 
      DEPENDS ${INFILES} ${LINKDEF_FILE})
 
 Endmacro(ROOT_GENERATE_DICTIONARY)
index 94d1e62..29dc72b 100644 (file)
@@ -71,3 +71,56 @@ Function(CheckViols LIB SRCS)
     
 EndFunction (CheckViols)
 
+#_______________________________________________________________________________
+Function(CheckViolsNew LIB SRCS)
+
+  If(RULE_CHECKER_FOUND)
+    Set(_FactExt $ENV{ALICE}/local/ALICENewRuleChecker/FactExtractor/FactExtractor.jar)
+    Set(_RuleCheck $ENV{ALICE}/local/ALICENewRuleChecker/NewRuleChecker/NewRuleChecker.jar)
+
+    String(REGEX MATCHALL "[^ ]*.cxx" CXXSRCS "${SRCS}")
+    
+    Set(_checkDir "${CMAKE_CURRENT_BINARY_DIR}/check_new")
+    
+    If(NOT EXISTS ${_checkDir})
+      File(MAKE_DIRECTORY ${_checkDir})
+    EndIf(NOT EXISTS ${_checkDir})
+    
+    Set(_inc_dirs)
+    Foreach(_dir ${INCLUDE_DIRECTORIES})
+      Set(_inc_dirs ${_inc_dirs} -I${_dir})
+    EndForeach(_dir ${INCLUDE_DIRECTORIES})
+    
+    Set(VIOLS)
+    Foreach(_checkFile ${CXXSRCS})
+      Get_Filename_Component(_checkFilePath ${_checkFile} PATH)
+      If(NOT EXISTS ${_checkDir}/${_checkFilePath})
+       File(MAKE_DIRECTORY ${_checkDir}/${_checkFilePath})
+      EndIf(NOT EXISTS ${_checkDir}/${_checkFilePath})
+      String(REGEX REPLACE "([^;]*).cxx" "${_checkDir}/\\1.cxx.xml" _srcxml "${_checkFile}")
+      String(REGEX REPLACE "([^;]*).cxx" "${_checkDir}/\\1.h.xml"   _hdrxml "${_checkFile}")
+      String(REGEX REPLACE "([^;]*).cxx" "${_checkDir}/\\1.h.viol"   _violFile "${_checkFile}")
+      String(REGEX REPLACE "([^;]*).cxx" "\\1.h" _checkHead "${_checkFile}")
+      Add_Custom_Command(
+       OUTPUT ${_violFile}
+       COMMAND src2srcml 
+        ARGS ${CMAKE_CURRENT_SOURCE_DIR}/${_checkFile} ${_srcxml}
+       COMMAND src2srcml 
+        ARGS ${CMAKE_CURRENT_SOURCE_DIR}/${_checkHead} ${_hdrxml}
+       COMMAND java
+       ARGS -jar ${_FactExt} 
+       COMMAND ${RULE_CHECKER_PATCH} ARGS ${_tempFile_in}
+       COMMAND CLASSPATH=${RULE_CHECKER_PATH} java ${RULE_CHECKER} 
+        ARGS ${_tempFile_in} ${CMAKE_CURRENT_SOURCE_DIR} > ${_violFile}
+       DEPENDS ${_checkFile}
+       WORKING_DIRECTORY ${_checkDir})
+      Set(VIOLS ${VIOLS} ${_violFile})
+    EndForeach(_checkFile ${CXXSRCS})
+    
+    Add_Custom_Target(check-${LIB} DEPENDS ${VIOLS})
+    Add_Dependencies(check-all check-${LIB})
+
+  EndIf(RULE_CHECKER_FOUND)
+    
+EndFunction (CheckViolsNew)
+