I just finished editing some relevant pages in the wiki.
- CompileOnUnix: I edited this page because I wanted to have clear instructions to compile FreeCAD myself. I mostly reviewed the packages needed for Debian/Ubuntu, as I use Ubuntu myself, and I tried to clarify the steps that you must follow in general in Linux for compilation.
- Source documentation: this page explains how to create the documented sources; it follows the same process as compiling FreeCAD in general, that is, cmake and then make DevDoc, instead of just make. FreeCAD produces its online documentation in a way that I still don’t understand very well. You don’t run the doxygen executable directly, but with the cmake+make process mentioned before, so Doxygen uses the appropriate paths, variables, and configuration (like HTML headers and footers). The specifics are still a bit of a mystery, as I think the calls to cmake create temporary files (CMakeLists?), or include other files, with the right configurations.
- Doxygen: this page was short so I expanded it with many details explaining how to use Doxygen in general, and for C++ and Python files that are used in FreeCAD.
Normally, Doxygen cannot read very well the docstrings of Python source code. However, the program doxypypy can be used to convert the docstrings to a format that Doxygen can understand better. So, when running Doxygen, doxypypy can be used as a filter, through which all Python files go, in order to pre-process the comments, and produce better documentation for Python files. This is explained in the same Doxygen page. It is a long document, but I provide examples, so hopefully it isn’t too hard to follow. At least for now I think this is the best solution to keep using Doxygen with both C++ and Python.
In the last section of the document I mention Sphinx. I wanted to do something else so I didn’t investigate further this part. It seems that, just like Doxygen is ideal for C++, Sphinx is ideal for Python. While Doxygen can process Python files with the help of doxypypy, it seems Sphinx can do the same but in the opposite direction. Sphinx can naturally process Python files, and it can document C++ files with the use of an intermediate program, like Breathe, which itself uses Doxygen. This deserves more investigation.
Clear, Functional C++ Documentation with Sphinx + Breathe + Doxygen + CMake
I’m not entirely sure what the “Domains” are in Sphinx, but the latest documentation seems to have a C++ Domain in Sphinx 3.0, which is still in development. I don’t know if this means that in the future Sphinx will be able to parse C++ natively, but it sounds promising.
Sphinx The C++ Domain
So I think there are two possibilities:
C++ and Python ----> Doxygen ----> doxypypy ----> HTML
C++ and Python ----> Sphinx ----> (natively, Breathe/Doxygen?) ----> HTML
Since I realize that you’ve made some progress on testing Sphinx, I would strongly suggest that you document the process in a Sphinx wiki page. I wanted to do this myself, but as I said, I got sidetracked doing something else. I want to refactor the Python code of the Draft Workbench (which is entirely in Python) precisely to test the Python documentation generation, as if the sources aren’t properly commented, automatic systems like Doxygen, doxypypy, and Sphinx don’t work quite well.
Personally, I think it should be possible to document everything with Sphinx. Having a nice programming interface like that of SciPy, Numpy, and Matplolib would be amazing. Or even the documentation of Blender; I believe the internals are in C++ but all public functions are in Python.