1 # Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 # Author: Roman NIKOLAEV
22 #----------------------------------------------------------------------------
23 # SALOME_ADD_SPHINX_DOC is a macro useful for generating sphinx documentation
25 # USAGE: SALOME_ADD_SPHINX_DOC(sphinx_type [path1 path2 ... ])
29 # sphinx_type: IN - type of the sphinx generator, use one of the following types:
31 # html - to make standalone HTML files
32 # dirhtml - to make HTML files named index.html in directories
33 # singlehtml - to make a single large HTML file
34 # pickle - to make pickle files
35 # json - to make JSON files
36 # htmlhelp - to make HTML files and a HTML help project
37 # qthelp - to make HTML files and a qthelp project"
38 # devhelp to make HTML files and a Devhelp project"
39 # epub to make an epub"
40 # latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
41 # latexpdf to make LaTeX files and run them through pdflatex"
42 # text to make text files"
43 # man to make manual pages"
44 # texinfo to make Texinfo files"
45 # info to make Texinfo files and run them through makeinfo
46 # gettext to make PO message catalogs"
47 # changes to make an overview of all changed/added/deprecated items
48 # linkcheck to check all external links for integrity"
49 # doctest to run all doctests embedded in the documentation (if enabled)\
51 # sphinx_name: IN - documentation target name
53 # path<N> : IN - optional arguments, list of the paths whese contains the sphinx configuration files.
55 # ADDITIONAL SETTINGS:
57 # Also you can set these variables to define additional sphinx settings:
59 # SPHINXOPTS - sphinx executable options
60 # PAPER - LaTeX paper type ("a4" by default)
61 # BUILDDIR - local sphinx build directory ("_build" by default)
62 #----------------------------------------------------------------------------
64 MACRO(SALOME_ADD_SPHINX_DOC sphinx_type sphinx_name)
66 # Get type and additional settings
67 SET(SPHINX_TYPE ${sphinx_type})
68 IF(${SPHINX_TYPE} STREQUAL "")
70 ENDIF(${SPHINX_TYPE} STREQUAL "")
72 IF("${PAPER}" STREQUAL "")
76 IF("${BUILDDIR}" STREQUAL "")
80 # Initialize internal variables
81 SET(PAPEROPT_a4 -D latex_paper_size=a4)
82 SET(PAPEROPT_letter -D latex_paper_size=letter)
83 SET(ALLSPHINXOPTS -d ${BUILDDIR}/doctrees ${PAPEROPT_${PAPER}} ${SPHINXOPTS})
84 SET(I18NSPHINXOPTS ${PAPEROPT_${PAPER}} ${SPHINXOPTS})
86 FOREACH(value ${ARGN})
87 SET(ALLSPHINXOPTS ${ALLSPHINXOPTS} ${value})
88 SET(I18NSPHINXOPTS ${I18NSPHINXOPTS} ${value})
89 ENDFOREACH(value ${ARGN})
91 # Set internal out directory
92 SET(_OUT_DIR ${sphinx_type})
93 IF(${sphinx_type} STREQUAL "gettext")
95 SET(ALLSPHINXOPTS ${I18NSPHINXOPTS})
96 ENDIF(${sphinx_type} STREQUAL "gettext")
98 # Build sphinx command
99 SET(_CMD_OPTIONS -b ${sphinx_type} ${ALLSPHINXOPTS} ${BUILDDIR}/${_OUT_DIR})
101 # This macro mainly prepares the environment in which sphinx should run:
102 # this sets the PYTHONPATH and LD_LIBRARY_PATH to include OMNIORB, DOCUTILS, SETUPTOOLS, etc ...
103 SALOME_GENERATE_ENVIRONMENT_SCRIPT(_cmd env_script "${SPHINX_EXECUTABLE}" "${_CMD_OPTIONS}")
104 ADD_CUSTOM_TARGET(${sphinx_name} ALL ${_cmd})
106 ENDMACRO(SALOME_ADD_SPHINX_DOC sphinx_type)