doc: updated Sphinx configuration to display project name and version

This commit is contained in:
Pirogov, Vadim
2025-07-11 18:02:00 -07:00
committed by Vadim Pirogov
parent 641db8953f
commit 9464ecab9d
3 changed files with 18 additions and 11 deletions

View File

@ -134,9 +134,9 @@ oneDNN supports systems meeting the following requirements:
The following tools are required to build oneDNN documentation: The following tools are required to build oneDNN documentation:
* [Doxygen] 1.8.5 or later * [Doxygen] 1.8.5 or later
* [Doxyrest] 2.1.2 or later * [Doxyrest] 2.1.2 or later
* [Sphinx] 4.0.2 or later * [Sphinx] 6.2.1 or later
* [sphinx-book-theme] 0.0.41 or later * [sphinx-book-theme] 1.1.4 or later
* [sphinx-copybutton] 0.5.2 * [sphinx-copybutton] 0.5.2 or later
* [graphviz] 2.40.1 * [graphviz] 2.40.1
Configurations of CPU and GPU engines may introduce additional build time Configurations of CPU and GPU engines may introduce additional build time

View File

@ -1,5 +1,5 @@
#=============================================================================== #===============================================================================
# Copyright 2021-2024 Intel Corporation # Copyright 2021-2025 Intel Corporation
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -38,10 +38,10 @@ if (Python_FOUND AND SPHINX_FOUND)
${CMAKE_CURRENT_SOURCE_DIR}/doc/*.jpg ${CMAKE_CURRENT_SOURCE_DIR}/doc/*.jpg
) )
file(COPY ${SPHINX_IMAGES} DESTINATION ${SPHINX_SOURCE_DIR}) file(COPY ${SPHINX_IMAGES} DESTINATION ${SPHINX_SOURCE_DIR})
file(COPY configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/doc/sphinx/conf.py ${CMAKE_CURRENT_SOURCE_DIR}/doc/sphinx/conf.py.in
DESTINATION ${SPHINX_SOURCE_DIR} ${SPHINX_SOURCE_DIR}/conf.py
) @ONLY)
file(COPY file(COPY
${CMAKE_CURRENT_SOURCE_DIR}/doc/sphinx/cleanup.py ${CMAKE_CURRENT_SOURCE_DIR}/doc/sphinx/cleanup.py
DESTINATION ${CMAKE_CURRENT_BINARY_DIR} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
@ -55,7 +55,7 @@ if (Python_FOUND AND SPHINX_FOUND)
COMMAND ${Python_EXECUTABLE} COMMAND ${Python_EXECUTABLE}
${CMAKE_CURRENT_BINARY_DIR}/cleanup.py ${SPHINX_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/cleanup.py ${SPHINX_SOURCE_DIR}
COMMAND ${SPHINX_EXECUTABLE} -b ${SPHINX_GENERATOR} COMMAND ${SPHINX_EXECUTABLE} -b ${SPHINX_GENERATOR}
-D release=v${PROJECT_VERSION} -j auto rst ${SPHINX_OUTPUT_DIR} -j auto rst ${SPHINX_OUTPUT_DIR}
COMMAND ${CMAKE_COMMAND} -E touch ${SPHINX_STAMP_FILE} COMMAND ${CMAKE_COMMAND} -E touch ${SPHINX_STAMP_FILE}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/reference WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/reference
COMMENT "Generating API documentation with Sphinx" VERBATIM) COMMENT "Generating API documentation with Sphinx" VERBATIM)

View File

@ -32,6 +32,7 @@
import os import os
import sys import sys
import subprocess import subprocess
import re
def whereis(binary): def whereis(binary):
command = 'which' if os.name != 'nt' else 'where' command = 'which' if os.name != 'nt' else 'where'
@ -50,7 +51,9 @@ sys.path.insert(1, os.path.abspath(doxyrest_share_path))
# -- Project information ----------------------------------------------------- # -- Project information -----------------------------------------------------
project = 'oneDNN' project = '@PROJECT_NAME@'
release = 'v@PROJECT_VERSION@'
version = re.search(r'(v\d+\.\d+)', release).group()
copyright = '2016-2025 Intel Corporation' copyright = '2016-2025 Intel Corporation'
author = '' author = ''
@ -137,10 +140,14 @@ html_theme = 'sphinx_book_theme'
html_static_path = ['_static'] html_static_path = ['_static']
#html_js_files = [('dnnl.js', {'defer': 'defer'})] #html_js_files = [('dnnl.js', {'defer': 'defer'})]
html_logo = '_static/oneAPI-rgb-rev-100.png'
html_favicon = '_static/favicons.png' html_favicon = '_static/favicons.png'
html_theme_options = { html_theme_options = {
"logo": {
"text": "oneDNN "+version+" Documentation",
"image_light": "_static/oneAPI-rgb-rev-100.png",
"image_dark": "_static/oneAPI-rgb-rev-100.png",
},
"repository_url": "https://github.com/uxlfoundation/oneDNN", "repository_url": "https://github.com/uxlfoundation/oneDNN",
"repository_branch": "main", "repository_branch": "main",
"use_repository_button": True, "use_repository_button": True,