FS#49448 - [doxygen] add -Duse-libclang:BOOL=ON to libclang parsing for C++ projects
Attached to Project:
Arch Linux
Opened by Antoine Poliakov (antoinep92) - Monday, 23 May 2016, 14:29 GMT
Last edited by Buggy McBugFace (bugbot) - Saturday, 25 November 2023, 20:24 GMT
Opened by Antoine Poliakov (antoinep92) - Monday, 23 May 2016, 14:29 GMT
Last edited by Buggy McBugFace (bugbot) - Saturday, 25 November 2023, 20:24 GMT
|
Details
Description:
Doxygen's C++ parser is fast but not always correct, especially for complex (heavy template usage) or modern (C++14/17) codes. For this purpose, there is an alternative parser based on LLVM's C++ parser used in the clang compiler, libclang. Because of the dependency on libclang, this option is optional on build. Could you please consider adding it by: - adding 'clang' as a dependency to doxygen - appending '-Duse_libclang:BOOL=ON' to cmake arguments I know this adds a heavy dependency, but the parsing quality for C++ code is really better with this. By the way, I noticed 2 minor unrelated issues in the PKGBUILD (probably not worth a specific bugreport): (1) the current CMake invocation includes '-DQT_QMAKE_EXECUTABLE:FILE=/usr/lib/qt4/bin/qmake' which seems to be obsolete: CMake Warning: Manually-specified variables were not used by the project: QT_QMAKE_EXECUTABLE => I think this line can be removed (2) the dev-dependencies include flex which is already in base-devel, so I think it's not necessary (but does no harm). Additional info: * package version(s): 1.8.11-4 * config and/or log files etc. Steps to reproduce: set CLANG_ASSISTED_PARSING=yes in a Doxyfile and run doxygen yields: warning: Tag `CLANG_ASSISTED_PARSING' at line ---- of file `Doxyfile' belongs to an option that was not enabled at compile time. |
This task depends upon
Closed by Buggy McBugFace (bugbot)
Saturday, 25 November 2023, 20:24 GMT
Reason for closing: Moved
Additional comments about closing: https://gitlab.archlinux.org/archlinux/p ackaging/packages/doxygen/issues/2
Saturday, 25 November 2023, 20:24 GMT
Reason for closing: Moved
Additional comments about closing: https://gitlab.archlinux.org/archlinux/p ackaging/packages/doxygen/issues/2
set(CLANG_LIBS libclang clangTooling ${llvm_libs})
to
set(CLANG_LIBS libclang clangTooling LLVM)
add to the make_depends 'clang' 'llvm' and the mentioned option to cmake
• The “llvm” package must be installed.
• There are 14 “CMakeLists.txt” files in the Doxygen source directory. As “loqs” pointed out, the one to modify is in the /src subdirectory. The change to be made is as described by “loqs”; however the relevant line number is no longer at 238. A search for
“set(CLANG_LIBS libclang clangTooling ${llvm_libs})” will find the correct line to modify.
• Once that change has been made, the instructions to build that worked for me are:
cd <doxygenSourceCodeDirectory>
mkdir build
cd build
cmake -Duse_libclang=ON -G "Unix Makefiles" ..
make
sudo make install
There is just one gotcha when using the clang parser. Besides enabling CLANG_ASSISTED_PARSING [1] you also need to configure -resource-dir via CLANG_OPTIONS [2], as I found in [3]. The correct path can be found by running "clang -print-resource-dir":
CLANG_OPTIONS = -resource-dir=/usr/lib/clang/11.1.0
[1] https://www.doxygen.nl/manual/config.html#cfg_clang_assisted_parsing
[2] https://www.doxygen.nl/manual/config.html#cfg_clang_options
[3] https://github.com/googleapis/google-cloud-cpp/commit/765e427e07eb53e726d25066e2b65f4b17911b99