我有一个项目,其中有大量的条件定义可简化跨平台开发。但是,我在说服Doxygen提取所有定义时遇到了问题,因为它只会拾取那些仅用于评估的定义。
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.
例如,在以下代码段中,Doxygen将记录 TARGET_X86_64 而不记录 TARGET_ARM64 code>。
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启用EXTRACT_ALL没有帮助,禁用预处理会使Doxygen根本不记录任何内容。如何获得双氧水提取两种情况的文件?
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?
推荐答案我提出了一个冗长但可行的解决方案。当您想要拥有 #elseif 语句时,与仅使用纯 #if 语句相比,它会比较别扭。
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.
/** Some define */ #define TARGET_DEFINE /** Some other define */ #define OTHER_TARGET_DEFINE第二,采用您最初使用的条件逻辑创建定义并将其转换为未定义逻辑。
Second, take the conditional logic that you originally used to create the defines and transform it to undefine logic.
#if !(ORIGINAL_LOGIC) #undef TARGET_DEFINE #endif最后,更改条件逻辑,以便在doxygen进行预处理时未定义任何内容。
Lastly, change the conditional logic so that nothing is undefined when doxygen is doing the preprocessing.
#if !defined(DOXYGEN) ...更多推荐
Doxygen文档所有条件定义
发布评论