mirror of
https://github.com/eclipse/upm.git
synced 2025-03-15 04:57:30 +03:00
cmake: inserted python doc build in top cmakelists
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:
parent
aa8b2c5774
commit
6727843477
@ -13,7 +13,7 @@ endif ()
|
|||||||
find_package (Threads REQUIRED)
|
find_package (Threads REQUIRED)
|
||||||
find_package (PkgConfig REQUIRED)
|
find_package (PkgConfig REQUIRED)
|
||||||
|
|
||||||
# force a libmraa search and minimum required version every time a config is generated
|
# force a libmraa search and minimum required version every time a config is generated
|
||||||
unset(MRAA_FOUND CACHE)
|
unset(MRAA_FOUND CACHE)
|
||||||
pkg_check_modules (MRAA REQUIRED mraa>=0.6.0)
|
pkg_check_modules (MRAA REQUIRED mraa>=0.6.0)
|
||||||
message (INFO " found libmraa version: ${MRAA_VERSION}")
|
message (INFO " found libmraa version: ${MRAA_VERSION}")
|
||||||
@ -70,6 +70,32 @@ if (BUILDDOC)
|
|||||||
COMMENT "Generating API documentation with Doxygen" VERBATIM
|
COMMENT "Generating API documentation with Doxygen" VERBATIM
|
||||||
)
|
)
|
||||||
endif (DOXYGEN_FOUND)
|
endif (DOXYGEN_FOUND)
|
||||||
|
# check if sphinx is installed
|
||||||
|
find_package (Sphinx)
|
||||||
|
if(SPHINX_FOUND)
|
||||||
|
# python required for sphinx build
|
||||||
|
find_package (PythonLibs)
|
||||||
|
string (REPLACE "." ";" PYTHON_VERSION_LIST ${PYTHONLIBS_VERSION_STRING})
|
||||||
|
list (GET PYTHON_VERSION_LIST 0 PYTHON_VERSION_MAJOR)
|
||||||
|
list (GET PYTHON_VERSION_LIST 1 PYTHON_VERSION_MINOR)
|
||||||
|
# check if site-packages exists, might need a more robust way on adding make install dependency and paths
|
||||||
|
if (EXISTS ${CMAKE_INSTALL_LIBDIR}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages/)
|
||||||
|
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/doxy/conf.py.in ${CMAKE_CURRENT_BINARY_DIR}/pydoc/conf.py @ONLY)
|
||||||
|
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/doxy/index.rst ${CMAKE_CURRENT_BINARY_DIR}/pydoc/index.rst)
|
||||||
|
add_custom_target (pydoc
|
||||||
|
${SPHINX_API_EXECUTABLE} -f -o pydoc ${CMAKE_INSTALL_LIBDIR}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages/
|
||||||
|
#use a separate cmake FILE module for string replacement instead
|
||||||
|
COMMAND sed -i.bak s|site-packages|sensor-drivers|g pydoc/modules.rst
|
||||||
|
COMMAND ${SPHINX_EXECUTABLE} -b html pydoc html/python
|
||||||
|
COMMAND sed -i.bak s|\">pyupm_|\">|g html/python/index.html html/python/modules.html
|
||||||
|
COMMAND sed -i.bak s|\\smodule</a>|</a>|g html/python/index.html html/python/modules.html
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
COMMENT "Generating API documentation with Sphinx" VERBATIM
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
message( WARNING " - Sphinx documentation depends on python libs generated by 'install' target. Run cmake again after installation to create 'pydoc' target!")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (IPK)
|
if (IPK)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user