How to use Kdevelop with CMSSW
Kdevelop is an Integrated Development Environment (IDE) in KDE: this is an application that integrates the C++ libraries you work with, like CMSSW,
ROOT, etc such that you can program more easily and quickly. So for example, if you have a histogram
TH1F object myhist declared in your code, the IDE will autocomplete the list of functions that you can call for myhist->. This is very handy: instead of going back and forth between your file and countless headers, .cc files, or the code's web to get a list of the functions, you are automatically presented with a menu with all possible options. Awesome! Of course, you can also build, debug, and test your code within Kdevelop.
Here are the instructions on how to make Kdevelop (3.3.4) work with CMSSW running on SLC5. (The latest Kdevelop4 only works in KDE4).
- We assume you have a work area with some CMSSW release and a list of your packages. For example RecoJets/JetAnalyzers:
- cd /scratch/username
- scram project CMSSW CMSSW_3_3_5
- cd CMSSW_3_3_5
- eval `scram ru -sh`
- cvs co -r V00-05-00 RecoJets/JetAnalyzers
- scram b
- Now launch kdevelop
- In Project, open "Import Existing Project"
- Directory: /scratch/username/CMSSW_3_3_5/src/RecoJets
- Project Name: RecoJets, for example
- Project Type: Generic C++ Application (Custom Makefiles)
- And click on Create Project
- It will then prompt you with a warning: "This project does not contain any files yet. Populate it with all C/C++/Java files below the project source directory?"
- Now you have created the project. Before you begin, you should enter information about additional libraries. Go to "Project > Project Options"
- On the "C++ specific" category and "General" tab, change .cpp with .cc as "Implementation Suffix"
- On the "Code Completion" tab, in the "Code Completion Databases" click on Add
- Select the "Kdevelop Custom Directory PCS Importer", and click Next
- Database name: ROOT
- Directories to parse: /afs/cern.ch/cms/sw/slc5_ia32_gcc434/lcg/root/5.22.00d-cms4
- This ROOT path can be obtained by: echo $ROOTSYS in your terminal
- Select the new ROOT directory, click on Add, and then Next. It will build the library. Be careful because kdevelop will use a lot of space in your home area to store all the information on this database. You might want to create a soft link for this directory: ~/.kde/share/apps/kdevcppsupport in a local scratch disk in the machine where you normally run Kdevelop.
- You can repeat this with other libraries for your code. But beware that the larger the library the slower the code will go.
- Now you can begin editing a file: In the "File selector" tab on the left you can navigate to open for example: RecoJets/JetAnalyzers/src/myJetAna.cc
- Now when you begin writing a new variable it will offer you a menu with the possibilities, and when you type -> it will also offer completion for all possible functions on that object!
Left to do is how to build within Kdevelop, for now you can still use the terminal.
--
AranGarciaBellido - 27-Jul-2010