CMakeLists.txt 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. if(SPHINX_FOUND)
  2. # Sphinx cache with pickled ReST documents
  3. set(SPHINX_CACHE_DIR "${CMAKE_CURRENT_BINARY_DIR}/_doctrees")
  4. # HTML output directory
  5. set(SPHINX_HTML_DIR "${CMAKE_CURRENT_BINARY_DIR}/html")
  6. set(SPHINX_MAN_DIR "${CMAKE_CURRENT_BINARY_DIR}/man1")
  7. set(SPHINX_PDF_DIR "${CMAKE_CURRENT_BINARY_DIR}/latex")
  8. set(SPHINX_QCH_DIR "${CMAKE_CURRENT_BINARY_DIR}/qthelp")
  9. set(SPHINX_HTMLHELP_DIR "${CMAKE_CURRENT_BINARY_DIR}/htmlhelp")
  10. set(MSHTML_COMPILER wine 'C:\\Program Files\\HTML Help Workshop\\hhc.exe')
  11. # assets
  12. set(LATEX_LOGO "${CMAKE_CURRENT_SOURCE_DIR}/logo-blue.pdf")
  13. install(DIRECTORY ${SPHINX_HTML_DIR} DESTINATION ${CMAKE_INSTALL_DOCDIR} OPTIONAL)
  14. install(DIRECTORY ${SPHINX_MAN_DIR} DESTINATION ${CMAKE_INSTALL_MANDIR} OPTIONAL)
  15. install(DIRECTORY ${SPHINX_PDF_DIR} DESTINATION ${CMAKE_INSTALL_DOCDIR} OPTIONAL)
  16. install(DIRECTORY ${SPHINX_QCH_DIR} DESTINATION ${CMAKE_INSTALL_DOCDIR} OPTIONAL)
  17. configure_file("${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in" conf.py @ONLY)
  18. if(WITH_DOC)
  19. add_custom_target(doc ALL DEPENDS doc-html COMMENT "Building documentation...")
  20. else(WITH_DOC)
  21. add_custom_target(doc DEPENDS doc-html COMMENT "Building documentation...")
  22. endif(WITH_DOC)
  23. if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/ocdoc/_shared_assets")
  24. add_dependencies(doc doc-html-org)
  25. add_dependencies(doc doc-html-com)
  26. endif()
  27. if(PDFLATEX_FOUND)
  28. # if this still fails on Debian/Ubuntu, run
  29. # apt-get install texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended
  30. add_custom_target(doc-latex ${SPHINX_EXECUTABLE}
  31. -q -c . -b latex
  32. -d ${SPHINX_CACHE_DIR}/latex
  33. -D latex_logo=${LATEX_LOGO}
  34. ${CMAKE_CURRENT_SOURCE_DIR}
  35. ${SPHINX_PDF_DIR} )
  36. add_custom_target(doc-pdf $(MAKE) -C ${SPHINX_PDF_DIR} all-pdf
  37. DEPENDS doc-latex )
  38. add_dependencies(doc doc-pdf)
  39. endif(PDFLATEX_FOUND)
  40. if (EXISTS ${QT_QCOLLECTIONGENERATOR_EXECUTABLE})
  41. add_custom_target( doc-qch-sphinx ${SPHINX_EXECUTABLE}
  42. -q -c . -b qthelp
  43. -d ${SPHINX_CACHE_DIR}/qthelp
  44. ${CMAKE_CURRENT_SOURCE_DIR}
  45. ${SPHINX_QCH_DIR} )
  46. add_custom_target( doc-qch ${QT_QCOLLECTIONGENERATOR_EXECUTABLE}
  47. ${SPHINX_QCH_DIR}/*.qhcp
  48. DEPENDS doc-qch-sphinx )
  49. add_dependencies(doc doc-qch)
  50. endif()
  51. add_custom_target( doc-html ${SPHINX_EXECUTABLE}
  52. -q -c . -b html
  53. -d ${SPHINX_CACHE_DIR}/html
  54. ${CMAKE_CURRENT_SOURCE_DIR}
  55. ${SPHINX_HTML_DIR}/unthemed )
  56. add_custom_target( doc-html-org ${SPHINX_EXECUTABLE}
  57. -q -c . -b html
  58. -d ${SPHINX_CACHE_DIR}/html
  59. -D html_theme=owncloud_org
  60. ${CMAKE_CURRENT_SOURCE_DIR}
  61. ${SPHINX_HTML_DIR}/org )
  62. add_custom_target( doc-html-com ${SPHINX_EXECUTABLE}
  63. -q -c . -b html
  64. -d ${SPHINX_CACHE_DIR}/html
  65. -D html_theme=owncloud_com
  66. ${CMAKE_CURRENT_SOURCE_DIR}
  67. ${SPHINX_HTML_DIR}/com )
  68. add_custom_target( doc-man ${SPHINX_EXECUTABLE}
  69. -q -c . -b man
  70. -d ${SPHINX_CACHE_DIR}/man
  71. ${CMAKE_CURRENT_SOURCE_DIR}
  72. ${SPHINX_MAN_DIR} )
  73. ## Building CHM files requires HTML Help Workshop. Since it requires wine
  74. ## with special dependencies, it's impossible to write a cmake check for it.
  75. ## This is why doc-chm is not a dependency for doc. Instead, run
  76. ## doc/scripts/htmlhelp.exe to install them and run this target
  77. ## explicitly.
  78. add_custom_target( doc-chm-sphinx ${SPHINX_EXECUTABLE}
  79. -q -c . -b htmlhelp
  80. -D html_theme=basic
  81. -d ${SPHINX_CACHE_DIR}/htmlhelp
  82. ${CMAKE_CURRENT_SOURCE_DIR}
  83. ${SPHINX_HTMLHELP_DIR} )
  84. add_custom_target( doc-chm pushd ${SPHINX_HTMLHELP_DIR}; ${MSHTML_COMPILER} *.hhp; popd
  85. DEPENDS doc-chm-sphinx )
  86. endif(SPHINX_FOUND)