From 9464ecab9de11b77dc9f33f6a2e3358d59d2188c Mon Sep 17 00:00:00 2001 From: "Pirogov, Vadim" Date: Fri, 11 Jul 2025 18:02:00 -0700 Subject: [PATCH] doc: updated Sphinx configuration to display project name and version --- README.md | 6 +++--- cmake/Sphinx.cmake | 12 ++++++------ doc/sphinx/{conf.py => conf.py.in} | 11 +++++++++-- 3 files changed, 18 insertions(+), 11 deletions(-) rename doc/sphinx/{conf.py => conf.py.in} (97%) diff --git a/README.md b/README.md index 35b40a5cad..20123d70f5 100644 --- a/README.md +++ b/README.md @@ -134,9 +134,9 @@ oneDNN supports systems meeting the following requirements: The following tools are required to build oneDNN documentation: * [Doxygen] 1.8.5 or later * [Doxyrest] 2.1.2 or later -* [Sphinx] 4.0.2 or later -* [sphinx-book-theme] 0.0.41 or later -* [sphinx-copybutton] 0.5.2 +* [Sphinx] 6.2.1 or later +* [sphinx-book-theme] 1.1.4 or later +* [sphinx-copybutton] 0.5.2 or later * [graphviz] 2.40.1 Configurations of CPU and GPU engines may introduce additional build time diff --git a/cmake/Sphinx.cmake b/cmake/Sphinx.cmake index ed1e17a41f..ce3cff7b29 100644 --- a/cmake/Sphinx.cmake +++ b/cmake/Sphinx.cmake @@ -1,5 +1,5 @@ #=============================================================================== -# Copyright 2021-2024 Intel Corporation +# Copyright 2021-2025 Intel Corporation # # Licensed under the Apache License, Version 2.0 (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 ) file(COPY ${SPHINX_IMAGES} DESTINATION ${SPHINX_SOURCE_DIR}) - file(COPY - ${CMAKE_CURRENT_SOURCE_DIR}/doc/sphinx/conf.py - DESTINATION ${SPHINX_SOURCE_DIR} - ) + configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/doc/sphinx/conf.py.in + ${SPHINX_SOURCE_DIR}/conf.py + @ONLY) file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/doc/sphinx/cleanup.py DESTINATION ${CMAKE_CURRENT_BINARY_DIR} @@ -55,7 +55,7 @@ if (Python_FOUND AND SPHINX_FOUND) COMMAND ${Python_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/cleanup.py ${SPHINX_SOURCE_DIR} 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} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/reference COMMENT "Generating API documentation with Sphinx" VERBATIM) diff --git a/doc/sphinx/conf.py b/doc/sphinx/conf.py.in similarity index 97% rename from doc/sphinx/conf.py rename to doc/sphinx/conf.py.in index 893943454f..9f6185d631 100644 --- a/doc/sphinx/conf.py +++ b/doc/sphinx/conf.py.in @@ -32,6 +32,7 @@ import os import sys import subprocess +import re def whereis(binary): 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 = 'oneDNN' +project = '@PROJECT_NAME@' +release = 'v@PROJECT_VERSION@' +version = re.search(r'(v\d+\.\d+)', release).group() copyright = '2016-2025 Intel Corporation' author = '' @@ -137,10 +140,14 @@ html_theme = 'sphinx_book_theme' html_static_path = ['_static'] #html_js_files = [('dnnl.js', {'defer': 'defer'})] -html_logo = '_static/oneAPI-rgb-rev-100.png' html_favicon = '_static/favicons.png' 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_branch": "main", "use_repository_button": True,