1

I haven't used cscope much. I would like to know the instructions to build (database) and use cscope with opencv. Also, Is it applicable only to C programs? how about C++?

Tom Iv
  • 409
  • 1
  • 5
  • 21
  • This might help too - http://stackoverflow.com/questions/11917923/how-to-use-cscope-for-a-project-which-has-c-cpp-and-h-files – kiranpradeep May 07 '15 at 02:18

1 Answers1

0

I found this long dead question as I searched for the same topic. Here's what I've found.

According to the cscope home page

The fuzzy parser supports C, but is flexible enough to be useful for C++ and Java, and for use as a generalized 'grep database' (use it to browse large text documents!)

So, I went ahead and generated a cscope database for opencv2, more or less adapting from the cscope large projects tutorial

in order to generate the appropriate cscope.files, if searching the OCV2 directory below, you'd run the find command, pruning out a lot of superfluous directories and files.

#!/bin/bash
OCV2=~/src/opencv/opencv
find $OCV2 -path "$OCV2*/.git" -prune -o -path "$OCV2*/samples" -prune -o -path "$OCV2*/cmake" -prune -o  -path "$OCV2*/data" -prune -o  -path "$OCV2*/doc" -prune -o  -path "$OCV2*/platforms" -prune -o  -path "$OCV2*/release" -prune -o  -iname "*\.cpp" -print -o -iname "*\.hpp" -print -o -iname "*\.c" -print -o  -iname "*\.h" -print > cscope.files

Now, you'll want to generate the cscope database, do so by running the following from within the same directory as cscope.files

cscope -b -q -k

which will create the files: cscope.in.out cscope.out cscope.po.out

If you have the environment variable $CSCOPE_DB set to point at cscope.out then you'll be ready to go.

Let me know if you have any other questions.

Community
  • 1
  • 1
OYRM
  • 1,395
  • 10
  • 29