Skip to content

Commit

Permalink
cmake for docs integrated
Browse files Browse the repository at this point in the history
  • Loading branch information
milyin committed Jul 26, 2023
1 parent 225ef90 commit a27e369
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 8 deletions.
6 changes: 6 additions & 0 deletions cmake/helpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
# functions and macros definitions
#

#
# Allow to fimnd cmake modules in this directory
#
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}" ${CMAKE_MODULE_PATH})


#
# Show VARIABLE = value on configuration stage
#
Expand Down
32 changes: 24 additions & 8 deletions docs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
cmake_minimum_required (VERSION 3.16)

project ("zenoh-cpp-docs")

set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../cmake" ${CMAKE_MODULE_PATH})

find_package(Doxygen REQUIRED)
find_package(Sphinx REQUIRED)
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
cmake_minimum_required (VERSION 3.16)
project(zenohcxx_docs)
else()
message(STATUS "zenoh-cxx docs")
include(../cmake/helpers.cmake)
endif()

find_package(Doxygen)
if(NOT DOXYGEN_FOUND)
message(STATUS "Doxygen not found, skipping docs")
return()
endif()

find_package(Sphinx)
if(NOT SPHINX_FOUND)
message(STATUS "Sphinx not found, skipping docs")
return()
endif()

# Find all the public headers

Expand Down Expand Up @@ -35,10 +46,15 @@ add_custom_target(Doxygen ALL DEPENDS ${DOXYGEN_INDEX_FILE})
set(SPHINX_SOURCE ${CMAKE_CURRENT_SOURCE_DIR})
set(SPHINX_BUILD ${CMAKE_CURRENT_BINARY_DIR}/docs/sphinx)


file (GLOB_RECURSE RST_FILES *.rst)
add_custom_target(Sphinx ALL
DEPENDS conf.py ${RST_FILES} ${DOXYGEN_INDEX_FILE}
COMMAND ${SPHINX_EXECUTABLE} -b html
# Tell Breathe where to find the Doxygen output
-Dbreathe_projects.zenohcpp=${DOXYGEN_OUTPUT_DIR}/xml
${SPHINX_SOURCE} ${SPHINX_BUILD}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating documentation with Sphinx")

add_custom_target(docs ALL DEPENDS Sphinx)

0 comments on commit a27e369

Please sign in to comment.