# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+# This file mainly prepares the environment in which sphinx should run:
+# this sets the PYTHONPATH and LD_LIBRARY_PATH to include OMNIORB, DOCUTILS, SETUPTOOLS, etc ...
+
+# Prepare Sphinx options
SET(SPHINXOPTS
)
SET(SOURCEDIR
SALOME_CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in" "${CMAKE_CURRENT_BINARY_DIR}/conf.py")
+# Write the shell file preparing the env for the Sphinx run:
+# This uses the paths to SPHINX, DOCUTILS and SETUPTOOLS:
+# Their root dir were found when looking for Sphinx (FindSalomeSphinx.cmake):
+
+SET(_pydir python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
IF(WINDOWS)
- STRING(REPLACE "/" "\\" SCR "@SET PYTHONPATH=${CMAKE_INSTALL_PREFIX}\\lib\\python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}\\site-packages\\salome\;%PYTHONPATH%
+ STRING(REPLACE "/" "\\" SCR "@SET PYTHONPATH=${CMAKE_INSTALL_PREFIX}\\lib\\${_pydir}\\site-packages\\salome\;%PYTHONPATH%
@SET PYTHONPATH=${CMAKE_INSTALL_PREFIX}\\bin\\salome\;%PYTHONPATH%
@SET PATH=${CMAKE_INSTALL_PREFIX}\\lib\\salome\;%PATH%
@SET PYTHONPATH=${OMNIORB_ROOT_DIR}\\lib\\x86_win32\;%PYTHONPATH%
SET(EXT "bat")
SET(CALL_STR "call")
ELSE(WINDOWS)
- SET(SCR " export PYTHONPATH=${CMAKE_INSTALL_PREFIX}/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages/salome:\${PYTHONPATH}
+ SET(SCR " export PYTHONPATH=${CMAKE_INSTALL_PREFIX}/lib/${_pydir}/site-packages/salome:\${PYTHONPATH}
export PYTHONPATH=${CMAKE_INSTALL_PREFIX}/bin/salome:\${PYTHONPATH}
export LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib/salome:\${LD_LIBRARY_PATH}
export PYTHONPATH=${OMNIORB_ROOT_DIR}/lib:\${PYTHONPATH}
- export PYTHONPATH=${OMNIORB_ROOT_DIR}/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages:\${PYTHONPATH}
+ export PYTHONPATH=${OMNIORB_ROOT_DIR}/lib/${_pydir}/site-packages:\${PYTHONPATH}
export PYTHONPATH=${OMNIORBPY_ROOT_DIR}/lib:\${PYTHONPATH}
- export PYTHONPATH=${OMNIORBPY_ROOT_DIR}/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages:\${PYTHONPATH}
+ export PYTHONPATH=${OMNIORBPY_ROOT_DIR}/lib/${_pydir}/site-packages:\${PYTHONPATH}
export LD_LIBRARY_PATH=${OMNIORB_ROOT_DIR}/lib:\${LD_LIBRARY_PATH}
- ")
+ export PYTHONPATH=${SETUPTOOLS_ROOT_DIR}/lib/${_pydir}/site-packages:\${PYTHONPATH}
+ export PYTHONPATH=${DOCUTILS_ROOT_DIR}/lib/${_pydir}/site-packages:\${PYTHONPATH}
+ export PYTHONPATH=${SPHINX_ROOT_DIR}/lib/${_pydir}/site-packages:\${PYTHONPATH}"
+ )
SET(EXT "sh")
SET(CALL_STR ".")
ENDIF(WINDOWS)
#
# The caller of this macro might set SPHINX_PYTHONPATH to provide a PYTHONPATH with
# which the sphinx command should be ran.
+# Note the environment is also overriden in
+# doc/docutils/CMakeLists.txt
+# with the creation of a dedicated launcher script.
#
SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(Sphinx SPHINX_EXECUTABLE 2)
+# Also retrieve paths to DOCUTILS and SETUPTOOLS:
+SET(SETUPTOOLS_ROOT_DIR "$ENV{SETUPTOOLS_ROOT_DIR}" CACHE PATH "Path to the Setuptools installation")
+SET(DOCUTILS_ROOT_DIR "$ENV{DOCUTILS_ROOT_DIR}" CACHE PATH "Path to the Setuptools installation")
+
# Ensure the command is run with the given PYTHONPATH
-IF(WIN32 AND NOT CYGWIN)
- MESSAGE(WARNING "Sphinx windows command needs a proper PYTHONPATH to run.")
-ELSE()
- SET(SPHINX_EXECUTABLE /usr/bin/env PYTHONPATH="${SPHINX_PYTHONPATH}:$ENV{PYTHONPATH}" ${SPHINX_EXECUTABLE})
-ENDIF()
+#IF(WIN32 AND NOT CYGWIN)
+# MESSAGE(WARNING "Sphinx windows command needs a proper PYTHONPATH to run.")
+#ELSE()
+# SET(SPHINX_EXECUTABLE /usr/bin/env PYTHONPATH="${SPHINX_PYTHONPATH}:$ENV{PYTHONPATH}" ${SPHINX_EXECUTABLE})
+#ENDIF()
MARK_AS_ADVANCED(SPHINX_EXECUTABLE)
-#message("SPHINX_EXECUTABLE : ${SPHINX_EXECUTABLE}")