python: Add doxygen python doc

Signed-off-by: Corentin Le Molgat <corentinl@google.com>
This commit is contained in:
Corentin Le Molgat
2023-07-03 16:37:01 +02:00
parent e0dfe811a5
commit 2b376f84af
4 changed files with 2777 additions and 4 deletions

View File

@@ -408,17 +408,43 @@ endif()
## Doc rules ##
###############
if(BUILD_PYTHON_DOC)
find_program(PDOC_PRG NAMES pdoc)
if (PDOC_PRG)
# add a target to generate API documentation with pdoc
# add a target to generate API documentation with Doxygen
find_package(Doxygen)
if(DOXYGEN_FOUND)
configure_file(${PROJECT_SOURCE_DIR}/ortools/python/Doxyfile.in ${PROJECT_BINARY_DIR}/python/Doxyfile @ONLY)
file(DOWNLOAD
https://raw.githubusercontent.com/jothepro/doxygen-awesome-css/v2.1.0/doxygen-awesome.css
${PROJECT_BINARY_DIR}/python/doxygen-awesome.css
SHOW_PROGRESS
)
add_custom_target(${PROJECT_NAME}_python_doc ALL
#COMMAND ${CMAKE_COMMAND} -E rm -rf ${PROJECT_BINARY_DIR}/docs/python
COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/docs/python
COMMAND ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/python/Doxyfile
DEPENDS
python_package
${PROJECT_BINARY_DIR}/python/Doxyfile
${PROJECT_BINARY_DIR}/python/doxygen-awesome.css
${PROJECT_SOURCE_DIR}/ortools/python/stylesheet.css
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMENT "Generating Python API documentation with Doxygen"
VERBATIM)
else()
message(WARNING "cmd `doxygen` not found, Python doc generation is disable!")
endif()
# pdoc doc
find_program(PDOC_PRG NAMES pdoc)
if (PDOC_PRG)
# add a target to generate API documentation with pdoc
add_custom_target(${PROJECT_NAME}_pdoc_doc ALL
#COMMAND ${CMAKE_COMMAND} -E rm -rf ${PROJECT_BINARY_DIR}/docs/pdoc
COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/docs/pdoc
COMMAND ${PDOC_PRG}
--logo https://developers.google.com/optimization/images/orLogo.png
--no-search -d google
--footer-text "OR-Tools v${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}"
-o ${PROJECT_BINARY_DIR}/docs/python
-o ${PROJECT_BINARY_DIR}/docs/pdoc
${PROJECT_BINARY_DIR}/python/ortools
DEPENDS python_package
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}

2720
ortools/python/Doxyfile.in Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,11 @@
/*! @file
* @author Laurent Perron <lperron@google.com>
* @author Corentin "Mizux" Le Molgat <corentinl@google.com>
*/
/*! @mainpage OR-Tools
This is the reference documentation for the Google OR-Tools Python wrappers.
This repository contains several components:
*/

View File

@@ -0,0 +1,16 @@
/* The standard CSS for doxygen 1.9.6*/
html {
/* page base colors */
/*--page-background-color: white;*/
/*--page-foreground-color: black;*/
/* header */
--header-background: #d9821e;
--header-foreground: white;
/* footer */
--footer-background: #d9821e;
--footer-foreground: white;
}