Fork me on GitHub

Opened 10 years ago

Closed 10 years ago

#313 closed Enhancement (fixed)

CMake for Delphes

Reported by: Benedikt Hegner Owned by:
Priority: minor Milestone:
Component: Delphes miscellaneous Version: Delphes 3
Keywords: Cc:

Description

Hi all,

to facilitate my work w/ Delphes for FCC I started implementing CMake files to allow out-of-source builds and as preparation for work on using externally provided fastjet libs. Current status in the patch attached.
After applying it and putting Delphes into "sources", it can be tested on lxplus w/:
mkdir build
cd build
export PATH=/afs/cern.ch/sw/lcg/contrib/CMake/2.8.9/Linux-i386/bin:${PATH}
source /afs/cern.ch/sw/lcg/external/gcc/4.8.1/x86_64-slc6/setup.sh
source /afs/cern.ch/exp/fcc/sw/0.2/ROOT/5.34.19/x86_64-slc6-gcc48-dbg/bin/thisroot.sh
cmake -DCMAKE_INSTALL_PREFIX:PATH=../install ../sources
make
make install

Attachments (1)

delphes.patch (7.8 KB ) - added by Benedikt Hegner 10 years ago.
Patches for adding CMake support

Download all attachments as: .zip

Change History (3)

by Benedikt Hegner, 10 years ago

Attachment: delphes.patch added

Patches for adding CMake support

comment:1 by Pavel Demin, 10 years ago

Hi Benedikt,

Thanks a lot for this patch!

I agree that it's a good idea to be able to build Delphes with CMake.

I've just tested this patch with the latest ROOT version and discovered that ROOT 6 has a slightly different format of the ROOT_GENERATE_DICTIONARY function.

For example, here is how it is described in the cmake/modules/RootNewMacros.cmake file for two different ROOT versions:

  • ROOT 5.34.06
    #---------------------------------------------------------------------------------------------------
    #---ROOT_GENERATE_DICTIONARY( dictionary headerfiles LINKDEF linkdef OPTIONS opt1 opt2 ...)
    #---------------------------------------------------------------------------------------------------
    
  • ROOT 6.00.02
    #---------------------------------------------------------------------------------------------------
    #---ROOT_GENERATE_DICTIONARY( dictionary headerfiles MODULE module DEPENDENCIES dep1 dep2
    #                                                    STAGE1 LINKDEF linkdef OPTIONS opt1 opt2 ...)
    #---------------------------------------------------------------------------------------------------
    

Actually, it's the 'MODULE' argument that affects the name of the dictionary file and if it's not specified then 'make install' doesn't work

I had to define the following function and replace all calls to ROOT_GENERATE_DICTIONARY with calls to DELPHES_GENERATE_DICTIONARY:

function(DELPHES_GENERATE_DICTIONARY dictionary)
  if(${ROOT_VERSION} LESS 6.0)
    ROOT_GENERATE_DICTIONARY(${dictionary} ${ARGN})
  else()
    ROOT_GENERATE_DICTIONARY(${dictionary} MODULE ${dictionary} ${ARGN})
  endif()
endfunction()

Otherwise, 'make install' complains that it can't find 'ModulesDict_rdict.pcm' and other '*_rdict.pcm' files.

I've also added the following code to the main CMakeLists.txt file:

if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
  set(CMAKE_INSTALL_LIBDIR "lib")
endif()

I've just committed the patch and my modifications to the Delphes' repository. So, it'll be available in the next release.

Cheers,

Pavel

comment:2 by Pavel Demin, 10 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.