Skip to content

Commit 4b24379

Browse files
committed
Replace doxygen with doxygen+sphinx as doc tool
* Using doxygen+breathe+recommonmark+sphinx tools set, a better looking and usable documentation can be generated. * Themes can be switched by replacing theme property in docs/conf.py. * Removed obsolete doxygen files used by html format * Add docs generation tools requirements to README. Note python3 is the preferred and recommended version for docs generation.
1 parent d47cc0b commit 4b24379

22 files changed

+697
-1632
lines changed

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,14 @@ endif()
5151

5252
#packages not available via hunter
5353
find_package(Doxygen QUIET)
54+
find_package(Sphinx QUIET)
5455
find_package(FreeImage QUIET)
5556
if(UNIX)
5657
find_package(FontConfig REQUIRED)
5758
endif()
5859

5960
option(FG_BUILD_DOCS
60-
"Build Documentation" ${DOXYGEN_FOUND})
61+
"Build Documentation" $<AND:${DOXYGEN_FOUND},${Sphinx_FOUND}>)
6162
option(FG_BUILD_EXAMPLES
6263
"Build Examples" ON)
6364
option(FG_WITH_FREEIMAGE

CMakeModules/FindSphinx.cmake

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
find_program(SPHINX_EXECUTABLE
2+
NAMES sphinx-build
3+
DOC "Path to sphinx-build executable")
4+
5+
include(FindPackageHandleStandardArgs)
6+
7+
find_package_handle_standard_args(Sphinx
8+
"Failed to find sphinx-build executable"
9+
SPHINX_EXECUTABLE)

CMakeModules/examples.dox.in

Lines changed: 0 additions & 3 deletions
This file was deleted.

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ An OpenGL interop library that can be used with ArrayFire or any other applicati
1010

1111
### Documentation
1212

13-
You can find the most recent and updated documentation [here](http://arrayfire.org/forge/index.htm).
13+
You can find the latest documentation [here](http://arrayfire.org/forge/index.htm).
1414

1515
### Dependencies
1616

@@ -19,6 +19,9 @@ You can find the most recent and updated documentation [here](http://arrayfire.o
1919
- [boost](https://www.boost.org/) - not a runtime dependency.
2020
- [FreeImage](http://freeimage.sourceforge.net/) (optional).
2121
- [fontconfig](http://www.freedesktop.org/wiki/Software/fontconfig/) on Linux and OSX.
22+
- Documentation Generation (preferred & recommended version of python is 3.\*)
23+
* [Doxygen](http://doxygen.nl/)
24+
* [Sphinx](http://www.sphinx-doc.org/) with extensions: [Breathe](https://breathe.readthedocs.io/en/latest/), [recommonmark](https://recommonmark.readthedocs.io/en/latest/)
2225

2326
**Linux/Unix**: Dependencies should be available via respective package managers.
2427
**Windows**: We recommend [vcpkg](https://github.com/Microsoft/vcpkg).

docs/CMakeLists.txt

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -18,47 +18,44 @@ set(EXAMPLES_DIR "${PROJECT_SOURCE_DIR}/examples")
1818
configure_file(${FG_DOCS_CONFIG} ${FG_DOCS_CONFIG_OUT})
1919
configure_file(${FG_DOCS_LAYOUT} ${FG_DOCS_LAYOUT_OUT})
2020

21-
###########################################################
22-
## This generates a list of the examples cpp files and
23-
## creates a dox file under docs/details/examples.dox
24-
## This is used to generate documentation for examples
25-
###########################################################
26-
file(GLOB EXAMPLES_CPP
27-
"${EXAMPLES_DIR}/cpu/*.cpp"
28-
"${EXAMPLES_DIR}/cuda/*.cu"
29-
"${EXAMPLES_DIR}/opencl/*.cpp"
30-
"${EXAMPLES_DIR}/opencl/*.h"
31-
)
32-
33-
# Sort alphabetically
34-
# Note: example directories will be major sort order
35-
list(SORT EXAMPLES_CPP)
36-
37-
# Get filenames and write to a string
38-
foreach(SRC ${EXAMPLES_CPP})
39-
get_filename_component(DIR_PATH ${SRC} DIRECTORY)
40-
get_filename_component(DIR_NAME ${DIR_PATH} NAME)
41-
get_filename_component(SRC_NAME ${SRC} NAME)
42-
set(EXAMPLES_LIST "${EXAMPLES_LIST}\\example ${DIR_NAME}/${SRC_NAME}\n")
43-
endforeach(SRC ${EXAMPLES_CPP})
44-
45-
# Write string containing file names to examples.dox
46-
configure_file(
47-
${PROJECT_SOURCE_DIR}/CMakeModules/examples.dox.in
48-
${DOCS_DIR}/details/examples.dox
49-
)
50-
###########################################################
51-
5221
add_custom_target(docs
5322
ALL
5423
COMMAND ${DOXYGEN_EXECUTABLE} ${FG_DOCS_CONFIG_OUT}
55-
COMMAND cmake -E copy_directory ${ASSETS_DIR} ${CMAKE_CURRENT_BINARY_DIR}/html
5624
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
5725
COMMENT "Generating Documentation"
5826
VERBATIM)
5927

28+
set(SPHINX_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
29+
set(SPHINX_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/sphinx")
30+
set(SPHINX_INDEX_FILE ${SPHINX_BUILD_DIR}/index.html)
31+
set(DOXY_OUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/xml)
32+
set(DOXY_INDEX_FILE ${DOXY_OUT_DIR}/index.xml)
33+
34+
file(GLOB restFiles rst/*.rst)
35+
file(GLOB mdFiles markdown/*.md)
36+
37+
# Only regenerate Sphinx when:
38+
# - Doxygen has rerun
39+
# - Our doc files have been updated
40+
# - The Sphinx config has been updated
41+
add_custom_command(OUTPUT ${SPHINX_INDEX_FILE}
42+
COMMAND
43+
${SPHINX_EXECUTABLE} -Dbreathe_projects.Forge=${DOXY_OUT_DIR}
44+
${SPHINX_SOURCE_DIR} ${SPHINX_BUILD_DIR}
45+
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
46+
DEPENDS
47+
${CMAKE_CURRENT_SOURCE_DIR}/index.rst
48+
${DOXY_INDEX_FILE}
49+
${restFiles}
50+
${mdFiles}
51+
MAIN_DEPENDENCY ${SPHINX_SOURCE_DIR}/conf.py
52+
COMMENT "Generating documentation with Sphinx")
53+
54+
# Nice named target so we can run the job easily
55+
add_custom_target(Sphinx ALL DEPENDS ${SPHINX_INDEX_FILE} docs)
56+
6057
# Install Doxygen documentation
61-
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html
58+
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/sphinx
6259
DESTINATION ${FG_INSTALL_DOC_DIR}
6360
COMPONENT documentation
6461
PATTERN "*"

docs/conf.py

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
#!/usr/bin/env python3
2+
# -*- coding: utf-8 -*-
3+
#
4+
# Forge documentation build configuration file, created by
5+
# sphinx-quickstart on Tue Jun 4 14:52:58 2019.
6+
#
7+
# This file is execfile()d with the current directory set to its
8+
# containing dir.
9+
#
10+
# Note that not all possible configuration values are present in this
11+
# autogenerated file.
12+
#
13+
# All configuration values have a default; values that are commented out
14+
# serve to show the default.
15+
16+
# If extensions (or modules to document with autodoc) are in another directory,
17+
# add these directories to sys.path here. If the directory is relative to the
18+
# documentation root, use os.path.abspath to make it absolute, like shown here.
19+
#
20+
# import os
21+
# import sys
22+
# sys.path.insert(0, os.path.abspath('.'))
23+
24+
25+
# -- General configuration ------------------------------------------------
26+
27+
# If your documentation needs a minimal Sphinx version, state it here.
28+
#
29+
# needs_sphinx = '1.0'
30+
31+
# Add any Sphinx extension module names here, as strings. They can be
32+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
33+
# ones.
34+
extensions = ['sphinx.ext.mathjax', 'breathe', 'recommonmark']
35+
36+
# Breathe Configuration
37+
breathe_default_project = "Forge"
38+
39+
# Add any paths that contain templates here, relative to this directory.
40+
templates_path = ['_templates']
41+
42+
# The suffix(es) of source filenames.
43+
# You can specify multiple suffix as a list of string:
44+
#
45+
source_suffix = ['.rst', '.md']
46+
47+
# The master toctree document.
48+
master_doc = 'index'
49+
50+
# General information about the project.
51+
project = 'Forge'
52+
copyright = '2019 ArrayFire'
53+
author = 'technical@arrayfire.com'
54+
55+
# The version info for the project you're documenting, acts as replacement for
56+
# |version| and |release|, also used in various other places throughout the
57+
# built documents.
58+
#
59+
# The short X.Y version.
60+
version = '1.0'
61+
# The full version, including alpha/beta/rc tags.
62+
release = '1.0.4'
63+
64+
# The language for content autogenerated by Sphinx. Refer to documentation
65+
# for a list of supported languages.
66+
#
67+
# This is also used if you do content translation via gettext catalogs.
68+
# Usually you set "language" from the command line for these cases.
69+
language = None
70+
71+
# List of patterns, relative to source directory, that match files and
72+
# directories to ignore when looking for source files.
73+
# This patterns also effect to html_static_path and html_extra_path
74+
exclude_patterns = []
75+
76+
# The name of the Pygments (syntax highlighting) style to use.
77+
pygments_style = 'sphinx'
78+
79+
# If true, `todo` and `todoList` produce output, else they produce nothing.
80+
todo_include_todos = False
81+
82+
83+
# -- Options for HTML output ----------------------------------------------
84+
85+
# The theme to use for HTML and HTML Help pages. See the documentation for
86+
# a list of builtin themes.
87+
#
88+
html_theme = 'sphinx_rtd_theme'
89+
#html_theme_path = ['.']
90+
91+
# Theme options are theme-specific and customize the look and feel of a theme
92+
# further. For a list of options available for each theme, see the
93+
# documentation.
94+
95+
html_theme_options = {
96+
'style_nav_header_background':'#073763',
97+
# Toc options
98+
'collapse_navigation': True,
99+
'sticky_navigation': True,
100+
'navigation_depth': 4,
101+
}
102+
html_favicon = '../assets/arrayfire.ico'
103+
html_logo = '../assets/arrayfire_icon.png'
104+
105+
# Add any paths that contain custom static files (such as style sheets) here,
106+
# relative to this directory. They are copied after the builtin static files,
107+
# so a file named "default.css" will overwrite the builtin "default.css".
108+
# html_static_path = ['_static']
109+
110+
# Custom sidebar templates, must be a dictionary that maps document names
111+
# to template names.
112+
#
113+
# This is required for the alabaster theme
114+
# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
115+
html_sidebars = {
116+
'**': [
117+
'relations.html', # needs 'show_related': True theme option to display
118+
'searchbox.html',
119+
]
120+
}
121+
122+
123+
# -- Options for HTMLHelp output ------------------------------------------
124+
125+
# Output file base name for HTML help builder.
126+
htmlhelp_basename = 'Forgedoc'
127+
128+
129+
# -- Options for LaTeX output ---------------------------------------------
130+
131+
latex_elements = {
132+
# The paper size ('letterpaper' or 'a4paper').
133+
#
134+
# 'papersize': 'letterpaper',
135+
136+
# The font size ('10pt', '11pt' or '12pt').
137+
#
138+
# 'pointsize': '10pt',
139+
140+
# Additional stuff for the LaTeX preamble.
141+
#
142+
# 'preamble': '',
143+
144+
# Latex figure (float) alignment
145+
#
146+
# 'figure_align': 'htbp',
147+
}
148+
149+
# Grouping the document tree into LaTeX files. List of tuples
150+
# (source start file, target name, title,
151+
# author, documentclass [howto, manual, or own class]).
152+
latex_documents = [
153+
(master_doc, 'Forge.tex', 'Forge Documentation',
154+
'technical@arrayfire.com', 'manual'),
155+
]
156+
157+
158+
# -- Options for manual page output ---------------------------------------
159+
160+
# One entry per manual page. List of tuples
161+
# (source start file, name, description, authors, manual section).
162+
man_pages = [
163+
(master_doc, 'forge', 'Forge Documentation',
164+
[author], 1)
165+
]
166+
167+
168+
# -- Options for Texinfo output -------------------------------------------
169+
170+
# Grouping the document tree into Texinfo files. List of tuples
171+
# (source start file, target name, title, author,
172+
# dir menu entry, description, category)
173+
texinfo_documents = [
174+
(master_doc, 'Forge', 'Forge Documentation',
175+
author, 'Forge', 'One line description of project.',
176+
'Miscellaneous'),
177+
]

docs/details/.gitignore

Whitespace-only changes.

docs/doxygen.mk

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -757,10 +757,9 @@ WARN_LOGFILE =
757757
# spaces.
758758
# Note: If this tag is empty the current directory is searched.
759759

760-
INPUT = ${DOCS_DIR}/pages \
760+
INPUT = ${DOCS_DIR}/markdown \
761761
${INCLUDE_DIR}/ \
762-
${INCLUDE_DIR}/fg/ \
763-
${DOCS_DIR}/details
762+
${INCLUDE_DIR}/fg/
764763

765764
# This tag can be used to specify the character encoding of the source files
766765
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
@@ -898,7 +897,7 @@ FILTER_SOURCE_PATTERNS =
898897
# (index.html). This can be useful if you have a project on for instance GitHub
899898
# and want to reuse the introduction page also for the doxygen output.
900899

901-
USE_MDFILE_AS_MAINPAGE = ${DOCS_DIR}/pages/README.md
900+
#USE_MDFILE_AS_MAINPAGE = ${DOCS_DIR}/markdown/README.md
902901

903902
#---------------------------------------------------------------------------
904903
# Configuration options related to source browsing
@@ -1019,7 +1018,7 @@ IGNORE_PREFIX =
10191018
# If the GENERATE_HTML tag is set to YES doxygen will generate HTML output
10201019
# The default value is: YES.
10211020

1022-
GENERATE_HTML = YES
1021+
GENERATE_HTML = NO
10231022

10241023
# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a
10251024
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
@@ -1054,7 +1053,7 @@ HTML_FILE_EXTENSION = .htm
10541053
# of the possible markers and block names see the documentation.
10551054
# This tag requires that the tag GENERATE_HTML is set to YES.
10561055

1057-
HTML_HEADER = ${DOCS_DIR}/header.html
1056+
#HTML_HEADER = ${DOCS_DIR}/header.html
10581057

10591058
# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
10601059
# generated HTML page. If the tag is left blank doxygen will generate a standard
@@ -1064,7 +1063,7 @@ HTML_HEADER = ${DOCS_DIR}/header.html
10641063
# that doxygen normally uses.
10651064
# This tag requires that the tag GENERATE_HTML is set to YES.
10661065

1067-
HTML_FOOTER = ${DOCS_DIR}/footer.html
1066+
#HTML_FOOTER = ${DOCS_DIR}/footer.html
10681067

10691068
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
10701069
# sheet that is used by each HTML page. It can be used to fine-tune the look of
@@ -1810,7 +1809,7 @@ MAN_LINKS = NO
18101809
# captures the structure of the code including all documentation.
18111810
# The default value is: NO.
18121811

1813-
GENERATE_XML = NO
1812+
GENERATE_XML = YES
18141813

18151814
# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
18161815
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of

docs/footer.html

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)