Add doc cmake targets (HTML, PDF, QtHelp, CHM, man)
make doc will build all of the above, except for CHM,
which needs manual preparation and can be built with
make doc-chm. See doc/scripts/README.rst for details.
We do our best to ensure to detect the required tools
before adding targets, so a build should always succeed.
Exception: On Debian and Ubuntu, the following packages are
required to build the PDF target (in addition to pdflatex
itself, which is autodetected):
* texlive-latex-recommended
* texlive-latex-extra
* texlive-fonts-recommended
If pdflatex is present, but those are not, the doc target
will fail.
Results can be found in $BUILDDIR/doc/$format.
2012-11-25 03:21:27 +04:00
|
|
|
if(SPHINX_FOUND)
|
|
|
|
|
|
|
|
# Sphinx cache with pickled ReST documents
|
|
|
|
set(SPHINX_CACHE_DIR "${CMAKE_CURRENT_BINARY_DIR}/_doctrees")
|
|
|
|
# HTML output directory
|
|
|
|
set(SPHINX_HTML_DIR "${CMAKE_CURRENT_BINARY_DIR}/html")
|
|
|
|
set(SPHINX_PDF_DIR "${CMAKE_CURRENT_BINARY_DIR}/latex")
|
|
|
|
set(SPHINX_QCH_DIR "${CMAKE_CURRENT_BINARY_DIR}/qthelp")
|
|
|
|
set(SPHINX_HTMLHELP_DIR "${CMAKE_CURRENT_BINARY_DIR}/htmlhelp")
|
|
|
|
set(MSHTML_COMPILER wine 'C:\\Program Files\\HTML Help Workshop\\hhc.exe')
|
2012-11-29 15:25:15 +04:00
|
|
|
# assets
|
|
|
|
set(LATEX_LOGO "${CMAKE_CURRENT_SOURCE_DIR}/logo-blue.pdf")
|
Add doc cmake targets (HTML, PDF, QtHelp, CHM, man)
make doc will build all of the above, except for CHM,
which needs manual preparation and can be built with
make doc-chm. See doc/scripts/README.rst for details.
We do our best to ensure to detect the required tools
before adding targets, so a build should always succeed.
Exception: On Debian and Ubuntu, the following packages are
required to build the PDF target (in addition to pdflatex
itself, which is autodetected):
* texlive-latex-recommended
* texlive-latex-extra
* texlive-fonts-recommended
If pdflatex is present, but those are not, the doc target
will fail.
Results can be found in $BUILDDIR/doc/$format.
2012-11-25 03:21:27 +04:00
|
|
|
|
2017-09-22 11:25:51 +03:00
|
|
|
set(APPLICATION_DOC_DIR "${CMAKE_INSTALL_DOCDIR}/${PACKAGE}")
|
|
|
|
install(DIRECTORY ${SPHINX_HTML_DIR} DESTINATION ${APPLICATION_DOC_DIR} OPTIONAL)
|
|
|
|
install(DIRECTORY ${SPHINX_PDF_DIR} DESTINATION ${APPLICATION_DOC_DIR} OPTIONAL)
|
|
|
|
install(DIRECTORY ${SPHINX_QCH_DIR} DESTINATION ${APPLICATION_DOC_DIR} OPTIONAL)
|
|
|
|
|
Add doc cmake targets (HTML, PDF, QtHelp, CHM, man)
make doc will build all of the above, except for CHM,
which needs manual preparation and can be built with
make doc-chm. See doc/scripts/README.rst for details.
We do our best to ensure to detect the required tools
before adding targets, so a build should always succeed.
Exception: On Debian and Ubuntu, the following packages are
required to build the PDF target (in addition to pdflatex
itself, which is autodetected):
* texlive-latex-recommended
* texlive-latex-extra
* texlive-fonts-recommended
If pdflatex is present, but those are not, the doc target
will fail.
Results can be found in $BUILDDIR/doc/$format.
2012-11-25 03:21:27 +04:00
|
|
|
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in" conf.py @ONLY)
|
2013-02-04 21:10:51 +04:00
|
|
|
|
2013-03-11 19:18:20 +04:00
|
|
|
if(WITH_DOC)
|
2017-03-24 19:49:20 +03:00
|
|
|
add_custom_target(doc ALL DEPENDS doc-html COMMENT "Building documentation...")
|
2013-03-11 19:18:20 +04:00
|
|
|
else(WITH_DOC)
|
2017-03-24 19:49:20 +03:00
|
|
|
add_custom_target(doc DEPENDS doc-html COMMENT "Building documentation...")
|
2013-03-11 19:18:20 +04:00
|
|
|
endif(WITH_DOC)
|
2013-02-04 21:10:51 +04:00
|
|
|
|
2013-09-12 14:55:12 +04:00
|
|
|
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/ocdoc/_shared_assets")
|
2013-09-02 16:01:15 +04:00
|
|
|
add_dependencies(doc doc-html-org)
|
|
|
|
add_dependencies(doc doc-html-com)
|
|
|
|
endif()
|
|
|
|
|
Add doc cmake targets (HTML, PDF, QtHelp, CHM, man)
make doc will build all of the above, except for CHM,
which needs manual preparation and can be built with
make doc-chm. See doc/scripts/README.rst for details.
We do our best to ensure to detect the required tools
before adding targets, so a build should always succeed.
Exception: On Debian and Ubuntu, the following packages are
required to build the PDF target (in addition to pdflatex
itself, which is autodetected):
* texlive-latex-recommended
* texlive-latex-extra
* texlive-fonts-recommended
If pdflatex is present, but those are not, the doc target
will fail.
Results can be found in $BUILDDIR/doc/$format.
2012-11-25 03:21:27 +04:00
|
|
|
if(PDFLATEX_FOUND)
|
|
|
|
# if this still fails on Debian/Ubuntu, run
|
|
|
|
# apt-get install texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended
|
|
|
|
add_custom_target(doc-latex ${SPHINX_EXECUTABLE}
|
|
|
|
-q -c . -b latex
|
Make building documantation parallelable.
sphinx will fail in a race condition, if every sphinx target
uses the same CACHE dir:
Exception occurred:
File "/usr/lib/pymodules/python2.7/sphinx/cmdline.py", line 189, in main
app.build(force_all, filenames)
File "/usr/lib/pymodules/python2.7/sphinx/application.py", line 204, in build
self.builder.build_update()
File "/usr/lib/pymodules/python2.7/sphinx/builders/__init__.py", line 196, in build_update
'out of date' % len(to_build))
File "/usr/lib/pymodules/python2.7/sphinx/builders/__init__.py", line 238, in build
self.env.topickle(path.join(self.doctreedir, ENV_PICKLE_FILENAME))
File "/usr/lib/pymodules/python2.7/sphinx/environment.py", line 351, in topickle
movefile(filename + '.tmp', filename)
File "/usr/lib/pymodules/python2.7/sphinx/util/osutil.py", line 104, in movefile
os.rename(source, dest)
OSError: [Errno 2] No such file or directory
2013-08-15 04:36:44 +04:00
|
|
|
-d ${SPHINX_CACHE_DIR}/latex
|
2012-11-29 15:25:15 +04:00
|
|
|
-D latex_logo=${LATEX_LOGO}
|
Add doc cmake targets (HTML, PDF, QtHelp, CHM, man)
make doc will build all of the above, except for CHM,
which needs manual preparation and can be built with
make doc-chm. See doc/scripts/README.rst for details.
We do our best to ensure to detect the required tools
before adding targets, so a build should always succeed.
Exception: On Debian and Ubuntu, the following packages are
required to build the PDF target (in addition to pdflatex
itself, which is autodetected):
* texlive-latex-recommended
* texlive-latex-extra
* texlive-fonts-recommended
If pdflatex is present, but those are not, the doc target
will fail.
Results can be found in $BUILDDIR/doc/$format.
2012-11-25 03:21:27 +04:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
${SPHINX_PDF_DIR} )
|
2017-09-22 12:15:35 +03:00
|
|
|
|
|
|
|
set(MAKE "make" CACHE FILEPATH "make to be used for documentation generation if not using make as generator anyway")
|
|
|
|
if(CMAKE_GENERATOR MATCHES "Makefiles")
|
|
|
|
set(MAKE "$(MAKE)")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
add_custom_target(doc-pdf ${MAKE} -C ${SPHINX_PDF_DIR} all-pdf
|
Add doc cmake targets (HTML, PDF, QtHelp, CHM, man)
make doc will build all of the above, except for CHM,
which needs manual preparation and can be built with
make doc-chm. See doc/scripts/README.rst for details.
We do our best to ensure to detect the required tools
before adding targets, so a build should always succeed.
Exception: On Debian and Ubuntu, the following packages are
required to build the PDF target (in addition to pdflatex
itself, which is autodetected):
* texlive-latex-recommended
* texlive-latex-extra
* texlive-fonts-recommended
If pdflatex is present, but those are not, the doc target
will fail.
Results can be found in $BUILDDIR/doc/$format.
2012-11-25 03:21:27 +04:00
|
|
|
DEPENDS doc-latex )
|
|
|
|
add_dependencies(doc doc-pdf)
|
|
|
|
endif(PDFLATEX_FOUND)
|
|
|
|
if (EXISTS ${QT_QCOLLECTIONGENERATOR_EXECUTABLE})
|
|
|
|
add_custom_target( doc-qch-sphinx ${SPHINX_EXECUTABLE}
|
|
|
|
-q -c . -b qthelp
|
Make building documantation parallelable.
sphinx will fail in a race condition, if every sphinx target
uses the same CACHE dir:
Exception occurred:
File "/usr/lib/pymodules/python2.7/sphinx/cmdline.py", line 189, in main
app.build(force_all, filenames)
File "/usr/lib/pymodules/python2.7/sphinx/application.py", line 204, in build
self.builder.build_update()
File "/usr/lib/pymodules/python2.7/sphinx/builders/__init__.py", line 196, in build_update
'out of date' % len(to_build))
File "/usr/lib/pymodules/python2.7/sphinx/builders/__init__.py", line 238, in build
self.env.topickle(path.join(self.doctreedir, ENV_PICKLE_FILENAME))
File "/usr/lib/pymodules/python2.7/sphinx/environment.py", line 351, in topickle
movefile(filename + '.tmp', filename)
File "/usr/lib/pymodules/python2.7/sphinx/util/osutil.py", line 104, in movefile
os.rename(source, dest)
OSError: [Errno 2] No such file or directory
2013-08-15 04:36:44 +04:00
|
|
|
-d ${SPHINX_CACHE_DIR}/qthelp
|
Add doc cmake targets (HTML, PDF, QtHelp, CHM, man)
make doc will build all of the above, except for CHM,
which needs manual preparation and can be built with
make doc-chm. See doc/scripts/README.rst for details.
We do our best to ensure to detect the required tools
before adding targets, so a build should always succeed.
Exception: On Debian and Ubuntu, the following packages are
required to build the PDF target (in addition to pdflatex
itself, which is autodetected):
* texlive-latex-recommended
* texlive-latex-extra
* texlive-fonts-recommended
If pdflatex is present, but those are not, the doc target
will fail.
Results can be found in $BUILDDIR/doc/$format.
2012-11-25 03:21:27 +04:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
${SPHINX_QCH_DIR} )
|
|
|
|
add_custom_target( doc-qch ${QT_QCOLLECTIONGENERATOR_EXECUTABLE}
|
|
|
|
${SPHINX_QCH_DIR}/*.qhcp
|
|
|
|
DEPENDS doc-qch-sphinx )
|
|
|
|
add_dependencies(doc doc-qch)
|
|
|
|
endif()
|
|
|
|
add_custom_target( doc-html ${SPHINX_EXECUTABLE}
|
|
|
|
-q -c . -b html
|
Make building documantation parallelable.
sphinx will fail in a race condition, if every sphinx target
uses the same CACHE dir:
Exception occurred:
File "/usr/lib/pymodules/python2.7/sphinx/cmdline.py", line 189, in main
app.build(force_all, filenames)
File "/usr/lib/pymodules/python2.7/sphinx/application.py", line 204, in build
self.builder.build_update()
File "/usr/lib/pymodules/python2.7/sphinx/builders/__init__.py", line 196, in build_update
'out of date' % len(to_build))
File "/usr/lib/pymodules/python2.7/sphinx/builders/__init__.py", line 238, in build
self.env.topickle(path.join(self.doctreedir, ENV_PICKLE_FILENAME))
File "/usr/lib/pymodules/python2.7/sphinx/environment.py", line 351, in topickle
movefile(filename + '.tmp', filename)
File "/usr/lib/pymodules/python2.7/sphinx/util/osutil.py", line 104, in movefile
os.rename(source, dest)
OSError: [Errno 2] No such file or directory
2013-08-15 04:36:44 +04:00
|
|
|
-d ${SPHINX_CACHE_DIR}/html
|
2013-09-02 16:01:15 +04:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
${SPHINX_HTML_DIR}/unthemed )
|
|
|
|
add_custom_target( doc-html-org ${SPHINX_EXECUTABLE}
|
|
|
|
-q -c . -b html
|
|
|
|
-d ${SPHINX_CACHE_DIR}/html
|
|
|
|
-D html_theme=owncloud_org
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
${SPHINX_HTML_DIR}/org )
|
|
|
|
add_custom_target( doc-html-com ${SPHINX_EXECUTABLE}
|
|
|
|
-q -c . -b html
|
|
|
|
-d ${SPHINX_CACHE_DIR}/html
|
|
|
|
-D html_theme=owncloud_com
|
Add doc cmake targets (HTML, PDF, QtHelp, CHM, man)
make doc will build all of the above, except for CHM,
which needs manual preparation and can be built with
make doc-chm. See doc/scripts/README.rst for details.
We do our best to ensure to detect the required tools
before adding targets, so a build should always succeed.
Exception: On Debian and Ubuntu, the following packages are
required to build the PDF target (in addition to pdflatex
itself, which is autodetected):
* texlive-latex-recommended
* texlive-latex-extra
* texlive-fonts-recommended
If pdflatex is present, but those are not, the doc target
will fail.
Results can be found in $BUILDDIR/doc/$format.
2012-11-25 03:21:27 +04:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
2013-09-02 16:01:15 +04:00
|
|
|
${SPHINX_HTML_DIR}/com )
|
2013-02-04 20:36:56 +04:00
|
|
|
|
Add doc cmake targets (HTML, PDF, QtHelp, CHM, man)
make doc will build all of the above, except for CHM,
which needs manual preparation and can be built with
make doc-chm. See doc/scripts/README.rst for details.
We do our best to ensure to detect the required tools
before adding targets, so a build should always succeed.
Exception: On Debian and Ubuntu, the following packages are
required to build the PDF target (in addition to pdflatex
itself, which is autodetected):
* texlive-latex-recommended
* texlive-latex-extra
* texlive-fonts-recommended
If pdflatex is present, but those are not, the doc target
will fail.
Results can be found in $BUILDDIR/doc/$format.
2012-11-25 03:21:27 +04:00
|
|
|
## Building CHM files requires HTML Help Workshop. Since it requires wine
|
|
|
|
## with special dependencies, it's impossible to write a cmake check for it.
|
|
|
|
## This is why doc-chm is not a dependency for doc. Instead, run
|
|
|
|
## doc/scripts/htmlhelp.exe to install them and run this target
|
|
|
|
## explicitly.
|
|
|
|
add_custom_target( doc-chm-sphinx ${SPHINX_EXECUTABLE}
|
|
|
|
-q -c . -b htmlhelp
|
|
|
|
-D html_theme=basic
|
Make building documantation parallelable.
sphinx will fail in a race condition, if every sphinx target
uses the same CACHE dir:
Exception occurred:
File "/usr/lib/pymodules/python2.7/sphinx/cmdline.py", line 189, in main
app.build(force_all, filenames)
File "/usr/lib/pymodules/python2.7/sphinx/application.py", line 204, in build
self.builder.build_update()
File "/usr/lib/pymodules/python2.7/sphinx/builders/__init__.py", line 196, in build_update
'out of date' % len(to_build))
File "/usr/lib/pymodules/python2.7/sphinx/builders/__init__.py", line 238, in build
self.env.topickle(path.join(self.doctreedir, ENV_PICKLE_FILENAME))
File "/usr/lib/pymodules/python2.7/sphinx/environment.py", line 351, in topickle
movefile(filename + '.tmp', filename)
File "/usr/lib/pymodules/python2.7/sphinx/util/osutil.py", line 104, in movefile
os.rename(source, dest)
OSError: [Errno 2] No such file or directory
2013-08-15 04:36:44 +04:00
|
|
|
-d ${SPHINX_CACHE_DIR}/htmlhelp
|
Add doc cmake targets (HTML, PDF, QtHelp, CHM, man)
make doc will build all of the above, except for CHM,
which needs manual preparation and can be built with
make doc-chm. See doc/scripts/README.rst for details.
We do our best to ensure to detect the required tools
before adding targets, so a build should always succeed.
Exception: On Debian and Ubuntu, the following packages are
required to build the PDF target (in addition to pdflatex
itself, which is autodetected):
* texlive-latex-recommended
* texlive-latex-extra
* texlive-fonts-recommended
If pdflatex is present, but those are not, the doc target
will fail.
Results can be found in $BUILDDIR/doc/$format.
2012-11-25 03:21:27 +04:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
${SPHINX_HTMLHELP_DIR} )
|
|
|
|
add_custom_target( doc-chm pushd ${SPHINX_HTMLHELP_DIR}; ${MSHTML_COMPILER} *.hhp; popd
|
|
|
|
DEPENDS doc-chm-sphinx )
|
2017-12-03 18:52:58 +03:00
|
|
|
endif(SPHINX_FOUND)
|