Salome HOME
This commit was generated by cvs2git to create branch 'V7_main'.
authoradmin <salome-admin@opencascade.com>
Fri, 8 Nov 2013 12:37:46 +0000 (12:37 +0000)
committeradmin <salome-admin@opencascade.com>
Fri, 8 Nov 2013 12:37:46 +0000 (12:37 +0000)
Cherrypick from master 2013-11-08 12:37:45 UTC rnv <rnv@opencascade.com> 'Implementation of the impruvement 0022256: [CEA 866] Add item "Developers" in menu "Help".':
    CMakeLists.txt
    CMakeModules/FindGraphviz.cmake
    CMakeModules/FindSalomeDoxygen.cmake
    CMakeModules/FindSalomeGraphviz.cmake
    CMakeModules/FindSalomeSphinx.cmake
    CMakeModules/FindSphinx.cmake
    CMakeModules/SalomeDocumentationMacros.cmake
    CMakeModules/SalomeMacros.cmake
    dev/CMakeLists.txt
    dev/cmake/CMakeLists.txt
    dev/cmake/source/config.rst
    dev/cmake/source/pkg.rst
    dev/cmake/source/skeleton.rst
    dev/cmake/source/various.rst
    dev/git/CMakeLists.txt
    dev/git/Git_Simple_Write_Procedure.rst
    dev/git/Switch-To-GIT-2013-06.docx
    dev/git/conf.py
    extra/CMakeLists.txt
    gui/CMakeLists.txt
    tui/CMakeLists.txt

