cmake: Add C++ documentation

This commit is contained in:
Mizux Seiha
2023-02-02 11:38:05 +01:00
parent 079c8ea2f7
commit 4f30a7ff2c
6 changed files with 2799 additions and 0 deletions

View File

@@ -257,6 +257,8 @@ message(STATUS "XPRESS support: ${USE_XPRESS}")
# Language specific options
if(BUILD_CXX)
CMAKE_DEPENDENT_OPTION(BUILD_CXX_DOC "Build the C++ doc" OFF "NOT BUILD_DOC" ON)
message(STATUS "C++: Build doc: ${BUILD_CXX_DOC}")
endif()
if(BUILD_DOTNET)

View File

@@ -222,6 +222,7 @@ cmake -S. -Bbuild -LH
| `USE_XPRESS` | OFF | Enable XPRESS support |
| | | |
| `BUILD_DOC` | OFF\* | Build all documentations |
| `BUILD_CXX_DOC` | OFF\* | Build C++ documentation<br>**Forced** to ON if `BUILD_DOC=ON` |
| `INSTALL_DOC` | OFF\* | Install all documentations<br>**Forced** to OFF if `BUILD_CXX=OFF` or `BUILD_DOC=OFF` |
| | | |
| `BUILD_SAMPLES` | ON\* | Build all samples<br>Default to ON if `BUILD_DEPS=ON` |

View File

@@ -287,6 +287,35 @@ add_subdirectory(ortools/linear_solver/proto_solver)
target_sources(${PROJECT_NAME} PRIVATE $<TARGET_OBJECTS:${PROJECT_NAME}_linear_solver_proto_solver>)
add_dependencies(${PROJECT_NAME} ${PROJECT_NAME}_linear_solver_proto_solver)
###############
## Doc rules ##
###############
if(BUILD_CXX_DOC)
# add a target to generate API documentation with Doxygen
find_package(Doxygen REQUIRED)
if(DOXYGEN_FOUND)
configure_file(${PROJECT_SOURCE_DIR}/ortools/cpp/Doxyfile.in ${PROJECT_BINARY_DIR}/cpp/Doxyfile @ONLY)
file(DOWNLOAD
https://raw.githubusercontent.com/jothepro/doxygen-awesome-css/v2.1.0/doxygen-awesome.css
${PROJECT_BINARY_DIR}/cpp/doxygen-awesome.css
SHOW_PROGRESS
)
add_custom_target(${PROJECT_NAME}_cxx_doc ALL
#COMMAND ${CMAKE_COMMAND} -E rm -rf ${PROJECT_BINARY_DIR}/docs/cpp
COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/docs/cpp
COMMAND ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/cpp/Doxyfile
DEPENDS
${PROJECT_BINARY_DIR}/cpp/Doxyfile
${PROJECT_BINARY_DIR}/cpp/doxygen-awesome.css
${PROJECT_SOURCE_DIR}/ortools/cpp/stylesheet.css
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMENT "Generating C++ API documentation with Doxygen"
VERBATIM)
else()
message(WARNING "cmd `doxygen` not found, C++ doc generation is disable!")
endif()
endif()
###################
## Install rules ##
###################

2722
ortools/cpp/Doxyfile.in Normal file

File diff suppressed because it is too large Load Diff

29
ortools/cpp/main.cpp.dox Normal file
View File

@@ -0,0 +1,29 @@
/*! @file
* @author Laurent Perron <lperron@google.com>
* @author Corentin "Mizux" Le Molgat <corentinl@google.com>
*/
/*! @mainpage OR-Tools
This is the reference documentation for Google OR-Tools.
This repository contains several component:
@li @ref ortools/algorithms "Algorithms"
@li @ref ortools/graph "Graph"
@li @ref ortools/linear_solver "Linear Solver"
@li @ref ortools/math_opt "Math Opt" (Bazel only)
@li @ref ortools/glop "GLOP"
@li @ref ortools/sat "SAT"
@li @ref ortools/pdlp "PDLP"
@li @ref ortools/constraint_solver "Constraint Solver"
@li @ref ortools/routing "Routing"
@li @ref ortools/packing "Packing"
@li @ref ortools/scheduling "Scheduling"
Misc:
@li @ref ortools/init "init"
@li @ref ortools/base "base"
@li @ref ortools/util "util"
*/

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: #4285f4;
--header-foreground: white;
/* footer */
--footer-background: #4285f4;
--footer-foreground: white;
}