CMakeLists.txt 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. find_package(Sphinx REQUIRED)
  2. make_directory(${PROJECT_BINARY_DIR}/doc_src)
  3. file(GLOB DOC_SRC "${PROJECT_SOURCE_DIR}/doc/*")
  4. file(COPY ${DOC_SRC} DESTINATION ${PROJECT_BINARY_DIR}/doc_src)
  5. function(generate_rst in out)
  6. add_custom_command(OUTPUT ${out}
  7. DEPENDS ${PROJECT_SOURCE_DIR}/tools/c2rst.py ${in}
  8. PRE_BUILD
  9. COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/tools/c2rst.py ${in} ${out})
  10. endfunction()
  11. generate_rst(${PROJECT_SOURCE_DIR}/include/ua_types.h ${PROJECT_BINARY_DIR}/doc_src/types.rst)
  12. generate_rst(${PROJECT_SOURCE_DIR}/include/ua_constants.h ${PROJECT_BINARY_DIR}/doc_src/constants.rst)
  13. generate_rst(${PROJECT_BINARY_DIR}/src_generated/ua_types_generated.h ${PROJECT_BINARY_DIR}/doc_src/types_generated.rst)
  14. generate_rst(${PROJECT_SOURCE_DIR}/include/ua_server.h ${PROJECT_BINARY_DIR}/doc_src/server.rst)
  15. generate_rst(${PROJECT_SOURCE_DIR}/include/ua_client.h ${PROJECT_BINARY_DIR}/doc_src/client.rst)
  16. generate_rst(${PROJECT_SOURCE_DIR}/include/ua_client_highlevel.h ${PROJECT_BINARY_DIR}/doc_src/client_highlevel.rst)
  17. generate_rst(${PROJECT_SOURCE_DIR}/include/ua_log.h ${PROJECT_BINARY_DIR}/doc_src/log.rst)
  18. generate_rst(${PROJECT_SOURCE_DIR}/include/ua_connection.h ${PROJECT_BINARY_DIR}/doc_src/connection.rst)
  19. generate_rst(${PROJECT_SOURCE_DIR}/src/server/ua_services.h ${PROJECT_BINARY_DIR}/doc_src/services.rst)
  20. generate_rst(${PROJECT_SOURCE_DIR}/src/server/ua_nodestore.h ${PROJECT_BINARY_DIR}/doc_src/nodestore.rst)
  21. add_custom_target(doc_latex ${SPHINX_EXECUTABLE}
  22. -b latex -c "${PROJECT_BINARY_DIR}/doc_src" "${PROJECT_BINARY_DIR}/doc_src" "${PROJECT_BINARY_DIR}/doc_latex"
  23. DEPENDS ${PROJECT_BINARY_DIR}/doc_src/types.rst
  24. DEPENDS ${PROJECT_BINARY_DIR}/doc_src/constants.rst
  25. DEPENDS ${PROJECT_BINARY_DIR}/doc_src/types_generated.rst
  26. DEPENDS ${PROJECT_BINARY_DIR}/doc_src/server.rst
  27. DEPENDS ${PROJECT_BINARY_DIR}/doc_src/client.rst
  28. DEPENDS ${PROJECT_BINARY_DIR}/doc_src/client_highlevel.rst
  29. DEPENDS ${PROJECT_BINARY_DIR}/doc_src/log.rst
  30. DEPENDS ${PROJECT_BINARY_DIR}/doc_src/connection.rst
  31. DEPENDS ${PROJECT_BINARY_DIR}/doc_src/services.rst
  32. DEPENDS ${PROJECT_BINARY_DIR}/doc_src/nodestore.rst
  33. COMMENT "Building LaTeX sources for documentation with Sphinx")
  34. add_dependencies(doc_latex open62541)
  35. add_custom_target(doc ${SPHINX_EXECUTABLE}
  36. -b html -c "${PROJECT_BINARY_DIR}/doc_src" "${PROJECT_BINARY_DIR}/doc_src" "${PROJECT_BINARY_DIR}/doc"
  37. COMMAND ${CMAKE_COMMAND} -E copy "${PROJECT_BINARY_DIR}/doc_src/open62541_html.png" "${PROJECT_BINARY_DIR}/doc/_static/"
  38. DEPENDS ${PROJECT_BINARY_DIR}/doc_src/types.rst
  39. DEPENDS ${PROJECT_BINARY_DIR}/doc_src/constants.rst
  40. DEPENDS ${PROJECT_BINARY_DIR}/doc_src/types_generated.rst
  41. DEPENDS ${PROJECT_BINARY_DIR}/doc_src/server.rst
  42. DEPENDS ${PROJECT_BINARY_DIR}/doc_src/client.rst
  43. DEPENDS ${PROJECT_BINARY_DIR}/doc_src/client_highlevel.rst
  44. DEPENDS ${PROJECT_BINARY_DIR}/doc_src/log.rst
  45. DEPENDS ${PROJECT_BINARY_DIR}/doc_src/connection.rst
  46. DEPENDS ${PROJECT_BINARY_DIR}/doc_src/services.rst
  47. DEPENDS ${PROJECT_BINARY_DIR}/doc_src/nodestore.rst
  48. COMMENT "Building HTML documentation with Sphinx")
  49. add_dependencies(doc open62541)