Skip to content

Commit

Permalink
htmldoc: add CMake to use man2html to create html doc from man pages
Browse files Browse the repository at this point in the history
This will be included on gh-pages during the next release.

Signed-off-by: Robin Getz <[email protected]>
  • Loading branch information
rgetz committed Apr 16, 2020
1 parent 2d7fad4 commit 7a75179
Showing 1 changed file with 28 additions and 5 deletions.
33 changes: 28 additions & 5 deletions man/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,35 @@ if (WITH_MAN)
${CMAKE_BINARY_DIR}/libiio.3.in
${CMAKE_BINARY_DIR}/man/libiio.3 @ONLY)

if (WITH_DOC)
find_program(MAN2HTML man2html)
if (NOT MAN2HTML)
message(FATAL_ERROR "Can not build html DOC from man without man2html")
endif()
message(STATUS "Building html doc pages with man2html")
file(MAKE_DIRECTORY ${CMAKE_HTML_DEST_DIR}/man3)
execute_process(
COMMAND ${MAN2HTML} -r
INPUT_FILE ${CMAKE_BINARY_DIR}/man/libiio.3
OUTPUT_FILE ${CMAKE_HTML_DEST_DIR}/man3/libiio.3.html
)
endif()
if (WITH_TESTS)
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/iio_attr.1.in ${CMAKE_BINARY_DIR}/man/iio_attr.1 @ONLY)
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/iio_info.1.in ${CMAKE_BINARY_DIR}/man/iio_info.1 @ONLY)
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/iio_readdev.1.in ${CMAKE_BINARY_DIR}/man/iio_readdev.1 @ONLY)
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/iio_reg.1.in ${CMAKE_BINARY_DIR}/man/iio_reg.1 @ONLY)
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/iio_writedev.1.in ${CMAKE_BINARY_DIR}/man/iio_writedev.1 @ONLY)
list(APPEND MAN1 iio_attr.1 iio_info.1 iio_readdev.1 iio_reg.1 iio_writedev.1)
foreach(_page ${MAN1})
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/${_page}.in
${CMAKE_BINARY_DIR}/man/${_page} @ONLY)
endforeach()
if (WITH_DOC)
file(MAKE_DIRECTORY ${CMAKE_HTML_DEST_DIR}/man1)
foreach(_page ${MAN1})
execute_process(
COMMAND ${MAN2HTML} -r
INPUT_FILE ${CMAKE_BINARY_DIR}/man/${_page}
OUTPUT_FILE ${CMAKE_HTML_DEST_DIR}/man1/${_page}.html
)
endforeach()
endif()
endif()
# install man files into the BINARY directories,
# section 3 = library functions
Expand Down

0 comments on commit 7a75179

Please sign in to comment.