Skip to content

Commit

Permalink
reorganize docs using Sphinx
Browse files Browse the repository at this point in the history
  • Loading branch information
jlblancoc committed Jul 21, 2020
1 parent be11684 commit 2b69558
Show file tree
Hide file tree
Showing 239 changed files with 5,213 additions and 758 deletions.
25 changes: 4 additions & 21 deletions doc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,40 +1,24 @@
include(../cmakemodules/AssureCMakeRootFile.cmake) # Avoid user mistake in CMake source directory

project(documentation)

# Dummy documentation target for showing grouped files in IDEs:
# ----------------------------------------------------------------------------
file(GLOB DOX_HDRS "${CMAKE_SOURCE_DIR}/doc/doxygen-pages/*.h")
file(GLOB_RECURSE RST_FILES "${CMAKE_SOURCE_DIR}/doc/*.rst")
file(GLOB_RECURSE H_FILES "${CMAKE_SOURCE_DIR}/doc/sources/*.h")
set(DOC_INDIV_FILES
"${CMAKE_SOURCE_DIR}/README.md"
)
set(all_docs_files ${DOX_HDRS} ${RST_FILES} ${DOC_INDIV_FILES})
set(all_docs_files ${RST_FILES} ${H_FILES} ${DOC_INDIV_FILES})
add_custom_target(DocumentationFiles DEPENDS ${all_docs_files} SOURCES ${all_docs_files})
set_target_properties(DocumentationFiles PROPERTIES FOLDER "documentation")

# Manpages
# ----------------------------------------------------------------------------
# Targets for building the documentation of the MRPT
# ----------------------------------------------------------------------------

project(documentation)

if(UNIX)
add_subdirectory(man-pages)
endif()

if(DOXYGEN_EXECUTABLE)
# --------------------------------
# documentation_html
# --------------------------------
add_custom_target(documentation_html
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build.py ${MRPT_VERSION}
COMMENT "Generating MRPT documentation (html)"
SOURCES build.py conf.py _templates/layout.html ${RST_FILES}
)
set_target_properties(documentation_html PROPERTIES FOLDER "documentation")
endif()


# Compile Latex targets:
if(NOT WIN32)
find_program(LATEXMK_PROGRAM latexmk)
Expand All @@ -49,6 +33,5 @@ if(LATEXMK_PROGRAM)
COMMENT "Generating graphslam-engine-guide (ps.gz)"
)
add_dependencies(documentation_psgz_guides documentation_graphslam-engine-guide)

endif()
endif()
50 changes: 50 additions & 0 deletions doc/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@

.DEFAULT_GOAL := all

# Replace this path with your local build of doxyrest:
export PYTHONPATH := $(HOME)/code/doxyrest_b/doxyrest/sphinx/:$(PYTHONPATH)
export PATH := $(HOME)/code/doxyrest_b/build/doxyrest/bin/Release:$(PATH)
export MRPT_VERSION_STR := $(shell head -n1 ../version_prefix.txt)
export MRPT_LIST_INCLUDE_DIRS := $(shell for f in ../libs/*/include; do printf "$$(realpath $$f) "; done)
export MRPT_DOX_INPUT_DIRS := $(shell for f in ../libs/*; do printf "$$(realpath $$f) "; done)

# Use to quickly test the documentation scripts:
ifeq ($(MRPT_DOCS_FAST_TEST),1)
export MRPT_DOX_INPUT_DIRS := $(shell realpath ../libs/core)
endif


.PHONY: clean
clean:
rm -fr html
rm -fr \
source/xml-dir \
source/class_* \
source/enum_* \
source/namespace_* \
source/group_* \
source/struct_* \
source/page_* \
source/union_* \
source/global.rst source/doxygen-index.rst \
2> /dev/null || true

.PHONY: all
all:
make html

html-and-view:
make html
xdg-open html/index.html

html:
echo "Building docs for these directories: ${MRPT_DOX_INPUT_DIRS}"
echo "Using MRPT_LIST_INCLUDE_DIRS: ${MRPT_LIST_INCLUDE_DIRS}"
# 1) Build Doxygen
cd source && doxygen
# 2) Doxygen XML -> RST
cd source && doxyrest -c doxyrest-config.lua
# Remove main doc file created for nanoflann:
rm source/page_index.rst 2>/dev/null || true
# 3) RST -> HTML with Sphinx
sphinx-build -b html source/ html/
22 changes: 22 additions & 0 deletions doc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Root directory for MRPT Sphinx documentation.

# Requisites

```
# Install Sphinx & dependencies:
sudo -H pip install sphinx_rtd_theme
```

Install doxyrest: [instructions](https://github.com/vovkos/doxyrest_b/blob/master/README.rst).


# How to generate docs

From the MRPT source tree:

```
cd docs
make
```

You may need to either modify PATH and PYTHONPATH in your env, or edit the hard-coded paths in mrpt/docs/Makefile
4 changes: 0 additions & 4 deletions doc/_readme_directory_.txt

This file was deleted.

Binary file removed doc/design_of_images/mrpt_logo.png
Binary file not shown.
6 changes: 0 additions & 6 deletions doc/html_postbuild/_readme_directory_.txt

This file was deleted.

Loading

0 comments on commit 2b69558

Please sign in to comment.