Skip to content

Commit 79f3db2

Browse files
JacobSzwejbkafacebook-github-bot
authored andcommitted
add cpp api reference (#618)
Summary: Pull Request resolved: #618 Adding cpp docs and updating the build system for the docs to support doxygen and breath (connects sphinx and doxygen). If anyone in the future wants to add similar cpp docs they can just reference their cpp classes and methods like we do in executorch-runtime-api-reference.rst, and then add the corresponding .h files to Doxyfile's INPUT arg. Reviewed By: svekars, cccclai Differential Revision: D49924199 fbshipit-source-id: 6abc26166158d5ab9ff70f6b9904269ec9d62489
1 parent 43eb74d commit 79f3db2

File tree

13 files changed

+808
-466
lines changed

13 files changed

+808
-466
lines changed

.ci/docker/build.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ TORCH_VERSION=$(cat ci_commit_pins/pytorch.txt)
3636
TORCHAUDIO_VERSION=$(cat ci_commit_pins/audio.txt)
3737
TORCHVISION_VERSION=$(cat ci_commit_pins/vision.txt)
3838

39+
BUILD_DOCS=1
40+
3941
# Copy requirements-lintrunner.txt from root to here
4042
cp ../../requirements-lintrunner.txt ./
4143

@@ -51,6 +53,7 @@ docker build \
5153
--build-arg "TORCHVISION_VERSION=${TORCHVISION_VERSION}.${NIGHTLY}" \
5254
--build-arg "BUCK2_VERSION=${BUCK2_VERSION}" \
5355
--build-arg "LINTRUNNER=${LINTRUNNER}" \
56+
--build-arg "BUILD_DOCS=${BUILD_DOCS}" \
5457
-f "${OS}"/Dockerfile \
5558
"$@" \
5659
.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
# Copyright (c) Meta Platforms, Inc. and affiliates.
3+
# All rights reserved.
4+
#
5+
# This source code is licensed under the BSD-style license found in the
6+
# LICENSE file in the root directory of this source tree.
7+
8+
set -ex
9+
10+
if [ -n "$BUILD_DOCS" ]; then
11+
apt-get update
12+
# Ignore error if gpg-agent doesn't exist (for Ubuntu 16.04)
13+
apt-get install -y gpg-agent || :
14+
15+
curl --retry 3 -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
16+
sudo apt-get install -y nodejs
17+
18+
curl --retry 3 -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
19+
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
20+
21+
apt-get update
22+
apt-get install -y --no-install-recommends yarn
23+
yarn global add katex --prefix /usr/local
24+
25+
sudo apt-get -y install doxygen
26+
27+
apt-get autoclean && apt-get clean
28+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
29+
30+
fi

.ci/docker/requirements-ci.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@ hypothesis==6.84.2
1515
parameterized==0.9.0
1616

1717
# Doc build requirements
18-
sphinx==5.0.0
18+
sphinx==4.5.0
1919
sphinx-gallery
20+
breathe==4.35.0
21+
exhale==0.3.6
22+
docutils==0.16
2023
matplotlib
2124
# PyTorch Theme
2225
-e git+https://github.com/pytorch/pytorch_sphinx_theme.git#egg=pytorch_sphinx_theme

.ci/docker/ubuntu/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ RUN bash ./install_buck.sh && rm install_buck.sh
2424
COPY ./common/install_user.sh install_user.sh
2525
RUN bash ./install_user.sh && rm install_user.sh
2626

27+
# Install docs
28+
ARG BUILD_DOCS
29+
COPY ./common/install_docs_reqs.sh install_docs_reqs.sh
30+
RUN bash ./install_docs_reqs.sh && rm install_docs_reqs.sh
31+
2732
# Install conda and other dependencies
2833
ARG MINICONDA_VERSION
2934
ARG PYTHON_VERSION

.github/workflows/doc-build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ jobs:
4646
4747
# Build docset:
4848
cd docs
49+
doxygen source/Doxyfile
4950
make html
5051
cd ..
5152

docs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33

44
# You can set these variables from the command line.
5-
SPHINXOPTS = -WT --keep-going
5+
# SPHINXOPTS = -WT --keep-going TODO(T165752164) fix sphinx warnings around preprocess macros in cpp like __ET_DEPRECATED
66
SPHINXBUILD = sphinx-build
77
SPHINXPROJ = ExecuTorch
88
SOURCEDIR = source

0 commit comments

Comments
 (0)