Skip to content

Commit

Permalink
Merge d478d19 into b3cfe45
Browse files Browse the repository at this point in the history
  • Loading branch information
tuoping authored May 29, 2021
2 parents b3cfe45 + d478d19 commit ab8fc7f
Show file tree
Hide file tree
Showing 10 changed files with 3,024 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ venv*
.vscode/**
_build
_templates
API_CC
2,662 changes: 2,662 additions & 0 deletions doc/Doxyfile

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions doc/README
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
To run the HTML documention build, doxygen have to be installed.
4 changes: 2 additions & 2 deletions doc/development/api.rst → doc/api.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
API
===
Python API
==========

.. toctree::
:maxdepth: 2
Expand Down
58 changes: 57 additions & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import subprocess
# import sys
import recommonmark
from recommonmark.transform import AutoStructify
Expand Down Expand Up @@ -108,6 +109,31 @@ def classify_index_TS():
copyright = '2020, Deep Potential'
author = 'Deep Potential'

def run_doxygen(folder):
"""Run the doxygen make command in the designated folder"""

try:
retcode = subprocess.call("cd %s; doxygen Doxyfile" % folder, shell=True)
if retcode < 0:
sys.stderr.write("doxygen terminated by signal %s" % (-retcode))
except OSError as e:
sys.stderr.write("doxygen execution failed: %s" % e)


def generate_doxygen_xml(app):
"""Run the doxygen make commands if we're on the ReadTheDocs server"""

read_the_docs_build = os.environ.get('READTHEDOCS', None) == 'True'

if read_the_docs_build:
run_doxygen("./")
else:
subprocess.call("doxygen Doxyfile", shell=True)

def setup(app):

# Add hook for building doxygen xml when needed
app.connect("builder-inited", generate_doxygen_xml)

# -- General configuration ---------------------------------------------------

Expand All @@ -129,9 +155,39 @@ def classify_index_TS():
extensions = [
"sphinx_rtd_theme",
'myst_parser',
'sphinx.ext.autosummary'
'sphinx.ext.autosummary',
'breathe',
'exhale'
]

# breathe_domain_by_extension = {
# "h" : "cpp",
# }
breathe_projects = {"myproject": "_build/xml/"}
breathe_default_project = "myproject"

exhale_args = {
"containmentFolder": "./API_CC",
"rootFileName": "api_cc.rst",
"rootFileTitle": "C++ API",
"doxygenStripFromPath": "..",
# Suggested optional arguments
# "createTreeView": True,
# TIP: if using the sphinx-bootstrap-theme, you need
# "treeViewIsBootstrap": True,
"exhaleExecutesDoxygen": True,
"exhaleDoxygenStdin": "INPUT = ../source/api_cc/include/",
# "unabridgedOrphanKinds": {"namespace"}
# "listingExclude": [r"namespace_*"]
}

# Tell sphinx what the primary language being documented is.
primary_domain = 'cpp'

# Tell sphinx what the pygments highlight language should be.
highlight_language = 'cpp'

#
myst_heading_anchors = 4

# Add any paths that contain templates here, relative to this directory.
Expand Down
3 changes: 2 additions & 1 deletion doc/development/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Developer Guide

- [API](api.rst)
- [Python API](../api.rst)
- [C++ API](../API_CC/api_cc.rst)
- [Coding Conventions](coding-conventions.rst)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
cmake_minimum_required_version="3.0",
extras_require={
"test": ["dpdata>=0.1.9", "ase", "pytest", "pytest-cov", "pytest-sugar"],
"docs": ["sphinx", "recommonmark", "sphinx_rtd_theme", "sphinx_markdown_tables", "myst-parser"],
"docs": ["sphinx", "recommonmark", "sphinx_rtd_theme", "sphinx_markdown_tables", "myst-parser", "breathe", "exhale"],
**extras_require,
},
entry_points={"console_scripts": ["dp = deepmd.entrypoints.main:main"]},
Expand Down
Loading

0 comments on commit ab8fc7f

Please sign in to comment.