From: rnv Date: Wed, 1 Feb 2012 12:19:44 +0000 (+0000) Subject: 1) Build documentation using sphinx. X-Git-Tag: V6_5_0a1~52 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b81928114eac92d3055bef0b81d57adc3b886244;p=modules%2Fkernel.git 1) Build documentation using sphinx. 2) win32 compilation of the Geometry module. --- diff --git a/salome_adm/cmake_files/FindSPHINX.cmake b/salome_adm/cmake_files/FindSPHINX.cmake new file mode 100755 index 000000000..b11663161 --- /dev/null +++ b/salome_adm/cmake_files/FindSPHINX.cmake @@ -0,0 +1,98 @@ +# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE +# +# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +# ------ +MESSAGE(STATUS "Check for sphinx ...") +# ------ + +IF(SPHINX_IS_MANDATORY STREQUAL 0) + SET(SPHINX_IS_MANDATORY 0) + SET(SPHINX_IS_OPTIONAL 1) +ENDIF(SPHINX_IS_MANDATORY STREQUAL 0) +IF(SPHINX_IS_OPTIONAL STREQUAL 0) + SET(SPHINX_IS_MANDATORY 1) + SET(SPHINX_IS_OPTIONAL 0) +ENDIF(SPHINX_IS_OPTIONAL STREQUAL 0) +IF(NOT SPHINX_IS_MANDATORY AND NOT SPHINX_IS_OPTIONAL) + SET(SPHINX_IS_MANDATORY 0) + SET(SPHINX_IS_OPTIONAL 1) +ENDIF(NOT SPHINX_IS_MANDATORY AND NOT SPHINX_IS_OPTIONAL) + +# ------ + +SET(SPHINX_STATUS 1) +IF(WITHOUT_SPHINX OR WITH_SPHINX STREQUAL 0) + SET(SPHINX_STATUS 0) + MESSAGE(STATUS "sphinx disabled from command line.") +ENDIF(WITHOUT_SPHINX OR WITH_SPHINX STREQUAL 0) + +# ------ + +IF(SPHINX_STATUS) + IF(WITH_SPHINX) + SET(SPHINX_ROOT_USER ${WITH_SPHINX}) + ENDIF(WITH_SPHINX) + IF(NOT SPHINX_ROOT_USER) + SET(SPHINX_ROOT_USER $ENV{SPHINX_ROOT}) + ENDIF(NOT SPHINX_ROOT_USER) + IF(NOT SPHINX_ROOT_USER) + SET(SPHINX_ROOT_USER $ENV{SPHINXHOME}) + ENDIF(NOT SPHINX_ROOT_USER) +ENDIF(SPHINX_STATUS) + +# ------ + +IF(SPHINX_STATUS) + SET(SPHINX_EXECUTABLE_TO_FIND sphinx-build) + IF(SPHINX_ROOT_USER) + SET(BINDIR) + IF(WINDOWS) + SET(BINDIR ${SPHINX_ROOT_USER}/Scripts) + ELSE(WINDOWS) + SET(BINDIR ${SPHINX_ROOT_USER}/bin) + ENDIF(WINDOWS) + FIND_PROGRAM(SPHINX_EXECUTABLE ${SPHINX_EXECUTABLE_TO_FIND} PATHS ${BINDIR} NO_DEFAULT_PATH) + ELSE(SPHINX_ROOT_USER) + FIND_PROGRAM(SPHINX_EXECUTABLE ${SPHINX_EXECUTABLE_TO_FIND}) + ENDIF(SPHINX_ROOT_USER) + IF(SPHINX_EXECUTABLE) + MESSAGE(STATUS "${SPHINX_EXECUTABLE_TO_FIND} found: ${SPHINX_EXECUTABLE}") + ELSE(SPHINX_EXECUTABLE) + MESSAGE(STATUS "${SPHINX_EXECUTABLE_TO_FIND} not found, try to use WITH_SPHINX option or SPHINX_ROOT (or SPHINXHOME) environment variable") + SET(SPHINX_STATUS 0) + ENDIF(SPHINX_EXECUTABLE) +ENDIF(SPHINX_STATUS) + +# ---- + +IF(SPHINX_STATUS) + SET(SPHINX_IS_OK 1) +ELSE(SPHINX_STATUS) + SET(SPHINX_IS_OK 0) + IF(SPHINX_IS_MANDATORY) + MESSAGE(FATAL_ERROR "sphinx not found ... mandatory ... abort") + ELSE(SPHINX_IS_MANDATORY) + MESSAGE(STATUS "sphinx not found ... optional ... disabled") + ENDIF(SPHINX_IS_MANDATORY) +ENDIF(SPHINX_STATUS) + +# ---- diff --git a/salome_adm/cmake_files/Makefile.am b/salome_adm/cmake_files/Makefile.am index 4d2ef90bb..b66106db8 100644 --- a/salome_adm/cmake_files/Makefile.am +++ b/salome_adm/cmake_files/Makefile.am @@ -38,5 +38,6 @@ FindPLATFORM.cmake \ FindPTHREADS.cmake \ FindPYTHON.cmake \ FindSWIG.cmake \ +FindSPHINX.cmake \ install_python_from_idl.cmake \ install_and_compile_python_file.cmake diff --git a/salome_adm/cmake_files/am2cmake.py b/salome_adm/cmake_files/am2cmake.py index 03a650dab..8c1da8114 100644 --- a/salome_adm/cmake_files/am2cmake.py +++ b/salome_adm/cmake_files/am2cmake.py @@ -318,6 +318,7 @@ class CMakeFile(object): "IGESExport", "IGESImport", "MeasureGUI", + "Material", "NMTDS", "NMTTools", "OCC2VTK", @@ -496,6 +497,7 @@ class CMakeFile(object): INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindDOXYGEN.cmake) INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindMPI.cmake) INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindLIBBATCH.cmake) + INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindSPHINX.cmake) """) pass else: @@ -576,8 +578,15 @@ class CMakeFile(object): INCLUDE(${GEOM_ROOT_DIR}/adm_local/cmake_files/FindGEOM.cmake) INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMEDFILE.cmake) INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMED.cmake) + INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindSPHINX.cmake) """) pass + if self.module == "geom": + newlines.append(""" + INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindSPHINX.cmake) + """) + pass + if self.module == "netgenplugin": newlines.append(""" SET(GEOM_ROOT_DIR $ENV{GEOM_ROOT_DIR}) @@ -631,7 +640,7 @@ class CMakeFile(object): newlines.append(""" INCLUDE(${CMAKE_SOURCE_DIR}/adm/cmake/FindEXPAT.cmake) INCLUDE(${CMAKE_SOURCE_DIR}/adm/cmake/FindGRAPHVIZ.cmake) - INCLUDE(${CMAKE_SOURCE_DIR}/adm/cmake/FindSPHINX.cmake) + INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindSPHINX.cmake) """) pass if self.module == "hxx2salome": @@ -1226,7 +1235,33 @@ class CMakeFile(object): newlines.append(r""" ADD_CUSTOM_TARGET(html_docs ${SPHINX_EXECUTABLE} %s -c ${CMAKE_BINARY_DIR}/doc -b html ${ALLSPHINXOPTS} html COMMAND ${PYTHON_EXECUTABLE} -c \"import shutil\;shutil.rmtree('''%s''', True)\;shutil.copytree('''${CMAKE_CURRENT_BINARY_DIR}/html''', '''%s''')\" - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})"""%(params, doc_gui_destination, doc_gui_destination)) + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})"""%(params, doc_gui_destination, doc_gui_destination)) + elif mod in ['kernel', 'smesh', 'geom'] and operator.contains(self.root, upmod + '_SRC'+path.sep+'doc'+path.sep+'docutils'): + from sys import platform + params = "" + ext = "" + prf = "" + if platform == "win32": + params = '-Q'; + ext = "bat" + prf = "call" + else: + ext = "sh" + prf = ". " + doc_gui_destination = "${CMAKE_INSTALL_PREFIX}/share/doc/salome/tui/%s/docutils"%(upmod) + scr = self.writeEnvScript(upmod) + newlines.append(r""" + IF(WINDOWS) + STRING(REPLACE "/" "\\" SCR "%s") + ELSE(WINDOWS) + SET(SCR "%s") + ENDIF(WINDOWS) + FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/env_s.%s "${SCR}") + ADD_CUSTOM_TARGET(html_docs %s ${CMAKE_CURRENT_BINARY_DIR}/env_s.%s && ${SPHINX_EXECUTABLE} %s -c ${CMAKE_BINARY_DIR}/doc/docutils -W -b html ${ALLSPHINXOPTS} html + COMMAND ${PYTHON_EXECUTABLE} -c \"import shutil\;shutil.rmtree('''%s''', True)\;shutil.copytree('''${CMAKE_CURRENT_BINARY_DIR}/html''', '''%s''')\" + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})"""%(scr,scr,ext,prf,ext,params, doc_gui_destination, doc_gui_destination)) + + # -- @@ -2385,7 +2420,72 @@ class CMakeFile(object): f.write(self.content) f.close() return - + + def writeEnvScript(self, upmod): + from sys import platform, version_info + p_version = """%s.%s"""%(version_info[0],version_info[1]) + python_path ="PYTHONPATH" + path = "" + begin = "" + end = "" + delim = "" + cmd = "" + pdir = "" + omni = "" + omni_py = "" + if platform == "win32" : + path = "PATH" + begin = "%" + end = "%" + delim = ";" + cmd = "@SET " + omni = "/x86_win32" + omni_py = "/python" + pdir = "PDIR" + else: + path = "LD_LIBRARY_PATH" + begin = "\${" + end = "}" + delim = ":" + cmd = "export " + omni_py = "/python" + p_version + "/" + "site-packages" + pdir = "INST_ROOT" + + + path_ = begin + path + end + root_dir_ = begin + upmod + "_ROOT_DIR" + end + python_path_ = begin + python_path + end + _python_path_ = delim + python_path_+ "\n" + _path_ = delim + path_+ "\n" + _pdir = begin + pdir + end + + + script = cmd + " " + python_path + "=" + root_dir_+"/lib/python" + p_version \ + + "/site-packages/salome" + _python_path_ + + script = script + cmd + " " + python_path + "=" + root_dir_+"/bin/salome" + \ + _python_path_ + + script = script + cmd + " "+ path + "=" + root_dir_+"/lib/salome"+ _path_ + + if upmod == "KERNEL" : + script = script + cmd + " " + python_path + "=" + _pdir + \ + "/omniORB-4.1.5/lib" + omni + _python_path_ + + script = script + cmd + " " + python_path + "=" + _pdir + \ + "/omniORB-4.1.5/lib" + omni_py + _python_path_ + + script = script + cmd + " "+ path + "=" + _pdir+ "/omniORB-4.1.5/lib" + \ + omni + _path_ + + if upmod == "GEOM" : + script = self.writeEnvScript("KERNEL") + script + script = self.writeEnvScript("GUI") + script + + if upmod == "SMESH" : + script = self.writeEnvScript("GEOM") + script + + return script pass def convertAmFile(the_root, root, dirs, files, f, module):