CMakeLists.txt 4.2 KB

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