mirror of
https://github.com/triqs/dft_tools
synced 2024-12-23 12:55:17 +01:00
[doc] Add cpp2rst and example output generation to doc building
This commit is contained in:
parent
66f270e741
commit
f28f0e68a4
@ -1,20 +1,6 @@
|
|||||||
# Generate the sphinx config file
|
# Generate the sphinx config file
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in ${CMAKE_CURRENT_BINARY_DIR}/conf.py @ONLY)
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in ${CMAKE_CURRENT_BINARY_DIR}/conf.py @ONLY)
|
||||||
|
|
||||||
# ---------------------------------
|
|
||||||
# Top Sphinx target
|
|
||||||
# ---------------------------------
|
|
||||||
# Sphinx has internal caching, always run it
|
|
||||||
add_custom_target(docs_sphinx ALL)
|
|
||||||
add_custom_command(
|
|
||||||
TARGET docs_sphinx
|
|
||||||
COMMAND PYTHONPATH=${CMAKE_BINARY_DIR}/python:$ENV{PYTHONPATH} ${TRIQS_SPHINXBUILD_EXECUTABLE} -c . -j8 -b html ${CMAKE_CURRENT_SOURCE_DIR} html
|
|
||||||
)
|
|
||||||
|
|
||||||
# Autodoc usage requires the python modules to be built first
|
|
||||||
get_property(CPP2PY_MODULES_LIST GLOBAL PROPERTY CPP2PY_MODULES_LIST)
|
|
||||||
add_dependencies(docs_sphinx ${CPP2PY_MODULES_LIST})
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# Create an optional target that allows us to regenerate the C++ doc with c++2rst
|
# Create an optional target that allows us to regenerate the C++ doc with c++2rst
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
@ -51,6 +37,45 @@ endmacro(generate_docs)
|
|||||||
|
|
||||||
generate_docs(${PROJECT_SOURCE_DIR}/c++/app4triqs/toto.hpp)
|
generate_docs(${PROJECT_SOURCE_DIR}/c++/app4triqs/toto.hpp)
|
||||||
|
|
||||||
|
# --------------------------------------------------------
|
||||||
|
# Build & Run the C++ doc examples and capture the output
|
||||||
|
# --------------------------------------------------------
|
||||||
|
|
||||||
|
add_custom_target(docs_example_output)
|
||||||
|
file(GLOB_RECURSE ExampleList RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
|
||||||
|
foreach(example ${ExampleList})
|
||||||
|
get_filename_component(f ${example} NAME_WE)
|
||||||
|
get_filename_component(d ${example} DIRECTORY)
|
||||||
|
add_executable(doc_${f} EXCLUDE_FROM_ALL ${example})
|
||||||
|
set_property(TARGET doc_${f} PROPERTY RUNTIME_OUTPUT_DIRECTORY ${d})
|
||||||
|
target_link_libraries(doc_${f} triqs)
|
||||||
|
add_custom_command(TARGET doc_${f}
|
||||||
|
COMMAND doc_${f} > ${CMAKE_CURRENT_SOURCE_DIR}/${d}/${f}.output 2>/dev/null
|
||||||
|
WORKING_DIRECTORY ${d}
|
||||||
|
)
|
||||||
|
add_dependencies(docs_example_output doc_${f})
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
# ---------------------------------
|
||||||
|
# Top Sphinx target
|
||||||
|
# ---------------------------------
|
||||||
|
# Sphinx has internal caching, always run it
|
||||||
|
add_custom_target(docs_sphinx ALL)
|
||||||
|
add_custom_command(
|
||||||
|
TARGET docs_sphinx
|
||||||
|
COMMAND PYTHONPATH=${CMAKE_BINARY_DIR}/python:$ENV{PYTHONPATH} ${TRIQS_SPHINXBUILD_EXECUTABLE} -c . -j8 -b html ${CMAKE_CURRENT_SOURCE_DIR} html
|
||||||
|
)
|
||||||
|
|
||||||
|
option(Sphinx_Only "When building the documentation, skip the Python Modules and the generation of C++ Api and example outputs" OFF)
|
||||||
|
if(NOT Sphinx_Only)
|
||||||
|
# Autodoc usage requires the python modules to be built first
|
||||||
|
get_property(CPP2PY_MODULES_LIST GLOBAL PROPERTY CPP2PY_MODULES_LIST)
|
||||||
|
add_dependencies(docs_sphinx ${CPP2PY_MODULES_LIST})
|
||||||
|
|
||||||
|
# Generation of C++ Api and Example Outputs
|
||||||
|
add_dependencies(docs_sphinx docs_cpp2rst docs_example_output)
|
||||||
|
endif()
|
||||||
|
|
||||||
# ---------------------------------
|
# ---------------------------------
|
||||||
# Install
|
# Install
|
||||||
# ---------------------------------
|
# ---------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user