From 600498e35eda0c667767242b0fb7fe53630e74f6 Mon Sep 17 00:00:00 2001 From: aguerre Date: Mon, 25 Nov 2013 14:14:12 +0000 Subject: [PATCH] Pull from V7_main --- CMakeLists.txt | 2 +- bin/appli_gen.py | 2 +- bin/salomeLauncherUtils.py | 32 ++- doc/docutils/archives/INSTALL.txt | 75 ++--- doc/docutils/archives/kernel_resources.txt | 4 +- doc/docutils/salomepypkg.rst | 5 +- doc/salome/install.dox | 85 ++---- doc/salome/kernel_resources.dox | 4 +- doc/salome/unittests.dox | 2 +- salome_adm/cmake_files/FindCppUnit.cmake | 36 ++- salome_adm/cmake_files/FindGraphviz.cmake | 26 +- salome_adm/cmake_files/FindMEDFile.cmake | 4 +- salome_adm/cmake_files/FindSalomeSphinx.cmake | 1 - salome_adm/cmake_files/SalomeMacros.cmake | 269 ++++++++++-------- .../cmake_files/SalomeSetupPlatform.cmake | 35 ++- src/KERNEL_PY/kernel/services.py | 8 +- src/KERNEL_PY/salome_test.py | 5 +- src/TestContainer/TestComponentPy.py | 6 +- 18 files changed, 308 insertions(+), 293 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2b643425c..455b29236 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -254,7 +254,7 @@ SET(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}/inc # Build variables that will be expanded when configuring SalomeConfig.cmake: SALOME_CONFIGURE_PREPARE(CppUnit Graphviz Doxygen Sphinx MPI omniORB LibBatch - PThread Boost HDF5 libXml2 Python SIMANIO HDF5) + PThread Boost HDF5 libXml2 Python SIMANIO) CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake diff --git a/bin/appli_gen.py b/bin/appli_gen.py index 3b4c21355..7f32f419a 100644 --- a/bin/appli_gen.py +++ b/bin/appli_gen.py @@ -200,7 +200,7 @@ def install(prefix,config_file,verbose=0): 'update_catalogs.py', '.bashrc', ): - virtual_salome.symlink("./bin/salome/appliskel/"+fn,os.path.join(home_dir, fn)) + virtual_salome.symlink( os.path.join( appliskel_dir, fn ), os.path.join( home_dir, fn) ) pass if filename != os.path.join(home_dir,"config_appli.xml"): diff --git a/bin/salomeLauncherUtils.py b/bin/salomeLauncherUtils.py index a3696dec6..33d867d7f 100644 --- a/bin/salomeLauncherUtils.py +++ b/bin/salomeLauncherUtils.py @@ -4,6 +4,7 @@ import os import sys import glob import subprocess +import re """ Define a specific exception class to manage exceptions related to SalomeRunner @@ -69,6 +70,7 @@ def getScriptsAndArgs(args=[]): currentKey = None argsPrefix = "args:" callPython = False + currentScript = None for i in range(len(args)): elt = args[i] @@ -83,12 +85,14 @@ def getScriptsAndArgs(args=[]): elif elt.startswith("python"): callPython = True elif os.path.isfile(elt) or os.path.isfile(elt+".py"): - if elt[-3:] == ".py": - currentScript = os.path.abspath(elt) - else: - currentScript = None - if elt[-4:] != ".hdf": + if elt[-4:] != ".hdf": + if elt[-3:] == ".py": + currentScript = os.path.abspath(elt) + elif os.path.isfile(elt+".py"): currentScript = os.path.abspath(elt+".py") + else: + currentScript = os.path.abspath(elt) # python script not necessary has .py extension + pass if currentScript and callPython: currentKey = "python "+currentScript scriptArgs.append({currentKey:[]}) @@ -98,7 +102,23 @@ def getScriptsAndArgs(args=[]): currentKey = "python "+currentScript scriptArgs.append({currentKey:[]}) else: - currentKey = currentScript + ispython = False + try: + fn = open(currentScript) + for i in xrange(10): # read only 10 first lines + ln = fn.readline() + if re.search("#!.*python"): + ispython = True + break + pass + fn.close() + except: + pass + if not ispython and currentScript[-3:] == ".py": + currentKey = "python "+currentScript + else: + currentKey = currentScript + pass scriptArgs.append({currentKey:[]}) # end for loop return scriptArgs diff --git a/doc/docutils/archives/INSTALL.txt b/doc/docutils/archives/INSTALL.txt index 7c01e348c..73769774d 100644 --- a/doc/docutils/archives/INSTALL.txt +++ b/doc/docutils/archives/INSTALL.txt @@ -46,7 +46,7 @@ Summary First of all, you have to check (or install if needed) the dependant software programs on your system. These programs are: -- common development tools as gcc, automake, autoconf and libtools. +- common development tools as gcc, CMake tool. - third party softwares used in SALOME building or runtime process (python, OCC, VTK, ...) @@ -62,13 +62,14 @@ The next step is to install the KERNEL (cf. [5] "Installing KERNEL"): $ mkdir $ mkdir -$ cd -$ ./build_configure $ cd -$ /configure --prefix= +$ cmake -DCMAKE_BUILD_TYPE= -DCMAKE_INSTALL_PREFIX= ../ $ make $ make install +Where is build mode(Release or Debug), +is a destination folder to install KERNEL module of SALOME. + Then, the SALOME components GEOM, MED, VISU, ... can be installed with a similar procedure (cf. [6]). @@ -92,13 +93,11 @@ If you have another platform, we suggest the following configuration for building process: - gcc-3.3.x or 3.4.x -- automake-1.7 or more (only aclocal is used) -- autoconf-2.59 -- libtool-1.5.6 +- CMake-2.8.8 or more remarks: -- This is the minimum level of automake, autoconf and libtool, if you need +- This is the minimum level of CMake, if you need to compile all the third party softwares (included OpenCascade 5.2.x). 3. Third-party dependencies @@ -206,64 +205,26 @@ STEP 1: $ mkdir STEP 2: - build configure script - - go to directory and generate the "configure" script:: + go to build directory - $ cd - $ ./build_configure - - If it doesn't work, check your system automake tools as specified in - section [2]. + $ cd STEP 3: configure the building process - go to the build directory and execute the configuration process:: - - $ cd - $ /configure --prefix= + $ cmake -DCMAKE_BUILD_TYPE= -DCMAKE_INSTALL_PREFIX= ../ + Where is build mode(Release or Debug), + is a destination folder to install KERNEL module of SALOME. Note that must be an absolute path. - When the configure process is complete, check the status of - third-party softwares detection. You should have a status like:: - - --------------------------------------------- - Summary - --------------------------------------------- - Configure - cc : yes - boost : yes - lex_yacc : yes - python : yes - swig : yes - threads : yes - OpenGL : yes - qt : yes - vtk : yes - hdf5 : yes - med2 : yes - omniORB : yes - occ : yes - sip : yes - pyqt : yes - qwt : yes - doxygen : yes - graphviz : no - openpbs : no - lsf : no - Default ORB : omniORB - ---------------------------------------------- - -If a software get a status "no", then it's not "seen" in the system: + When the configure process is complete, check the status of cmake build. + You should not have the errors and warnings. All included products and packages must be found. + + If a software get a status "not found", then it's not "seen" in the system: - the software is not installed, or - the shell environment is not set correctly. -In this example, the software programs graphviz, openpbs and lsf are not -installed (optional for most usages). - - STEP 4 : Building the binary files @@ -275,7 +236,7 @@ STEP 4 : STEP 5: Installing binary files, scripts and documentation - Execute install target in the directory:: + Execute install target in the directory:: $ make install @@ -285,7 +246,7 @@ STEP 5: TInstalling a component is done by following the same instructions as given for the KERNEL, replacing KERNEL by - (build_configure, configure, make, make install). +. You just have to be aware of the dependencies between components: diff --git a/doc/docutils/archives/kernel_resources.txt b/doc/docutils/archives/kernel_resources.txt index 0bc9700da..c3ca235ce 100644 --- a/doc/docutils/archives/kernel_resources.txt +++ b/doc/docutils/archives/kernel_resources.txt @@ -82,9 +82,9 @@ This file must be included in C++ source. Some macros are activated only in debug mode, others are always activated. To activate the debug mode, ``_DEBUG_`` must be defined, which is the case when SALOME -Makefiles are generated from configure, without +Makefiles are generated from CMakeLists.txt, without options. When ``_DEBUG_`` is undefined (release mode: -``configure --disable-debug --enable-production``), the +``cmake -DCMAKE_BUILD_TYPE=Release ../KERNEL_SRC``), the debug mode macros are defined empty (they do nothing). So, when switching from debug to release, it is possible (and recommended) to let the macro calls diff --git a/doc/docutils/salomepypkg.rst b/doc/docutils/salomepypkg.rst index c46063eb2..f17285ec7 100644 --- a/doc/docutils/salomepypkg.rst +++ b/doc/docutils/salomepypkg.rst @@ -169,7 +169,7 @@ Considering the elements described above, a procedure that works to get the packaged python structure is: * Rename the file ``salome.py`` in ``__init__.py`` (and adapt the - Makefile.am). This is located in the source directory + CMakeLists.txt). This is located in the source directory ``src/KERNEL_PY``. * Copy the sources files of the kernel part in the source directory ``src/KERNEL_PY`` starting with a stage named ``kernel`` including @@ -238,7 +238,8 @@ Files to be added: * KERNEL: file ``src/KERNEL_PY/__init__.py`` (``salome.py`` renamed) * KERNEL: directory ``src/KERNEL_PY/kernel`` * KERNEL: directory ``doc/docutils`` -* KERNEL: file ``salome_adm/unix/config_files/check_sphinx.m4`` +* KERNEL: file ``salome_adm/cmake_files/FindSalomeSphinx.cmake`` +* KERNEL: file ``salome_adm/cmake_files/FindSphinx.cmake`` * GEOM : directory ``src/GEOM_PY`` * GEOM : directory ``doc/docutils`` * SMESH : directory ``src/SMESH_PY`` diff --git a/doc/salome/install.dox b/doc/salome/install.dox index f77b0a2e0..ce7a819be 100644 --- a/doc/salome/install.dox +++ b/doc/salome/install.dox @@ -21,7 +21,7 @@ You'll find here generic instructions for installing the SALOME platform. First of all, you have to check (or install if needed) the dependant software programs on your system. These programs are: -- common development tools as gcc, automake, autoconf and libtools. +- common development tools as gcc, CMake tool. - third party softwares used in %SALOME building or runtime process (python, OCC, VTK, ...) @@ -36,14 +36,15 @@ The next step is to install the KERNEL (cf. \ref S5_install): \code $ mkdir $ mkdir -$ cd -$ ./build_configure $ cd -$ /configure --prefix= +$ cmake -DCMAKE_BUILD_TYPE= -DCMAKE_INSTALL_PREFIX= ../ $ make $ make install \endcode +Where is build mode (Release or Debug), +is a destination folder to install KERNEL module of SALOME. + Then, the %SALOME components GEOM, MED, VISU, ... can be installed with a similar procedure (cf. \ref S6_install). @@ -66,13 +67,11 @@ If you have another platform, we suggest the following configuration for building process: - gcc-3.3.x or 3.4.x -- automake-1.7 or more (only aclocal is used) -- autoconf-2.59 -- libtool-1.5.6 +- CMake-2.8.8 or more remarks: -- This is the minimum level of automake, autoconf and libtool, if you need +- This is the minimum level of CMake, if you need to compile all the third party softwares (included OpenCascade 5.2.x). \section S3_install Third-party dependencies @@ -179,72 +178,32 @@ $ mkdir $ mkdir \endcode -STEP 2: - build configure script - - go to directory and generate the "configure" script: - + go to the build directory + \code -$ cd -$ ./build_configure +$ cd \endcode - If it doesn't work, check your system automake tools as specified in - section \ref S2_install. - -STEP 3: +STEP 2: configure the building process - go to the build directory and execute the configuration process: \code -$ cd -$ /configure --prefix= +$ cmake -DCMAKE_BUILD_TYPE= -DCMAKE_INSTALL_PREFIX= ../ \endcode + Where is build mode(Release or Debug), + is a destination folder to install KERNEL module of SALOME. Note that must be an absolute path. - When the configure process is complete, check the status of - third-party softwares detection. You should have a status like: - - \code - --------------------------------------------- - Summary - --------------------------------------------- - Configure - cc : yes - boost : yes - lex_yacc : yes - python : yes - swig : yes - threads : yes - OpenGL : yes - qt : yes - vtk : yes - hdf5 : yes - med2 : yes - omniORB : yes - occ : yes - sip : yes - pyqt : yes - qwt : yes - doxygen : yes - graphviz : no - openpbs : no - lsf : no - Default ORB : omniORB - ---------------------------------------------- - \endcode - -If a software get a status "no", then it's not "seen" in the system: + When the configure process is complete, check the status of cmake build. + You should not have the errors and warnings. All dependent products and packages must be found. + + If a software get a status "not found", then it is not "seen" in the system: - the software is not installed, or - the shell environment is not set correctly. -In this example, the software programs graphviz, openpbs and lsf are not -installed (optional for most usages). - - -STEP 4 : +STEP 3 : Building the binary files Execute make in the directory: @@ -253,10 +212,10 @@ installed (optional for most usages). $ make \endcode -STEP 5: +STEP 4: Installing binary files, scripts and documentation - Execute install target in the directory: + Execute install target in the directory: \code $ make install @@ -266,7 +225,7 @@ $ make install Installing a component is done by following the same instructions as given for the KERNEL, replacing KERNEL by - (build_configure, configure, make, make install). +. You just have to be aware of the dependencies between components: diff --git a/doc/salome/kernel_resources.dox b/doc/salome/kernel_resources.dox index 1bcbead6f..01d39bcfb 100644 --- a/doc/salome/kernel_resources.dox +++ b/doc/salome/kernel_resources.dox @@ -58,9 +58,9 @@ This file must be included in C++ source. Some macros are activated only in debug mode, others are always activated. To activate the debug mode, _DEBUG_ must be defined, which is the case when %SALOME -Makefiles are generated from configure, without +Makefiles are generated from CMake build system, without options. When _DEBUG_ is undefined (release mode: -configure --disable-debug --enable-production), the +cmake -DCMAKE_BUILD_TYPE=Release ../KERNEL_SRC), the debug mode macros are defined empty (they do nothing). So, when switching from debug to release, it is possible (and recommended) to let the macro calls diff --git a/doc/salome/unittests.dox b/doc/salome/unittests.dox index 517b80cd1..d9fb7bcc2 100644 --- a/doc/salome/unittests.dox +++ b/doc/salome/unittests.dox @@ -32,7 +32,7 @@ the unit tests. Interfaces definitions for KERNEL test components. - KERNEL_SRC/salome_adm :\n - Configuration files used by autotools (M4 macros & co.) + Configuration files used by CMake (*.cmake files) - KERNEL_SRC/src :\n The source code (C++ and Python) diff --git a/salome_adm/cmake_files/FindCppUnit.cmake b/salome_adm/cmake_files/FindCppUnit.cmake index b34e80a35..7ab228727 100644 --- a/salome_adm/cmake_files/FindCppUnit.cmake +++ b/salome_adm/cmake_files/FindCppUnit.cmake @@ -60,20 +60,28 @@ ELSE(WIN32) MESSAGE(FATAL_ERROR "Error in CPPUNIT detection ! cppunit-config executable not found !") ENDIF(NOT CPPUNIT_CONFIG_BIN) EXECUTE_PROCESS(COMMAND ${CPPUNIT_CONFIG_BIN} --libs OUTPUT_VARIABLE CPPUNIT_LDFLAGS) - STRING( REGEX MATCHALL "-L([^\" ]+|\"[^\"]+\")" CPPUNIT_TMP4 "${CPPUNIT_LDFLAGS}" ) - IF(CPPUNIT_TMP4) - STRING( REGEX REPLACE "^-L" "" CPPUNIT_LIBRARY_DIRS ${CPPUNIT_TMP4}) - LIST(APPEND CMAKE_LIBRARY_PATH ${CPPUNIT_LIBRARY_DIRS}) - ENDIF(CPPUNIT_TMP4) - STRING( REGEX MATCHALL "-l([^\", \n]+)" CPPUNIT_TMP5 "${CPPUNIT_LDFLAGS}" ) - FOREACH(LIB ${CPPUNIT_TMP5}) - STRING(REGEX REPLACE "^-l" "" LIB2 ${LIB}) - FIND_LIBRARY(CPPUNIT_SUBLIB_${LIB2} ${LIB2}) - IF(NOT CPPUNIT_SUBLIB_${LIB2}) - MESSAGE(FATAL_ERROR "Error in CPPUNIT detection ! Fail to locate the needed library ${LIB2} !") - ENDIF(NOT CPPUNIT_SUBLIB_${LIB2}) - LIST(APPEND CPPUNIT_LIBRARIES ${CPPUNIT_SUBLIB_${LIB2}}) - ENDFOREACH(LIB ${CPPUNIT_TMP5}) + STRING(STRIP ${CPPUNIT_LDFLAGS} CPPUNIT_LDFLAGS) + STRING(REPLACE " " ";" LDFLAGS_LIST ${CPPUNIT_LDFLAGS}) + FOREACH(LDFLAG ${LDFLAGS_LIST}) + STRING(REGEX MATCH "^-L.*" LIBDIR "${LDFLAG}") + STRING(REGEX MATCH "^-l.*" LIB "${LDFLAG}") + IF(LIBDIR) + STRING(REGEX REPLACE "^-L" "" LIBDIR ${LIBDIR}) + LIST(APPEND CMAKE_LIBRARY_PATH ${LIBDIR}) + ELSEIF(LIB) + STRING(REGEX REPLACE "^-l" "" LIB ${LIB}) + LIST(APPEND LIBS ${LIB}) + ELSE() + MESSAGE(FATAL_ERROR "Unrecognized token \"${LDFLAG}\" in the output of cppunit-config --libs") + ENDIF() + ENDFOREACH(LDFLAG ${LDFLAGS_LIST}) + FOREACH(LIB ${LIBS}) + FIND_LIBRARY(CPPUNIT_SUBLIB_${LIB} ${LIB}) + IF(NOT CPPUNIT_SUBLIB_${LIB}) + MESSAGE(FATAL_ERROR "Error in CPPUNIT detection! Fail to locate the needed library ${LIB}!") + ENDIF(NOT CPPUNIT_SUBLIB_${LIB}) + LIST(APPEND CPPUNIT_LIBRARIES ${CPPUNIT_SUBLIB_${LIB}}) + ENDFOREACH(LIB ${LIBS}) # MESSAGE("**** ${CPPUNIT_LIBRARIES}") ENDIF(WIN32) diff --git a/salome_adm/cmake_files/FindGraphviz.cmake b/salome_adm/cmake_files/FindGraphviz.cmake index 6eb1e5a71..5134c35bc 100644 --- a/salome_adm/cmake_files/FindGraphviz.cmake +++ b/salome_adm/cmake_files/FindGraphviz.cmake @@ -1,9 +1,9 @@ # - 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. +# 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 @@ -35,22 +35,26 @@ 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 +SET(GRAPHVIZ_LIBRARIES ${GRAPHVIZ_cdt_LIBRARY} - ${GRAPHVIZ_cgraph_LIBRARY} - ${GRAPHVIZ_graph_LIBRARY} + ${GRAPHVIZ_graph_LIBRARY} ${GRAPHVIZ_gvc_LIBRARY} ${GRAPHVIZ_pathplan_LIBRARY} ) +## Don't detect cgraph on Windows +#IF(NOT WIN32) +# FIND_LIBRARY(GRAPHVIZ_cgraph_LIBRARY NAMES cgraph PATH_SUFFIXES bin) +# SET(GRAPHVIZ_LIBRARIES ${GRAPHVIZ_cgraph_LIBRARY}) +#ENDIF() + # 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) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Graphviz REQUIRED_VARS + GRAPHVIZ_EXECUTABLE + GRAPHVIZ_LIBRARIES + GRAPHVIZ_INCLUDE_DIRS) diff --git a/salome_adm/cmake_files/FindMEDFile.cmake b/salome_adm/cmake_files/FindMEDFile.cmake index 3b08b6a6c..aa2f0b25c 100644 --- a/salome_adm/cmake_files/FindMEDFile.cmake +++ b/salome_adm/cmake_files/FindMEDFile.cmake @@ -42,8 +42,8 @@ ENDIF(MEDFILE_ROOT_DIR) FIND_PATH(MEDFILE_INCLUDE_DIRS med.h) #FIND_PROGRAM(MDUMP mdump) -FIND_LIBRARY(MEDFILE_C_LIBRARIES NAMES libmedC.so medC) -FIND_LIBRARY(MEDFILE_F_LIBRARIES NAMES libmed.so med) +FIND_LIBRARY(MEDFILE_C_LIBRARIES NAMES medC) +FIND_LIBRARY(MEDFILE_F_LIBRARIES NAMES med) IF(MEDFILE_F_LIBRARIES) SET(MEDFILE_LIBRARIES ${MEDFILE_C_LIBRARIES} ${MEDFILE_F_LIBRARIES}) ELSE(MEDFILE_F_LIBRARIES) diff --git a/salome_adm/cmake_files/FindSalomeSphinx.cmake b/salome_adm/cmake_files/FindSalomeSphinx.cmake index f7d625c95..659be9199 100644 --- a/salome_adm/cmake_files/FindSalomeSphinx.cmake +++ b/salome_adm/cmake_files/FindSalomeSphinx.cmake @@ -30,7 +30,6 @@ SET(DOCUTILS_ROOT_DIR "$ENV{DOCUTILS_ROOT_DIR}" CACHE PATH "Path to the Docutils # 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}) diff --git a/salome_adm/cmake_files/SalomeMacros.cmake b/salome_adm/cmake_files/SalomeMacros.cmake index ea9604d2a..1934386a3 100755 --- a/salome_adm/cmake_files/SalomeMacros.cmake +++ b/salome_adm/cmake_files/SalomeMacros.cmake @@ -20,7 +20,7 @@ # #---------------------------------------------------------------------------- -# LIST_CONTAINS is a macro useful for determining whether a list has a +# LIST_CONTAINS is a macro useful for determining whether a list has a # particular entry #---------------------------------------------------------------------------- MACRO(LIST_CONTAINS var value) @@ -43,7 +43,7 @@ ENDMACRO(LIST_CONTAINS) # 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 +# 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 @@ -98,10 +98,10 @@ ENDMACRO(PARSE_ARGUMENTS) # 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. +# 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}) @@ -116,7 +116,7 @@ MACRO(SALOME_INSTALL_SCRIPTS file_list path) ELSE() SET(file_name ${file}) IF(SALOME_INSTALL_SCRIPTS_WORKING_DIRECTORY) - SET(PREFIX "${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}) @@ -150,7 +150,7 @@ MACRO(INSTALL_AND_COMPILE_PYTHON_FILE PYFILE2COMPINST PYFILELOC) ENDMACRO(INSTALL_AND_COMPILE_PYTHON_FILE PYFILE2COMPINST PYFILELOC) #---------------------------------------------------------------------------- -# SALOME_CONFIGURE_FILE is a macro useful for copying a file to another location +# 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]) @@ -190,19 +190,19 @@ ENDMACRO(SALOME_CONFIGURE_FILE) # text comparison is performed. # result is a boolean. ### -MACRO(SALOME_CHECK_EQUAL_PATHS varRes path1 path2) +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() + ENDIF() IF(EXISTS "${path2}") GET_FILENAME_COMPONENT(_tmp2 "${path2}" REALPATH) ELSE() SET(_tmp2 "${path2}") - ENDIF() + ENDIF() IF("${_tmp1}" STREQUAL "${_tmp2}") SET("${varRes}" ON) @@ -213,9 +213,9 @@ ENDMACRO() #### # SALOME_LOG_OPTIONAL_PACKAGE(pkg flag) # -# Register in global variables the detection status (found or not) of the optional package 'pkg' +# 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 +# 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 @@ -238,8 +238,8 @@ MACRO(SALOME_LOG_OPTIONAL_PACKAGE pkg flag) LIST(APPEND _SALOME_OPTIONAL_PACKAGES_names ${pkg}) LIST(APPEND _SALOME_OPTIONAL_PACKAGES_found ${_isFound}) LIST(APPEND _SALOME_OPTIONAL_PACKAGES_flags ${flag}) - ENDIF() - + ENDIF() + ENDMACRO(SALOME_LOG_OPTIONAL_PACKAGE) #### @@ -262,7 +262,7 @@ MACRO(SALOME_JUSTIFY_STRING input length result) STRING(LENGTH ${input} _input_length) MATH(EXPR _nb_spaces "${length}-${_input_length}-1") IF (_nb_spaces GREATER 0) - FOREACH(_idx RANGE ${_nb_spaces}) + FOREACH(_idx RANGE ${_nb_spaces}) SET(${result} "${${result}} ") ENDFOREACH() ENDIF() @@ -272,8 +272,8 @@ 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 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. @@ -288,7 +288,7 @@ MACRO(SALOME_PACKAGE_REPORT_AND_CHECK) ELSE() SET(_length 23) ENDIF() - MESSAGE(STATUS "") + MESSAGE(STATUS "") MESSAGE(STATUS " Optional packages - Detection report ") MESSAGE(STATUS " ==================================== ") MESSAGE(STATUS "") @@ -296,7 +296,7 @@ MACRO(SALOME_PACKAGE_REPORT_AND_CHECK) 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}) + 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) @@ -309,13 +309,13 @@ MACRO(SALOME_PACKAGE_REPORT_AND_CHECK) 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.") @@ -328,18 +328,18 @@ ENDMACRO(SALOME_PACKAGE_REPORT_AND_CHECK) # 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 +# 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 +# +# 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 +# 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). -# +# example). +# # This macro is to be called from within the FindSalomeXXXX.cmake file. # #### @@ -354,62 +354,62 @@ MACRO(SALOME_FIND_PACKAGE englobPkg stdPkg mode) SET(_tmp_quiet "QUIET") ELSE() SET(_tmp_quiet) - ENDIF() + ENDIF() IF(${englobPkg}_FIND_REQUIRED AND NOT _OPT_ARG) SET(_tmp_req "REQUIRED") ELSE() SET(_tmp_req) - ENDIF() + ENDIF() IF(${englobPkg}_FIND_VERSION_EXACT) SET(_tmp_exact "EXACT") ELSE() SET(_tmp_exact) ENDIF() - # Call the CMake FIND_PACKAGE() command: + # 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'. + # 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} + 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} + 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} + 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} + 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() @@ -417,36 +417,36 @@ 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 +# 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 # to obtain the package root directory. -# -# For example: SALOME_FIND_PACKAGE_DETECT_CONFLICTS(SWIG SWIG_EXECUTABLE 2) +# +# 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 +# * 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 +# * 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 +# 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) @@ -467,21 +467,21 @@ MACRO(SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS pkg referenceVariable upCount) ELSE() SET(_var_already_there FALSE) ENDIF() - # Make cache entry + # 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! + # 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 + + # 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() @@ -493,7 +493,7 @@ MACRO(SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS pkg referenceVariable upCount) 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) @@ -511,18 +511,18 @@ MACRO(SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS pkg referenceVariable upCount) 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. - + ## 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) @@ -530,8 +530,8 @@ MACRO(SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS pkg referenceVariable upCount) # Note the double de-reference of "referenceVariable": SET(_tmp_ROOT_DIR "${${referenceVariable}}") ENDIF() - IF(${upCount}) - FOREACH(_unused RANGE 1 ${upCount}) + IF(${upCount}) + FOREACH(_unused RANGE 1 ${upCount}) GET_FILENAME_COMPONENT(_tmp_ROOT_DIR "${_tmp_ROOT_DIR}" PATH) ENDFOREACH() ENDIF() @@ -545,12 +545,12 @@ MACRO(SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS pkg referenceVariable upCount) 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!") + 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) + 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() @@ -561,42 +561,57 @@ MACRO(SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS pkg referenceVariable upCount) ## 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}") + 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() ENDIF() - + ## ## 6. Save the detected installation ## SET(${pkg_UC}_ROOT_DIR "${_tmp_ROOT_DIR}") - + ELSE() - MESSAGE(STATUS "${pkg} was not found.") + 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) +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_TOHEXA() +# Convert a number (smaller than 16) into hexadecimal representation +# with a leading 0. +MACRO(SALOME_TOHEXA num result) + SET(_hexa_map a b c d e f) + IF(${num} LESS 10) + SET(${result} "0${num}") + ELSE() + MATH(EXPR _res "${num}-10" ) + LIST(GET _hexa_map ${_res} _out) + SET(${result} "0${_out}") + ENDIF() +ENDMACRO(SALOME_TOHEXA) + #################################################################### # SALOME_XVERSION() -# +# # Computes hexadecimal version of SALOME package # # USAGE: SALOME_XVERSION(package) @@ -613,17 +628,23 @@ ENDMACRO(SALOME_ADD_MPI_TO_HDF5) 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) + SET(_major) + SET(_minor) + SET(_patch) + SALOME_TOHEXA(${${_pkg_UC}_MAJOR_VERSION} _major) + SALOME_TOHEXA(${${_pkg_UC}_MINOR_VERSION} _minor) + SALOME_TOHEXA(${${_pkg_UC}_PATCH_VERSION} _patch) + SET(${_pkg_UC}_XVERSION "0x${_major}${_minor}${_patch}") 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 +# 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) @@ -639,14 +660,14 @@ 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 +# 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. # @@ -679,25 +700,25 @@ MACRO(SALOME_ACCUMULATE_ENVIRONMENT envvar) IF(NOT IS_DIRECTORY ${_item}) IF(TARGET ${_item}) GET_TARGET_PROPERTY(_item ${_item} LOCATION) - ENDIF() + ENDIF() GET_FILENAME_COMPONENT(_item ${_item} PATH) - ENDIF() + 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() 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() ENDIF(_is_check) - ENDIF() + ENDIF() ENDFOREACH() - + LIST(FIND _${PROJECT_NAME}_EXTRA_ENV ${envvar} _res) IF(_res EQUAL -1) LIST(APPEND _${PROJECT_NAME}_EXTRA_ENV ${envvar}) @@ -710,7 +731,7 @@ ENDMACRO(SALOME_ACCUMULATE_ENVIRONMENT) ######################################################################### # SALOME_GENERATE_ENVIRONMENT_SCRIPT() -# +# # USAGE: SALOME_GENERATE_ENVIRONMENT_SCRIPT(output script cmd opts) # # ARGUMENTS: @@ -719,12 +740,12 @@ ENDMACRO(SALOME_ACCUMULATE_ENVIRONMENT) # 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. +# 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_, where is name of variable and # _${PROJECT_NAME}_EXTRA_ENV (see marco SALOME_ACCUMULATE_ENVIRONMENT); # and puts generated command in proper environment into argument. -# +# # Notes: # - If