blob: d06bf07833b141af716fd204baa7bb293a56fc06 [file]
load("@doxygen//:doxygen.bzl", "doxygen")
load("@rules_python//sphinxdocs:sphinx.bzl", "sphinx_build_binary", "sphinx_docs")
load("@rules_python//sphinxdocs:sphinx_docs_library.bzl", "sphinx_docs_library")
load("@pypi//:requirements.bzl", "requirement")
exports_files(["requirements.txt"])
doxygen(
name = "doxygen",
srcs = glob([
"*.h",
"*.cpp",
]),
outs = [
"html",
# Mark `tags` as an output folder/group, and ensure its creation
"tags",
],
extract_all = True,
# Add the `$(OUTDIR)` make variable to specify the root output directory
# where to generate the file
generate_tagfile = "$(OUTDIR)/tags/lib.tag",
)
# Define the `sphinx` build binary that will be used to build the documentation
sphinx_build_binary(
name = "sphinx_bin",
deps = [
requirement("sphinx"),
requirement("sphinxcontrib-doxylink"),
],
)
# Capture the Doxygen output files and put them in the `doxygen` subdirectory
sphinx_docs_library(
name = "sphinx_doxygen_tags",
srcs = [":doxygen"],
prefix = "doxygen/",
)
# Use sphinx to generate HTML documentation
sphinx_docs(
name = "sphinx",
srcs = ["index.rst"],
config = "conf.py",
formats = ["html"],
sphinx = ":sphinx_bin",
# This ensures that we are in the `sphinx/_source` directory,
# without more nesting
strip_prefix = package_name() + "/",
deps = [":sphinx_doxygen_tags"],
)