Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make doxygen document the #ifdef parts too

As suggested here, I have some parts in my code, that are enabled by a compilation flag.

For example I have this piece of code:

#ifdef MYPROJ_HAS_BOOST
  ...
#endif

Doxygen will leave them out, because they are omitted, since MYPROJ_HAS_BOOST is not defined. I solved it, with adding a #define MYPROJ_HAS_BOOST.

However this is not nice, because in the future (I am planning to extend the project), when the time comes to re-generate my documentation, maybe I will have forgotten about this.

Is there any way to say to Doxygen (ideally via doxywizard) to take into account these parts of my code too?

like image 736
gsamaras Avatar asked Sep 25 '14 15:09

gsamaras


Video Answer


3 Answers

In your Doxyfile (or whatever you've renamed it to) add the lines

PREDEFINED = MYPROJ_HAS_BOOST

You can also do this in doxywizard by setting the variable PREDEFINED to include MYPROJ_HAS_BOOST.

like image 79
randomusername Avatar answered Sep 20 '22 20:09

randomusername


My understanding today is, that doxygen supports the defines. In your case you should enable

ENABLE_PREPROCESSING = YES

and set

PREDEFINED = MYPROJ_HAS_BOOST

or

PREDEFINED = MYPROJ_HAS_BOOST=1

If you want to reverse it (as you wanted it in your example) change to

PREDEFINED = MYPROJ_HAS_BOOST=0

Is is explained in more details here.

like image 37
musbach Avatar answered Sep 21 '22 20:09

musbach


I think you just need to disable preprocessing at all by setting ENABLE_PREPROCESSING to NO in doxygen configuration file.

In doxywizard go to Expert -> Preprocessor and you will find ENABLE_PREPROCESSING. Just uncheck it to set it to NO.

More information about preprocessing in doxygen can be found in documentation here.

like image 42
afenster Avatar answered Sep 17 '22 20:09

afenster