I have a project where I have a substantial amount of conditional defines for making cross platform development easier. However I'm having issues convincing Doxygen to extract all the defines, as it will only pick up ones that only happened to evaluate.
For example in the following snippet, Doxygen will document TARGET_X86_64
but not TARGET_ARM64
.
#if defined(_M_ARM64) || defined(__arm64__) || defined(__aarch64__)
/** Build target is ARM64 if defined. */
#define TARGET_ARM64
#else
/** Build target is x86_64 if defined. */
#define TARGET_X86_64
#endif
Enabling EXTRACT_ALL did not help, and disabling preprocessing causes Doxygen to not document anything at all. How do I get doxygen to extract documentation for both cases?
I made a "solution" that's verbose, but works. It's less awkward when you want to have
#elseif
statements than using just using pure#if
statements. Although either would work.First, define everything and not care about conditional logic.
Second, take the conditional logic that you originally used to create the defines and transform it to undefine logic.
Lastly, change the conditional logic so that nothing is undefined when doxygen is doing the preprocessing.