gdal icon indicating copy to clipboard operation
gdal copied to clipboard

Docs: Use CMake to build docs directly

Open dbaston opened this issue 1 year ago • 4 comments

          > Would it make sense to remove the Makefile and use CMake directly to build the docs?

yes, such further enhancements are totally reasonable. I just wanted to do something relatively quick to get documentation building easily accessible from CMake. Would you like following up on this in subsequent PRs ?

(I'm wondering if we could have things not requiring a Unix environment so doc building is available from non-Cygwin Windows (provided folks have installed Doxygen, sphinx, etc.), but that would be more a stretch goal...)

Originally posted by @rouault in https://github.com/OSGeo/gdal/issues/9836#issuecomment-2091115198

dbaston avatar May 14 '24 21:05 dbaston

This is a bit tricky because the docs include some .rst files (driver summaries) that are generated at build time by a Python script invoked by make. Since Sphinx requires all rst files to be under a single root, this would require us to copy/link the static rst files into the build directory (as is done for autotest). This could be avoided by building the driver summaries with a Sphinx extension instead of the standalone Python script, but it's not clear if this would reduce overall complexity.

dbaston avatar Jun 04 '24 16:06 dbaston

Since Sphinx requires all rst files to be under a single root, this would require us to copy/link the static rst files into the build directory

although not super elegant, why not just forcing the working directory to be PROJECT_SOURCE_DIR/doc when running the script that generates the .rst file ?

rouault avatar Jun 04 '24 16:06 rouault

Are there other cases where the build process writes to the tree for an out-of-tree build? I didn't want to be the first.

dbaston avatar Jun 04 '24 17:06 dbaston

Are there other cases where the build process writes to the tree for an out-of-tree build?

can't think of any. Doc building not being a default build target, I wouldn't mind an exception

rouault avatar Jun 04 '24 17:06 rouault

This is a bit tricky because the docs include some .rst files (driver summaries) that are generated at build time by a Python script invoked by make

We could also avoid this issue by generating the driver summaries using Sphinx instead of an external script.

dbaston avatar Mar 04 '25 17:03 dbaston