21 files changed:
CMakeLists.txt [new file with mode: 0644]
CMakeModules/FindGraphviz.cmake [new file with mode: 0644]
CMakeModules/FindSalomeDoxygen.cmake [new file with mode: 0644]
CMakeModules/FindSalomeGraphviz.cmake [new file with mode: 0644]
CMakeModules/FindSalomeSphinx.cmake [new file with mode: 0644]
CMakeModules/FindSphinx.cmake [new file with mode: 0644]
CMakeModules/SalomeDocumentationMacros.cmake [new file with mode: 0644]
CMakeModules/SalomeMacros.cmake [new file with mode: 0755]
dev/CMakeLists.txt [new file with mode: 0755]
dev/cmake/CMakeLists.txt [new file with mode: 0644]
dev/cmake/source/config.rst [new file with mode: 0644]
dev/cmake/source/pkg.rst [new file with mode: 0644]
dev/cmake/source/skeleton.rst [new file with mode: 0644]
dev/cmake/source/various.rst [new file with mode: 0644]
dev/git/CMakeLists.txt [new file with mode: 0644]
dev/git/Git_Simple_Write_Procedure.rst [new file with mode: 0644]
dev/git/Switch-To-GIT-2013-06.docx [new file with mode: 0644]
dev/git/conf.py [new file with mode: 0644]
extra/CMakeLists.txt [new file with mode: 0644]
gui/CMakeLists.txt [new file with mode: 0644]
tui/CMakeLists.txt [new file with mode: 0644]

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644 (file)
index 0000000..154d1e5
--- /dev/null
@@ -0,0 +1,76 @@
+# Copyright (C) 2012-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# 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
+#
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8 FATAL_ERROR)
+INCLUDE(CMakeDependentOption)
+
+PROJECT(SalomeDOCUMENTATION)
+
+# Versioning
+# ========
+# Project name, upper case
+STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
+
+SET(${PROJECT_NAME_UC}_MAJOR_VERSION 7)
+SET(${PROJECT_NAME_UC}_MINOR_VERSION 2)
+SET(${PROJECT_NAME_UC}_PATCH_VERSION 0)
+SET(${PROJECT_NAME_UC}_VERSION
+  ${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION})
+SET(${PROJECT_NAME_UC}_VERSION_DEV 1)
+
+# Our own set of macros:
+# ==================
+LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMakeModules")
+INCLUDE(SalomeMacros)
+
+
+# Find prerequisites needed to documentation generation
+# ==================================================
+FIND_PACKAGE(SalomeDoxygen)
+FIND_PACKAGE(SalomeGraphviz)
+FIND_PACKAGE(SalomeSphinx)
+
+# Directories
+# =========
+SET(SALOME_DOCUMENTATION_EXTRA_INSTALL extra CACHE PATH "Install path: SALOME Extra documentation")
+SET(SALOME_DOCUMENTATION_GIT_INSTALL dev/git CACHE PATH "Install path: SALOME Git documentation")
+SET(SALOME_DOCUMENTATION_CMAKE_INSTALL dev/cmake CACHE PATH "Install path: SALOME CMake documentation")
+SET(SALOME_DOCUMENTATION_GUI_INSTALL gui CACHE PATH "Install path: SALOME GUI documentation")
+SET(SALOME_DOCUMENTATION_TUI_INSTALL tui CACHE PATH "Install path: SALOME TUI documentation")
+
+MARK_AS_ADVANCED(
+ SALOME_DOCUMENTATION_EXTRA_INSTALL
+ SALOME_DOCUMENTATION_GIT_INSTALL
+ SALOME_DOCUMENTATION_CMAKE_INSTALL
+ SALOME_DOCUMENTATION_GUI_INSTALL 
+ SALOME_DOCUMENTATION_TUI_INSTALL
+)
+
+# Sources 
+# =====
+ADD_SUBDIRECTORY(tui)
+ADD_SUBDIRECTORY(gui)
+ADD_SUBDIRECTORY(extra)
+ADD_SUBDIRECTORY(dev)
+
+# Install rules
+# ==========
+FILE(GLOB COMMON_HTML_FILES "${CMAKE_CURRENT_SOURCE_DIR}/*.html")
+FILE(GLOB COMMON_PNG_FILES "${CMAKE_CURRENT_SOURCE_DIR}/*.png")
+
+INSTALL(FILES ${COMMON_HTML_FILES} ${COMMON_PNG_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX})
diff --git a/CMakeModules/FindGraphviz.cmake b/CMakeModules/FindGraphviz.cmake
new file mode 100644 (file)
index 0000000..6eb1e5a
--- /dev/null
@@ -0,0 +1,56 @@
+# - Graphviz detection
+#
+# Output variables: GRAPHVIZ_EXECUTABLE   - where is executable 'dot' takes place.
+#                  GRAPHVIZ_INCLUDE_DIRS - where to find headers.
+#                  GRAPHVIZ_LIBRARIES    - where to get libraries.
+#                  GRAPHVIZ_FOUND        - True if Graphiz was found.
+#
+###########################################################################
+# Copyright (C) 2007-2013  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
+#
+###########################################################################
+
+FIND_PROGRAM(GRAPHVIZ_EXECUTABLE dot)
+
+FIND_PATH(GRAPHVIZ_INCLUDE_DIR NAMES graphviz/graph.h)
+SET(GRAPHVIZ_INCLUDE_DIRS ${GRAPHVIZ_INCLUDE_DIR} ${GRAPHVIZ_INCLUDE_DIR}/graphviz)
+
+FIND_LIBRARY(GRAPHVIZ_cdt_LIBRARY      NAMES cdt PATH_SUFFIXES bin)
+FIND_LIBRARY(GRAPHVIZ_cgraph_LIBRARY   NAMES cgraph PATH_SUFFIXES bin)
+FIND_LIBRARY(GRAPHVIZ_graph_LIBRARY    NAMES graph PATH_SUFFIXES bin)
+FIND_LIBRARY(GRAPHVIZ_gvc_LIBRARY      NAMES gvc PATH_SUFFIXES bin)
+FIND_LIBRARY(GRAPHVIZ_pathplan_LIBRARY NAMES pathplan PATH_SUFFIXES bin)
+
+SET(GRAPHVIZ_LIBRARIES 
+  ${GRAPHVIZ_cdt_LIBRARY}
+  ${GRAPHVIZ_cgraph_LIBRARY} 
+  ${GRAPHVIZ_graph_LIBRARY} 
+  ${GRAPHVIZ_gvc_LIBRARY}
+  ${GRAPHVIZ_pathplan_LIBRARY}
+  )
+
+# Handle the standard arguments of the find_package() command:
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Graphviz REQUIRED_VARS 
+                                          GRAPHVIZ_EXECUTABLE 
+                                          GRAPHVIZ_LIBRARIES 
+                                          GRAPHVIZ_INCLUDE_DIRS)
diff --git a/CMakeModules/FindSalomeDoxygen.cmake b/CMakeModules/FindSalomeDoxygen.cmake
new file mode 100644 (file)
index 0000000..9da127e
--- /dev/null
@@ -0,0 +1,44 @@
+# Copyright (C) 2013  CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# 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
+#
+# Author: Adrien Bruneton
+#
+
+# Doxygen detection for salome
+#
+#  !! Please read the generic detection procedure in SalomeMacros.cmake !!
+#
+# Additional variables:
+#
+# DOXYGEN_SUPPORT_STL (string) [advanced] : set to YES if doxygen properly manages STL files
+#                     or to NO otherwise (version 1.4.4 or older); see description of 
+#                     BUILTIN_STL_SUPPORT configuration variable in the doxygen documentation
+
+SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(Doxygen DOXYGEN_EXECUTABLE 2)
+IF(DOXYGEN_FOUND)
+  IF(DOXYGEN_VERSION VERSION_LESS "1.4.5")
+    SET(DOXYGEN_SUPPORT_STL NO)
+  ELSE()
+    SET(DOXYGEN_SUPPORT_STL YES)
+  ENDIF()
+ENDIF()
+MARK_AS_ADVANCED(DOXYGEN_SUPPORT_STL)
+
+IF(DOXYGEN_FOUND)
+  SALOME_ACCUMULATE_ENVIRONMENT(PATH ${DOXYGEN_EXECUTABLE})
+ENDIF()
diff --git a/CMakeModules/FindSalomeGraphviz.cmake b/CMakeModules/FindSalomeGraphviz.cmake
new file mode 100644 (file)
index 0000000..ad3c3c4
--- /dev/null
@@ -0,0 +1,33 @@
+# Copyright (C) 2013  CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# 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
+#
+# Author: Adrien Bruneton
+#
+
+# Graphviz detection for salome
+#
+#  !! Please read the generic detection procedure in SalomeMacros.cmake !!
+#
+
+SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(Graphviz GRAPHVIZ_EXECUTABLE GRAPHVIZ_LIBRARIES GRAPHVIZ_INCLUDE_DIRS 2)
+MARK_AS_ADVANCED(GRAPHVIZ_EXECUTABLE GRAPHVIZ_LIBRARIES GRAPHVIZ_INCLUDE_DIRS)
+
+IF(GRAPHVIZ_FOUND)
+  SALOME_ACCUMULATE_ENVIRONMENT(PATH ${GRAPHVIZ_EXECUTABLE})
+  SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH ${GRAPHVIZ_LIBRARIES})
+ENDIF()
\ No newline at end of file
diff --git a/CMakeModules/FindSalomeSphinx.cmake b/CMakeModules/FindSalomeSphinx.cmake
new file mode 100644 (file)
index 0000000..f7d625c
--- /dev/null
@@ -0,0 +1,44 @@
+# Copyright (C) 2013  CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# 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
+#
+
+# Sphinx detection for Salome
+#
+#  !! Please read the generic detection procedure in SalomeMacros.cmake !!
+#
+
+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 Docutils installation")
+
+# Ensure the command is run with the given PYTHONPATH
+IF(WIN32 AND NOT CYGWIN)
+   MESSAGE(WARNING "Sphinx windows command not re-tested.")
+   SET(SPHINX_EXECUTABLE ${SPHINX_EXECUTABLE})
+ELSE()
+   SET(SPHINX_EXECUTABLE /usr/bin/env PYTHONPATH="${SPHINX_PYTHONPATH}:$$PYTHONPATH" ${SPHINX_EXECUTABLE})
+ENDIF()
+
+MARK_AS_ADVANCED(SPHINX_EXECUTABLE)
+
+IF(SPHINX_FOUND)
+  SALOME_ACCUMULATE_ENVIRONMENT(PATH ${SPHINX_EXECUTABLE})
+  SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH ${SPHINX_PYTHONPATH})
+ENDIF()
diff --git a/CMakeModules/FindSphinx.cmake b/CMakeModules/FindSphinx.cmake
new file mode 100644 (file)
index 0000000..9871e4d
--- /dev/null
@@ -0,0 +1,44 @@
+# - Sphinx detection
+#
+# Output variables:
+#   SPHINX_EXECUTABLE - path to the Sphinx executable
+#   SPHINX_PYTHONPATH - path to the Sphinx Python modules                 
+# 
+###########################################################################
+# Copyright (C) 2007-2013  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
+#
+###########################################################################
+
+FIND_PROGRAM(SPHINX_EXECUTABLE sphinx-build PATH_SUFFIXES Scripts)
+
+# Get root dir locally, going up two levels from the exec:
+GET_FILENAME_COMPONENT(_tmp_ROOT_DIR "${SPHINX_EXECUTABLE}" PATH)
+GET_FILENAME_COMPONENT(_tmp_ROOT_DIR "${_tmp_ROOT_DIR}" PATH)
+IF(WIN32)
+  SET(SPHINX_PYTHONPATH "${_tmp_ROOT_DIR}/lib/site-packages")
+ELSE()
+  SET(SPHINX_PYTHONPATH "${_tmp_ROOT_DIR}/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages")
+ENDIF()
+# Handle the standard arguments of the find_package() command:
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Sphinx REQUIRED_VARS SPHINX_EXECUTABLE)
+
diff --git a/CMakeModules/SalomeDocumentationMacros.cmake b/CMakeModules/SalomeDocumentationMacros.cmake
new file mode 100644 (file)
index 0000000..3ddbe5f
--- /dev/null
@@ -0,0 +1,106 @@
+# Copyright (C) 2012-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# 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
+#
+# Author: Roman NIKOLAEV
+#
+
+#----------------------------------------------------------------------------
+# SALOME_ADD_SPHINX_DOC is a macro useful for generating sphinx documentation
+#
+# USAGE: SALOME_ADD_SPHINX_DOC(sphinx_type [path1 path2 ... ])
+#
+# ARGUMENTS:
+#
+# sphinx_type: IN - type of the sphinx generator, use one of the following  types: 
+#
+#                       html       - to make standalone HTML files
+#                       dirhtml    - to make HTML files named index.html in directories
+#                       singlehtml - to make a single large HTML file
+#                       pickle     - to make pickle files
+#                       json       - to make JSON files
+#                       htmlhelp   - to make HTML files and a HTML help project
+#                       qthelp     - to make HTML files and a qthelp project"
+#                       devhelp    to make HTML files and a Devhelp project"
+#                       epub       to make an epub"
+#                       latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter
+#                       latexpdf   to make LaTeX files and run them through pdflatex"
+#                       text       to make text files"
+#                       man        to make manual pages"
+#                       texinfo    to make Texinfo files"
+#                       info       to make Texinfo files and run them through makeinfo
+#                       gettext    to make PO message catalogs"
+#                       changes    to make an overview of all changed/added/deprecated items
+#                       linkcheck  to check all external links for integrity"
+#                       doctest    to run all doctests embedded in the documentation (if enabled)\
+# 
+# sphinx_name: IN - documentation target name
+#
+# path<N>    : IN - optional arguments, list of the paths whese contains the sphinx configuration files.
+#
+# ADDITIONAL SETTINGS:
+#
+# Also you can set these variables to define additional sphinx settings:
+#
+#                        SPHINXOPTS    - sphinx executable options
+#                        PAPER         - LaTeX paper type          ("a4" by default)
+#                        BUILDDIR      - local sphinx build directory  ("_build" by default)
+#----------------------------------------------------------------------------
+
+MACRO(SALOME_ADD_SPHINX_DOC sphinx_type sphinx_name)
+
+# Get type and additional settings
+ SET(SPHINX_TYPE ${sphinx_type})
+ IF(${SPHINX_TYPE} STREQUAL "")
+   SET(SPHINX_TYPE html)
+ ENDIF(${SPHINX_TYPE} STREQUAL "")
+
+ IF("${PAPER}" STREQUAL "")
+   SET(PAPER a4)
+ ENDIF()
+ IF("${BUILDDIR}" STREQUAL "")
+   SET(BUILDDIR _build)
+ ENDIF()
+
+ # Initialize internal variables
+ SET(PAPEROPT_a4 -D latex_paper_size=a4)
+ SET(PAPEROPT_letter -D latex_paper_size=letter)
+ SET(ALLSPHINXOPTS  -d ${BUILDDIR}/doctrees ${PAPEROPT_${PAPER}} ${SPHINXOPTS})
+ SET(I18NSPHINXOPTS  ${PAPEROPT_${PAPER}} ${SPHINXOPTS})
+
+ FOREACH(value ${ARGN})
+   SET(ALLSPHINXOPTS ${ALLSPHINXOPTS} ${value})
+   SET(I18NSPHINXOPTS ${I18NSPHINXOPTS} ${value})
+ ENDFOREACH(value ${ARGN})
+
+ # Set internal out directory
+ SET(_OUT_DIR ${sphinx_type}) 
+ IF(${sphinx_type} STREQUAL "gettext")
+   SET(_OUT_DIR gettext)
+   SET(ALLSPHINXOPTS ${I18NSPHINXOPTS})
+ ENDIF(${sphinx_type} STREQUAL "gettext")
+
+ # Build sphinx command
+ SET(_CMD_OPTIONS -b ${sphinx_type} ${ALLSPHINXOPTS} ${BUILDDIR}/${_OUT_DIR})
+
+ # This macro mainly prepares the environment in which sphinx should run:
+ # this sets the PYTHONPATH and LD_LIBRARY_PATH to include OMNIORB, DOCUTILS, SETUPTOOLS, etc ...
+ SALOME_GENERATE_ENVIRONMENT_SCRIPT(_cmd env_script "${SPHINX_EXECUTABLE}" "${_CMD_OPTIONS}")
+ ADD_CUSTOM_TARGET(${sphinx_name} ALL ${_cmd})
+
+ENDMACRO(SALOME_ADD_SPHINX_DOC sphinx_type)
\ No newline at end of file
diff --git a/CMakeModules/SalomeMacros.cmake b/CMakeModules/SalomeMacros.cmake
new file mode 100755 (executable)
index 0000000..ea9604d
--- /dev/null
@@ -0,0 +1,840 @@
+# Copyright (C) 2012-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# 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
+#
+# Author: A.Geay, V. Sandler, A. Bruneton
+#
+
+#----------------------------------------------------------------------------
+# LIST_CONTAINS is a macro useful for determining whether a list has a 
+# particular entry
+#----------------------------------------------------------------------------
+MACRO(LIST_CONTAINS var value)
+  SET(${var})
+  FOREACH(value2 ${ARGN})
+    IF(${value} STREQUAL "${value2}")
+      SET(${var} TRUE)
+    ENDIF (${value} STREQUAL "${value2}")
+  ENDFOREACH (value2)
+ENDMACRO(LIST_CONTAINS)
+
+#----------------------------------------------------------------------------
+# The PARSE_ARGUMENTS macro will take the arguments of another macro and
+# define several variables.
+#
+# USAGE:  PARSE_ARGUMENTS(prefix arg_names options arg1 arg2...)
+#
+# ARGUMENTS:
+#
+# prefix: IN: a prefix to put on all variables it creates.
+#
+# arg_names: IN: a list of names.
+# For each item in arg_names, PARSE_ARGUMENTS will create a 
+# variable with that name, prefixed with prefix_. Each variable will be filled
+# with the arguments that occur after the given arg_name is encountered
+# up to the next arg_name or the end of the arguments. All options are
+# removed from these lists. PARSE_ARGUMENTS also creates a
+# prefix_DEFAULT_ARGS variable containing the list of all arguments up
+# to the first arg_name encountered.
+#
+# options: IN: a list of options.
+# For each item in options, PARSE_ARGUMENTS will create a
+# variable with that name, prefixed with prefix_. So, for example, if prefix is
+# MY_MACRO and options is OPTION1;OPTION2, then PARSE_ARGUMENTS will
+# create the variables MY_MACRO_OPTION1 and MY_MACRO_OPTION2. These
+# variables will be set to true if the option exists in the command line
+# or false otherwise.
+# arg_names and options lists should be quoted.
+#
+# The rest of PARSE_ARGUMENTS are arguments from another macro to be parsed.
+#----------------------------------------------------------------------------
+MACRO(PARSE_ARGUMENTS prefix arg_names option_names)
+  SET(DEFAULT_ARGS)
+  FOREACH(arg_name ${arg_names})
+    SET(${prefix}_${arg_name})
+  ENDFOREACH(arg_name)
+  FOREACH(option ${option_names})
+    SET(${prefix}_${option} FALSE)
+  ENDFOREACH(option)
+  SET(current_arg_name DEFAULT_ARGS)
+  SET(current_arg_list)
+  FOREACH(arg ${ARGN})
+    LIST_CONTAINS(is_arg_name ${arg} ${arg_names})
+    IF (is_arg_name)
+      SET(${prefix}_${current_arg_name} ${current_arg_list})
+      SET(current_arg_name ${arg})
+      SET(current_arg_list)
+    ELSE (is_arg_name)
+      LIST_CONTAINS(is_option ${arg} ${option_names})
+      IF (is_option)
+      SET(${prefix}_${arg} TRUE)
+      ELSE (is_option)
+      SET(current_arg_list ${current_arg_list} ${arg})
+      ENDIF (is_option)
+    ENDIF (is_arg_name)
+  ENDFOREACH(arg)
+  SET(${prefix}_${current_arg_name} ${current_arg_list})
+ENDMACRO(PARSE_ARGUMENTS)
+
+#----------------------------------------------------------------------------
+# SALOME_INSTALL_SCRIPTS is a macro useful for installing scripts.
+#
+# USAGE: SALOME_INSTALL_SCRIPTS(file_list path [WORKING_DIRECTORY dir] [DEF_PERMS])
+#
+# ARGUMENTS:
+# file_list: IN : list of files to be installed. This list should be quoted.
+# path: IN : full pathname for installing.
+# 
+# By default files to be installed as executable scripts.
+# If DEF_PERMS option is provided, than permissions for installed files are
+# only OWNER_WRITE, OWNER_READ, GROUP_READ, and WORLD_READ. 
+#----------------------------------------------------------------------------
+MACRO(SALOME_INSTALL_SCRIPTS file_list path)
+  PARSE_ARGUMENTS(SALOME_INSTALL_SCRIPTS "WORKING_DIRECTORY" "DEF_PERMS" ${ARGN})
+  SET(PERMS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+  IF(NOT SALOME_INSTALL_SCRIPTS_DEF_PERMS)
+    SET(PERMS ${PERMS} OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE)
+  ENDIF(NOT SALOME_INSTALL_SCRIPTS_DEF_PERMS)
+  FOREACH(file ${file_list})
+    SET(PREFIX "")
+    IF(IS_ABSOLUTE ${file})
+      GET_FILENAME_COMPONENT(file_name ${file} NAME)
+    ELSE()
+      SET(file_name ${file})
+      IF(SALOME_INSTALL_SCRIPTS_WORKING_DIRECTORY)
+       SET(PREFIX "${SALOME_INSTALL_SCRIPTS_WORKING_DIRECTORY}/")
+      ENDIF(SALOME_INSTALL_SCRIPTS_WORKING_DIRECTORY)
+    ENDIF(IS_ABSOLUTE ${file})
+    INSTALL(FILES ${PREFIX}${file} DESTINATION ${path} PERMISSIONS ${PERMS})
+    GET_FILENAME_COMPONENT(ext ${file} EXT)
+    IF(ext STREQUAL .py)
+      INSTALL(CODE "MESSAGE(STATUS \"py compiling ${CMAKE_INSTALL_PREFIX}/${path}/${file_name}\")")
+      INSTALL(CODE "SET(CMD \"import py_compile ; py_compile.compile('${CMAKE_INSTALL_PREFIX}/${path}/${file_name}')\")")
+      INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c \"\${CMD}\")")
+      INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -O -c \"\${CMD}\")")
+    ENDIF(ext STREQUAL .py)
+  ENDFOREACH(file ${file_list})
+ENDMACRO(SALOME_INSTALL_SCRIPTS)
+
+#----------------------------------------------------------------------------
+# SALOME_INSTALL_SCRIPTS is a macro useful for installing executable scripts.
+# ARGUMENTS:
+# PYFILE2COMPINST: IN : list of python files to be installed.
+# PYFILELOC: IN : full pathname for installing.
+# Permissions of installed files: OWNER_WRITE, OWNER_READ, GROUP_READ, and WORLD_READ
+#----------------------------------------------------------------------------
+MACRO(INSTALL_AND_COMPILE_PYTHON_FILE PYFILE2COMPINST PYFILELOC)
+  INSTALL(CODE "SET(PYTHON_FILE ${f})")
+  FOREACH(input ${PYFILE2COMPINST})
+    GET_FILENAME_COMPONENT(inputname ${input} NAME)
+    INSTALL(FILES ${input} DESTINATION ${CMAKE_INSTALL_PREFIX}/${PYFILELOC})
+    INSTALL(CODE "MESSAGE(STATUS \"py compiling ${CMAKE_INSTALL_PREFIX}/${PYFILELOC}/${inputname}\")")
+    INSTALL(CODE "SET(CMD \"import py_compile ; py_compile.compile('${CMAKE_INSTALL_PREFIX}/${PYFILELOC}/${inputname}')\")")
+    INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c \"\${CMD}\")")
+    INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -O -c \"\${CMD}\")")
+  ENDFOREACH(input ${PYFILE2COMPINST})
+ENDMACRO(INSTALL_AND_COMPILE_PYTHON_FILE PYFILE2COMPINST PYFILELOC)
+
+#----------------------------------------------------------------------------
+# SALOME_CONFIGURE_FILE is a macro useful for copying a file to another location 
+# and modify its contents.
+#
+# USAGE: SALOME_CONFIGURE_FILE(in_file out_file [INSTALL dir])
+#
+# ARGUMENTS:
+# in_file: IN : input file (if relative path is given, full file path is computed from current source dir).
+# out_file: IN : output file (if relative path is given, full file path is computed from current build dir).
+# If INSTALL is specified, then 'out_file' will be installed to the 'dir' directory.
+#----------------------------------------------------------------------------
+MACRO(SALOME_CONFIGURE_FILE IN_FILE OUT_FILE)
+  IF(IS_ABSOLUTE ${IN_FILE})
+    SET(_in_file ${IN_FILE})
+  ELSE()
+    SET(_in_file ${CMAKE_CURRENT_SOURCE_DIR}/${IN_FILE})
+  ENDIF()
+  IF(IS_ABSOLUTE  ${OUT_FILE})
+    SET(_out_file ${OUT_FILE})
+  ELSE()
+    SET(_out_file ${CMAKE_CURRENT_BINARY_DIR}/${OUT_FILE})
+  ENDIF()
+  MESSAGE(STATUS "Creation of ${_out_file}")
+  CONFIGURE_FILE(${_in_file} ${_out_file} @ONLY)
+  PARSE_ARGUMENTS(SALOME_CONFIGURE_FILE "INSTALL" "" ${ARGN})
+  IF(SALOME_CONFIGURE_FILE_INSTALL)
+    INSTALL(FILES ${_out_file} DESTINATION ${SALOME_CONFIGURE_FILE_INSTALL})
+  ENDIF(SALOME_CONFIGURE_FILE_INSTALL)
+ENDMACRO(SALOME_CONFIGURE_FILE)
+
+
+#######################################################################################
+# Useful macros for SALOME own package detection system
+#
+
+###
+# SALOME_CHECK_EQUAL_PATHS(result path1 path2)
+#  Check if two paths are identical, resolving links. If the paths do not exist a simple
+#  text comparison is performed.
+#  result is a boolean.
+###
+MACRO(SALOME_CHECK_EQUAL_PATHS varRes path1 path2)  
+  SET("${varRes}" OFF)
+  IF(EXISTS "${path1}")
+    GET_FILENAME_COMPONENT(_tmp1 "${path1}" REALPATH)
+  ELSE()
+    SET(_tmp1 "${path1}")
+  ENDIF() 
+
+  IF(EXISTS "${path2}")
+    GET_FILENAME_COMPONENT(_tmp2 "${path2}" REALPATH)
+  ELSE()
+    SET(_tmp2 "${path2}")
+  ENDIF() 
+
+  IF("${_tmp1}" STREQUAL "${_tmp2}")
+    SET("${varRes}" ON)
+  ENDIF()
+#  MESSAGE(${${varRes}})
+ENDMACRO()
+
+####
+# SALOME_LOG_OPTIONAL_PACKAGE(pkg flag)
+#
+# Register in global variables the detection status (found or not) of the optional package 'pkg' 
+# and the configuration flag that should be turned off to avoid detection of the package.
+# The global variables are read again by SALOME_PACKAGE_REPORT_AND_CHECK to produce 
+# a summary report of the detection status and stops the process if necessary.
+MACRO(SALOME_LOG_OPTIONAL_PACKAGE pkg flag)
+  # Was the package found
+  STRING(TOUPPER ${pkg} _pkg_UC)
+  IF(${pkg}_FOUND OR ${_pkg_UC}_FOUND)
+    SET(_isFound TRUE)
+  ELSE()
+    SET(_isFound FALSE)
+  ENDIF()
+
+  # Is the package already in the list? Then update its status:
+  LIST(FIND _SALOME_OPTIONAL_PACKAGES_names ${pkg} _result)
+  IF(NOT ${_result} EQUAL -1)
+    LIST(REMOVE_AT _SALOME_OPTIONAL_PACKAGES_found ${_result})
+    LIST(REMOVE_AT _SALOME_OPTIONAL_PACKAGES_flags ${_result})
+    LIST(INSERT    _SALOME_OPTIONAL_PACKAGES_found ${_result} ${_isFound})
+    LIST(INSERT    _SALOME_OPTIONAL_PACKAGES_flags ${_result} ${flag})
+  ELSE()
+    # Otherwise insert it
+    LIST(APPEND _SALOME_OPTIONAL_PACKAGES_names ${pkg})
+    LIST(APPEND _SALOME_OPTIONAL_PACKAGES_found ${_isFound})
+    LIST(APPEND _SALOME_OPTIONAL_PACKAGES_flags ${flag})
+  ENDIF() 
+  
+ENDMACRO(SALOME_LOG_OPTIONAL_PACKAGE)
+
+####
+# SALOME_JUSTIFY_STRING()
+#
+# Justifies the string specified as an argument to the given length
+# adding required number of spaces to the end. Does noting if input
+# string is longer as required length.
+# Puts the result to the output variable.
+#
+# USAGE: SALOME_JUSTIFY_STRING(input length result)
+#
+# ARGUMENTS:
+#   input  [in] input string
+#   length [in] required length of resulting string
+#   result [out] name of variable where the result string is put to
+#
+MACRO(SALOME_JUSTIFY_STRING input length result)
+  SET(${result} ${input})
+  STRING(LENGTH ${input} _input_length)
+  MATH(EXPR _nb_spaces "${length}-${_input_length}-1")
+  IF (_nb_spaces GREATER 0)
+    FOREACH(_idx RANGE ${_nb_spaces})  
+      SET(${result} "${${result}} ")
+    ENDFOREACH()
+  ENDIF()
+ENDMACRO(SALOME_JUSTIFY_STRING)
+
+####
+# SALOME_PACKAGE_REPORT_AND_CHECK()
+#
+# Print a quick summary of the detection of optional prerequisites.
+# If a package was not found, the configuration is stopped. The summary also indicates 
+# which flag should be turned off to skip the detection of the package. 
+#
+# If optional JUSTIFY argument is specified, names of packages
+# are left-justified to the given length; default value is 10.
+#
+# USAGE: SALOME_PACKAGE_REPORT_AND_CHECK([JUSTIFY length])
+#
+MACRO(SALOME_PACKAGE_REPORT_AND_CHECK)
+  SET(_will_fail OFF)
+  PARSE_ARGUMENTS(SALOME_PACKAGE_REPORT "JUSTIFY" "" ${ARGN})
+  IF(SALOME_PACKAGE_REPORT_JUSTIFY)
+    SET(_length ${SALOME_PACKAGE_REPORT_JUSTIFY})
+  ELSE()
+    SET(_length 23)
+  ENDIF()
+  MESSAGE(STATUS "") 
+  MESSAGE(STATUS "  Optional packages - Detection report ")
+  MESSAGE(STATUS "  ==================================== ")
+  MESSAGE(STATUS "")
+  IF(DEFINED _SALOME_OPTIONAL_PACKAGES_names)
+    LIST(LENGTH _SALOME_OPTIONAL_PACKAGES_names _list_len)
+    # Another CMake stupidity - FOREACH(... RANGE r) generates r+1 numbers ...
+    MATH(EXPR _range "${_list_len}-1")
+    FOREACH(_idx RANGE ${_range})  
+      LIST(GET _SALOME_OPTIONAL_PACKAGES_names ${_idx} _pkg_name)
+      LIST(GET _SALOME_OPTIONAL_PACKAGES_found ${_idx} _pkg_found)
+      LIST(GET _SALOME_OPTIONAL_PACKAGES_flags ${_idx} _pkg_flag)
+      SALOME_JUSTIFY_STRING(${_pkg_name} ${_length} _pkg_name)
+      IF(_pkg_found)
+        SET(_found_msg "Found")
+        SET(_flag_msg "")
+      ELSE()
+        SET(_will_fail ON)
+        SET(_found_msg "NOT Found")
+        SET(_flag_msg " - ${_pkg_flag} can be switched OFF to skip this prerequisite.")
+      ENDIF()
+    
+      MESSAGE(STATUS "  * ${_pkg_name}  ->  ${_found_msg}${_flag_msg}")
+    ENDFOREACH()
+  ENDIF(DEFINED _SALOME_OPTIONAL_PACKAGES_names)
+  MESSAGE(STATUS "")
+  MESSAGE(STATUS "")
+  
+  # Failure if some packages were missing:
+  IF(_will_fail)
+    MESSAGE(FATAL_ERROR "Some required prerequisites have NOT been found. Take a look at the report above to fix this.")
+  ENDIF()
+ENDMACRO(SALOME_PACKAGE_REPORT_AND_CHECK)
+
+####
+# SALOME_FIND_PACKAGE(englobingPackageName standardPackageName modus [onlyTryQuietly])
+#
+# example:  SALOME_FIND_PACKAGE(SalomeVTK VTK CONFIG)
+#
+# Encapsulate the call to the standard FIND_PACKAGE(standardPackageName) passing all the options
+# given when calling the command FIND_PACKAGE(SalomeXYZ). Those options are stored implicitly in 
+# CMake variables: xyz__FIND_QUIETLY, xyz_FIND_REQUIRED, etc ...
+# 
+# If a list of components was specified when invoking the initial FIND_PACKAGE(SalomeXyz ...) this is 
+# also handled properly.
+#
+# Modus is either MODULE or CONFIG (cf standard FIND_PACKAGE() documentation).
+# The last argument is optional and if set to TRUE will force the search to be OPTIONAL and QUIET.
+# If the package is looked for in CONFIG mode, the standard system paths are skipped. If you still want a 
+# system installation to be found in this mode, you have to set the ROOT_DIR variable explicitly to /usr (for
+# example). 
+#  
+# This macro is to be called from within the FindSalomeXXXX.cmake file.
+#
+####
+MACRO(SALOME_FIND_PACKAGE englobPkg stdPkg mode)
+  SET(_OPT_ARG ${ARGV3})
+  # Only bother if the package was not already found:
+  # Some old packages use the lower case version - standard should be to always use
+  # upper case:
+  STRING(TOUPPER ${stdPkg} stdPkgUC)
+  IF(NOT (${stdPkg}_FOUND OR ${stdPkgUC}_FOUND))
+    IF(${englobPkg}_FIND_QUIETLY OR _OPT_ARG)
+      SET(_tmp_quiet "QUIET")
+    ELSE()
+      SET(_tmp_quiet)
+    ENDIF()  
+    IF(${englobPkg}_FIND_REQUIRED AND NOT _OPT_ARG)
+      SET(_tmp_req "REQUIRED")
+    ELSE()
+      SET(_tmp_req)
+    ENDIF()  
+    IF(${englobPkg}_FIND_VERSION_EXACT)
+      SET(_tmp_exact "EXACT")
+    ELSE()
+      SET(_tmp_exact)
+    ENDIF()
+
+    # Call the CMake FIND_PACKAGE() command:    
+    STRING(TOLOWER ${stdPkg} _pkg_lc)
+    IF(("${mode}" STREQUAL "NO_MODULE") OR ("${mode}" STREQUAL "CONFIG"))
+      # Hope to find direclty a CMake config file, indicating the SALOME CMake file
+      # paths (the command already looks in places like "share/cmake", etc ... by default)
+      # Note the options NO_CMAKE_BUILDS_PATH, NO_CMAKE_PACKAGE_REGISTRY to avoid (under Windows)
+      # looking into a previous CMake build done via a GUI, or into the Win registry.
+      # NO_CMAKE_SYSTEM_PATH and NO_SYSTEM_ENVIRONMENT_PATH ensure any _system_ files like 'xyz-config.cmake' 
+      # don't get loaded (typically Boost). To force their loading, set the XYZ_ROOT_DIR variable to '/usr'. 
+      # See documentation of FIND_PACKAGE() for full details.
+      
+      # Do we need to call the signature using components?
+      IF(${englobPkg}_FIND_COMPONENTS)
+        FIND_PACKAGE(${stdPkg} ${${englobPkg}_FIND_VERSION} ${_tmp_exact} 
+              NO_MODULE ${_tmp_quiet} ${_tmp_req} COMPONENTS ${${englobPkg}_FIND_COMPONENTS}
+              PATH_SUFFIXES "salome_adm/cmake_files" "adm_local/cmake_files"
+              NO_CMAKE_BUILDS_PATH NO_CMAKE_PACKAGE_REGISTRY NO_CMAKE_SYSTEM_PACKAGE_REGISTRY NO_CMAKE_SYSTEM_PATH
+                NO_SYSTEM_ENVIRONMENT_PATH)
+      ELSE()
+        FIND_PACKAGE(${stdPkg} ${${englobPkg}_FIND_VERSION} ${_tmp_exact} 
+              NO_MODULE ${_tmp_quiet} ${_tmp_req}
+              PATH_SUFFIXES "salome_adm/cmake_files" "adm_local/cmake_files"
+              NO_CMAKE_BUILDS_PATH NO_CMAKE_PACKAGE_REGISTRY NO_CMAKE_SYSTEM_PACKAGE_REGISTRY NO_CMAKE_SYSTEM_PATH
+                 NO_SYSTEM_ENVIRONMENT_PATH)
+      ENDIF()
+      MARK_AS_ADVANCED(${stdPkg}_DIR)
+      
+    ELSEIF("${mode}" STREQUAL "MODULE")
+    
+      # Do we need to call the signature using components?
+      IF(${englobPkg}_FIND_COMPONENTS)
+        FIND_PACKAGE(${stdPkg} ${${englobPkg}_FIND_VERSION} ${_tmp_exact} 
+              MODULE ${_tmp_quiet} ${_tmp_req} COMPONENTS ${${englobPkg}_FIND_COMPONENTS})
+      ELSE()
+        FIND_PACKAGE(${stdPkg} ${${englobPkg}_FIND_VERSION} ${_tmp_exact} 
+              MODULE ${_tmp_quiet} ${_tmp_req})
+      ENDIF()
+      
+    ELSE()
+    
+      MESSAGE(FATAL_ERROR "Invalid mode argument in the call to the macro SALOME_FIND_PACKAGE. Should be CONFIG or MODULE.")
+      
+    ENDIF()
+    
+  ENDIF()
+ENDMACRO()
+
+
+####################################################################
+# SALOME_FIND_PACKAGE_DETECT_CONFLICTS(pkg referenceVariable upCount)
+#    pkg              : name of the system package to be detected
+#    referenceVariable: variable containing a path that can be browsed up to 
+# retrieve the package root directory (xxx_ROOT_DIR)
+#    upCount          : number of times we have to go up from the path <referenceVariable>
+# to obtain the package root directory.
+#   
+# For example:  SALOME_FIND_PACKAGE_DETECT_CONFLICTS(SWIG SWIG_EXECUTABLE 2) 
+#
+# Generic detection (and conflict check) procedure for package XYZ:
+# 1. Load a potential env variable XYZ_ROOT_DIR as a default choice for the cache entry XYZ_ROOT_DIR
+#    If empty, load a potential XYZ_ROOT_DIR_EXP as default value (path exposed by another package depending
+# directly on XYZ)
+# 2. Invoke FIND_PACKAGE() in this order:
+#    * in CONFIG mode first (if possible): priority is given to a potential 
+#    "XYZ-config.cmake" file
+#    * then switch to the standard MODULE mode, appending on CMAKE_PREFIX_PATH 
+# the above XYZ_ROOT_DIR variable
+# 3. Extract the path actually found into a temp variable _XYZ_TMP_DIR
+# 4. Warn if XYZ_ROOT_DIR is set and doesn't match what was found (e.g. when CMake found the system installation
+#    instead of what is pointed to by XYZ_ROOT_DIR - happens when a typo in the content of XYZ_ROOT_DIR).
+# 5. Conflict detection:
+#    * check the temp variable against a potentially existing XYZ_ROOT_DIR_EXP
+# 6. Finally expose what was *actually* found in XYZ_ROOT_DIR.  
+# 7. Specific stuff: for example exposing a prerequisite of XYZ to the rest of the world for future 
+# conflict detection. This is added after the call to the macro by the callee.
+#
+MACRO(SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS pkg referenceVariable upCount)
+  ##
+  ## 0. Initialization
+  ##
+  
+  # Package name, upper case
+  STRING(TOUPPER ${pkg} pkg_UC)
+
+  ##
+  ## 1. Load environment or any previously detected root dir for the package
+  ##
+  IF(DEFINED ENV{${pkg_UC}_ROOT_DIR})
+    FILE(TO_CMAKE_PATH "$ENV{${pkg_UC}_ROOT_DIR}" _${pkg_UC}_ROOT_DIR_ENV)
+    SET(_dflt_value "${_${pkg_UC}_ROOT_DIR_ENV}")
+  ELSE()
+    # will be blank if no package was previously loaded:
+    SET(_dflt_value "${${pkg_UC}_ROOT_DIR_EXP}")
+  ENDIF()
+
+  # Detect if the variable has been set on the command line or elsewhere:
+  IF(DEFINED ${pkg_UC}_ROOT_DIR)
+     SET(_var_already_there TRUE)
+  ELSE()
+     SET(_var_already_there FALSE)
+  ENDIF()
+  #   Make cache entry 
+  SET(${pkg_UC}_ROOT_DIR "${_dflt_value}" CACHE PATH "Path to ${pkg_UC} directory")
+
+  ##
+  ## 2. Find package - try CONFIG mode first (i.e. looking for XYZ-config.cmake)
+  ##
+  
+  # Override the variable - don't append to it, as it would give precedence
+  # to what was stored there before!  
+  SET(CMAKE_PREFIX_PATH "${${pkg_UC}_ROOT_DIR}")
+    
+  # Try find_package in config mode. This has the priority, but is 
+  # performed QUIET and not REQUIRED:
+  SALOME_FIND_PACKAGE("Salome${pkg}" ${pkg} NO_MODULE TRUE)
+  
+  IF (${pkg_UC}_FOUND OR ${pkg}_FOUND)
+    MESSAGE(STATUS "Found ${pkg} in CONFIG mode!")
+  ENDIF()
+
+  # Otherwise try the standard way (module mode, with the standard CMake Find*** macro):
+  # We do it quietly to produce our own error message, except if we are in debug mode:
+  IF(SALOME_CMAKE_DEBUG)
+    SALOME_FIND_PACKAGE("Salome${pkg}" ${pkg} MODULE FALSE)
+  ELSE()
+    SALOME_FIND_PACKAGE("Salome${pkg}" ${pkg} MODULE TRUE)
+  ENDIF()
+  
+  # Set the "FOUND" variable for the SALOME wrapper:
+  IF(${pkg_UC}_FOUND OR ${pkg}_FOUND)
+    SET(SALOME${pkg_UC}_FOUND TRUE)
+  ELSE()
+    SET(SALOME${pkg_UC}_FOUND FALSE)
+    IF(NOT Salome${pkg}_FIND_QUIETLY)
+      IF(Salome${pkg}_FIND_REQUIRED)
+         MESSAGE(FATAL_ERROR "Package ${pkg} couldn't be found - did you set the corresponing root dir correctly? "
+         "It currently contains ${pkg_UC}_ROOT_DIR=${${pkg_UC}_ROOT_DIR}  "
+         "Append -DSALOME_CMAKE_DEBUG=ON on the command line if you want to see the original CMake error.")
+      ELSE()
+         MESSAGE(WARNING "Package ${pkg} couldn't be found - did you set the corresponing root dir correctly? "
+         "It currently contains ${pkg_UC}_ROOT_DIR=${${pkg_UC}_ROOT_DIR}  "
+         "Append -DSALOME_CMAKE_DEBUG=ON on the command line if you want to see the original CMake error.")
+      ENDIF()
+    ENDIF()
+  ENDIF()
+  
+  IF (${pkg_UC}_FOUND OR ${pkg}_FOUND)
+    ## 3. Set the root dir which was finally retained by going up "upDir" times
+    ## from the given reference path. The variable "referenceVariable" may be a list.
+    ## In this case we take its first element. 
+    
+    # First test if the variable exists, warn otherwise:
+    IF(NOT DEFINED ${referenceVariable})
+      MESSAGE(WARNING "${pkg}: the reference variable '${referenceVariable}' used when calling the macro "
+      "SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS() is not defined.")
+    ENDIF()
+    
+    LIST(LENGTH ${referenceVariable} _tmp_len)
+    IF(_tmp_len)
+       LIST(GET ${referenceVariable} 0 _tmp_ROOT_DIR)
+    ELSE()
+       #  Note the double de-reference of "referenceVariable":
+       SET(_tmp_ROOT_DIR "${${referenceVariable}}")
+    ENDIF()
+    IF(${upCount}) 
+      FOREACH(_unused RANGE 1 ${upCount})        
+        GET_FILENAME_COMPONENT(_tmp_ROOT_DIR "${_tmp_ROOT_DIR}" PATH)
+      ENDFOREACH()
+    ENDIF()
+
+    ##
+    ## 4. Warn if CMake found something not located under ENV(XYZ_ROOT_DIR)
+    ##
+    IF(DEFINED ENV{${pkg_UC}_ROOT_DIR})
+      SALOME_CHECK_EQUAL_PATHS(_res "${_tmp_ROOT_DIR}" "${_${pkg_UC}_ROOT_DIR_ENV}")
+      IF(NOT _res)
+        MESSAGE(WARNING "${pkg} was found, but not at the path given by the "
+            "environment ${pkg_UC}_ROOT_DIR! Is the variable correctly set? "
+            "The two paths are: ${_tmp_ROOT_DIR} and: ${_${pkg_UC}_ROOT_DIR_ENV}")
+        
+      ELSE()
+        MESSAGE(STATUS "${pkg} found directory matches what was specified in the ${pkg_UC}_ROOT_DIR variable, all good!")    
+      ENDIF()
+    ELSE()
+        IF(NOT _var_already_there) 
+          MESSAGE(STATUS "Variable ${pkg_UC}_ROOT_DIR was not explicitly defined. "
+          "An installation was found anyway: ${_tmp_ROOT_DIR}")
+        ENDIF()
+    ENDIF()
+
+    ##
+    ## 5. Conflict detection
+    ##     From another prerequisite using the package:
+    ##
+    IF(${pkg_UC}_ROOT_DIR_EXP)
+        SALOME_CHECK_EQUAL_PATHS(_res "${_tmp_ROOT_DIR}" "${${pkg_UC}_ROOT_DIR_EXP}") 
+        IF(NOT _res)
+           MESSAGE(WARNING "Warning: ${pkg}: detected version conflicts with a previously found ${pkg}!"
+                           " The two paths are " ${_tmp_ROOT_DIR} " vs " ${${pkg_UC}_ROOT_DIR_EXP})
+        ELSE()
+            MESSAGE(STATUS "${pkg} directory matches what was previously exposed by another prereq, all good!")
+        ENDIF()        
+    ENDIF()
+    
+    ##
+    ## 6. Save the detected installation
+    ##
+    SET(${pkg_UC}_ROOT_DIR "${_tmp_ROOT_DIR}")
+     
+  ELSE()
+    MESSAGE(STATUS "${pkg} was not found.")  
+  ENDIF()
+  
+  SET(Salome${pkg}_FOUND "${pkg}_FOUND")
+ENDMACRO(SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS)
+
+
+####################################################################
+# SALOME_ADD_MPI_TO_HDF5()
+# 
+# Overload the HDF5 flags so that they also contain MPI references.
+# This is to be used when HDF5 was compiled with MPI support;
+MACRO(SALOME_ADD_MPI_TO_HDF5)  
+  SET(HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIRS} ${MPI_INCLUDE_DIRS})
+  SET(HDF5_DEFINITIONS "${HDF5_DEFINITIONS} ${MPI_DEFINITIONS}")
+  SET(HDF5_LIBRARIES ${HDF5_LIBRARIES} ${MPI_LIBRARIES})
+ENDMACRO(SALOME_ADD_MPI_TO_HDF5)
+
+####################################################################
+# SALOME_XVERSION()
+# 
+# Computes hexadecimal version of SALOME package
+#
+# USAGE: SALOME_XVERSION(package)
+#
+# ARGUMENTS:
+#
+# package: IN: SALOME package name
+#
+# The macro reads SALOME package version from PACKAGE_VERSION variable
+# (note package name in uppercase as assumed for SALOME modules);
+# hexadecimal version value in form 0xAABBCC (where AA, BB and CC are
+# major, minor and maintenance components of package version in
+# hexadecimal form) is put to the PACKAGE_XVERSION variable
+MACRO(SALOME_XVERSION pkg)
+  STRING(TOUPPER ${pkg} _pkg_UC)
+  IF(${_pkg_UC}_VERSION)
+    EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import sys; t=sys.argv[-1].split(\".\") ; t[:]=(int(elt) for elt in t) ; sys.stdout.write(\"0x%02x%02x%02x\"%tuple(t))" ${${_pkg_UC}_VERSION}
+                    OUTPUT_VARIABLE ${_pkg_UC}_XVERSION)
+  ENDIF()
+ENDMACRO(SALOME_XVERSION)
+
+#########################################################################
+# SALOME_ACCUMULATE_HEADERS()
+# 
+# This macro is called in the various FindSalomeXYZ.cmake modules to accumulate
+# internally the list of include headers to be saved for future export. 
+# The full set of include is saved in a variable called 
+#      _${PROJECT_NAME}_EXTRA_HEADERS
+#
+MACRO(SALOME_ACCUMULATE_HEADERS lst)
+  FOREACH(l IN LISTS ${lst})
+    LIST(FIND _${PROJECT_NAME}_EXTRA_HEADERS "${l}" _res)
+    IF(_res EQUAL "-1")
+      IF(NOT "${l}" STREQUAL "/usr/include")
+        LIST(APPEND _${PROJECT_NAME}_EXTRA_HEADERS "${l}")
+      ENDIF()
+    ENDIF()
+  ENDFOREACH()
+ENDMACRO(SALOME_ACCUMULATE_HEADERS)
+
+#########################################################################
+# SALOME_ACCUMULATE_ENVIRONMENT()
+# 
+# USAGE: SALOME_ACCUMULATE_ENVIRONMENT(envvar value [value ...])
+#
+# ARGUMENTS:
+#   envvar [in] environment variable name, e.g. PATH
+#   value  [in] value(s) to be added to environment variable
+#
+# This macro is called in the various FindSalomeXYZ.cmake modules to 
+# accumulate environment variables, to be used later to run some command
+# in proper environment.
+#
+# 1. Each envrironment variable is stored in specific CMake variable
+#    _${PROJECT_NAME}_EXTRA_ENV_<var>, where <var> is name of variable.
+# 2. Full list of environment variable names is stored in CMake variable
+#    _${PROJECT_NAME}_EXTRA_ENV.
+#
+# Notes:
+# - The arguments list can include optional CHECK or NOCHECK keywords:
+#   * For all arguments following CHECK keyword the macro perform an
+#     additional check (see below); this is the default mode, it is suitable
+#     for path variables (PATH, LD_LIBRARY_PATH, etc).
+#   * For all arguments following NOCHECK keyword, no additional check is
+#     performed.
+#   Checking an argument means that we check:
+#    - That the path actually exists
+#    - That this is not a standard system path (starting with "/usr"); this avoids
+#   polluting LD_LIBRARY_PATH or PATH with things like "/usr/lib64" ...
+#
+MACRO(SALOME_ACCUMULATE_ENVIRONMENT envvar)
+  SET(_is_check ON)
+  FOREACH(_item ${ARGN})
+    IF(${_item} STREQUAL "NOCHECK")
+      SET(_is_check OFF)
+    ELSEIF(${_item} STREQUAL "CHECK")
+      SET(_is_check ON)
+    ELSE()
+      IF(_is_check)
+        IF(NOT IS_DIRECTORY ${_item})
+          IF(TARGET ${_item})
+            GET_TARGET_PROPERTY(_item ${_item} LOCATION)
+          ENDIF()        
+          GET_FILENAME_COMPONENT(_item ${_item} PATH)
+        ENDIF()    
+        IF(EXISTS ${_item})
+          STRING(REGEX MATCH "^(/usr|/lib|/bin)" _usr_find ${_item})
+          LIST(FIND _${PROJECT_NAME}_EXTRA_ENV_${envvar} ${_item} _res)
+          IF(NOT _usr_find AND _res EQUAL -1)
+              LIST(APPEND _${PROJECT_NAME}_EXTRA_ENV_${envvar} ${_item})
+          ENDIF()  
+        ENDIF()
+      ELSE(_is_check)
+        LIST(FIND _${PROJECT_NAME}_EXTRA_ENV_${envvar} ${_item} _res)
+        IF( _res EQUAL -1)
+          LIST(APPEND _${PROJECT_NAME}_EXTRA_ENV_${envvar} ${_item})
+        ENDIF()  
+      ENDIF(_is_check)
+    ENDIF()   
+  ENDFOREACH()
+  
+  LIST(FIND _${PROJECT_NAME}_EXTRA_ENV ${envvar} _res)
+  IF(_res EQUAL -1)
+    LIST(APPEND _${PROJECT_NAME}_EXTRA_ENV ${envvar})
+  ENDIF()
+  SET(_${PROJECT_NAME}_EXTRA_ENV_FULL "SET\(${PROJECT_NAME}_EXTRA_ENV ${_${PROJECT_NAME}_EXTRA_ENV}\)")
+  FOREACH(_res ${_${PROJECT_NAME}_EXTRA_ENV})
+    SET(_${PROJECT_NAME}_EXTRA_ENV_FULL "${_${PROJECT_NAME}_EXTRA_ENV_FULL}\nSET\(${PROJECT_NAME}_EXTRA_ENV_${_res} ${_${PROJECT_NAME}_EXTRA_ENV_${_res}}\)")
+  ENDFOREACH()
+ENDMACRO(SALOME_ACCUMULATE_ENVIRONMENT)
+
+#########################################################################
+# SALOME_GENERATE_ENVIRONMENT_SCRIPT()
+# 
+# USAGE: SALOME_GENERATE_ENVIRONMENT_SCRIPT(output script cmd opts)
+#
+# ARGUMENTS:
+#   output [out] output command, e.g. for creation of target.
+#   script [in]  output environement script name
+#   cmd    [in]  input command, e.g. sphinx or python command.
+#   opts   [in]  options for input command (cmd).
+#
+# This macro is called when it's necessary to use given environment to run some command. 
+# Macro generates environement script using previously created variables
+# _${PROJECT_NAME}_EXTRA_ENV_<var>, where <var> is name of variable and
+# _${PROJECT_NAME}_EXTRA_ENV (see marco SALOME_ACCUMULATE_ENVIRONMENT);
+# and puts generated command in proper environment into <output> argument.
+# 
+# Notes:
+# - If <script> is specified as relative path, it is computed from the current build
+#   directory.
+#
+MACRO(SALOME_GENERATE_ENVIRONMENT_SCRIPT output script cmd opts)
+  IF(IS_ABSOLUTE ${script})
+    SET(_script ${script})
+  ELSE()
+    SET(_script ${CMAKE_CURRENT_BINARY_DIR}/${script})
+  ENDIF()
+
+  SET(_env)
+  FOREACH(_item ${_${PROJECT_NAME}_EXTRA_ENV})
+    FOREACH(_val ${_${PROJECT_NAME}_EXTRA_ENV_${_item}})
+      IF(WIN32)
+        IF(${_item} STREQUAL "LD_LIBRARY_PATH")
+          SET(_item PATH)
+        ENDIF()
+        STRING(REPLACE "/" "\\" _env "${_env} @SET ${_item}=${_val};%${_item}%\n")
+        SET(_ext "bat")
+        SET(_call_cmd "call")
+      ELSE(WIN32)
+        SET(_env "${_env} export ${_item}=${_val}:\${${_item}}\n")
+        SET(_ext "sh")
+        SET(_call_cmd ".")
+      ENDIF(WIN32)
+    ENDFOREACH()
+  ENDFOREACH()
+  
+  SET(_script ${_script}.${_ext})
+  FILE(WRITE ${_script} "${_env}")
+  
+  SET(${output} ${_call_cmd} ${_script} && ${cmd} ${opts})
+  
+ENDMACRO(SALOME_GENERATE_ENVIRONMENT_SCRIPT)
+
+#########################################################################
+# SALOME_GENERATE_TESTS_ENVIRONMENT()
+# 
+# USAGE: SALOME_GENERATE_TESTS_ENVIRONMENT(output)
+#
+# ARGUMENTS:
+#   output [out] output environement variable.
+#
+# This macro generates <output> variable to use given environment to run some tests. 
+# Macro generates environement variable using previously created variables
+# _${PROJECT_NAME}_EXTRA_ENV_<var>, where <var> is name of variable and
+# _${PROJECT_NAME}_EXTRA_ENV (see marco SALOME_ACCUMULATE_ENVIRONMENT);
+# and puts this variable into <output> argument.
+#
+MACRO(SALOME_GENERATE_TESTS_ENVIRONMENT output)
+  SET(_env)
+  FOREACH(_item ${_${PROJECT_NAME}_EXTRA_ENV})
+    FOREACH(_val ${_${PROJECT_NAME}_EXTRA_ENV_${_item}})
+      IF(WIN32)
+        SET(_env "${_val};${_env}")
+      ELSE()
+        SET(_env "${_val}:${_env}")
+      ENDIF()
+    ENDFOREACH()
+    SET(_env " ${_item}=${_env}")
+  ENDFOREACH() 
+  SET(${output} ${_env})  
+ENDMACRO(SALOME_GENERATE_TESTS_ENVIRONMENT)
+
+#########################################################################
+# SALOME_APPEND_LIST_OF_LIST()
+# 
+# USAGE: SALOME_APPEND_LIST_OF_LIST(result element_list)
+#
+# Build a list of lists. The element_list is first parsed to convert it 
+# from 
+#     a;b;c;d;e
+# to 
+#     a,b,c,d,e
+#
+# It is then added to the big list 'result'. Hence 'result' looks like:
+#     a,b,c,d,e;f,g,h; ...
+#
+MACRO(SALOME_APPEND_LIST_OF_LIST result element_list)
+  SET(_tmp_res)
+  STRING(REPLACE ";" "," _tmp_res "${${element_list}}")
+  SET(${result} "${${result}};${_tmp_res}")  # LIST(APPEND ...) doesn't handle well empty elements!?
+ENDMACRO(SALOME_APPEND_LIST_OF_LIST)
+
+#########################################################################
+# SALOME_CONFIGURE_PREPARE()
+# 
+# USAGE: SALOME_CONFIGURE_PREPARE(pkg1 pkg2 ...)
+#
+# Prepare the variable that will be used to configure the file Salome<MODULE>Config.cmake,
+# namely:
+#    - _PREREQ_LIST      : the list of level 1 external prerequisites
+#    - _PREREQ_DIR_LIST  : their corresponding CMake directories (i.e. where the CMake configuration
+#    file for this package can be found, if there is any!)
+#    - _PREREQ_COMPO_LIST: the list of components requested when this package was invoked
+#
+# All this information is built from the package_list, the list of level 1 packages for this module.
+# Only the packages found in CONFIG mode are retained.
+#
+MACRO(SALOME_CONFIGURE_PREPARE)
+  SET(_tmp_prereq "${ARGV}")
+  SET(_PREREQ_LIST)
+  SET(_PREREQ_DIR_LIST)
+  SET(_PREREQ_COMPO_LIST)
+  FOREACH(_prereq IN LISTS _tmp_prereq)
+    IF(${_prereq}_DIR)
+      SET(_PREREQ_LIST "${_PREREQ_LIST} ${_prereq}")
+      SET(_PREREQ_DIR_LIST "${_PREREQ_DIR_LIST} \"${${_prereq}_DIR}\"")
+      SALOME_APPEND_LIST_OF_LIST(_PREREQ_COMPO_LIST Salome${_prereq}_COMPONENTS)
+    ENDIF()
+  ENDFOREACH()
+ENDMACRO(SALOME_CONFIGURE_PREPARE)
diff --git a/dev/CMakeLists.txt b/dev/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..01e4a2c
--- /dev/null
@@ -0,0 +1,20 @@
+# Copyright (C) 2012-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# 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
+#
+ADD_SUBDIRECTORY(git)
+ADD_SUBDIRECTORY(cmake)
diff --git a/dev/cmake/CMakeLists.txt b/dev/cmake/CMakeLists.txt
new file mode 100644 (file)
index 0000000..e84d5de
--- /dev/null
@@ -0,0 +1,30 @@
+# Copyright (C) 2012-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# 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
+#
+
+# Include common macros
+# ==================
+INCLUDE(SalomeDocumentationMacros)
+
+# Add sphinx documentation target
+# ============================
+SALOME_ADD_SPHINX_DOC( html cmake_doc ${CMAKE_CURRENT_SOURCE_DIR}/source)
+
+# Install rules
+# ==========
+INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/_build/html DESTINATION ${SALOME_DOCUMENTATION_CMAKE_INSTALL}/build)
diff --git a/dev/cmake/source/config.rst b/dev/cmake/source/config.rst
new file mode 100644 (file)
index 0000000..bcadedc
--- /dev/null
@@ -0,0 +1,209 @@
+.. _config:
+
+Exposing a module's configuration (advanced)
+============================================
+
+.. _cfg_principle:
+
+Principle
+---------
+
+When invoking the FIND_PACKAGE() command in CMake, two modes are possible:
+
+* MODULE mode - this is the standard mode. CMake then looks for a file called FindXXX.cmake, pre-sets some variables (indicating if the package is required, etc ... see :ref:`pkg_impl`) and invokes the code in the macro. 
+* CONFIG (or NO_MODULE) mode - if the package was itself compiled with CMake, it might offer a file called xyz-config.cmake or XyzConfig.cmake (where <Xyz> is the case-sensitive name of the package) exposing the configuration elements for an usage by a dependent project. This mechanism allows to remain in a pure CMake logic, where the package detection triggers the inclusion of the targets it references. Those targets can then be used directly. For example finding HDF5 in CONFIG mode allows to directly reference the "hdf5" target (and to link against it). It also provides the ability to pass more configuration elements than just libraries and binaries (for example user options for compilation, etc ...)
+
+Take a look at the official CMake documentation for more details.
+
+With this last setup (and if done properly!), a project can theoritically be either:
+
+* configured, built and installed in a standalone fashion
+* or have its sources directly be included as a sub-folder in the soure code of another bigger project. An ADD_SUBDIRECTORY in the root CMakeLists.txt of the encapsulating project should then trigger the proper configuration/build of the sub-project. 
+
+The last point was however never tested in the SALOME context, and probably needs some further debug.
+
+In the SALOME context this logic offers the advantage to have a minimal specification on the prerequisites. Technically one just needs to set the _ROOT_DIR variables for the packages that were never found before, and to get "for free" what was already found in a dependent module (for example Qt4 in GUI, but not OmniORB as it was already used by KERNEL). This works thanks to the exposition of all the ROOT_DIR used by one module into its configuration file. This can then be automatically reused by a dependent module.
+
+Inspired from the CMake tutorial (http://www.cmake.org/Wiki/CMake/Tutorials/How_to_create_a_ProjectConfig.cmake_file) some 
+important module use this scheme and install the \*Config.cmake files facilitating the configuration of other dependent modules. Most important SALOME modules (KERNEL, GUI, MED) expose their configuration in such a way. 
+
+
+Guidelines
+----------
+
+* When writing such CMake files, care must be taken to use PROJECT_BINARY_DIR and PROJECT_SOURCE_DIR variables instead of CMAKE_BINARY_DIR and CMAKE_SOURCE_DIR. This ensures that the project will also work properly when included as a sub-folder of a bigger project.
+* The use of the local (or global) CMake Registry (via the EXPORT(PACKAGE ...) command) is not recommended. This overrides some of the FIND_PACKAGE mechanisms and quickly becomes a mess when compiling several versions of the same package on the same machine (typically the case for SALOME developers).
+* Only level one dependency configurations are exported in the XXXConfig.cmake files (direct dependencies). See below :ref:`config_file` how the level 2 dependencies are automatically reloaded.
+* Care must be taken to explicitly request a target to be part of the export set in the code sub-folders, when installing it  (EXPORT option)::
+
+    INSTALL(TARGETS kerncompo kern_main
+       # IMPORTANT: Add the library kerncompo to the "export-set" so it will be available 
+       # to dependent projects
+       EXPORT ${PROJECT_NAME}Targets
+       LIBRARY DESTINATION "${INSTALL_LIB_DIR}"
+       RUNTIME DESTINATION "${INSTALL_BIN_DIR}")
+
+
+The rules are a bit lengthy but very generic. The idea is to define a set of targets to be exported, and to then explicitly
+call the export command to generate the appropriate files (some fragments have been cut for readability).
+The standard CMake macro CONFIGURE_PACKAGE_CONFIG_FILE() and WRITE_BASIC_PACKAGE_VERSION_FILE() (both located
+in CMakePackageConfigHelpers) help generate a suitable configuration file (see next section)::
+
+  # Configuration export
+  # ====================
+  INCLUDE(CMakePackageConfigHelpers)
+
+  # List of targets in this project we want to make visible to the rest of the world.
+  # They all have to be INSTALL'd with the option "EXPORT ${PROJECT_NAME}TargetGroup"
+  SET(_${PROJECT_NAME}_exposed_targets
+    CalciumC SalomeCalcium DF Launcher  
+  ...)
+    
+  # Add all targets to the build-tree export set
+  EXPORT(TARGETS ${_${PROJECT_NAME}_exposed_targets}
+    FILE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake)
+
+  # Create the configuration files:
+  #   - in the build tree:
+
+  #      Ensure the variables are always defined for the configure:
+  SET(CPPUNIT_ROOT_DIR "${CPPUNIT_ROOT_DIR}")
+  ...
+   
+  SET(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}/include")
+  CONFIGURE_PACKAGE_CONFIG_FILE(salome_adm/cmake_files/${PROJECT_NAME}Config.cmake.in 
+      ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
+      INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE}"
+      PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE CMAKE_INSTALL_PREFIX
+          ...)
+
+  #   - in the install tree:
+  #       Get the relative path of the include directory so 
+  #       we can register it in the generated configuration files:
+  SET(CONF_INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/${INSTALL_INCLUDE_DIR}")
+  CONFIGURE_PACKAGE_CONFIG_FILE(salome_adm/cmake_files/${PROJECT_NAME}Config.cmake.in 
+      ${PROJECT_BINARY_DIR}/to_install/${PROJECT_NAME}Config.cmake
+      INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE}"
+      PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE CMAKE_INSTALL_PREFIX 
+        ...)
+
+  WRITE_BASIC_PACKAGE_VERSION_FILE(${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
+      VERSION ${${PROJECT_NAME_UC}_VERSION}
+      COMPATIBILITY AnyNewerVersion)
+    
+  # Install the CMake configuration files:
+  INSTALL(FILES
+    "${PROJECT_BINARY_DIR}/to_install/${PROJECT_NAME}Config.cmake"
+    "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
+    DESTINATION "${SALOME_INSTALL_CMAKE}")
+
+  # Install the export set for use with the install-tree
+  INSTALL(EXPORT ${PROJECT_NAME}TargetGroup DESTINATION "${SALOME_INSTALL_CMAKE}" 
+          FILE ${PROJECT_NAME}Targets.cmake)
+
+
+.. _config_file:
+
+Configuration file
+------------------
+
+The configuration file exposed in the build tree (e.g. SalomeGUIConfig.cmake) and in the install tree is itself configured by CMake by substituing variables and other stuff in a template file (e.g. SalomeGUIConfig.cmake.in).
+
+We present here the config file of GUI as it loads itself the KERNEL. 
+
+The first part does some initialization (the tag @PACKAGE_INIT@ is expanded by the macro CONFIGURE_PACKAGE_CONFIG_FILE() and serves mainly to locate the root directory of the installation)::
+
+  ### Initialisation performed by CONFIGURE_PACKAGE_CONFIG_FILE:
+  @PACKAGE_INIT@
+
+
+The target file is loaded only if a representative target of the project (here in GUI the target ''Event'') is not already defined. This distinguishes between an inclusion of the project directly in the source directory or after a full standalone installation (see :ref:`cfg_principle` above)::
+
+  # Load the dependencies for the libraries of @PROJECT_NAME@ 
+  # (contains definitions for IMPORTED targets). This is only 
+  # imported if we are not built as a subproject (in this case targets are already there)
+  IF(NOT TARGET Event AND NOT @PROJECT_NAME@_BINARY_DIR)
+    INCLUDE("@PACKAGE_SALOME_INSTALL_CMAKE@/@PROJECT_NAME@Targets.cmake")
+  ENDIF()   
+
+Note how the variable SALOME_INSTALL_CMAKE is prefixed with PACKAGE_SALOME_INSTALL_CMAKE. With this setup the helper macro CONFIGURE_PACKAGE_CONFIG_FILE() is able to adjust correctly the path (contained in SALOME_INSTALL_CMAKE) to always point to the right place (regardless of wether the SalomeGUIConfig.cmake file is in the build tree or in the install tree).
+This is why the variable SALOME_INSTALL_CMAKE is passed as an argument when calling CONFIGURE_PACKAGE_CONFIG_FILE(). 
+
+The user options, and the directories of the level 1 prerequisites (i.e. direct dependencies) are exposed in a variable called ''XYZ_ROOT_DIR_EXP'' (note the trailing ''EXP'' like EXPosed). This will be used by the package detection logic to check for potential conflicts.
+The @PACKAGE_XYZ_ROOT_DIR@ variables are expanded by CONFIGURE_PACKAGE_CONFIG_FILE(). If you want to use a @PACKAGE_XYZ_ROOT_DIR@ in the config file, don't forget to add explicitly the XYZ_ROOT_DIR variable to the list of variables to be expanded by CONFIGURE_PACKAGE_CONFIG_FILE():: 
+
+  # Package root dir:
+  SET_AND_CHECK(GUI_ROOT_DIR_EXP "@PACKAGE_CMAKE_INSTALL_PREFIX@")
+
+  # Include directories
+  SET_AND_CHECK(GUI_INCLUDE_DIRS "${GUI_ROOT_DIR_EXP}/@SALOME_INSTALL_HEADERS@")
+  SET(GUI_DEFINITIONS "@KERNEL_DEFINITIONS@")
+
+  # Options exported by the package:
+  SET(SALOME_USE_MPI     @SALOME_USE_MPI@)
+  ...
+
+  # Advanced options
+  SET(SALOME_USE_OCCVIEWER    @SALOME_USE_OCCVIEWER@)
+  ...
+
+  # Level 1 prerequisites:
+  SET_AND_CHECK(KERNEL_ROOT_DIR_EXP "@PACKAGE_KERNEL_ROOT_DIR@")
+  SET_AND_CHECK(SIP_ROOT_DIR_EXP "@PACKAGE_SIP_ROOT_DIR@")
+  ...
+
+  # Optional level 1 prerequisites:
+  IF(SALOME_USE_OCCVIEWER)
+    SET_AND_CHECK(CAS_ROOT_DIR_EXP "@PACKAGE_CAS_ROOT_DIR@")    
+  ENDIF()
+  ...
+
+Then a specific logic is included to ensure the following: if a prerequisite of GUI was detected and used (in GUI) in CONFIG mode, then its targets should be included again when a third project uses GUI. For example, if GUI uses VTK, and VTK was found if CONFIG mode, it means that some GUI libraries were linked directly using a reference to a VTK target instead of a full path (simply ''vtkCommon'' instead of ''/usr/lib/bla/bli/libvtkCommon.so''). A project which needs to link on GUI must then also be able to link (indirectly) against VTK (which is just referred as ''-lvtkCommon'' in the GUI library description exposed by CMake).
+
+This avoids having to set the LD_LIBRARY_PATH (or PATH under Windows).
+
+The following loop detects such a situation (there is always a variable Xyz_DIR when the package was found in CONFIG mode) and reloads if necessary the corresponding target by calling FIND_PACKAGE() in CONFIG mode on the exact same directory. This is done for all level 1 prerequisites of GUI, and would in our case expose the target ''vtkCommon'' to a project linking against GUI::
+
+  # For all prerequisites, load the corresponding targets if the package was used 
+  # in CONFIG mode. This ensures dependent projects link correctly
+  # without having to set LD_LIBRARY_PATH:
+  SET(_PREREQ CAS OpenGL PyQt4 Qt4 Qwt SIP VTK)
+  SET(_PREREQ_CONFIG_DIR "@CAS_DIR@" "@OpenGL_DIR@" "@PyQt4_DIR@" "@Qt4_DIR@" "@Qwt_DIR@" "@SIP_DIR@" "@VTK_DIR@")
+  LIST(LENGTH _PREREQ_CONFIG_DIR _list_len)
+  # Another CMake stupidity - FOREACH(... RANGE r) generates r+1 numbers ...
+  MATH(EXPR _range "${_list_len}-1")
+  FOREACH(_p RANGE ${_range})  
+    LIST(GET _PREREQ            ${_p} _pkg    )
+    LIST(GET _PREREQ_CONFIG_DIR ${_p} _pkg_dir)
+    IF(_pkg_dir)
+       MESSAGE(STATUS "===> Reloading targets from ${_pkg} ...")
+       FIND_PACKAGE(${_pkg} REQUIRED NO_MODULE 
+            PATHS "${_pkg_dir}" 
+            NO_DEFAULT_PATH)
+    ENDIF()
+  ENDFOREACH()
+
+We also make sure, in the case of GUI, that the same is done for KERNEL's targets::
+
+  # Include KERNEL targets if they were not already loaded:
+  IF(NOT (TARGET SALOMEBasics)) 
+    INCLUDE("${KERNEL_ROOT_DIR_EXP}/${SALOME_INSTALL_CMAKE}/SalomeKERNELTargets.cmake")
+  ENDIF()
+
+We finally expose the installation directories and define the target variables that will be used to link against targets given in the export list::
+
+  # Installation directories
+  SET(SALOME_INSTALL_BINS "@SALOME_INSTALL_BINS@")
+  SET(SALOME_INSTALL_LIBS "@SALOME_INSTALL_LIBS@")
+  ...
+
+  # Exposed GUI targets:
+  SET(GUI_caf caf)
+  SET(GUI_CAM CAM)
+  ...
+
+
+
+
+
+
diff --git a/dev/cmake/source/pkg.rst b/dev/cmake/source/pkg.rst
new file mode 100644 (file)
index 0000000..31c91d3
--- /dev/null
@@ -0,0 +1,210 @@
+.. _package:
+
+Package detection mechanism
+===========================
+
+SALOME modules need some external packages in order to compile and run properly. For example KERNEL relies on the Python libraries, on the Boost libraries, etc ... The correct detection of those prerequisites is a key point of the CMake build procedure.
+
+Philosophy
+----------
+
+The philosophy of the SALOME package detection is, first, to rely as 
+much as possible on the standard CMake detection modules (FindXyz.cmake files, located in the standard CMake installation directory).
+It is assumed those modules will get better and better with newer releases of CMake
+and using them ensures future compatibility with newer versions of CMake.
+
+Second, the implementation of the detection process relies exclusively
+on the XYZ_ROOT_DIR variable giving the installation path of the package. This means the user compiling SALOME should not have to set anything else than those XYZ variables (no PATH override, no LD_LIBRARY_PATH override should be necessary). This is not strictly always possible, but should enforce as often as possible.
+
+Finally only the direct dependencies of a module should be explicitly detected: for example GUI has no source code which uses MPI functionalities. Hence GUI does not detect the MPI package. However if KERNEL was compiled with MPI, then some of the information (include directories, definitions, ...) needs to be propagated to GUI (in this case for example, MPI needs to be in the list of include directories, since GUI include KERNEL headers, which themselves include MPI headers). This is done exclusively through the variables exposed in the KERNEL configuration file: KERNEL_INCLUDE_DIRS, KERNEL_DEFINITIONS.
+
+Root dir variables and priority order
+-------------------------------------
+
+The detection is however guided through a variable of the form XYZ_ROOT_DIR which
+gives the root directory of an installation of the package. For example, to indicate
+that we wish to use the Python installed in our home directory, one sets PYTHON_ROOT_DIR to
+"/home/smith/Python-2.7.0".
+
+The variable guiding the detection is always builts as::
+
+  XYZ_ROOT_DIR
+
+where <XYZ> is (*exactly*) the upper case name of the standard CMake module. For example, the
+detection of Qt4 is guided by setting QT4_ROOT_DIR. The variables \*_ROOT_DIR are only there to guide the process, not to force it. Typically under Linux, one would never set PTHREAD_ROOT_DIR, thus leaving the logic find the system installation. 
+
+Beware that package names in the CMakeLists.txt are case-sensitive, but the corresponding variables are always upper-case (because on some platforms environment variables are not case-sensitive).
+
+The order of priority for the detection of a package is (from high to low priority):
+
+1. CMake variables explicitly set by the user (typically on the command line with -DXYZ_ROOT_DIR=...)
+2. Environment variables set by the user (with the same name XYZ_ROOT_DIR)
+3. Default value based on a previous dependency using the tool already
+4. Detection direclty in the host system by the standard CMake logic
+
+CMake has two possible modes of detection, CONFIG mode and MODULE mode. The order of priority is explicitly set in SALOME to:
+
+1. CONFIG (also called NO_MODULE) mode: this tries to load a xyz-config.cmake file from the package installation itself. Note that by default, this mode doesn't look at a potential system installation. If you do want the CONFIG mode to also inspect your system, you have to explicitly set the XYZ_ROOT_DIR variable to your system's path (typically "/usr").
+2. MODULE mode: this relies on the logic written in a FindXyz.cmake macro, looking directly for representative libraries, binaries or headers of the package.
+
+The first mode is preferred as it allows to directly include the CMake targets of the prerequisite.
+
+The package detection is only made in the root CMakeLists.txt, potentially conditionned on some
+user options. 
+
+Writing the detection macro of a new SALOME prerequisite
+--------------------------------------------------------
+
+All detection macros are located under the soure directory::
+
+  salome_adm/cmake_files
+
+or::
+
+  adm_local/cmake_files
+
+All prerequisite detection in SALOME should be implemented by:
+
+* writing a file FindSalome<Xyz>.cmake (note the extra ''Salome''), where <Xyz> matches *exactly* the name of the standard CMake module (see below if there is no standard module for <Xyz>)
+* invoking FIND_PACKAGE() command in the root CMakeLists.txt::
+  
+    FIND_PACKAGE(SalomeLibXml2 REQUIRED)
+
+* potentially, a prerequisite might be optional. In this case the following syntax is preferred::
+  
+    FIND_PACKAGE(SalomeLibXml2)
+    SALOME_LOG_OPTIONAL_PACKAGE(LibXml2 SALOME_FOO_FEATURE)
+    
+
+* the custom macro SALOME_LOG_OPTIONAL_PACKAGE registers internally the fact that the package is optional, and the flag that can be changed to avoid its detection. The final status of what has been found or not can then be displayed by calling SALOME_PACKAGE_REPORT_AND_CHECK(). This will trigger the failure of the configuration process if some package is missing, and it will also display the flag that should be turned OFF to avoid the issue::
+
+    # Final report and global check of optional prerequisites:
+    SALOME_PACKAGE_REPORT_AND_CHECK()
+
+Typically the FindSalome<Xyz>.cmake file looks like this::
+
+    SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(CppUnit CPPUNIT_INCLUDE_DIRS 1)
+    MARK_AS_ADVANCED(CPPUNIT_INCLUDE_DIRS CPPUNIT_LIBRARIES CPPUNIT_CONFIG_BIN CPPUNIT_SUBLIB_cppunit CPPUNIT_SUBLIB_dl)
+
+It invokes the SALOME macro SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS() which takes:
+
+* as first argument the name of the package (here CppUnit), 
+* as second argument, the name of a (path) variable set when the package is found properly, 
+* as third argument, the number of levels this variable should be browsed up to reach the root directory of the package installation.
+    
+
+In the example above,
+
+* we look for the package CppUnit (note that this is case-sensitive). There is already a standard CMake module to detect CppUnit, which sets the CMake variable CPPUNIT_INCLUDE_DIRS to the (list of) directories to include when compiling with CppUnit. 
+* going one level up from the include directory (typically /usr/include) gives the root directory of the installation (/usr).
+* all the variables exposed in the cache by the standard detection logic (CPPUNIT_INCLUDE_DIRS, CPPUNIT_LIBRARIES, etc ...) are marked as "advanced" so that they do not automatically appear in ccmake or cmake-gui.
+
+Note that the reference variable may be a list, only its first element is then considered.
+
+Writing a new generic detection macro (advanced)
+------------------------------------------------
+
+If you need to include in SALOME a prerequisite for which the standard CMake distribution 
+doesn't provide the FindXyz.cmake module, you will need to write it yourself.
+This also applies if you judge that the standard FindXyz.cmake CMake module doesn't do its job
+properly (yes, it can happen).
+
+The following guidelines apply:
+
+* make the module as generic as possible, considering that it should also run properly outside SALOME. This separates clearly the basic detection of the package from the SALOME logic. Basically the module represents the point 4. in the order of priority given above and should behave as much as possible like any standard CMake module
+* invoking the FIND_LIBRARY(), FIND_PROGRAM(), FIND_PATH() and FIND_FILE() commands should be done without specifying an explicit PATH option to the command (this is not always possible - see for example FindOmniORBPy.cmake). The idea is that the root directory for the search is set by the SALOME encapsulation (by setting CMAKE_PREFIX_PATH)
+* document properly which variables you are setting, respecting the CMake standard (see for example FindOmniORB.cmake)
+* use the CMake code found in many standard modules::
+
+    INCLUDE(FindPackageHandleStandardArgs)
+    FIND_PACKAGE_HANDLE_STANDARD_ARGS(Graphviz REQUIRED_VARS GRAPHVIZ_EXECUTABLE)
+
+
+* This macro takes care (among other things) of setting the XYZ_FOUND variable (upper case), and of displaying a message if not in QUIET mode (TBC).
+* the macro should be saved in the same directory as above
+* respect the naming conventions for the variables you set (start with the package name, upper case - see :ref:`naming_conventions`)
+* do not do any ADD_DEFINITIONS() or INCLUDE_DIRECTORIES() in such a macro. This should be done by the caller or in a UseXYZ.cmake file. The purpose of a FindXXX.cmake macro is to detect, not to make usable. This rule does not apply to FindSalomeXXX.cmake macros where we know we are always in the SALOME context.
+* here is a simple example of the detection of Sphinx::
+
+    # - Sphinx detection
+    #
+    # Output variable: SPHINX_EXECUTABLE
+    #                  
+    # 
+    # The executable 'sphinx-build' is looked for and returned in the above variable.
+    #
+
+    ###########################################################################
+    # Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+    <...>
+    ###########################################################################
+
+    FIND_PROGRAM(SPHINX_EXECUTABLE sphinx-build)
+
+    # Handle the standard arguments of the find_package() command:
+    INCLUDE(FindPackageHandleStandardArgs)
+    FIND_PACKAGE_HANDLE_STANDARD_ARGS(Sphinx REQUIRED_VARS SPHINX_EXECUTABLE)
+
+
+.. _pkg_impl:
+
+Implementation details (advanced)
+---------------------------------
+
+The core of the SALOME detection logic is located in the macro
+SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS() implemented in KERNEL/salome_adm/cmake_files/SalomeMacros.cmake.
+
+All the logic is thus concentrated in one (hopefully well documented) macro. This means: one place to fix if there is a bug, and better, one place to amend if we ever want to define a new behaviour (for example if we want to change the order of priorities between CONFIG and MODULE mode). The end user (someone developing in SALOME) just needs to call it. It is the responsability of the core SALOME developpers to understand and maintain this macro.
+
+The reader is invited to have the code at hand when reading the following.
+
+The macro signature is
+::
+
+  SALOME_FIND_PACKAGE_DETECT_CONFLICTS(pkg referenceVariable upCount)
+
+where:
+
+* *pkg*              : name of the system package to be detected
+* *referenceVariable*: variable containing a path that can be browsed up to retrieve the package root directory (xxx_ROOT_DIR)
+* *upCount*          : number of times we have to go up from the path <referenceVariable> to obtain the package root directory.
+
+For example::  
+
+  SALOME_FIND_PACKAGE_DETECT_CONFLICTS(SWIG SWIG_EXECUTABLE 2) 
+
+The macro has a significant size but is very linear:
+
+1. Load a potential env variable XYZ_ROOT_DIR as a default choice for the cache entry XYZ_ROOT_DIR.
+   If empty, load a potential XYZ_ROOT_DIR_EXP as default value (path exposed by another package depending
+   directly on XYZ)
+2. Invoke FIND_PACKAGE() in this order:
+
+  * in CONFIG mode first (if possible): priority is given to a potential "XYZ-config.cmake" file. In this mode, the standard system paths are skipped. If you however want to force a detection in CONFIG mode into a system path, you have to set explicitly the XYZ_ROOT_DIR variable to "/usr".
+  * then switch to the standard MODULE mode, appending on CMAKE_PREFIX_PATH the above XYZ_ROOT_DIR variable.
+
+3. Extract the path actually found into a temp variable _XYZ_TMP_DIR
+4. Warn if XYZ_ROOT_DIR is set and doesn't match what was found (e.g. when CMake found the system installation
+   instead of what is pointed to by XYZ_ROOT_DIR - happens when there is a typo in the content of XYZ_ROOT_DIR).
+5. Conflict detection: check the temporary variable against a potentially existing XYZ_ROOT_DIR_EXP
+6. Finally expose what was *actually* found in XYZ_ROOT_DIR.  This might be different from the initial XYZ_ROOT_DIR, but there has been a warning in such a case.
+
+
+The specific stuff (for example exposing a prerequisite of XYZ to the rest of the world for future conflict detection) is added after the call to the macro by the callee. See for example the FindSalomeHDF5.cmake macro which exposes the MPI_ROOT_DIR if HDF5 was compiled with parallel support.
+
+If the invokation of FIND_PACKAGE() was done with some options:
+
+* QUIET, REQUIRED
+* COMPONENTS
+* VERSION [EXACT]
+
+those options are completly handled through the analysis of the standard CMake variables (which are automatically set when those options are given):
+
+* Xyz_FIND_QUIETLY and Xyz_FIND_REQUIRED
+* Xyz_FIND_COMPONENTS
+* Xyz_FIND_VERSION and Xyz_FIND_VERSION_EXACT
+
+
+
+
+
diff --git a/dev/cmake/source/skeleton.rst b/dev/cmake/source/skeleton.rst
new file mode 100644 (file)
index 0000000..dc4cf6a
--- /dev/null
@@ -0,0 +1,123 @@
+.. _skeleton:
+
+Anatomy of a CMakeLists.txt file
+================================
+
+Root CMakeLists.txt
+-------------------
+
+The root CMakeLists.txt should contain the following elements:
+
+* Versioning: definition of the major, minor and patch version number. This is the sole place where those numbers should be defined.
+* Platform setup: specific flags, detection of the architecture, ... This it typically done by including the SalomeSetupPlatform macro.
+* User option definitions: in SALOME the following flags should be found in all modules:
+
+  * SALOME_USE_MPI: wether Salome should be built using MPI containers
+  * SALOME_BUILD_TESTS: wether the unit tests should be built
+  * SALOME_BUILD_DOC: wether the documentation for the current module should be generated and installed
+
+  Other flags specific to the module might be added, and should then start with *SALOME_XYZ_* where <XYZ> is the module's name (MED for example).
+
+* Detection of the required prerequisites for the module. All prerequisites in SALOME are detected through a call to FIND_PACKAGE(SalomeXYZ ...). See section :ref:`package`::
+
+    FIND_PACKAGE(SalomePython REQUIRED)
+    FIND_PACKAGE(SalomePThread REQUIRED)
+    FIND_PACKAGE(SalomeSWIG REQUIRED)
+
+
+* Detection of the optional prerequisites (potentially conditioned on some user options - see :ref:`package` for more on this)::
+
+    IF(SALOME_BUILD_DOC)
+      FIND_PACKAGE(SalomeDoxygen)
+      FIND_PACKAGE(SalomeGraphviz)
+      FIND_PACKAGE(SalomeSphinx)
+      SALOME_UPDATE_FLAG_AND_LOG_PACKAGE(Doxygen SALOME_BUILD_DOC)
+      SALOME_UPDATE_FLAG_AND_LOG_PACKAGE(Graphviz SALOME_BUILD_DOC)
+      SALOME_UPDATE_FLAG_AND_LOG_PACKAGE(Sphinx SALOME_BUILD_DOC)
+    ENDIF(SALOME_BUILD_DOC)
+
+
+* Printing a report about the detection status::
+
+    SALOME_PACKAGE_REPORT()
+
+
+* Common installation directories. Those directories should be used consistently across all SALOME modules::
+
+    SET(SALOME_INSTALL_BINS bin/salome CACHE PATH "Install path: SALOME binaries")
+    SET(SALOME_INSTALL_LIBS lib/salome CACHE PATH "Install path: SALOME libs")
+    SET(SALOME_INSTALL_IDLS idl/salome CACHE PATH "Install path: SALOME IDL files")
+    SET(SALOME_INSTALL_HEADERS include/salome CACHE PATH "Install path: SALOME headers")
+    SET(SALOME_INSTALL_SCRIPT_SCRIPTS ${SALOME_INSTALL_BINS} CACHE PATH "Install path: SALOME scripts")
+    ...
+
+
+* Specific installation directories. Those should start with SALOME_<MODULE>::
+
+    SET(SALOME_GUI_INSTALL_PARAVIEW_LIBS lib/paraview CACHE PATH "Install path: SALOME GUI ParaView libraries")
+    SET(SALOME_GUI_INSTALL_RES_DATA "${SALOME_INSTALL_RES}/gui" CACHE PATH "Install path: SALOME GUI specific data")    
+    ...
+
+
+* Inclusion of the source code directories to be compiled::
+
+    IF(NOT SALOME_LIGHT_ONLY)
+      ADD_SUBDIRECTORY(idl)
+    ENDIF()
+    ADD_SUBDIRECTORY(src)
+
+
+* Header configuration: creation of the version header files, among other
+* Configuration export (see dedicated section :ref:`config`)
+
+
+CMakeLists.txt dedicated to the build of a target
+-------------------------------------------------
+
+First, include directories::
+
+  INCLUDE_DIRECTORIES(
+    ${OMNIORB_INCLUDE_DIR}
+    ${PTHREAD_INCLUDE_DIRS}
+    ${PROJECT_BINARY_DIR}/salome_adm
+    ${CMAKE_CURRENT_SOURCE_DIR}/../Basics
+    ${CMAKE_CURRENT_SOURCE_DIR}/../SALOMELocalTrace
+    ${CMAKE_CURRENT_SOURCE_DIR}/../Utils
+    ${PROJECT_BINARY_DIR}/idl
+    )
+
+Then we define the sources list <target>_SOURCES::
+
+  SET(SalomeNS_SOURCES
+    SALOME_NamingService.cxx
+    ServiceUnreachable.cxx
+    NamingService_WaitForServerReadiness.cxx
+  )
+
+Set the common compilation flags of all targets of the directory::
+
+  ADD_DEFINITIONS(${OMNIORB_DEFINITIONS})
+
+Ensure dependencies are correctly set, if needed (please refer to :ref:`dependencies`)::
+
+  ADD_DEPENDENCIES(SalomeNS SalomeIDLKernel)
+
+Then the standard way to compile, link and install a library or executable is::
+
+  ADD_LIBRARY(SalomeNS ${SalomeNS_SOURCES})
+  TARGET_LINK_LIBRARIES(SalomeNS OpUtil)
+  INSTALL(TARGETS SalomeNS DESTINATION ${SALOME_INSTALL_LIBS})
+
+Note that there is no SHARED reference, no SET_TARGET_PROPERTIES( .. COMPILE_FLAGS ..). If you need to link against a KERNEL or other SALOME target, use the variable name of the target, not the target directly::
+
+  TARGET_LINK_LIBRARIES(xyz ${KERNEL_SalomeNS})   # OK
+  TARGET_LINK_LIBRARIES(xyz SalomeNS)             # Bad!!
+
+Finally write the specific installation rule for scripts or headers::
+
+  SALOME_INSTALL_SCRIPTS(SALOME_NamingServicePy.py ${SALOME_INSTALL_SCRIPT_SCRIPTS})
+  FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx")
+  INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${SALOME_INSTALL_HEADERS})
+
+
+
diff --git a/dev/cmake/source/various.rst b/dev/cmake/source/various.rst
new file mode 100644 (file)
index 0000000..14ce16b
--- /dev/null
@@ -0,0 +1,120 @@
+Various guidelines and conventions (advanced)
+=============================================
+
+.. _debug:
+
+Debugging CMake
+---------------
+
+CMake generates a build process which is per default much less verbose than the Autotools one. 
+One doesn't see automatically the compilation/linking commands being invoked. 
+Each of the following solutions displays the full command line for each build action::
+
+  make VERBOSE=1
+  env VERBOSE=1 make
+  export VERBOSE=1; make
+
+To have this by default for every build, one can specify this setting at the configuration 
+step by toggling the CMAKE_VERBOSE_MAKEFILE to ON.
+
+Normally detection problems are wrapped by the macro SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS() to print a simple error message that mostly shows the current content of the XYZ_ROOT_DIR variable. The developper can switch the flag::
+
+  SALOME_CMAKE_DEBUG
+  
+to ON to see the full original CMake error message.
+
+.. _conventions:
+
+General conventions
+-------------------
+* Specify the languages used in the project::
+
+    PROJECT(MyProject C CXX)
+
+* the version of the module is specified in one place: the root CMakeLists.txt file via standard variables
+* never, I said *NEVER*, specify includes or libraries by overriding COMPILE_FLAGS. CMake provide standard commands for this (INCLUDE_DIRECTORIES, TARGET_LINK_LIBRARIES) and produces much more portable build files! If a directory includes two or more targets that compulsory need different set of include dir, split into several subdirectories, and put the different targets in them (MEDFile has plenty of this).
+* at present there is no management in SALOME of API versioning. So there is no need to deal with SO_VERSION in \*.so libraries (\*.so.1.2.3 …)
+* No use of GLOBS for sources (\*.cxx), but GLOBS can be used for includes and \*.i on installation
+* no \*.hxx in <SMTH>_SOURCES variable
+* FIND_PACKAGE() is called only in root <Module>/CMakeLists.txt
+* INCLUDE() directives, if needed, must come early in the file
+* ADD_SUBDIRECTORY() directives, if needed, must be done just after INCLUDE and FIND_PACKAGE, then the specific part of subdirectory can be done
+* INSTALL should be called at the end of the CMakelists.txt
+* Create MACRO in \*.cmake to factorize some repetitive lines. (Try to) comment them. 
+* All <Module>/CMakeLists.txt (see KERNEL_SRC/CMakeLists.txt) contains the definition of the variables which specify the location of installation directories. Only these variables should be used in subdirectories, and the model given in KERNEL should be followed.
+* Use builtin WIN32 variable instead of WINDOWS variable to detect a Windows platform. Potentially avoid CYGWIN also::
+
+    IF(WIN32 AND NOT CYGWIN)
+     ...
+    ENDIF()
+
+* Use FILE(TO_CMAKE_PATH) instead of REPLACE(“\\” “/”) and FILE(TO_NATIVE_PATH) to convert a path to the CMake internal format
+* Use strictly python to execute portably a script
+* Use PROJECT_BINARY_DIR and PROJECT_SOURCE_DIR instead of CMAKE_BINARY_DIR and CMAKE_SOURCE_DIR. This helps having a proper behavior when the module is included as a sub-folder in the code of a bigger project.
+* It is not necessary to rewrite the full text when closing a conditional statement or a control flow statement. This is up to you::
+
+    IF(A_VERY_LONG_CONDITION)
+      ..
+    ENDIF() # no need to repeat A_VERY_LONG_CONDITION 
+
+* When appending to CMake lists, the following syntax should be used::
+
+    LIST(APPEND a_variable ${element1} ...)
+
+* Names of variables used internally should start with an underscore
+* For every path read from outside CMake (typically from an environment variable), the following conversion should be used to ensure the path format is compatible with the internal CMake syntax::
+
+    FILE(TO_CMAKE_PATH ...)
+
+* all install paths should be relative
+* beware that variables inside macros are persistent (static) - do not assume they are reset everytime you re-enter the macro (think of a macro as a simple text subsitution at the place it was called)
+* always use variables to reference targets, do not reference target directly (this will save some effort the day we want to rename a target ...)
+
+
+.. _naming_conventions:
+
+Naming conventions
+------------------
+They are few of them but let's try to be consistent:
+
+* use upper case for CMake commands. For vars, the case is free. Why? As targets are generally in lower case it allows discriminating more easily CMake commands from local vars and targets.
+* for sources the convention <Target>_SOURCES is used to store sources needed by target <Target>.
+* for headers the convention <Target>_HEADERS is used to store headers to be installed in pair with <Target>.
+* for all the variables set by a given package, the naming convention is based on a CMake prefix (upper case if possible)::
+
+    <PRODUCE>_myVariable
+
+* temporary variables (not used outside the macro or outside the module) should start with an underscore
+
+
+.. _dependencies:
+
+Parallel compilation - Correct dependencies
+-------------------------------------------
+Contrary to Autotools, CMake is working by targets and not by directories. If parallel compilation fails, it means that some dependencies are missing or not properly set. This can happen mainly with generated sources (such as the ones produced by the IDL compiler, or by SWIG).
+
+The linked libraries of the target are automatically considered as dependency by CMake. But, for instance, when a library needs only generated includes from Kernel IDL (no link needed with the generated code for a CORBA client), the dependency should be explicitly added by the::
+
+  ADD_DEPENDENCIES(<target> SalomeIDLKernel) 
+
+command in the CMakeLists.txt.
+
+To check parallel compilation (i.e. dependencies) of a target, the developer must start from an empty, generated by CMake build directory and use the “make (-jX) <target>”.
+
+.. _cmd_conventions:
+
+Command specific conventions
+----------------------------
+
+* INCLUDE(): only specify the name of the macro, e.g. INCLUDE(SalomeMacros). The directory is almost always already in the CMAKE_MODULE_PATH.
+* Strings: variables representing strings or paths should always be used quoted. For example "${my_var}". This ensures a proper behavior if the string contains a semi-colonn
+* appending an element to a list variable should be done with::
+
+    LIST(APPEND xyz ...)
+
+  and not with::
+    
+    SET(xyz ${xyz} ...)    
+
+
+
diff --git a/dev/git/CMakeLists.txt b/dev/git/CMakeLists.txt
new file mode 100644 (file)
index 0000000..e349eac
--- /dev/null
@@ -0,0 +1,33 @@
+# Copyright (C) 2012-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# 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
+#
+
+# Include common macros
+# ==================
+INCLUDE(SalomeDocumentationMacros)
+
+# Add sphinx documentation target
+# ============================
+SALOME_ADD_SPHINX_DOC( html git_doc ${CMAKE_CURRENT_SOURCE_DIR})
+
+# Install rules
+# ==========
+INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/_build/html DESTINATION ${SALOME_DOCUMENTATION_GIT_INSTALL}/build)
+
+FILE(GLOB COMMON_DOCX_FIELS "${CMAKE_CURRENT_SOURCE_DIR}/*.docx")
+INSTALL(FILES ${COMMON_DOCX_FIELS} DESTINATION ${SALOME_DOCUMENTATION_GIT_INSTALL})
diff --git a/dev/git/Git_Simple_Write_Procedure.rst b/dev/git/Git_Simple_Write_Procedure.rst
new file mode 100644 (file)
index 0000000..6dd4072
--- /dev/null
@@ -0,0 +1,143 @@
+Contributing to the SALOME project with Git
+===========================================
+
+This short document indicates the process to be followed by anyone wishing to contribute code to the SALOME project using Git. If you read this document, you should have received the credentials allowing you to write your changes into the central repository.
+
+Get your copy of the central repository
+---------------------------------------
+
+1. Clone the latest version of the repository for the module you want to modify::    
+
+     git clone ssh://<proper-final-url>
+
+   or::
+
+     git clone https://<proper-final-url>
+  
+  This retrieves a local copy of the module's repository onto your machine. 
+   
+  .. note:: The later should be used to work behind a proxy (see :ref:`special-instructions-for-https` )
+  
+
+2. If you were already given a branch name to work with, you can simply retrieve it and start working::
+
+    git checkout -b <branch_name> origin/<branch_name>
+
+
+  This creates a local copy of the branch, set up to be a copy of the remote branch on the central server. You can jump directly to the next section (Workflow) telling how to commit and publish changes.
+
+3. Otherwise you need to create and publish a new branch in which you will do your changes (you are not allowed to commit changes directly into the main branch 'master'). First create the local version of the new branch::
+
+    git checkout master
+    git checkout -b <xyz/short_desc>
+  
+
+  where <xyz> are you initials (John Smith gives 'jsm') and <short_desc> is a small string indicating what changes will be made. For example::
+    
+    jsm/new_viewer
+
+  
+  The last command creates the branch locally, and update your working directory (i.e. the source code) to match this branch: every change and commit you make from now on will be stored in this branch.
+
+4. Publish your branch to the central repository for the first time::
+
+    git push -u origin <xyz/short_desc>
+  
+  
+  The option "-u" ensure your local branch will be easily synchronized with the remote copy on the central server. With older versions of Git you might have to execute the above in two steps::
+
+    git push origin <xyz/short_desc>
+    git branch -u origin/<xyz/short_desc>
+  
+  
+Workflow
+--------
+
+1. If you didn't update your local copy for a while, update it with the following command. This retrieves from the central server all changes published by other people working on your branch. This step is not necessary if you just initialized your repository as described above::
+
+    git pull
+  
+2. Do your changes, compile. 
+3. Perform the appropriate tests to ensure the changes work as expected.
+4. If you create a new source file, you need to make Git aware of it::
+
+    git add <path/to/new/file>
+  
+5. When everything is ready you can commit all your changes into your local repository::
+
+    git commit -a
+  
+  The "-a" option tells Git to automatically take all the changes you made for the current commit. You will be asked to enter a commit message. Please, *please*, write something sensible. A good format is::
+
+    GLViewer: enhance ergonomy of the 3D view
+  
+    User can now zoom in and out using the mouse wheel. Corresponding keyboard shortcuts have also been added.
+
+  i.e. a first short line containing the class/code entity that was modified, and a short description of the change. Then a blank line, and a long description of the change. Remember that this message is mainly for other people to understand quickly what you did.
+  
+  
+  At this point, the changes are just saved in your local repository. You can still revert them, amend the commits, and perform any other operation that re-writes the local history.
+  
+6. Once you feel everything is ready to be seen by the rest of the world, you can publish your work. The first step is to synchronize again with any potential change published on the central repository while you were working locally::
+
+    git pull
+  
+7. At this stage, two situations can arise. If nothing (or some unrelated stuff to your work) happened on the central repository, Git will not complain (or potentially do an automatic merge). You can inspect the latest changes committed by others with commands like::
+
+    git log
+    gitk 
+
+  If you notice changes made by others that can affect what you're working on, it might be a good idea to recompile and retest what you have done, even if Git did the merge automatically. Once you are happy, you can directly go to step 9.
+
+8. Conflict resolution. If a message saying "CONFLICT: automatic merge FAILED" appears, it means that some changes made by others are in conflict with what you committed locally (typically happens when the other person modified a file that you also changed). In that case, you need to integrate both changes: edit the file so that both changes work together (or so that only one version is retained). Conflicts are marked in the file like this::
+
+    <<<<<<< HEAD:mergetest
+    This is my third line
+    =======
+    This is a fourth line I am adding
+    >>>>>>> 4e2b407f501b68f8588aa645acafffa0224b9b78:mergetest
+
+  Once you resolved the conflict, re-compiled and re-tested the code, you need to tell Git that the file is no more in conflict::
+  
+    git add <the_file>
+
+  You can then finish the merge operation by committing the whole thing::
+  
+    git commit -a
+  
+  In this peculiar case (conflict resolution) you will see that Git offers you a default message (merge message). You can complete this message to indicate for example how the conflict was solved. 
+  
+9. When all conflicts are solved (and the code has been compiled and tested again if needed) you can finally publish your work to the central repository::
+
+    git push
+
+  This makes your changes visible to others.
+
+10. Once all your changes have been committed (potentially several commits) and you feel your modification is ready to be integrated in the main development line (i.e. to be considered for the next release), you can notify an administrator of the project to ask for your changes to be merged in the *master* branch. 
+
+.. _special-instructions-for-https:
+
+Special instructions for https protocol
+--------------------------------------
+
+Certificates
+~~~~~~~~~~~~
+To be able to use the https protocol you will first have to install the appropriate certificate (let's call it *ca.crt*)
+On Debian the procedure is described here::
+
+  /usr/share/doc/ca-certificates/README.Debian
+
+As explained in this file you will have to copy the certificate *ca.crt* in::
+
+  /usr/local/share/ca-certificates/
+
+and run::
+
+  update-ca-certificates
+
+Configure Git for http(s) protocol behind a proxy
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+If you want to use Git via http (or https) protocol behind a proxy configure Git by executing the following command::
+
+ git config --global http.proxy http://<login_internet>:<password_internet>@aproxy:aport
+
diff --git a/dev/git/Switch-To-GIT-2013-06.docx b/dev/git/Switch-To-GIT-2013-06.docx
new file mode 100644 (file)
index 0000000..782cf8f
Binary files /dev/null and b/dev/git/Switch-To-GIT-2013-06.docx differ
diff --git a/dev/git/conf.py b/dev/git/conf.py
new file mode 100644 (file)
index 0000000..98448b7
--- /dev/null
@@ -0,0 +1,242 @@
+# -*- coding: utf-8 -*-
+#
+# Git - Short procedure documentation build configuration file, created by
+# sphinx-quickstart on Thu Sep  5 09:16:31 2013.
+#
+# This file is execfile()d with the current directory set to its containing dir.
+#
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+import sys, os
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+#sys.path.insert(0, os.path.abspath('.'))
+
+# -- General configuration -----------------------------------------------------
+
+# If your documentation needs a minimal Sphinx version, state it here.
+#needs_sphinx = '1.0'
+
+# Add any Sphinx extension module names here, as strings. They can be extensions
+# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+extensions = []
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix of source filenames.
+source_suffix = '.rst'
+
+# The encoding of source files.
+#source_encoding = 'utf-8-sig'
+
+# The master toctree document.
+master_doc = 'Git_Simple_Write_Procedure'
+
+# General information about the project.
+project = u'Git - Short procedure'
+copyright = u'2013, Adrien BRUNETON (CEA/DANS/STMF/LGLS)'
+
+# The version info for the project you're documenting, acts as replacement for
+# |version| and |release|, also used in various other places throughout the
+# built documents.
+#
+# The short X.Y version.
+version = '1.0'
+# The full version, including alpha/beta/rc tags.
+release = '1.0'
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+#language = None
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+#today_fmt = '%B %d, %Y'
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+exclude_patterns = ['_build']
+
+# The reST default role (used for this markup: `text`) to use for all documents.
+#default_role = None
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+# A list of ignored prefixes for module index sorting.
+#modindex_common_prefix = []
+
+
+# -- Options for HTML output ---------------------------------------------------
+
+# The theme to use for HTML and HTML Help pages.  See the documentation for
+# a list of builtin themes.
+html_theme = 'default'
+
+# Theme options are theme-specific and customize the look and feel of a theme
+# further.  For a list of options available for each theme, see the
+# documentation.
+#html_theme_options = {}
+
+# Add any paths that contain custom themes here, relative to this directory.
+#html_theme_path = []
+
+# The name for this set of Sphinx documents.  If None, it defaults to
+# "<project> v<release> documentation".
+#html_title = None
+
+# A shorter title for the navigation bar.  Default is the same as html_title.
+#html_short_title = None
+
+# The name of an image file (relative to this directory) to place at the top
+# of the sidebar.
+#html_logo = None
+
+# The name of an image file (within the static path) to use as favicon of the
+# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+#html_favicon = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['_static']
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+#html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#html_additional_pages = {}
+
+# If false, no module index is generated.
+#html_domain_indices = True
+
+# If false, no index is generated.
+#html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+#html_split_index = False
+
+# If true, links to the reST sources are added to the pages.
+#html_show_sourcelink = True
+
+# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
+#html_show_sphinx = True
+
+# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
+#html_show_copyright = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a <link> tag referring to it.  The value of this option must be the
+# base URL from which the finished HTML is served.
+#html_use_opensearch = ''
+
+# This is the file name suffix for HTML files (e.g. ".xhtml").
+#html_file_suffix = None
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'Git-Shortproceduredoc'
+
+
+# -- Options for LaTeX output --------------------------------------------------
+
+latex_elements = {
+# The paper size ('letterpaper' or 'a4paper').
+#'papersize': 'letterpaper',
+
+# The font size ('10pt', '11pt' or '12pt').
+#'pointsize': '10pt',
+
+# Additional stuff for the LaTeX preamble.
+#'preamble': '',
+}
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title, author, documentclass [howto/manual]).
+latex_documents = [
+  ('Git_Simple_Write_Procedure', 'Git-Shortprocedure.tex', u'SALOME and Git - Short procedure',
+   u'Adrien BRUNETON (CEA/DANS/STMF/LGLS)', 'howto'),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+#latex_logo = None
+
+# For "manual" documents, if this is true, then toplevel headings are parts,
+# not chapters.
+#latex_use_parts = False
+
+# If true, show page references after internal links.
+#latex_show_pagerefs = False
+
+# If true, show URL addresses after external links.
+#latex_show_urls = False
+
+# Documents to append as an appendix to all manuals.
+#latex_appendices = []
+
+# If false, no module index is generated.
+#latex_domain_indices = True
+
+
+# -- Options for manual page output --------------------------------------------
+
+# One entry per manual page. List of tuples
+# (source start file, name, description, authors, manual section).
+man_pages = [
+    ('Git_Simple_Write_Procedure', 'git-shortprocedure', u'Git - Short procedure Documentation',
+     [u'Adrien BRUNETON (CEA/DANS/STMF/LGLS)'], 1)
+]
+
+# If true, show URL addresses after external links.
+#man_show_urls = False
+
+
+# -- Options for Texinfo output ------------------------------------------------
+
+# Grouping the document tree into Texinfo files. List of tuples
+# (source start file, target name, title, author,
+#  dir menu entry, description, category)
+texinfo_documents = [
+  ('Git_Simple_Write_Procedure', 'Git-Shortprocedure', u'Git - Short procedure Documentation',
+   u'Adrien BRUNETON (CEA/DANS/STMF/LGLS)', 'Git-Shortprocedure', 'One line description of project.',
+   'Miscellaneous'),
+]
+
+# Documents to append as an appendix to all manuals.
+#texinfo_appendices = []
+
+# If false, no module index is generated.
+#texinfo_domain_indices = True
+
+# How to display URL addresses: 'footnote', 'no', or 'inline'.
+#texinfo_show_urls = 'footnote'
diff --git a/extra/CMakeLists.txt b/extra/CMakeLists.txt
new file mode 100644 (file)
index 0000000..392c2e3
--- /dev/null
@@ -0,0 +1,23 @@
+# Copyright (C) 2012-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# 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
+#
+
+# Install rules
+# ===========
+FILE(GLOB COMMON_PDF_FILES "${CMAKE_CURRENT_SOURCE_DIR}/*.pdf")
+INSTALL(FILES ${COMMON_PDF_FILES} DESTINATION ${SALOME_DOCUMENTATION_EXTRA_INSTALL})
diff --git a/gui/CMakeLists.txt b/gui/CMakeLists.txt
new file mode 100644 (file)
index 0000000..425f095
--- /dev/null
@@ -0,0 +1,23 @@
+# Copyright (C) 2012-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# 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
+#
+#
+
+# Install rules
+# ==========
+INSTALL(FILES README DESTINATION ${SALOME_DOCUMENTATION_GUI_INSTALL})
diff --git a/tui/CMakeLists.txt b/tui/CMakeLists.txt
new file mode 100644 (file)
index 0000000..263f536
--- /dev/null
@@ -0,0 +1,23 @@
+# Copyright (C) 2012-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# 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
+#
+#
+
+# Install rules
+# ==========
+INSTALL(FILES README DESTINATION ${SALOME_DOCUMENTATION_TUI_INSTALL})