Add FASTJET package definition/finding macro for general use; use FASTJET_FOUND varia...
authormvl <marco.van.leeuwen@cern.ch>
Wed, 12 Mar 2014 21:58:43 +0000 (22:58 +0100)
committerhristov <Peter.Hristov@cern.ch>
Thu, 27 Mar 2014 15:24:56 +0000 (16:24 +0100)
CMakeLists.txt
JETAN/CMakeLists.txt
JETAN/CMakelibFASTJETAN.pkg
PWGJE/CMakelibPWGJE.pkg
PWGJE/CMakelibPWGJEEMCALJetTasks.pkg
cmake/FindFASTJET.cmake [new file with mode: 0644]

index 24fed0e..2064a16 100644 (file)
@@ -96,6 +96,10 @@ find_package(CPack)
 # ------------------------------
 find_package(ZeroMQ)
 
+# fastjet
+# ------------------------------
+find_package(FASTJET)
+
 #--------------------------------------------------------------------------------#
 # Environment/Compiler Configuration                                             #
 #--------------------------------------------------------------------------------#
index 7c89877..6fe3c18 100644 (file)
@@ -5,15 +5,12 @@
 
 cmake_minimum_required(VERSION 2.8.4 FATAL_ERROR)
 
-# file(GLOB PACKAGES CMake*.pkg)
-set(FASTJET_ROOT $ENV{FASTJET_ROOT})
-
-if(NOT FASTJET_ROOT)
+if(NOT FASTJET_FOUND)
   set(PACKAGES CMakelibJETAN.pkg)
-  message("JETAN: Fastjet not found; skipping FASTJETAN")
+  message(STATUS "skipping FASTJETAN")
 else()
   set(PACKAGES CMakelibFASTJETAN.pkg CMakelibJETAN.pkg)
-endif(NOT FASTJET_ROOT)
+endif(NOT FASTJET_FOUND)
 
 
 ALICE_BuildModule()
index 94e0a77..d62975b 100644 (file)
 
 set ( SRCS AliFastJetFinder.cxx AliFastJetHeaderV1.cxx AliFastJetInput.cxx AliFastJetBkg.cxx AliSISConeJetFinder.cxx AliSISConeJetHeader.cxx AliAnalysisTaskJetCluster.cxx AliAnalysisTaskJetBackgroundSubtract.cxx)
 
-# set(FASTJET_ROOT $ENV{FASTJET_ROOT})  # already done in CMakeLists.txt
-
-set (FASTJET_INC ${FASTJET_ROOT}/include)
-
 string ( REPLACE ".cxx" ".h" HDRS "${SRCS}" )
 
 set ( DHDR  FASTJETANLinkDef.h)
 
-set ( EDEFINE -isystem${FASTJET_INC} )
-set ( EINCLUDE ${FASTJET_INC} ANALYSIS STEER/AOD STEER/STEERBase )
+set ( EDEFINE -isystem${FASTJET_INCLUDE_DIR} ) # Not sure whether we need this...
+set ( EINCLUDE ${FASTJET_INCLUDE_DIR} ANALYSIS STEER/AOD STEER/STEERBase )
 
index 789f826..a3526d7 100644 (file)
@@ -55,17 +55,15 @@ set ( SRCS
     UserTasks/AliIDFFUtils.cxx
     )
 
-set(FASTJET_ROOT $ENV{FASTJET_ROOT})
-
 # Add code that needs fastjet or FJWrapper here 
-if (FASTJET_ROOT)
+if (FASTJET_FOUND)
   LIST(APPEND  SRCS
     UserTasks/AliAnalysisTaskCheckSingleTrackJetRejection.cxx 
     UserTasks/AliAnalysisTaskJetHadronCorrelation.cxx
     UserTasks/AliAnalysisTaskJetHBOM.cxx
   )
-  set ( CINTFLAGS ${CINTFLAGS} -DHAVE_FASTJET)
-endif(FASTJET_ROOT)
+  set ( CINTFLAGS ${CINTFLAGS} ${FASTJET_DEFINITIONS})
+endif(FASTJET_FOUND)
 
 string ( REPLACE ".cxx" ".h" HDRS "${SRCS}" )
 
@@ -73,13 +71,12 @@ set ( DHDR  PWGJELinkDef.h)
 
 string ( REPLACE ".cxx" ".h" EXPORT "${SRCS}" )
 
-if(FASTJET_ROOT)
-  set (FASTJET_INC ${FASTJET_ROOT}/include)
-  set ( EINCLUDE ${FASTJET_INC} ANALYSIS JETAN CORRFW PWGJE PWG/Tools PWGCF/Correlations/Base STEER/AOD STEER/ESD STEER/STEERBase)
+if(FASTJET_FOUND)
+  set ( EINCLUDE ${FASTJET_INCLUDE_DIR} ANALYSIS JETAN CORRFW PWGJE PWG/Tools PWGCF/Correlations/Base STEER/AOD STEER/ESD STEER/STEERBase)
   set ( HDRS ${HDRS}  EMCALJetTasks/FJ_includes.h  )
 else()
   set ( EINCLUDE ANALYSIS JETAN CORRFW PWGJE PWG/Tools PWGCF/Correlations/Base STEER/AOD STEER/ESD STEER/STEERBase)
