Salome HOME
CMake: Edition accumulation of LD_LIBRARY_PATH, PATH and PYTHONPATH
[modules/smesh.git] / src / Tools / Verima / Doc / CMakeLists.txt
1 # Copyright (C) 2012-2013  CEA/DEN, EDF R&D, OPEN CASCADE
2 #
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.
7 #
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.
12 #
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
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19
20 # This file mainly prepares the environment in which sphinx should run:
21 #  this sets the PYTHONPATH and LD_LIBRARY_PATH to include OMNIORB, DOCUTILS, SETUPTOOLS, etc ...
22
23 # Prepare Sphinx options
24 SET(SPHINXOPTS
25 )
26 SET(SOURCEDIR
27   ${CMAKE_CURRENT_SOURCE_DIR}
28 )
29 SET(PAPEROPT_a4
30   -D
31   latex_paper_size=a4
32 )
33 SET(ALLSPHINXOPTS
34   -d
35   doctrees
36   ${PAPEROPT_a4}
37   ${SPHINXOPTS}
38   ${SOURCEDIR}
39 )
40
41 SALOME_CONFIGURE_FILE(conf.py.in conf.py)                
42
43 # Write the shell file preparing the env for the Sphinx run:
44 #    This uses the paths to SPHINX, DOCUTILS and SETUPTOOLS:
45 #    Their root dir were found when looking for Sphinx (FindSalomeSphinx.cmake):
46
47 SET(_pydir python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
48 IF(WIN32)
49   STRING(REPLACE "/" "\\" SCR "@SET PYTHONPATH=${CMAKE_INSTALL_PREFIX}\\lib\\${_pydir}\\site-packages\\salome\;%PYTHONPATH%
50   @SET PYTHONPATH=${CMAKE_INSTALL_PREFIX}\\bin\\salome\;%PYTHONPATH%
51   @SET PATH=${CMAKE_INSTALL_PREFIX}\\lib\\salome\;%PATH%
52   @SET PYTHONPATH=${CMAKE_INSTALL_PREFIX}\\${SALOME_INSTALL_PYTHON}\;%PYTHONPATH%
53   @SET PYTHONPATH=${CMAKE_INSTALL_PREFIX}\\${SALOME_INSTALL_PYTHON_SHARED}\;%PYTHONPATH%
54   @SET PYTHONPATH=${HDF5_ROOT_DIR}\\lib\;%PYTHONPATH%
55   @SET PYTHONPATH=${MPI_ROOT_DIR}\\lib\;%PYTHONPATH%
56
57   @SET PYTHONPATH=${KERNEL_ROOT_DIR}\\bin\\salome\;%PYTHONPATH%
58   @SET PATH=${KERNEL_ROOT_DIR}\\lib\\salome\;%PATH%
59   @SET PYTHONPATH=${KERNEL_ROOT_DIR}\\${SALOME_INSTALL_PYTHON}\;%PYTHONPATH%
60   @SET PYTHONPATH=${KERNEL_ROOT_DIR}\\${SALOME_INSTALL_PYTHON_SHARED}\;%PYTHONPATH%
61
62   @SET PYTHONPATH=${OMNIORB_ROOT_DIR}\\lib\\x86_win32\;%PYTHONPATH%
63   @SET PYTHONPATH=${OMNIORB_ROOT_DIR}\\lib\\python\;%PYTHONPATH%
64   @SET PATH=${OMNIORB_ROOT_DIR}\\lib\\x86_win32\;%PATH%
65   ")
66   SET(EXT "bat")
67   SET(CALL_STR "call")
68 ELSE(WIN32)
69   SET(SCR  " export PYTHONPATH=${CMAKE_INSTALL_PREFIX}/lib/${_pydir}/site-packages/salome:\${PYTHONPATH}
70   export PYTHONPATH=${CMAKE_INSTALL_PREFIX}/bin/salome:\${PYTHONPATH}
71   export LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib/salome:\${LD_LIBRARY_PATH}
72   export PYTHONPATH=${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_PYTHON}:\${PYTHONPATH}
73   export PYTHONPATH=${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_PYTHON_SHARED}:\${PYTHONPATH}
74   export PYTHONPATH=${HDF5_ROOT_DIR}/lib:\${PYTHONPATH}
75   export PYTHONPATH=${MPI_ROOT_DIR}/lib:\${PYTHONPATH}
76
77   export PYTHONPATH=${KERNEL_ROOT_DIR}/bin/salome:\${PYTHONPATH}
78   export LD_LIBRARY_PATH=${KERNEL_ROOT_DIR}/lib/salome:\${LD_LIBRARY_PATH}
79   export PYTHONPATH=${KERNEL_ROOT_DIR}/${SALOME_INSTALL_PYTHON}:\${PYTHONPATH}
80   export PYTHONPATH=${KERNEL_ROOT_DIR}/${SALOME_INSTALL_PYTHON_SHARED}:\${PYTHONPATH}
81
82   export PYTHONPATH=${OMNIORB_ROOT_DIR}/lib:\${PYTHONPATH}
83   export PYTHONPATH=${OMNIORB_ROOT_DIR}/lib/${_pydir}/site-packages:\${PYTHONPATH}
84   export PYTHONPATH=${OMNIORB_ROOT_DIR}/lib64/${_pydir}/site-packages:\${PYTHONPATH}
85   export PYTHONPATH=${OMNIORBPY_ROOT_DIR}/lib:\${PYTHONPATH}
86   export PYTHONPATH=${OMNIORBPY_ROOT_DIR}/lib/${_pydir}/site-packages:\${PYTHONPATH}
87   export PYTHONPATH=${OMNIORBPY_ROOT_DIR}/lib64/${_pydir}/site-packages:\${PYTHONPATH}
88   export LD_LIBRARY_PATH=${OMNIORB_ROOT_DIR}/lib:\${LD_LIBRARY_PATH}
89   export PYTHONPATH=${SETUPTOOLS_ROOT_DIR}/lib/${_pydir}/site-packages:\${PYTHONPATH}
90   export PYTHONPATH=${DOCUTILS_ROOT_DIR}/lib/${_pydir}/site-packages:\${PYTHONPATH}
91   export PYTHONPATH=${SPHINX_ROOT_DIR}/lib/${_pydir}/site-packages:\${PYTHONPATH}
92 "
93   )
94   SET(EXT "sh")
95   SET(CALL_STR ".")
96 ENDIF(WIN32)
97
98 FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/env_s.${EXT} "${SCR}")
99
100 ADD_CUSTOM_TARGET(html_docs_Verima ${CALL_STR} ${CMAKE_CURRENT_BINARY_DIR}/env_s.${EXT} && ${SPHINX_EXECUTABLE} -c ${PROJECT_BINARY_DIR}/doc/docutils -b html ${ALLSPHINXOPTS} docutils
101 )
102
103 INSTALL(CODE "EXECUTE_PROCESS(COMMAND \"${CMAKE_COMMAND}\" --build ${PROJECT_BINARY_DIR} --target html_docs_Verima)")
104 INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/docutils/ DESTINATION ${SALOME_INSTALL_DOC}/gui/SMESH/Verima)