-endif(FASTJET_ROOT)
+endif(FASTJET_FOUND)
 
 
 install (DIRECTORY macros
index d5ecd21..86ff5b9 100644 (file)
@@ -76,20 +76,19 @@ set ( SRCS
  EMCALJetTasks/UserTasks/AliAnalysisTaskSOH.cxx
 )
 
-set ( FASTJET_ROOT $ENV{FASTJET_ROOT} ) # Can be done in CMakeList.txt?
-
 # Add code that needs fastjet or FJWrapper here
-if (FASTJET_ROOT)
-LIST(APPEND SRCS
- EMCALJetTasks/AliFJWrapper.cxx
- EMCALJetTasks/AliEmcalJetTask.cxx
- EMCALJetTasks/AliEmcalJetFinder.cxx
- EMCALJetTasks/AliJetEmbeddingFromAODTask.cxx
- EMCALJetTasks/UserTasks/AliAnalysisTaskFullpAJets.cxx
- EMCALJetTasks/UserTasks/AliAnalysisTaskFullppJet.cxx
- EMCALJetTasks/UserTasks/AliAnalysisTaskHJetDphi.cxx
-)
-endif(FASTJET_ROOT)
+if (FASTJET_FOUND)
+  LIST(APPEND SRCS
+   EMCALJetTasks/AliFJWrapper.cxx
+   EMCALJetTasks/AliEmcalJetTask.cxx
+   EMCALJetTasks/AliEmcalJetFinder.cxx
+   EMCALJetTasks/AliJetEmbeddingFromAODTask.cxx
+   EMCALJetTasks/UserTasks/AliAnalysisTaskFullpAJets.cxx
+   EMCALJetTasks/UserTasks/AliAnalysisTaskFullppJet.cxx
+   EMCALJetTasks/UserTasks/AliAnalysisTaskHJetDphi.cxx
+  )
+  set ( CINTFLAGS ${CINTFLAGS} ${FASTJET_DEFINITIONS})
+endif(FASTJET_FOUND)
 
 set ( DHDR  PWGJEEMCALJetTasksLinkDef.h)
 
@@ -97,13 +96,11 @@ string ( REPLACE ".cxx" ".h" EXPORT "${SRCS}" )
 
 string ( REPLACE ".cxx" ".h" HDRS "${SRCS}" )
 
-
-if(FASTJET_ROOT)
-  set (FASTJET_INC ${FASTJET_ROOT}/include)
-  set ( EDEFINE -isystem${FASTJET_INC})
-  set ( EINCLUDE ${FASTJET_INC} PWGJE/EMCALJetTasks PWG/EMCAL EMCAL OADB STEER/ESD STEER/STEERBase ANALYSIS)
+if(FASTJET_FOUND)
+  set ( EDEFINE -isystem${FASTJET_INCLUDE_DIR})
+  set ( EINCLUDE ${FASTJET_INCLUDE_DIR} PWGJE/EMCALJetTasks PWG/EMCAL EMCAL OADB STEER/ESD STEER/STEERBase ANALYSIS)
   set ( HDRS ${HDRS}  EMCALJetTasks/FJ_includes.h )
 else()
   set ( EINCLUDE PWGJE/EMCALJetTasks PWG/EMCAL EMCAL OADB STEER/ESD STEER/STEERBase ANALYSIS)
-endif(FASTJET_ROOT)
+endif(FASTJET_FOUND)
 
diff --git a/cmake/FindFASTJET.cmake b/cmake/FindFASTJET.cmake
new file mode 100644 (file)
index 0000000..26d5b5d
--- /dev/null
@@ -0,0 +1,29 @@
+# AliRoot Build System Module to find and configure FASTJET
+#
+# Author: Marco van Leeuwen
+#
+# Simple first version; checks env variables and fastjet-config; does not verify that includes and libs are really present
+
+cmake_minimum_required(VERSION 2.8.4 FATAL_ERROR)
+
+set(FASTJET_ROOT $ENV{FASTJET_ROOT})
+
+if (NOT FASTJET_ROOT)
+  set(FASTJET_ROOT $ENV{FASTJET})
+endif(NOT FASTJET_ROOT)
+
+if (NOT FASTJET_ROOT)
+  execute_process (COMMAND fastjet-config --prefix OUTPUT_VARIABLE FASTJET_ROOT)
+  string (STRIP ${FASTJET_ROOT} FASTJET_ROOT)
+endif(NOT FASTJET_ROOT)
+
+if (FASTJET_ROOT) 
+  message(STATUS "FASTJET found in ${FASTJET_ROOT}")
+  set (FASTJET_FOUND true)
+  set (FASTJET_INCLUDE_DIR ${FASTJET_ROOT}/include)
+  message(STATUS "FASTJET include directory: ${FASTJET_INCLUDE_DIR}")
+  set (FASTJET_DEFINITIONS -DHAVE_FASTJET)
+else()
+  message(STATUS "FASTJET not found; make sure to set the FASTJET_ROOT environment variable or have fastjet-config in your path to use fastjet")
+endif(FASTJET_ROOT)
+