From: aguerre Date: Tue, 28 May 2013 15:59:43 +0000 (+0000) Subject: merge from BR_KERNEL_REFACTORING X-Git-Tag: V7_4_0a1~5 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d9904f7ff3e87d82347311c61b53d3127f587fe0;p=modules%2Fkernel.git merge from BR_KERNEL_REFACTORING --- diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100755 index 000000000..326f97bba --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,108 @@ +# Copyright (C) 2012 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.4.7 FATAL_ERROR) + +IF(COMMAND cmake_policy) + cmake_policy(SET CMP0003 NEW) +ENDIF(COMMAND cmake_policy) + +# Temporary step instead Find Calcium.cmake +SET(CALCIUM_IDL_INT_F77 long) +SET(CALCIUM_CORBA_INT_F77 CORBA::Long) +SET(LONG_OR_INT int) + +# Temporary definitions +SET(DOXYGEN_IS_OK 0) +IF(WINDOWS) + SET(CPPUNIT_IS_OK 0) +ENDIF(WINDOWS) +SET(WITH_LOCAL 1) +SET(WITH_BATCH 1) + +ENABLE_TESTING() +SET(VERSION "7.0.0") +SET(VERSION_DEV "1") + +INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindPLATFORM.cmake) +INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindPYTHON.cmake) +INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindMPI.cmake) +INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindOMNIORB.cmake) +INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindPTHREADS.cmake) +INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindHDF5.cmake) +INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindBOOST.cmake) +INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindLIBXML2.cmake) +INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindSWIG.cmake) +INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindCPPUNIT.cmake) +INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindDOXYGEN.cmake) +INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindLIBBATCH.cmake) +INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindSPHINX.cmake) +INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/SalomeMacros.cmake) + +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))" ${VERSION} + OUTPUT_VARIABLE XVERSION) + +SET(KERNEL_salomebin_BINS bin/salome) + +SET(KERNEL_salomelib_LIBS lib/salome) + +SET(KERNEL_salomeidl_IDLS idl/salome) + +SET(KERNEL_salomeinclude_HEADERS include/salome) + +SET(KERNEL_salomeres_DATA share/salome/resources/kernel) + +SET(KERNEL_salomeres_SCRIPTS share/salome/resources/kernel) + +SET(KERNEL_salomescript_SCRIPTS bin/salome) + +SET(KERNEL_salomescript_DATA bin/salome) + +SET(KERNEL_salomescript_PYTHON bin/salome) + +SET(KERNEL_appliskel_SCRIPTS bin/salome/appliskel) + +SET(KERNEL_appliskel_PYTHON bin/salome/appliskel) + +SET(KERNEL_pythondir lib/python${PYTHON_VERSION}/site-packages) + +SET(KERNEL_salomepythondir ${KERNEL_pythondir}/salome) + +SET(KERNEL_sharedpkgpython_PYTHON ${KERNEL_salomepythondir}/shared_modules) + +SET(KERNEL_salomeadmcmake salome_adm/cmake_files) + +IF(CORBA_GEN) + ADD_SUBDIRECTORY(idl) +ENDIF(CORBA_GEN) + +ADD_SUBDIRECTORY(src) +ADD_SUBDIRECTORY(resources) + +IF(NOT WITHONLYLAUNCHER) + ADD_SUBDIRECTORY(bin) + ADD_SUBDIRECTORY(salome_adm) + ADD_SUBDIRECTORY(doc) +ENDIF(NOT WITHONLYLAUNCHER) + +SET(input ${CMAKE_CURRENT_SOURCE_DIR}/KERNEL_version.h.in) +SET(output ${CMAKE_CURRENT_BINARY_DIR}/KERNEL_version.h) +MESSAGE(STATUS "Creation of ${output}") +CONFIGURE_FILE(${input} ${output} @ONLY) +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/KERNEL_version.h DESTINATION ${KERNEL_salomeinclude_HEADERS}) diff --git a/Makefile.am b/Makefile.am index 471d18f5d..abfd02f99 100644 --- a/Makefile.am +++ b/Makefile.am @@ -45,7 +45,7 @@ DISTCLEANFILES = a.out local-install.sh hack_libtool aclocal.m4 configure salome salomeinclude_DATA = KERNEL_version.h -EXTRA_DIST = \ +EXTRA_DIST += \ build_cmake \ build_cmake.bat \ build_configure \ diff --git a/bin/CMakeLists.txt b/bin/CMakeLists.txt new file mode 100755 index 000000000..693a2a7d8 --- /dev/null +++ b/bin/CMakeLists.txt @@ -0,0 +1,64 @@ +# Copyright (C) 2012 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(appliskel) + +CONFIGURE_FILE(VERSION.in VERSION @ONLY) + +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/VERSION DESTINATION ${KERNEL_salomebin_BINS}) + +# =============================================================== +# Files to be installed +# =============================================================== + +# These files are data, module or lib files +#INSTALL(FILES salome.launch DESTINATION ${KERNEL_salomescript_DATA}) + +# These files are executable scripts +SET(SCRIPTS + appli_clean.sh + runIDLparser + addToKillList.py + appli_gen.py + envSalome.py + killSalome.py + killSalomeWithPort.py + launchConfigureParser.py + nameserver.py + NSparam.py + orbmodule.py + ORBConfigFile.py + parseConfigFile.py + runSalome.py + runSession.py + runConsole.py + salomeConsole.py + salomeRunner.py + salome_session.py + salome_utils.py + searchFreePort.py + server.py + setenv.py + showNS.py + shutdownSalome.py + virtual_salome.py + waitContainers.py + waitNS.py + ) +SALOME_INSTALL_SCRIPTS("${SCRIPTS}" ${KERNEL_salomescript_SCRIPTS}) diff --git a/bin/Makefile.am b/bin/Makefile.am index 039f9b468..1f5a870de 100644 --- a/bin/Makefile.am +++ b/bin/Makefile.am @@ -20,7 +20,7 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -# -* Makefile *- +# -* Makefile *- # Author : Guillaume Boulant (CSSI) # Module : KERNEL # $Header$ @@ -36,9 +36,7 @@ SUBDIRS = appliskel # # These files are data, module or lib files -dist_salomescript_DATA = \ - config_appli.xml \ - salome.launch +dist_salomescript_DATA = nodist_salomescript_DATA = \ VERSION @@ -46,15 +44,7 @@ nodist_salomescript_DATA = \ # These files are executable scripts dist_salomescript_SCRIPTS = \ appli_clean.sh \ - appli_install.sh \ - createAppli.sh \ - runIDLparser \ - runNS.sh \ - runSalome \ - runSalome.csh \ - runSalome.ksh \ - runSalome.bat \ - waitNS.sh + runIDLparser # These files are python files dist_salomescript_PYTHON = \ @@ -64,15 +54,19 @@ dist_salomescript_PYTHON = \ killSalome.py \ killSalomeWithPort.py \ launchConfigureParser.py \ - launchSalome.py \ nameserver.py \ NSparam.py \ orbmodule.py \ - runNS.py \ + ORBConfigFile.py \ + parseConfigFile.py \ runSalome.py \ + runSession.py \ + runConsole.py \ salomeConsole.py \ + salomeRunner.py \ salome_session.py \ - salome_utils.py \ + salome_utils.py \ + searchFreePort.py \ server.py \ setenv.py \ showNS.py \ @@ -83,5 +77,5 @@ dist_salomescript_PYTHON = \ install-data-hook: @for f in $(dist_salomescript_PYTHON) ; do \ - chmod -f a+x $(DESTDIR)$(salomescriptdir)/$$f ; \ - done + chmod -f a+x $(DESTDIR)$(salomescriptdir)/$$f ; \ + done diff --git a/bin/NSparam.py b/bin/NSparam.py index bd35a3a71..f1c79a831 100755 --- a/bin/NSparam.py +++ b/bin/NSparam.py @@ -37,38 +37,40 @@ def getNSparams(info=""): from salome_utils import getORBcfgInfo my_version, my_host, my_port = getORBcfgInfo() if info=='host': - # keep print, stdout used in shell - print my_host os.environ['NSHOST']=my_host return my_host pass elif info=='port': - # keep print, stdout used in shell - print my_port os.environ['NSPORT']=my_port return my_port pass else: - # keep print, stdout used in shell - print my_host, my_port return my_host, my_port pass +# # ------------------------------------------------------------------------ if __name__ == "__main__": - if len(sys.argv) >1: + if len(sys.argv) >1: if sys.argv[1]=='host': - getNSparams('host') + my_host = getNSparams('host') + # keep print, stdout used in shell + print my_host pass elif sys.argv[1]=='port': - getNSparams('port') + my_port = getNSparams('port') + # keep print, stdout used in shell + print my_port pass else: - getNSparams() + my_host, my_port = getNSparams() pass pass else: getNSparams() + # keep print, stdout used in shell + print my_host, my_port pass pass +# diff --git a/bin/ORBConfigFile.py b/bin/ORBConfigFile.py new file mode 100644 index 000000000..58b6c208e --- /dev/null +++ b/bin/ORBConfigFile.py @@ -0,0 +1,84 @@ +#!/usr/bin/env python +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2012 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 +# + +# IMPORTANT NOTE: do not add any print call (cf. note at the bottom of the file) +def writeORBConfigFile(path, host, port, kwargs={}): + + from salome_utils import generateFileName + omniorb_config = generateFileName(path, prefix="omniORB", + extension="cfg", + hidden=True, + with_hostname=True, + with_port=port, + **kwargs) + import os + os.environ['OMNIORB_CONFIG'] = omniorb_config + os.environ['NSPORT'] = "%s"%(port) + os.environ['NSHOST'] = "%s"%(host) + + from omniORB import CORBA + prefix = "" if CORBA.ORB_ID == "omniORB4" else "ORB" + + GIOP_MaxMsgSize=2097152000 # 2 GBytes + + orbdata = [] + orbdata.append("%sInitRef = NameService=corbaname::%s:%s"%(prefix,host,port)) + orbdata.append("%sgiopMaxMsgSize = %s # 2 GBytes"%(prefix,GIOP_MaxMsgSize)) + orbdata.append("%straceLevel = 0 # critical errors only"%(prefix)) + orbdata.append("") + + f = open(omniorb_config, "w") + f.write("\n".join(orbdata)) + f.close() + + return [ omniorb_config, GIOP_MaxMsgSize ] + +# ----------------------------------------------------------------------------- + +if __name__ == "__main__": + import sys, getopt + + path = sys.argv[1] + host = sys.argv[2] + port = sys.argv[3] + argv = sys.argv[4:] + + kwargs = {} + for a in argv: + alist = str(a).split("=", 1) + opt = str(alist[0]) + arg = alist[1] + kwargs[opt] = arg + pass + + [ filename, msgSize ] = writeORBConfigFile(path, host, port, kwargs) + + # :TRICKY: print values so they can be read from caller bash script + # Example of bash script: + # RETURN_VALUES=$(python ORBConfigFile.py path host port) + # RETURN_VALUE_1=$(echo ${RETURN_VALUES} | cut -d' ' -f1) + # RETURN_VALUE_2=$(echo ${RETURN_VALUES} | cut -d' ' -f2) + # ... + # IMPORTANT NOTE: this print call MUST BE the first one!! + print filename, msgSize diff --git a/bin/appli_gen.py b/bin/appli_gen.py index 648656c83..fd5dd371b 100644 --- a/bin/appli_gen.py +++ b/bin/appli_gen.py @@ -185,15 +185,16 @@ def install(prefix,config_file,verbose=0): for fn in ('envd', 'getAppliPath.py', - 'searchFreePort.sh', + 'kill_remote_containers.py', +# 'searchFreePort.sh', # REMOVED + 'runAppli', # OBSOLETE (replaced by salome.py) + 'runConsole', # OBSOLETE (replaced by salome.py) 'runRemote.sh', - 'runAppli', - 'runConsole', - 'runSession', 'runSalomeScript', - 'runTests', + 'runSession', # OBSOLETE (replaced by salome.py) +# 'runTests', # REMOVED + 'salome.py', 'update_catalogs.py', - 'kill_remote_containers.py', '.bashrc', ): virtual_salome.symlink("./bin/salome/appliskel/"+fn,os.path.join(home_dir, fn)) diff --git a/bin/appli_install.sh b/bin/appli_install.sh deleted file mode 100644 index 4778d4ddc..000000000 --- a/bin/appli_install.sh +++ /dev/null @@ -1,89 +0,0 @@ -#!/bin/sh -# Copyright (C) 2007-2012 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 -# - -SALOME_ROOT=${HOME}/SALOME2 -INSTALL_ROOT=${SALOME_ROOT}/Install - -APPLI_ROOT=`pwd` - -# --- clean appli -rm -rf bin lib share doc envd getAppliPath.py searchFreePort.sh runAppli runConsole runSession env.d - -# --- install appli - -mkdir -p env.d -ln -fs bin/salome/appliskel/envd . -ln -fs bin/salome/appliskel/getAppliPath.py . -ln -fs bin/salome/appliskel/searchFreePort.sh . -ln -fs bin/salome/appliskel/runRemote.sh . -ln -fs bin/salome/appliskel/runAppli . -ln -fs bin/salome/appliskel/runConsole . -ln -fs bin/salome/appliskel/runSession . -ln -fs bin/salome/appliskel/runTests . -ln -fs bin/salome/appliskel/.bashrc . - -# --- prerequisites - -if [ x${PREREQUISITE_SH} != x ]; then - cp ${PREREQUISITE_SH} env.d/envProducts.sh; -else - # --- unless PREREQUISITE_SH defines the prerequisite script, - # edit and uncomment the following line to set it, and comment the echo and exit lines - #ln -fs myPathForSalomePrerequisiteScriptToBeSourced env.d/envProducts.sh - echo "The file to source for SALOME prerequisite definition is not known:" - echo "--> Edit the corresponding line in " $0 ",Comment this message and the following exit command," - exit 1; -fi - -# --- symbolic links creation, from modules_root_dir - -VERSION=V3_2_0 - -for module in KERNEL MED GUI GEOM SMESH VISU LIGHT NETGENPLUGIN PYCALCULATOR; -do - echo " ========= " ${module}; - python virtual_salome.py -v --prefix="." --module=$INSTALL_ROOT/${module}_${VERSION} - echo "export ${module}_ROOT_DIR=$APPLI_ROOT" >> env.d/configSalome.sh -done - -# --- HELLO module - -echo " ========= HELLO1"; -python virtual_salome.py -v --prefix="." --module=$INSTALL_ROOT/HELLO1_${VERSION} -echo "export HELLO_ROOT_DIR=$APPLI_ROOT" >> env.d/configSalome.sh - -# --- PYHELLO module - -echo " ========= PYHELLO1"; -python virtual_salome.py -v --prefix="." --module=$INSTALL_ROOT/PYHELLO1_${VERSION} -echo "export PYHELLO_ROOT_DIR=$APPLI_ROOT" >> env.d/configSalome.sh - -# --- GUI config - -echo "export config_var=$APPLI_ROOT:$APPLI_ROOT/share/salome/resources/gui" >> env.d/configGUI.sh - -# --- SAMPLES directory - -echo "export DATA_DIR=$INSTALL_ROOT/SAMPLES/${VERSION}/SAMPLES_SRC" >> env.d/configSalome.sh - -# --- diff --git a/bin/appliskel/.bashrc b/bin/appliskel/.bashrc index 5405c993f..21f1a4e9a 100644 --- a/bin/appliskel/.bashrc +++ b/bin/appliskel/.bashrc @@ -26,4 +26,25 @@ [ -z "$PS1" ] && return # prefix prompt with naming server hostname and port -export PS1='[NS='${NSHOST}':'${NSPORT}']'${PS1} +#export PS1='[NS='${NSHOST}':'${NSPORT}']'${PS1} + +NO_COLOR="\[\033[0m\]" +RED="\[\033[0;31m\]" +DARK_RED="\[\033[1;31m\]" +GREEN="\[\033[0;32m\]" +DARK_GREEN="\[\033[1;32m\]" +BROWN="\[\033[0;33m\]" +DARK_BROWN="\[\033[1;33m\]" +BLUE="\[\033[0;34m\]" +DARK_BLUE="\[\033[1;34m\]" +PURPLE="\[\033[0;35m\]" +DARK_PURPLE="\[\033[1;35m\]" +CYAN="\[\033[0;36m\]" +DARK_CYAN="\[\033[1;36m\]" + +NS_COLOR=${BROWN} +HOST_COLOR=${BLUE} +PORT_COLOR=${PURPLE} +DEFAULT_COLOR=${NO_COLOR} + +export PS1="${DEFAULT_COLOR}[${NS_COLOR}NS=${HOST_COLOR}${NSHOST}${NS_COLOR}:${PORT_COLOR}${NSPORT}${NS_COLOR}${DEFAULT_COLOR}]\$ " diff --git a/bin/appliskel/CMakeLists.txt b/bin/appliskel/CMakeLists.txt new file mode 100755 index 000000000..c0c7b89ed --- /dev/null +++ b/bin/appliskel/CMakeLists.txt @@ -0,0 +1,38 @@ +# Copyright (C) 2012 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 +# + +# =============================================================== +# Files to be installed +# =============================================================== + +# These files are executable scripts +SET(SCRIPTS + envd + runRemote.sh + runAppli + runConsole + runSession + runSalomeScript + getAppliPath.py + update_catalogs.py + kill_remote_containers.py + salome.py +) + +SALOME_INSTALL_SCRIPTS("${SCRIPTS}" ${KERNEL_salomescript_SCRIPTS}/appliskel) diff --git a/bin/appliskel/Makefile.am b/bin/appliskel/Makefile.am index 06285247a..9e9bac6a0 100644 --- a/bin/appliskel/Makefile.am +++ b/bin/appliskel/Makefile.am @@ -20,7 +20,7 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -# -* Makefile *- +# -* Makefile *- # Author : Renaud Barate (EDF R&D) # Module : KERNEL # $Header$ @@ -37,20 +37,19 @@ appliskeldir = $(salomescriptdir)/appliskel # These files are executable scripts dist_appliskel_SCRIPTS = \ envd \ - searchFreePort.sh \ runRemote.sh \ runAppli \ runConsole \ runSession \ runSalomeScript \ - runTests \ .bashrc # These files are python files dist_appliskel_PYTHON = \ getAppliPath.py \ update_catalogs.py \ - kill_remote_containers.py + kill_remote_containers.py \ + salome.py install-data-hook: @for f in $(dist_appliskel_PYTHON) ; do \ diff --git a/bin/appliskel/getAppliPath.py b/bin/appliskel/getAppliPath.py index 24cd69653..de2a17218 100755 --- a/bin/appliskel/getAppliPath.py +++ b/bin/appliskel/getAppliPath.py @@ -24,32 +24,14 @@ import os -def relpath(target, base): - """ Find relative path from base to target - if target== "/local/chris/appli" and base== "/local/chris" the result is appli - if target== /tmp/appli and base /local/chris the result is ../../tmp/appli - """ - target=target.split(os.path.sep) - base=base.split(os.path.sep) - for i in xrange(len(base)): - if base[i] != target[i]: - i=i-1 - #not in base - break - p=['..']*(len(base)-i-1)+target[i+1:] - if p == []: - return '.' - return os.path.join( *p ) +def get_appli_path(filePath=None): + if filePath is None: + filePath = os.path.realpath(os.path.dirname(__file__)) -def set_var(VAR, strpath): - """Set VAR environment variable """ - value = "%r" % strpath - shell = os.getenv('SHELL') - if shell and shell.endswith('csh'): - return "setenv %s %s" % (VAR, value) - else: - return "export %s=%s" % (VAR, value) + homePath = os.path.realpath(os.getenv('HOME')) + applipath = os.path.relpath(filePath, homePath) + return applipath if __name__ == "__main__": - applipath=relpath(os.path.realpath(os.path.dirname(__file__)),os.path.realpath(os.getenv('HOME'))) - print applipath + applipath = get_appli_path() + print applipath diff --git a/bin/appliskel/runRemote.sh b/bin/appliskel/runRemote.sh index dead646a7..717085068 100755 --- a/bin/appliskel/runRemote.sh +++ b/bin/appliskel/runRemote.sh @@ -50,15 +50,12 @@ export APPLI=`${APPLI_HOME}/getAppliPath.py` . ${HOME}/${APPLI}/envd ${HOME}/${APPLI} # --- set the OMNIORB_CONFIG file and environment relative to this run of SALOME +export NSHOST=$1 +export NSPORT=$2 -OMNIORB_CONFIG=${HOME}/${APPLI}/USERS/.omniORB_${USER}_$1_$2.cfg -export OMNIORB_CONFIG -NSHOST=$1 -export NSHOST -NSPORT=$2 -export NSPORT -initref="NameService=corbaname::"$1":$2" -echo "InitRef = $initref" > $OMNIORB_CONFIG +# Get (in bash) the configuration filename from (Python) ORBConfigFile return values +RETURN_VALUES=$(${KERNEL_ROOT_DIR}/bin/salome/envSalome.py python ${KERNEL_ROOT_DIR}/bin/salome/ORBConfigFile.py ${HOME}/${APPLI}/USERS ${NSHOST} ${NSPORT} with_username=${USER}) +export OMNIORB_CONFIG=$(echo ${RETURN_VALUES} | cut -d' ' -f1) #go to the requested working directory if any if test "x$3" == "xWORKINGDIR"; then diff --git a/bin/appliskel/runSession b/bin/appliskel/runSession index f12e53c21..e1616f18b 100755 --- a/bin/appliskel/runSession +++ b/bin/appliskel/runSession @@ -68,6 +68,23 @@ export APPLI=`${APPLI_HOME}/getAppliPath.py` . ${HOME}/${APPLI}/envd ${HOME}/${APPLI} +# --- set the OMNIORB_CONFIG file and environment relative to this run of SALOME +# Usage: writeConfigFile PORT HOST +function writeConfigFile +{ + if [ $# -ne 2 ]; then + echo "Usage: $0 PORT HOST" + return + fi + export NSPORT=$1 + export NSHOST=$2 + + # Get (in bash) the configuration filename from (Python) ORBConfigFile return values + RETURN_VALUES=$(${KERNEL_ROOT_DIR}/bin/salome/envSalome.py python ${KERNEL_ROOT_DIR}/bin/salome/ORBConfigFile.py ${HOME}/${APPLI}/USERS ${NSHOST} ${NSPORT} with_username=${USER}) + export OMNIORB_CONFIG=$(echo ${RETURN_VALUES} | cut -d' ' -f1) +} + + if test "x${NSPORT}" == "xlast"; then #PORT is not given if test "x${NSHOST}" == "xlocalhost"; then @@ -75,47 +92,28 @@ if test "x${NSPORT}" == "xlast"; then # --- set omniORB configuration to current session if any fileOmniConfig=${HOME}/${APPLI}/USERS/.omniORB_${USER}_last.cfg if [ -f $fileOmniConfig ]; then - OMNIORB_CONFIG=${HOME}/${APPLI}/USERS/.omniORB_${USER}_last.cfg - export OMNIORB_CONFIG + export OMNIORB_CONFIG=${HOME}/${APPLI}/USERS/.omniORB_${USER}_last.cfg # --- set environment variables for port and hostname of NamingService - NSHOST=`${KERNEL_ROOT_DIR}/bin/salome/NSparam.py host` - NSPORT=`${KERNEL_ROOT_DIR}/bin/salome/NSparam.py port` - export NSPORT - export NSHOST + export NSHOST=`${KERNEL_ROOT_DIR}/bin/salome/NSparam.py host` + export NSPORT=`${KERNEL_ROOT_DIR}/bin/salome/NSparam.py port` fi else #MACHINE is given PORT is not given - NSPORT=2810 - OMNIORB_CONFIG=${HOME}/${APPLI}/USERS/.omniORB_${USER}_${NSHOST}_${NSPORT}.cfg - export OMNIORB_CONFIG - #if omniorb config file exists do not override (perhaps too conservative) - if [ ! -f ${OMNIORB_CONFIG} ]; then - echo "InitRef = NameService=corbaname::${NSHOST}:${NSPORT}" > ${OMNIORB_CONFIG} - fi - export NSPORT - export NSHOST + writeConfigFile 2810 ${NSHOST} fi else #PORT is given if test "x${NSHOST}" == "xlocalhost"; then #MACHINE is not given PORT is given - NSHOST=`hostname` + NSHOST=`hostname` fi - OMNIORB_CONFIG=${HOME}/${APPLI}/USERS/.omniORB_${USER}_${NSHOST}_${NSPORT}.cfg - export OMNIORB_CONFIG - #if omniorb config file exists do not override (perhaps too conservative) - if [ ! -f ${OMNIORB_CONFIG} ]; then - echo "InitRef = NameService=corbaname::${NSHOST}:${NSPORT}" > ${OMNIORB_CONFIG} - fi - export NSPORT - export NSHOST + writeConfigFile ${NSPORT} ${NSHOST} fi # --- invoke shell with or without args if [ $# -ne 0 ] ; then - ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py -exec $* + ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py -exec $* else - - ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py /bin/bash --rcfile ${HOME}/${APPLI}/.bashrc + ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py /bin/bash --rcfile ${HOME}/${APPLI}/.bashrc fi diff --git a/bin/appliskel/runTests b/bin/appliskel/runTests deleted file mode 100755 index 352daad91..000000000 --- a/bin/appliskel/runTests +++ /dev/null @@ -1,90 +0,0 @@ -#!/bin/bash -# Copyright (C) 2007-2012 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 -# - -# --- retrieve APPLI path, relative to $HOME, set ${APPLI} - -APPLI_HOME=`dirname $0` -export APPLI=`${APPLI_HOME}/getAppliPath.py` - -# --- set the SALOME environment (prerequisites, MODULES_ROOT_DIR...) - -. ${HOME}/${APPLI}/envd ${HOME}/${APPLI} - -# --- define port for CORBA naming service - -searchFreePort() { - echo -n "Searching for a free port for naming service: " - export NSPORT=2810 - local limit=$NSPORT - let limit=limit+100 - while [ 1 ] - do - aRes=`netstat -ltn | grep -E :${NSPORT}` - if [ -z "$aRes" ]; then - echo ${NSPORT} - Ok - local myhost=`hostname` - OMNIORB_CONFIG=${HOME}/${APPLI}/USERS/.omniORB_${USER}_${myhost}_${NSPORT}.cfg - export OMNIORB_CONFIG - export NSPORT - NSHOST=${myhost} - export NSHOST - local initref="NameService=corbaname::"`hostname`":$NSPORT" - #echo "ORBInitRef $initref" > $OMNIORB_CONFIG - echo "InitRef = $initref" > $OMNIORB_CONFIG - LAST_RUNNING_CONFIG=${HOME}/${APPLI}/USERS/.omniORB_${USER}_${myhost}_test.cfg - export LAST_RUNNING_CONFIG - rm ${LAST_RUNNING_CONFIG} - ln -s ${OMNIORB_CONFIG} ${LAST_RUNNING_CONFIG} - break - fi - echo -n "${NSPORT} " - if [[ $NSPORT -eq $limit ]] ; then - echo - echo "Can't find a free port to launch omniNames" - echo "Try to kill the running servers and then launch SALOME again." - exit - fi - let NSPORT=NSPORT+1 - done -} - -# --- if mpi lam, start lam (seems safe to be done several times) -# arret manuel avec lamhalt - -if [ "$LAMBHOST" ]; then - lamboot -fi - -# --- invoque shell with or without args - -searchFreePort - -if [ $# -ne 0 ] ; then - ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py /bin/bash --rcfile ${HOME}/${APPLI}/.bashrc -c "$*" -else - - ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py /bin/bash --rcfile ${HOME}/${APPLI}/.bashrc -fi - -rm ${OMNIORB_CONFIG} -rm ${LAST_RUNNING_CONFIG} diff --git a/bin/appliskel/salome.py b/bin/appliskel/salome.py new file mode 100755 index 000000000..a4f525b8c --- /dev/null +++ b/bin/appliskel/salome.py @@ -0,0 +1,74 @@ +#! /usr/bin/env python + +import os +import sys + +# Preliminary work to initialize path to SALOME Python modules +def __initialize(): + currentPath = os.path.dirname(__file__) + homePath = os.path.realpath(os.environ['HOME']) + appliPath = os.path.relpath(currentPath, homePath) + absoluteAppliPath = homePath+os.sep+appliPath + os.environ['APPLI'] = appliPath # needed to convert .sh environment files + os.environ['ABSOLUTE_APPLI_PATH'] = absoluteAppliPath + + sys.path[:0] = [absoluteAppliPath+'/bin/salome'] +# End of preliminary work + +def __getConfigFileNamesDefault(): + import glob + + absoluteAppliPath = os.environ['ABSOLUTE_APPLI_PATH'] + envdDir = absoluteAppliPath + '/env.d' + if os.path.isdir(envdDir): + configFileNames = glob.glob(envdDir+os.sep+'*.cfg') + glob.glob(envdDir+os.sep+'*.sh') + configFileNames = [os.path.basename(x) for x in configFileNames] + else: + configFileNames = [] + + configFileNames = [envdDir+'/'+x for x in configFileNames] + return configFileNames +# + +def __getConfigFileNames(args): + # special case: configuration files are provided by user + # Search for command-line argument(s) --config=file1,file2,..., filen + configOptionPrefix = "--config=" + configArgs = [ str(x) for x in args if str(x).startswith(configOptionPrefix) ] + + if len(configArgs) == 0: + return __getConfigFileNamesDefault(), args + + args = [ x for x in args if not x.startswith(configOptionPrefix) ] + files = [ x.replace(configOptionPrefix, '') for x in configArgs ] + configFileNames = [] + for x in files: + configFileNames += x.split(',') + + return configFileNames, args +# + +if __name__ == "__main__": + args = sys.argv[1:] + + # Identify application path then locate configuration files + __initialize() + configFileNames, args = __getConfigFileNames(args) + + # Create a SalomeRunner which parses configFileNames to initialize environment + from salomeRunner import SalomeRunner + runner = SalomeRunner(configFileNames) + + + # Here set specific variables, if needed + # runner.addToPath('mypath') + # runner.addToLdLibraryPath('myldlibrarypath') + # runner.addToPythonPath('mypythonpath') + # runner.setEnviron('myvarname', 'value') + + + # Start SALOME, parsing command line arguments + runner.go(args) + + print 'Thank you for using SALOME!' +# diff --git a/bin/appliskel/searchFreePort.sh b/bin/appliskel/searchFreePort.sh deleted file mode 100755 index 8d0346561..000000000 --- a/bin/appliskel/searchFreePort.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/bash -# Copyright (C) 2007-2012 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 -# - -# --- define port for CORBA naming service - -searchFreePort() { - echo -n "Searching for a free port for naming service: " - NSPORT=2810 - export NSPORT - local limit=$NSPORT - let limit=limit+100 - while [ 1 ] - do - aRes=`netstat -ltn | grep -E :${NSPORT}` - if [ -z "$aRes" ]; then - echo ${NSPORT} - Ok - local myhost=`hostname` - OMNIORB_CONFIG=${HOME}/${APPLI}/USERS/.omniORB_${USER}_${myhost}_${NSPORT}.cfg - export OMNIORB_CONFIG - export NSPORT - NSHOST=${myhost} - export NSHOST - local initref="NameService=corbaname::"`hostname`":$NSPORT" - #echo "ORBInitRef $initref" > $OMNIORB_CONFIG - echo "InitRef = $initref" > $OMNIORB_CONFIG - LAST_RUNNING_CONFIG=${HOME}/${APPLI}/USERS/.omniORB_${USER}_last.cfg - export LAST_RUNNING_CONFIG - rm ${LAST_RUNNING_CONFIG} - ln -s ${OMNIORB_CONFIG} ${LAST_RUNNING_CONFIG} - break - fi - echo -n "${NSPORT} " - if [[ $NSPORT -eq $limit ]] ; then - echo - echo "Can't find a free port to launch omniNames" - echo "Try to kill the running servers and then launch SALOME again." - exit - fi - let NSPORT=NSPORT+1 - done -} - diff --git a/bin/config_appli.xml b/bin/config_appli.xml deleted file mode 100644 index 027a166f4..000000000 --- a/bin/config_appli.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/bin/createAppli.sh b/bin/createAppli.sh deleted file mode 100755 index 2103a4601..000000000 --- a/bin/createAppli.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/sh -# Copyright (C) 2007-2012 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 -# - -comName=`which $0` -rep=`dirname $comName` - -if [ $# -ne 1 ]; then - echo "--- usage:" - echo $0 AppliName - echo "--- In which AppliName is a directory to create with SALOME application scripts" -elif [ -d $1 ]; then - echo $1 "directory already exists, nothing done" -else - mkdir -p $1 - mkdir -p $1/USERS - cp -r $rep/appliskel/* $1 - cp $rep/appliskel/.bashrc $1 - chmod +x $1/*.sh $1/run* $1/envd -fi diff --git a/bin/killSalome.py b/bin/killSalome.py index 020f7ed44..26dc0bb6f 100755 --- a/bin/killSalome.py +++ b/bin/killSalome.py @@ -96,4 +96,3 @@ def killAllPorts(): if __name__ == "__main__": killAllPorts() pass - diff --git a/bin/killSalomeWithPort.py b/bin/killSalomeWithPort.py index 57729aa88..c6c128b23 100755 --- a/bin/killSalomeWithPort.py +++ b/bin/killSalomeWithPort.py @@ -117,7 +117,7 @@ def appliCleanOmniOrbConfig(port): os.remove(omniorb_config) pass - if os.path.lexists(last_running_config):return + if os.path.lexists(last_running_config):return #try to relink last.cfg to an existing config file if any files = glob.glob(os.path.join(os.environ["HOME"],Utils_Identity.getapplipath(), @@ -137,21 +137,21 @@ def appliCleanOmniOrbConfig(port): ########## kills all salome processes with the given port ########## -def shutdownMyPort(port): +def shutdownMyPort(port, cleanup=True): """ Shutdown SALOME session running on the specified port. Parameters: - port - port number """ if not port: return - + from salome_utils import generateFileName # set OMNIORB_CONFIG variable to the proper file home = os.getenv("HOME") appli = os.getenv("APPLI") kwargs = {} - if appli is not None: + if appli is not None: home = os.path.join(os.path.realpath(home), appli,"USERS") kwargs["with_username"]=True pass @@ -162,22 +162,29 @@ def shutdownMyPort(port): with_port=port, **kwargs) os.environ['OMNIORB_CONFIG'] = omniorb_config + os.environ['NSPORT'] = str(port) # give the chance to the servers to shutdown properly try: import time - import salome_kernel - orb, lcc, naming_service, cm = salome_kernel.salome_kernel_init() + from omniORB import CORBA + from LifeCycleCORBA import LifeCycleCORBA # shutdown all + orb = CORBA.ORB_init([''], CORBA.ORB_ID) + lcc = LifeCycleCORBA(orb) lcc.shutdownServers() # give some time to shutdown to complete time.sleep(1) # shutdown omniNames and notifd - salome_kernel.LifeCycleCORBA.killOmniNames() + if cleanup: + lcc.killOmniNames() + time.sleep(1) + pass + pass except: pass pass - + def killMyPort(port): """ Kill SALOME session running on the specified port. @@ -185,12 +192,12 @@ def killMyPort(port): - port - port number """ from salome_utils import getShortHostName, getHostName - + # try to shutdown session nomally import threading, time - threading.Thread(target=shutdownMyPort, args=(port,)).start() + threading.Thread(target=shutdownMyPort, args=(port,False)).start() time.sleep(3) # wait a little, then kill processes (should be done if shutdown procedure hangs up) - + # new-style dot-prefixed pidict file filedict = getPiDict(port, hidden=True) # provide compatibility with old-style pidict file (not dot-prefixed) @@ -218,7 +225,7 @@ def killMyPort(port): suffix="Pid_omniNames", extension="log", with_port=port) - if not sys.platform == 'win32': + if not sys.platform == 'win32': cmd = 'pid=`ps -eo pid,command | egrep "[0-9] omniNames -start %s"` ; echo $pid > %s' % ( str(port), fpidomniNames ) a = os.system(cmd) pass @@ -255,7 +262,7 @@ def killMyPort(port): try: if sys.platform == "win32": import win32pm - win32pm.killpid(int(pid),0) + win32pm.killpid(int(pid),0) else: os.kill(int(pid),signal.SIGKILL) pass @@ -285,7 +292,7 @@ def killMyPort(port): # appliCleanOmniOrbConfig(port) pass - + def killNotifdAndClean(port): """ Kill notifd daemon and clean application running on the specified port. @@ -355,10 +362,19 @@ def killMyPortSpy(pid, port): return if __name__ == "__main__": + if len(sys.argv) < 2: + print "Usage: " + print " %s " % os.path.basename(sys.argv[0]) + print + print "Kills SALOME session running on specified ." + sys.exit(1) + pass if sys.argv[1] == "--spy": - pid = sys.argv[2] - port = sys.argv[3] - killMyPortSpy(pid, port) + if len(sys.argv) > 3: + pid = sys.argv[2] + port = sys.argv[3] + killMyPortSpy(pid, port) + pass sys.exit(0) pass for port in sys.argv[1:]: diff --git a/bin/launchConfigureParser.py b/bin/launchConfigureParser.py index 5ffb99b98..7e092ac91 100755 --- a/bin/launchConfigureParser.py +++ b/bin/launchConfigureParser.py @@ -80,7 +80,7 @@ script_nam = "pyscript" # possible choices for the "embedded" and "standalone" parameters embedded_choices = [ "registry", "study", "moduleCatalog", "cppContainer", "SalomeAppEngine" ] -standalone_choices = [ "registry", "study", "moduleCatalog", "cppContainer", "pyContainer"] +standalone_choices = [ "registry", "study", "moduleCatalog", "cppContainer"] # values of boolean type (must be '0' or '1'). # xml_parser.boolValue() is used for correct setting @@ -122,11 +122,18 @@ def version_id(fname): if len(vers) > 0: major = int(vers[0]) if len(vers) > 1: minor = int(vers[1]) if len(vers) > 2: - mr = re.search(r'^([0-9]+)([A-Za-z]?)([0-9]*)',vers[2]) + mr = re.search(r'^([0-9]+)([A-Z]|RC)?([0-9]*)',vers[2], re.I) if mr: release = int(mr.group(1)) - if mr.group(2).strip(): dev1 = ord(mr.group(2).strip()) - if mr.group(3).strip(): dev2 = int(mr.group(3).strip()) + if mr.group(2): + tag = mr.group(2).strip().lower() + if tag == "rc": + dev1 = 49 # release candidate + elif tag: + dev1 = ord(tag)-ord('a')+1 + pass + if mr.group(3): + dev2 = int(mr.group(3).strip()) pass pass dev = dev1 * 100 + dev2 @@ -134,15 +141,15 @@ def version_id(fname): ver = ver * 100 + minor ver = ver * 100 + release ver = ver * 10000 - if dev > 0: ver = ver - 10000 + dev + if dev > 0: ver = ver - dev return ver ### # Get default user configuration file name # For SALOME, it is: -# - on Linux: ~/.config/salome/.SalomeApprc.[version] -# - on Windows: ~/SalomeApp.xml.[version] -# where [version] is a version number +# - on Linux: ~/.config/salome/SalomeApprc[.] +# - on Windows: ~/SalomeApp.xml[.] +# where is an optional version number ### def defaultUserFile(appname=salomeappname, cfgname=salomecfgname): v = version() @@ -151,7 +158,7 @@ def defaultUserFile(appname=salomeappname, cfgname=salomecfgname): filename = os.path.join(getHomeDir(), "%s.xml%s" % (appname, v)) else: if cfgname: - filename = os.path.join(getHomeDir(), ".config", cfgname, ".%src%s" % (appname, v)) + filename = os.path.join(getHomeDir(), ".config", cfgname, "%src%s" % (appname, v)) pass else: filename = os.path.join(getHomeDir(), ".%src%s" % (appname, v)) @@ -166,11 +173,11 @@ def userFile(appname, cfgname): # get app version v = version() if not v: return None # unknown version - + # get default user file name filename = defaultUserFile(appname, cfgname) if not filename: return None # default user file name is bad - + # check that default user file exists if os.path.exists(filename): return filename # user file is found @@ -179,24 +186,31 @@ def userFile(appname, cfgname): # ... calculate default version id id0 = version_id(v) if not id0: return None # bad version id -> can't detect appropriate file - + # ... get all existing user preferences files if sys.platform == "win32": files = glob.glob(os.path.join(getHomeDir(), "%s.xml.*" % appname)) else: files = [] - if cfgname: files += glob.glob(os.path.join(getHomeDir(), ".config", cfgname, ".%src.*" % appname)) - files += glob.glob(os.path.join(getHomeDir(), ".%src.*" % appname)) + if cfgname: + # Since v6.6.0 - in ~/.config/salome directory, without dot prefix + files += glob.glob(os.path.join(getHomeDir(), ".config", cfgname, "%src.*" % appname)) + # Since v6.5.0 - in ~/.config/salome directory, dot-prefixed (backward compatibility) + files += glob.glob(os.path.join(getHomeDir(), ".config", cfgname, ".%src.*" % appname)) + pass + # old style (before v6.5.0) - in ~ directory, dot-prefixed + files += glob.glob(os.path.join(getHomeDir(), ".%src.*" % appname)) pass # ... loop through all files and find most appopriate file (with closest id) appr_id = -1 appr_file = "" for f in files: + ff = os.path.basename( f ) if sys.platform == "win32": - match = re.search( r'%s\.xml\.([a-zA-Z0-9.]+)$'%appname, f ) + match = re.search( r'^%s\.xml\.([a-zA-Z0-9.]+)$'%appname, ff ) else: - match = re.search( r'\.%src\.([a-zA-Z0-9.]+)$'%appname, f ) + match = re.search( r'^\.?%src\.([a-zA-Z0-9.]+)$'%appname, ff ) if match: ver = version_id(match.group(1)) if not ver: continue # bad version id -> skip file @@ -204,6 +218,9 @@ def userFile(appname, cfgname): appr_id = ver appr_file = f pass + elif abs(appr_id-id0) == abs(ver-id0): + if not os.path.basename(f).startswith("."): appr_file = f + pass pass pass return appr_file @@ -284,11 +301,11 @@ class xml_parser: def startElement(self, name, attrs): self.space.append(name) self.current = None - + # if we are importing file if self.space == [doc_tag, import_tag] and nam_att in attrs.getNames(): self.importFile( attrs.getValue(nam_att) ) - + # if we are analyzing "section" element and its "name" attribute is # either "launch" or module name -- set section_name if self.space == [doc_tag, sec_tag] and nam_att in attrs.getNames(): @@ -349,14 +366,14 @@ class xml_parser: def endDocument(self): self.read = None pass - + def importFile(self, fname): # get absolute name if os.path.isabs (fname) : absfname = fname else: absfname = os.path.join(os.path.dirname(self.fileName), fname) - + # check existing and registry file for ext in ["", ".xml", ".XML"] : if os.path.exists(absfname + ext) : @@ -369,7 +386,7 @@ class xml_parser: else: if verbose(): print "Configure parser: Error : file %s does not exist" % absfname return - + # importing file try: # copy current options @@ -387,7 +404,7 @@ class xml_parser: except: if verbose(): print "Configure parser: Error : can not read configuration file %s" % absfname pass - + # ----------------------------------------------------------------------------- @@ -859,7 +876,7 @@ def get_env(theAdditionalOptions=[], appname=salomeappname, cfgname=salomecfgnam # Process --print-port option if cmd_opts.print_port: - from runSalome import searchFreePort + from searchFreePort import searchFreePort searchFreePort({}) print "port:%s"%(os.environ['NSPORT']) sys.exit(0) diff --git a/bin/launchSalome.py b/bin/launchSalome.py deleted file mode 100755 index 9fe2af56b..000000000 --- a/bin/launchSalome.py +++ /dev/null @@ -1,114 +0,0 @@ -#! /usr/bin/env python -# -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2012 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 -# - -import socket -import os -import sys -import shutil - -##################################################################### -def findFreePort(startPort, step) : - - currentPort = startPort; - if step < 1: - step = 1; - - serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM); - - portFound = 0; - while (portFound != 1 and currentPort < 65536): - try : - serversocket.bind((socket.gethostname(), currentPort)); - portFound = 1; - print str(currentPort) + ": " + "OK"; -# serversocket.shutdown(0); -# serversocket.close(); - except Exception, inst: - print str(currentPort) + ": " + str(inst.args); - currentPort = currentPort+step; - - - - - if (portFound != 1) : - currentPort = -1; - return currentPort; -##################################################################### - - - -## 1. Generate config file for omniORB: -# content: -# InitRef = NameService=corbaname::[HOST_NAME]:[PORT_NUMBER] - -freePort = findFreePort(2810, 1); -hostName = socket.gethostname(); - -if (len(sys.argv) > 1) and sys.argv[1] == "-nothing" : - print "port:" + str(freePort); - sys.exit(0) - - - - -if freePort < 0 : - print - print "Can't find a free port to launch omniNames" - print "Try to kill the running servers and then launch SALOME again." - print - sys.exit(0) - -else : - omniCfgFileContent = "InitRef = NameService=corbaname::" + str(hostName) + ":" + str(freePort); - omniCfgFilePath = os.environ.get('HOME') + "/" + ".omniORB_" + str(hostName) + "_" + str(freePort) + ".cfg"; - - omni_file = file(omniCfgFilePath,'w+'); - omni_file.write(omniCfgFileContent); - omni_file.write("\n"); - omni_file.close(); - - if (len(sys.argv) > 1) and sys.argv[1] == "--save-config" : - omniCfgCurrent = os.environ.get('HOME') + "/.omniORB_current.cfg"; - if os.name == "posix" : - #make a symbolic link - symlink(omniCfgFilePath, omniCfgCurrent); - else : - #copy the file - shutil.copy(omniCfgFilePath, omniCfgCurrent); - - omniCfgFilePath = omniCfgCurrent; - - - - - ## 2. Set the OMNIORB_CONFIG environment variable - os.environ['OMNIORB_CONFIG']=omniCfgFilePath; - - - ## 3. execute the file runSalome.py - runSalomePyFilePath = os.environ.get('KERNEL_ROOT_DIR') + "/bin/salome/runSalome.py"; - - if os.path.isfile(runSalomePyFilePath) : - execfile(runSalomePyFilePath); - diff --git a/bin/orbmodule.py b/bin/orbmodule.py index 0499db75b..507c68c39 100755 --- a/bin/orbmodule.py +++ b/bin/orbmodule.py @@ -41,10 +41,9 @@ class client: """Client for SALOME""" def __init__(self,args=None): - #set GIOP message size for bug 10560: impossible to get field values in TUI mode - sys.argv.extend(["-ORBgiopMaxMsgSize", "104857600"]) ## = 100 * 1024 * 1024 # Initialise the ORB self.orb=CORBA.ORB_init(sys.argv, CORBA.ORB_ID) + # Initialise the Naming Service self.initNS(args or {}) @@ -59,7 +58,7 @@ class client: except (CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE): self.rootContext = None if verbose(): print "Launch Naming Service++", - + # On lance le Naming Server (doit etre dans le PATH) test = True if args['wake_up_session']: @@ -142,14 +141,14 @@ class client: count += 1 if count > maxcount : raise RuntimeError, "Impossible de trouver %s" % name obj=self.Resolve(name) - if obj : + if obj : print " found in %s seconds " % ((count-1)*delta) break else: sys.stdout.write('+') sys.stdout.flush() time.sleep(delta) - + if typobj is None:return obj nobj = obj._narrow(typobj) @@ -170,7 +169,7 @@ class client: raise RuntimeError, "Process %d for %s not found" % (thePID,theName) aCount += 1 anObj = self.Resolve(theName) - if anObj: + if anObj: print " found in %s seconds " % ((aCount-1)*aDelta) break else: @@ -179,7 +178,7 @@ class client: time.sleep(aDelta) pass pass - + if theTypObj is None: return anObj @@ -206,7 +205,7 @@ class client: except (CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE): obj = None return obj - + # -------------------------------------------------------------------------- def waitLogger(self,name,typobj=None,maxcount=40): @@ -217,18 +216,17 @@ class client: count += 1 if count > maxcount : raise RuntimeError, "Impossible de trouver %s" % name obj=self.ResolveLogger(name) - if obj : + if obj : print " found in %s seconds " % ((count-1)*delta) break else: sys.stdout.write('+') sys.stdout.flush() time.sleep(delta) - + if typobj is None:return obj nobj = obj._narrow(typobj) if nobj is None: print "%s exists but is not a %s" % (name,typobj) return nobj - diff --git a/bin/parseConfigFile.py b/bin/parseConfigFile.py new file mode 100644 index 000000000..38f8f2dbf --- /dev/null +++ b/bin/parseConfigFile.py @@ -0,0 +1,301 @@ +import ConfigParser +import os +import logging +import re +from io import StringIO + +logging.basicConfig() +logConfigParser = logging.getLogger(__name__) + +RESERVED_PREFIX = 'ADD_TO_' + + +# :TRICKY: So ugly solution... +class MultiOptSafeConfigParser(ConfigParser.SafeConfigParser): + def __init__(self): + ConfigParser.SafeConfigParser.__init__(self) + + # copied from python 2.6.8 Lib.ConfigParser.py + # modified (see code comments) to handle duplicate keys + def _read(self, fp, name): + """Parse a sectioned setup file. + + The sections in setup file contains a title line at the top, + indicated by a name in square brackets (`[]'), plus key/value + options lines, indicated by `name: value' format lines. + Continuations are represented by an embedded newline then + leading whitespace. Blank lines, lines beginning with a '#', + and just about everything else are ignored. + """ + cursect = None # None, or a dictionary + optname = None + lineno = 0 + e = None # None, or an exception + while True: + line = fp.readline() + if not line: + break + lineno = lineno + 1 + # comment or blank line? + if line.strip() == '' or line[0] in '#;': + continue + if line.split(None, 1)[0].lower() == 'rem' and line[0] in "rR": + # no leading whitespace + continue + # continuation line? + if line[0].isspace() and cursect is not None and optname: + value = line.strip() + if value: + cursect[optname].append(value) + # a section header or option header? + else: + # is it a section header? + mo = self.SECTCRE.match(line) + if mo: + sectname = mo.group('header') + if sectname in self._sections: + cursect = self._sections[sectname] + elif sectname == ConfigParser.DEFAULTSECT: + cursect = self._defaults + else: + cursect = self._dict() + cursect['__name__'] = sectname + self._sections[sectname] = cursect + # So sections can't start with a continuation line + optname = None + # no section header in the file? + elif cursect is None: + raise MissingSectionHeaderError(fpname, lineno, line) + # an option line? + else: + mo = self.OPTCRE.match(line) + if mo: + optname, vi, optval = mo.group('option', 'vi', 'value') + optname = self.optionxform(optname.rstrip()) + # This check is fine because the OPTCRE cannot + # match if it would set optval to None + if optval is not None: + if vi in ('=', ':') and ';' in optval: + # ';' is a comment delimiter only if it follows + # a spacing character + pos = optval.find(';') + if pos != -1 and optval[pos-1].isspace(): + optval = optval[:pos] + optval = optval.strip() + # allow empty values + if optval == '""': + optval = '' + # REPLACE following line (original): + #cursect[optname] = [optval] + # BY THESE LINES: + # Check if this optname already exists + if (optname in cursect) and (cursect[optname] is not None): + cursect[optname][0] += ','+optval + else: + cursect[optname] = [optval] + # END OF SUBSITUTION + else: + # valueless option handling + cursect[optname] = optval + else: + # a non-fatal parsing error occurred. set up the + # exception but keep going. the exception will be + # raised at the end of the file and will contain a + # list of all bogus lines + if not e: + e = ParsingError(fpname) + e.append(lineno, repr(line)) + # if any parsing errors occurred, raise an exception + if e: + raise e + + # join the multi-line values collected while reading + all_sections = [self._defaults] + all_sections.extend(self._sections.values()) + for options in all_sections: + for name, val in options.items(): + if isinstance(val, list): + options[name] = '\n'.join(val) + # + + +# Parse configuration file +# Input: filename, and a list of reserved keywords (environment variables) +# Output: a list of pairs (variable, value), and a dictionary associating a list of user-defined values to each reserved keywords +# Note: Does not support duplicate keys in a same section +def parseConfigFile(filename, reserved = []): + config = MultiOptSafeConfigParser() + config.optionxform = str # case sensitive + + # :TODO: test file existence + + # Read config file + try: + config.read(filename) + except ConfigParser.MissingSectionHeaderError: + logConfigParser.error("No section found in file: %s"%(filename)) + return [] + + return _processConfigFile(config, reserved) +# + +def _processConfigFile(config, reserved = []): + # :TODO: may detect duplicated variables in the same section (raise a warning) + # or even duplicate sections + + outputVariables = [] + # Get raw items for each section, and make some processing for environment variables management + reservedKeys = [RESERVED_PREFIX+str(x) for x in reserved] # produce [ 'ADD_TO_reserved_1', 'ADD_TO_reserved_2', ..., ADD_TO_reserved_n ] + reservedValues = dict([str(i),[]] for i in reserved) # create a dictionary in which keys are the 'ADD_TO_reserved_i' and associated values are empty lists: { 'reserved_1':[], 'reserved_2':[], ..., reserved_n:[] } + sections = config.sections() + for section in sections: + entries = config.items(section, raw=False) # use interpolation + if len(entries) == 0: # empty section + logConfigParser.warning("Empty section: %s in file: %s"%(section, filename)) + pass + for key,val in entries: + if key in reserved: + logConfigParser.error("Invalid use of reserved variable: %s in file: %s"%(key, filename)) + else: + expandedVal = os.path.expandvars(val) # expand environment variables + # Search for not expanded variables (i.e. non-existing environment variables) + pattern = re.compile('\${ ( [^}]* ) }', re.VERBOSE) # string enclosed in ${ and } + expandedVal = pattern.sub(r'', expandedVal) # remove matching patterns + # Trim colons + expandedVal = _trimColons(expandedVal) + + if key in reservedKeys: + shortKey = key[len(RESERVED_PREFIX):] + vals = expandedVal.split(',') + reservedValues[shortKey] += vals + # remove left&right spaces on each element + vals = [v.strip(' \t\n\r') for v in vals] + else: + outputVariables.append((key, expandedVal)) + pass + pass # end if key + pass # end for key,val + pass # end for section + + return outputVariables, reservedValues +# + +def _trimColons(var): + v = var + # Remove leading and trailing colons (:) + pattern = re.compile('^:+ | :+$', re.VERBOSE) + v = pattern.sub(r'', v) # remove matching patterns + # Remove multiple colons + pattern = re.compile('::+', re.VERBOSE) + v = pattern.sub(r':', v) # remove matching patterns + return v +# + +# This class is used to parse .sh environment file +# It deals with specific treatments: +# - virtually add a section to configuration file +# - process shell keywords (if, then...) +class EnvFileConverter(object): + def __init__(self, fp, section_name, reserved = [], outputFile=None): + self.fp = fp + self.sechead = '[' + section_name + ']\n' + self.reserved = reserved + self.outputFile = outputFile + self.allParsedVariableNames=[] + # exclude line that begin with: + self.exclude = [ 'if', 'then', 'fi', '#' ] + # discard the following keywords if at the beginning of line: + self.discard = [ 'export' ] + + def readline(self): + if self.sechead: + try: + if self.outputFile is not None: + self.outputFile.write(self.sechead) + return self.sechead + finally: + self.sechead = None + else: + line = self.fp.readline() + # trim whitespaces + line = line.strip(' \t\n\r') + # line of interest? (not beginning by a keyword of self.exclude) + for k in self.exclude: + if line.startswith(k): + return '\n' + # look for substrinsg beginning with sharp charcter ('#') + line = re.sub(r'#.*$', r'', line) + # line to be pre-processed? (beginning by a keyword of self.discard) + for k in self.discard: + if line.startswith(k): + line = line[len(k):] + line = line.strip(' \t\n\r') + # process reserved keywords + for k in self.reserved: + if line.startswith(k) and "=" in line: + variable, value = line.split('=') + value = self._purgeValue(value, k) + line = RESERVED_PREFIX + k + ": " + value + # Update list of variable names + if "=" in line: + variable, value = line.split('=') + self.allParsedVariableNames.append(variable) + # Self-extending variables that are not in reserved keywords + # Example: FOO=something:${FOO} + # :TODO: + # + # replace "${FOO}" and "$FOO" and ${FOO} and $FOO by %(FOO)s if FOO is + # defined in current file (i.e. it is not an external environment variable) + for k in self.allParsedVariableNames: + key = r'\$\{?'+k+'\}?' + pattern = re.compile(key, re.VERBOSE) + line = pattern.sub(r'%('+k+')s', line) + # Remove quotes + pattern = re.compile(r'\"', re.VERBOSE) + line = pattern.sub(r'', line) + # + # Replace `shell_command` by its result + def myrep(obj): + obj = re.sub('`', r'', obj.group(0)) # remove quotes + import subprocess + res = subprocess.Popen([obj], stdout=subprocess.PIPE).communicate()[0] + res = res.strip(' \t\n\r') # trim whitespaces + return res + # + line = re.sub('`[^`]+`', myrep, line) + # + if self.outputFile is not None: + self.outputFile.write(line+'\n') + return line + + def _purgeValue(self, value, name): + # Replace foo:${PATTERN}:bar or foo:$PATTERN:bar by foo:bar + key = r'\$\{?'+name+'\}?' + pattern = re.compile(key, re.VERBOSE) + value = pattern.sub(r'', value) + + # trim colons + value = _trimColons(value) + + return value + # + +# Convert .sh environment file to configuration file format +def convertEnvFileToConfigFile(envFilename, configFilename): + #reserved=['PATH', 'LD_LIBRARY_PATH', 'PYTHONPATH'] + reserved=['PATH', 'LD_LIBRARY_PATH', 'PYTHONPATH', 'MANPATH', 'R_LIBS', 'PV_PLUGIN_PATH'] + fileContents = open(envFilename, 'r').read() + + pattern = re.compile('\n[\n]+', re.VERBOSE) # multiple '\n' + fileContents = pattern.sub(r'\n', fileContents) # replace by a single '\n' + + finput = StringIO(unicode(fileContents)) + foutput = open(configFilename, 'w') + + config = MultiOptSafeConfigParser() + config.optionxform = str # case sensitive + config.readfp(EnvFileConverter(finput, 'SALOME Configuration', reserved, outputFile=foutput)) + foutput.close() + + logConfigParser.info('Configuration file generated: %s'%configFilename) +# diff --git a/bin/runConsole.py b/bin/runConsole.py new file mode 100644 index 000000000..72d73c77b --- /dev/null +++ b/bin/runConsole.py @@ -0,0 +1,42 @@ +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2012 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 +# + +def __prompt(vars = None, commands=[], message = "Connecting to SALOME"): + if vars is None: + vars = globals() + import code + import rlcompleter + import readline + readline.parse_and_bind("tab: complete") + # calling this with globals ensures we can see the environment + print message + shell = code.InteractiveConsole(vars) + for cmd in commands: + shell.push(cmd) + return shell.interact +# + +def connect(args=[]): + p = __prompt(commands=["import salomeConsole"]) + p() +# diff --git a/bin/runNS.py b/bin/runNS.py deleted file mode 100755 index 95e6c1788..000000000 --- a/bin/runNS.py +++ /dev/null @@ -1,121 +0,0 @@ -#!/usr/bin/env python -# -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2012 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 -# - -#log files localization -# -import os, commands, sys, re, string, socket -from Utils_Identity import getShortHostName - -if sys.platform == "win32": - # temporarily using home directory for Namning Service logs - # to be replaced with TEMP later... - os.environ["BaseDir"]=os.environ["HOME"] -else: - os.environ["BaseDir"]="/tmp" - -os.environ["Username"]=os.environ["USER"] - -# kill OmniNames if exists - -#killall -q -9 omniNames - -# clear log files - -def startOmni(): - try: - os.mkdir(os.environ["BaseDir"] + "/logs") - os.chmod(os.environ["BaseDir"] + "/logs", 0777) - except: - #print "Can't create " + os.environ["BaseDir"] + "/logs" - pass - - upath = os.environ["BaseDir"] + "/logs/" + os.environ["Username"] - - try: - os.mkdir(upath) - except: - #print "Can't create " + upath - pass - - #os.system("touch " + upath + "/dummy") - for fname in os.listdir(upath): - try: - if not fname.startswith("."): os.remove(upath + "/" + fname) - except: - pass - #os.system("rm -f " + upath + "/omninames* " + upath + "/dummy " + upath + "/*.log") - - print "Name Service... " - #hname=os.environ["HOST"] #commands.getoutput("hostname") - if sys.platform == "win32": - hname=getShortHostName() - else: - hname=socket.gethostname() - - print "hname=",hname - - f=open(os.environ["OMNIORB_CONFIG"]) - ss=re.findall("NameService=corbaname::" + hname + ":\d+", f.read()) - print "ss = ", ss - f.close() - aPort=re.findall("\d+", ss[0])[0] - - #aSedCommand="s/.*NameService=corbaname::" + hname + ":\([[:digit:]]*\)/\1/" - #print "sed command = ", aSedCommand - #aPort = commands.getoutput("sed -e\"" + aSedCommand + "\"" + os.environ["OMNIORB_CONFIG"]) - global process_id - print "port=", aPort - if sys.platform == "win32": - #import win32pm - #command = ['omniNames -start ' , aPort , ' -logdir ' , '\"' + upath + '\"'] - #os.system("start omniNames -start " + aPort + " -logdir " + "\"" + upath + "\"" ) - command = "start omniNames -start " + aPort + " -logdir " + "\"" + upath + "\"" - #print command - pid = win32pm.spawnpid( string.join(command, " "), -nc ) - process_id[pid]=command - else: - os.system("omniNames -start " + aPort + " -logdir " + upath + " &") - - print "ok" - print "to list contexts and objects bound into the context with the specified name : showNS " - -# In LifeCycleCORBA, FactoryServer is started with rsh on the requested -# computer if this Container does not exist. Default is localhost. -# Others Containers are started with start_impl method of FactoryServer Container. -# For using rsh it is necessary to have in the ${HOME} directory a .rhosts file -# Warning : on RedHat the file /etc/hosts contains by default a line like : -# 127.0.0.1 bordolex bordolex.paris1.matra-dtv.fr localhost.localdomain localhost -# (bordolex is the station name). omniNames on bordolex will be accessible from other -# computers only if the computer name is removed on that line like : -# 127.0.0.1 bordolex.paris1.matra-dtv.fr localhost.localdomain localhost - -# To start dynamically Containers on several computers you need to -# put in the ${OMNIORB_CONFIG} file a computer name instead of "localhost" -# example : ORBInitRef NameService=corbaname::dm2s0017 - -# If you need to use several omniNames running on the same computer, you have to : -#1. put in your ${OMNIORB_CONFIG} file a computer name and port number -# example : ORBInitRef NameService=corbaname::dm2s0017:1515 -#2. start omninames with this port number in runNS.sh -# example : omniNames -start 1515 -logdir ${BaseDir}/logs/${Username} & diff --git a/bin/runNS.sh b/bin/runNS.sh deleted file mode 100755 index 61d4bd33d..000000000 --- a/bin/runNS.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/sh -# Copyright (C) 2007-2012 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 -# - -#log files localization -# -BaseDir=/tmp -Username=`/usr/bin/whoami` - -# kill OmniNames if exists - -#killall -q -9 omniNames - -# clear log files - -mkdir -m 777 ${BaseDir}/logs -mkdir ${BaseDir}/logs/${Username} -touch ${BaseDir}/logs/${Username}/dummy -\rm -f ${BaseDir}/logs/${Username}/omninames* ${BaseDir}/logs/${Username}/dummy ${BaseDir}/logs/${Username}/*.log - -echo "Name Service... " -aSedCommand="s/.*NameService=corbaname::`hostname`:\([[:digit:]]*\)/\1/" -aPort=`cat $OMNIORB_CONFIG | grep NameService | sed -e"$aSedCommand"` -omniNames -start $aPort -logdir ${BaseDir}/logs/${Username} & - -# In LifeCycleCORBA, FactoryServer is started with rsh on the requested -# computer if this Container does not exist. Default is localhost. -# Others Containers are started with start_impl method of FactoryServer Container. -# For using rsh it is necessary to have in the ${HOME} directory a .rhosts file -# Warning : on RedHat the file /etc/hosts contains by default a line like : -# 127.0.0.1 bordolex bordolex.paris1.matra-dtv.fr localhost.localdomain localhost -# (bordolex is the station name). omniNames on bordolex will be accessible from other -# computers only if the computer name is removed on that line like : -# 127.0.0.1 bordolex.paris1.matra-dtv.fr localhost.localdomain localhost - -# To start dynamically Containers on several computers you need to -# put in the ${OMNIORB_CONFIG} file a computer name instead of "localhost" -# example : ORBInitRef NameService=corbaname::dm2s0017 - -# If you need to use several omniNames running on the same computer, you have to : -#1. put in your ${OMNIORB_CONFIG} file a computer name and port number -# example : ORBInitRef NameService=corbaname::dm2s0017:1515 -#2. start omninames with this port number in runNS.sh -# example : omniNames -start 1515 -logdir ${BaseDir}/logs/${Username} & - -echo ok -echo "to list contexts and objects bound int the context with the specified name : showNS " diff --git a/bin/runSalome b/bin/runSalome deleted file mode 100755 index af8082153..000000000 --- a/bin/runSalome +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Copyright (C) 2007-2012 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 -# - -${KERNEL_ROOT_DIR}/bin/salome/envSalome.py python ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py $* - -# ----------------------------------------------------------------------------- -# examples: -# --------- -# $: ${KERNEL_ROOT_DIR}/bin/salome/runSalome -# -# - parameters for launching are taken from SalomeApp.xml; -# - if the config file does not exist, it is created with default values. -# -# -# $: ${KERNEL_ROOT_DIR}/bin/salome/runSalome --modules=GEOM,SMESH,VISU,MED --embedded=registry,study,moduleCatalog,cppContainer --standalone=pyContainer --xterm --killall -# -# parameters from command line supersede those from SalomeApp.xml -# -# Some CORBA servers can be launched in the SALOME_Session_Server's process -# (embedded = same process) or in a separate process (standalone): -# --> registry,study,moduleCatalog,cppContainer -# Other CORBA servers could only be launched in separate process (standalone): -# --> pyContainer -# -# $: ${KERNEL_ROOT_DIR}/bin/salome/runSalome -h -# help -# ----------------------------------------------------------------------------- -# -# l'option -i permet de garder l'interpreteur python ouvert : -# par defaut, les differents serveurs ouvrent des fenêtres xterm -# (cf. runSalome.py) -# le serveur Logger n'est pas obligatoire (commenté dans runSalome.py) -# -# ----------------------------------------------------------------------------- diff --git a/bin/runSalome.bat b/bin/runSalome.bat deleted file mode 100644 index 60e7198a5..000000000 --- a/bin/runSalome.bat +++ /dev/null @@ -1,23 +0,0 @@ -@REM Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE -@REM -@REM Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -@REM CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -@REM -@REM This library is free software; you can redistribute it and/or -@REM modify it under the terms of the GNU Lesser General Public -@REM License as published by the Free Software Foundation; either -@REM version 2.1 of the License. -@REM -@REM This library is distributed in the hope that it will be useful, -@REM but WITHOUT ANY WARRANTY; without even the implied warranty of -@REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -@REM Lesser General Public License for more details. -@REM -@REM You should have received a copy of the GNU Lesser General Public -@REM License along with this library; if not, write to the Free Software -@REM Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -@REM -@REM See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -@REM - -@"%PYTHONBIN%" "%KERNEL_ROOT_DIR%\bin\salome\envSalome.py" "%PYTHONBIN%" "%KERNEL_ROOT_DIR%\bin\salome\runSalome.py" %* diff --git a/bin/runSalome.csh b/bin/runSalome.csh deleted file mode 100755 index a4606fc1d..000000000 --- a/bin/runSalome.csh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/csh -f -# Copyright (C) 2007-2012 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 -# - -runSalome --gui --modules=GEOM,SMESH,VISU,MED --killall diff --git a/bin/runSalome.ksh b/bin/runSalome.ksh deleted file mode 100644 index 57804f295..000000000 --- a/bin/runSalome.ksh +++ /dev/null @@ -1,98 +0,0 @@ -#!/bin/ksh -# Copyright (C) 2007-2012 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 -# - -searchFreePort() { - echo -n "Searching for a free port for naming service: " - NSPORT=2810 - export NSPORT - local limit=$NSPORT - let limit=limit+100 - while [ 1 ] - do - aRes=`netstat -ltn | grep -E :${NSPORT}` - if [ -z "$aRes" ]; then - echo ${NSPORT} - Ok - local myhost=`hostname` - OMNIORB_CONFIG=${HOME}/.omniORB_${myhost}_${NSPORT}.cfg - export OMNIORB_CONFIG - local initref="NameService=corbaname::"`hostname`":$NSPORT" - export NSPORT - if [[ `python -c "import CORBA; print CORBA.ORB_ID"` = "omniORB4" ]]; then - echo "InitRef = $initref" > $OMNIORB_CONFIG - else - echo "ORBInitRef $initref" > $OMNIORB_CONFIG - fi - break - fi - echo -n "${NSPORT} " - if [[ $NSPORT -eq $limit ]] ; then - echo - echo "Can't find a free port to launch omniNames" - echo "Try to kill the running servers and then launch SALOME again." - exit - fi - let NSPORT=NSPORT+1 - done -} - -searchFreePort - -if [[ "$*" = "-nothing" ]]; then - echo "port:$NSPORT" -elif [ $# -ne 0 ] ; then - python ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py $* -else - python ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py -fi - -# ----------------------------------------------------------------------------- -# examples: -# --------- -# $: ${KERNEL_ROOT_DIR}/bin/salome/runSalome -# -# - parameters for launching are taken from SalomeApp.xml; -# - if the config file does not exist, it is created with default values. -# -# -# $: ${KERNEL_ROOT_DIR}/bin/salome/runSalome --modules=GEOM,SMESH,VISU,MED --embedded=registry,study,moduleCatalog,cppContainer --standalone=pyContainer --xterm --killall -# -# parameters from command line supersede those from SalomeApp.xml -# -# Some CORBA servers can be launched in the SALOME_Session_Server's process -# (embedded = same process) or in a separate process (standalone): -# --> registry,study,moduleCatalog,cppContainer -# Other CORBA servers could only be launched in separate process (standalone): -# --> pyContainer -# -# $: ${KERNEL_ROOT_DIR}/bin/salome/runSalome -h -# help -# ----------------------------------------------------------------------------- -# -# l'option -i permet de garder l'interpreteur python ouvert : -# par defaut, les differents serveurs ouvrent des fenêtres xterm -# (cf. runSalome.py) -# le serveur Logger n'est pas obligatoire (commenté dans runSalome.py) -# -# ----------------------------------------------------------------------------- -# Example on CCRT (without ihm) : -# ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py --terminal --modules=MED,CALCULATOR,COMPONENT --standalone=registry,study,moduleCatalog,cppContainer,pyContainer --killall diff --git a/bin/runSalome.py b/bin/runSalome.py index c56da55cf..0389622f6 100755 --- a/bin/runSalome.py +++ b/bin/runSalome.py @@ -32,11 +32,6 @@ import setenv from launchConfigureParser import verbose from server import process_id, Server -if sys.platform == "win32": - SEP = ";" -else: - SEP = ":" - # ----------------------------------------------------------------------------- from killSalome import killAllPorts @@ -46,7 +41,7 @@ def killLocalPort(): kill servers from a previous SALOME exection, if needed, on the CORBA port given in args of runSalome """ - + from killSalomeWithPort import killMyPort my_port=str(args['port']) try: @@ -55,13 +50,13 @@ def killLocalPort(): print "problem in killLocalPort()" pass pass - + def givenPortKill(port): """ kill servers from a previous SALOME exection, if needed, on the same CORBA port """ - + from killSalomeWithPort import killMyPort my_port=port try: @@ -96,7 +91,7 @@ class InterpServer(Server): self.CMD=['xterm', '-e']+ env_ld_library_path + ['python'] else: self.CMD=['cmd', '/c', 'start cmd.exe', '/K', 'python'] - + def run(self): global process_id command = self.CMD @@ -132,7 +127,7 @@ def get_cata_path(list_modules,modules_root_dir): cata_path.append(cata_file) modules_cata[module]=cata_file - for path in os.getenv("SALOME_CATALOGS_PATH","").split(SEP): + for path in os.getenv("SALOME_CATALOGS_PATH","").split(os.pathsep): if os.path.exists(path): for cata_file in glob.glob(os.path.join(path,"*Catalog.xml")): module_name= os.path.basename(cata_file)[:-11] @@ -152,7 +147,7 @@ class CatalogServer(Server): self.SCMD2=[] home_dir=os.getenv('HOME') if home_dir is not None: - self.SCMD2=['-personal',os.path.join(home_dir,'Salome/resources/CatalogModulePersonnel.xml')] + self.SCMD2=['-personal',os.path.join(home_dir,'Salome/resources/CatalogModulePersonnel.xml')] def setpath(self,modules_list,modules_root_dir): list_modules = modules_list[:] @@ -200,17 +195,6 @@ class ContainerCPPServer(Server): # --- -class ContainerPYServer(Server): - def __init__(self,args): - self.args=args - self.initArgs() - if sys.platform == "win32": - self.CMD=[os.environ["PYTHONBIN"], '\"'+os.environ["KERNEL_ROOT_DIR"] + '/bin/salome/SALOME_ContainerPy.py'+'\"','FactoryServerPy'] - else: - self.CMD=['SALOME_ContainerPy.py','FactoryServerPy'] - -# --- - class LoggerServer(Server): def __init__(self,args): self.args=args @@ -250,7 +234,7 @@ class SessionServer(Server): self.SCMD1+=['--with','ModuleCatalog','(','-common'] home_dir=os.getenv('HOME') if home_dir is not None: - self.SCMD2+=['-personal',os.path.join(home_dir,'Salome/resources/CatalogModulePersonnel.xml')] + self.SCMD2+=['-personal',os.path.join(home_dir,'Salome/resources/CatalogModulePersonnel.xml')] self.SCMD2+=[')'] if 'study' in self.args['embedded']: self.SCMD2+=['--with','SALOMEDS','(',')'] @@ -258,11 +242,11 @@ class SessionServer(Server): self.SCMD2+=['--with','Container','(','FactoryServer',')'] if 'SalomeAppEngine' in self.args['embedded']: self.SCMD2+=['--with','SalomeAppEngine','(',')'] - + if 'cppContainer' in self.args['standalone'] or 'cppContainer' in self.args['embedded']: self.SCMD2+=['CPP'] if 'pyContainer' in self.args['standalone'] or 'pyContainer' in self.args['embedded']: - self.SCMD2+=['PY'] + raise Exception('Python containers no longer supported') if self.args['gui']: session_gui = True if self.args.has_key('session_gui'): @@ -276,6 +260,10 @@ class SessionServer(Server): self.SCMD2+=['--study-hdf=%s'%self.args['study_hdf']] pass pass + if self.args.has_key('pyscript') and len(self.args['pyscript']) > 0: + self.SCMD2+=['--pyscript=%s'%(",".join(self.args['pyscript']))] + pass + pass pass if self.args['noexcepthandler']: self.SCMD2+=['noexcepthandler'] @@ -294,9 +282,8 @@ class SessionServer(Server): list_modules.insert(0,m) list_modules.reverse() self.SCMD2+=['--modules (%s)' % ":".join(list_modules)] - - if self.args.has_key('pyscript') and len(self.args['pyscript']) > 0: - self.SCMD2+=['--pyscript=%s'%(",".join(self.args['pyscript']))] + pass + pass def setpath(self,modules_list,modules_root_dir): list_modules = modules_list[:] @@ -333,7 +320,7 @@ class SessionServer(Server): self.CMD = ["xterm", "-e", "gdb", "--command=.gdbinit4salome", self.CMD[0]] pass pass - + if self.args["valgrind_session"]: l = ["valgrind"] val = os.getenv("VALGRIND_OPTIONS") @@ -342,7 +329,7 @@ class SessionServer(Server): pass self.CMD = l + self.CMD pass - + # --- class LauncherServer(Server): @@ -406,7 +393,7 @@ def startGUI(clt): import SALOME_Session_idl session=clt.waitNS("/Kernel/Session",SALOME.Session) session.GetInterface() - + # ----------------------------------------------------------------------------- def startSalome(args, modules_list, modules_root_dir): @@ -414,13 +401,13 @@ def startSalome(args, modules_list, modules_root_dir): init_time = os.times() if verbose(): print "startSalome ", args - + # # Set server launch command # if args.has_key('server_launch_mode'): Server.set_server_launch_mode(args['server_launch_mode']) - + # # Wake up session option # @@ -430,7 +417,7 @@ def startSalome(args, modules_list, modules_root_dir): home = os.getenv("HOME") appli = os.getenv("APPLI") kwargs={} - if appli is not None: + if appli is not None: home = os.path.join(os.path.realpath(home), appli,"USERS") kwargs["with_username"] = True pass @@ -442,11 +429,11 @@ def startSalome(args, modules_list, modules_root_dir): os.environ['OMNIORB_CONFIG'] = last_running_config pass pass - + # # Initialisation ORB and Naming Service # - + clt=orbmodule.client(args) # @@ -478,7 +465,7 @@ def startSalome(args, modules_list, modules_root_dir): session.GetInterface() args["session_object"] = session return clt - + # Save Naming service port name into # the file args["ns_port_log_file"] if args.has_key('ns_port_log_file'): @@ -505,7 +492,7 @@ def startSalome(args, modules_list, modules_root_dir): if sys.platform != "win32": if verbose(): print "Notify Server to launch" - + myServer=NotifyServer(args,modules_root_dir) myServer.run() @@ -563,7 +550,7 @@ def startSalome(args, modules_list, modules_root_dir): # # Launch LauncherServer # - + myCmServer = LauncherServer(args) myCmServer.setpath(modules_list,modules_root_dir) myCmServer.run() @@ -577,7 +564,7 @@ def startSalome(args, modules_list, modules_root_dir): from Utils_Identity import getShortHostName - + if os.getenv("HOSTNAME") == None: if os.getenv("HOST") == None: os.environ["HOSTNAME"]=getShortHostName() @@ -585,13 +572,13 @@ def startSalome(args, modules_list, modules_root_dir): os.environ["HOSTNAME"]=os.getenv("HOST") theComputer = getShortHostName() - + # # Launch local C++ Container (FactoryServer), # and wait until it is registered in naming service # - if ('cppContainer' in args['standalone']) | (args["gui"] == 0) : + if ('cppContainer' in args['standalone']) | (args["gui"] == 0) : myServer=ContainerCPPServer(args) myServer.run() if sys.platform == "win32": @@ -605,19 +592,14 @@ def startSalome(args, modules_list, modules_root_dir): # if 'pyContainer' in args['standalone']: - myServer=ContainerPYServer(args) - myServer.run() - if sys.platform == "win32": - clt.waitNS("/Containers/" + theComputer + "/FactoryServerPy") - else: - clt.waitNSPID("/Containers/" + theComputer + "/FactoryServerPy",myServer.PID) + raise Exception('Python containers no longer supported') # # Wait until Session Server is registered in naming service # - + if args["gui"]: -##---------------- +##---------------- import Engines import SALOME import SALOMEDS @@ -641,7 +623,7 @@ def startSalome(args, modules_list, modules_root_dir): # additionnal external python interpreters # nbaddi=0 - + try: if 'interp' in args: nbaddi = args['interp'] @@ -651,7 +633,7 @@ def startSalome(args, modules_list, modules_root_dir): print "-------------------------------------------------------------" print "-- to get an external python interpreter:runSalome --interp=1" print "-------------------------------------------------------------" - + if verbose(): print "additional external python interpreters: ", nbaddi if nbaddi: for i in range(nbaddi): @@ -666,7 +648,7 @@ def startSalome(args, modules_list, modules_root_dir): import readline except ImportError: pass - + return clt # ----------------------------------------------------------------------------- @@ -678,7 +660,7 @@ def useSalome(args, modules_list, modules_root_dir): show registered objects in Naming Service. """ global process_id - + clt=None try: clt = startSalome(args, modules_list, modules_root_dir) @@ -688,7 +670,7 @@ def useSalome(args, modules_list, modules_root_dir): print print print "--- Error during Salome launch ---" - + #print process_id from addToKillList import addToKillList @@ -702,28 +684,28 @@ def useSalome(args, modules_list, modules_root_dir): if verbose(): print """ Saving of the dictionary of Salome processes in %s To kill SALOME processes from a console (kill all sessions from all ports): - python killSalome.py + python killSalome.py To kill SALOME from the present interpreter, if it is not closed : killLocalPort() --> kill this session (use CORBA port from args of runSalome) - givenPortKill(port) --> kill a specific session with given CORBA port + givenPortKill(port) --> kill a specific session with given CORBA port killAllPorts() --> kill all sessions - + runSalome, with --killall option, starts with killing the processes resulting from the previous execution. """%filedict - + # # Print Naming Service directory list # - + if clt != None: if verbose(): print print " --- registered objects tree in Naming Service ---" clt.showNS() pass - + if not args['gui'] or not args['session_gui']: if args['shutdown_servers']: class __utils__(object): @@ -739,7 +721,7 @@ def useSalome(args, modules_list, modules_root_dir): args['shutdown_servers'] = __utils__(args['port']) pass pass - + # run python scripts, passed via --execute option toimport = [] if args.has_key('pyscript'): @@ -781,7 +763,7 @@ def useSalome(args, modules_list, modules_root_dir): pass pass return clt - + def execScript(script_path): print 'executing', script_path sys.path.insert(0, os.path.dirname(script_path)) @@ -809,112 +791,6 @@ def registerEnv(args, modules_list, modules_root_dir): # ----------------------------------------------------------------------------- -def searchFreePort(args, save_config=1): - print "Searching for a free port for naming service:", - # - if sys.platform == "win32": - tmp_file = os.getenv('TEMP'); - else: - tmp_file = '/tmp' - tmp_file = os.path.join(tmp_file, '.netstat_%s'%os.getpid()) - # - ###status = os.system("netstat -ltn | grep -E :%s > /dev/null 2>&1"%(NSPORT)) - os.system( "netstat -a -n > %s" % tmp_file ); - f = open( tmp_file, 'r' ); - ports = f.readlines(); - f.close(); - os.remove( tmp_file ); - # - def portIsUsed(port, data): - regObj = re.compile( ".*tcp.*:([0-9]+).*:.*listen", re.IGNORECASE ); - for item in data: - try: - p = int(regObj.match(item).group(1)) - if p == port: return True - pass - except: - pass - pass - return False - # - NSPORT=2810 - limit=NSPORT+100 - # - while 1: - if not portIsUsed(NSPORT, ports): - print "%s - OK"%(NSPORT) - # - from salome_utils import generateFileName, getHostName - hostname = getHostName() - # - home = os.getenv("HOME") - appli = os.getenv("APPLI") - kwargs={} - if appli is not None: - home = os.path.join(os.path.realpath(home), appli,"USERS") - kwargs["with_username"]=True - # - omniorb_config = generateFileName(home, prefix="omniORB", - extension="cfg", - hidden=True, - with_hostname=True, - with_port=NSPORT, - **kwargs) - orbdata = [] - initref = "NameService=corbaname::%s:%s"%(hostname, NSPORT) - from omniORB import CORBA - if CORBA.ORB_ID == "omniORB4": - orbdata.append("InitRef = %s"%(initref)) - orbdata.append("giopMaxMsgSize = 2097152000 # 2 GBytes") - orbdata.append("traceLevel = 0 # critical errors only") - else: - orbdata.append("ORBInitRef %s"%(initref)) - orbdata.append("ORBgiopMaxMsgSize = 2097152000 # 2 GBytes") - orbdata.append("ORBtraceLevel = 0 # critical errors only") - pass - orbdata.append("") - f = open(omniorb_config, "w") - f.write("\n".join(orbdata)) - f.close() - # - os.environ['OMNIORB_CONFIG'] = omniorb_config - os.environ['NSPORT'] = "%s"%(NSPORT) - os.environ['NSHOST'] = "%s"%(hostname) - args['port'] = os.environ['NSPORT'] - # - if save_config: - last_running_config = generateFileName(home, prefix="omniORB", - suffix="last", - extension="cfg", - hidden=True, - **kwargs) - try: - if sys.platform == "win32": - import shutil - shutil.copyfile(omniorb_config, last_running_config) - else: - try: - os.remove(last_running_config) - except OSError: - pass - os.symlink(omniorb_config, last_running_config) - pass - pass - except: - pass - break - print "%s"%(NSPORT), - if NSPORT == limit: - msg = "\n" - msg += "Can't find a free port to launch omniNames\n" - msg += "Try to kill the running servers and then launch SALOME again.\n" - raise RuntimeError, msg - NSPORT=NSPORT+1 - pass - return - -# ----------------------------------------------------------------------------- - def no_main(): """Salome Launch, when embedded in other application""" fileEnv = os.environ["SALOME_LAUNCH_CONFIG"] @@ -922,6 +798,7 @@ def no_main(): args, modules_list, modules_root_dir = pickle.load(fenv) fenv.close() kill_salome(args) + from searchFreePort import searchFreePort searchFreePort(args, 0) clt = useSalome(args, modules_list, modules_root_dir) return clt @@ -933,6 +810,7 @@ def main(): from salome_utils import getHostName print "runSalome running on %s" % getHostName() args, modules_list, modules_root_dir = setenv.get_config() + kill_salome(args) save_config = True if args.has_key('save_config'): @@ -943,6 +821,7 @@ def main(): test = False pass if test: + from searchFreePort import searchFreePort searchFreePort(args, save_config) pass # -- @@ -992,7 +871,7 @@ def foreGround(clt, args): server.CMD = [os.getenv("PYTHONBIN"), "-m", "killSalomeWithPort", "--spy", "%s"%(os.getpid()), "%s"%(port)] else: server.CMD = ["killSalomeWithPort.py", "--spy", "%s"%(os.getpid()), "%s"%(port)] - server.run() + server.run() # os.system("killSalomeWithPort.py --spy %s %s &"%(os.getpid(), port)) # -- dt = 1.0 @@ -1012,10 +891,9 @@ def foreGround(clt, args): killMyPort(port) pass return +# -# ----------------------------------------------------------------------------- - -if __name__ == "__main__": +def runSalome(): import user clt,args = main() # -- @@ -1043,3 +921,10 @@ if __name__ == "__main__": pass # -- pass +# + +# ----------------------------------------------------------------------------- + +if __name__ == "__main__": + runSalome() +# diff --git a/bin/runSession.py b/bin/runSession.py new file mode 100644 index 000000000..0e2fd7ce1 --- /dev/null +++ b/bin/runSession.py @@ -0,0 +1,106 @@ +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2012 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 +# + +import os +import sys +from optparse import OptionParser +from NSparam import getNSparams + +# Use to display newlines (\n) in epilog +class MyParser(OptionParser): + def format_epilog(self, formatter): + return self.epilog +# + +def configureSession(args=[]): + usage = "Usage: %prog [options]" + epilog = """\nIf the command is not given a shell is opened. +If PORT and MACHINE are not given, try to connect to the last active session on the local machine. +If PORT and MACHINE are given, try to connect to the remote session associated with PORT on MACHINE. +If MACHINE is not given, try to connect to the session associated to PORT on the local machine. +If PORT is not given, try to connect to the remote session associated to port 2810 on MACHINE.\n\n""" + parser = MyParser(usage=usage, epilog=epilog) + parser.add_option("-p", "--port", metavar="", default=0, + action="store", type="int", dest="port", + help="The port to connect to." + ) + parser.add_option("-m", "--machine", metavar="", default=0, + action="store", type="int", dest="machine", + help="The machine to connect to." + ) + try: + (options, args) = parser.parse_args(args) + except Exception, e: + print e + return + + port = options.port + machine = options.machine + + # :GLITCH: this code defines specific environment variables (OMNIORB_CONFIG, NSPORT, + # NSHOST) which are later used by other modules. Working, but not really "safe"... + if not port: + if not machine: + # neither MACHINE nor PORT are given + # --- set omniORB configuration to current session if any + absoluteAppliPath = os.environ['ABSOLUTE_APPLI_PATH'] + fileOmniConfig = absoluteAppliPath + '/USERS/.omniORB_' + os.environ['USER'] + '_last.cfg' + if os.path.isfile(fileOmniConfig): + os.environ['OMNIORB_CONFIG'] = fileOmniConfig + # --- set environment variables for port and hostname of NamingService + host, port = getNSparams() + os.environ['NSHOST'] = host + os.environ['NSPORT'] = port + else: + # No running session + os.environ['NSHOST'] = "no_host" + os.environ['NSPORT'] = "no_port" + pass + else: + # only MACHINE is given + _writeConfigFile(2810, os.environ['NSHOST']) + # + else: + if not machine: + # only PORT is given + os.environ['NSHOST'] = `hostname` + pass + # both MACHINE and PORT are given + _writeConfigFile(os.environ['NSPORT'], os.environ['NSHOST']) + # +# + +# --- set the OMNIORB_CONFIG file and environment relative to this run of SALOME +def _writeConfigFile(port, host): + os.environ['NSPORT'] = port + os.environ['NSHOST'] = host + + absoluteAppliPath = os.environ['ABSOLUTE_APPLI_PATH'] + path = absoluteAppliPath + '/USERS' + kwargs = {'with_username' : os.environ['USER']} + + from ORBConfigFile import writeORBConfigFile + [ filename, msgSize ] = writeORBConfigFile(path, host, port, kwargs) + + os.environ['OMNIORB_CONFIG'] = filename +# diff --git a/bin/salome.launch b/bin/salome.launch deleted file mode 100644 index 5c71df7ef..000000000 --- a/bin/salome.launch +++ /dev/null @@ -1,29 +0,0 @@ - - - yes - no - no - yes - no - - - - - - - - - - - - - - registry - study - moduleCatalog - cppContainer - - - pyContainer - - diff --git a/bin/salomeConsole.py b/bin/salomeConsole.py index a8c4a60a4..8f95798df 100755 --- a/bin/salomeConsole.py +++ b/bin/salomeConsole.py @@ -67,18 +67,18 @@ else: if rep == "y": filename=f break - + if filename != "": os.environ['OMNIORB_CONFIG']=filename else: rep= raw_input("Do you want to try a local session on port 2810 ? [y|n]") if rep == "y": # Try a local session running on port 2810 - sys.argv=sys.argv+['-ORBInitRef','NameService=corbaname::localhost:2810'] + sys.argv=sys.argv+['-ORBInitRef','NameService=corbaname::localhost:2810']#+['-ORBgiopMaxMsgSize','2097152000'] # 2 GBytes else: sys.exit(1) -print sys.argv +#print sys.argv #direct adress from clt.orb.object_to_string(clt.rootContext) #sys.argv=sys.argv+['-ORBInitRef','NameService=IOR:010000000100000000000000010000000000000023000000010100000a0000006c6f63616c686f737400fa0a0b0000004e616d6553657276696365'] diff --git a/bin/salomeRunner.py b/bin/salomeRunner.py new file mode 100644 index 000000000..9b9343a63 --- /dev/null +++ b/bin/salomeRunner.py @@ -0,0 +1,294 @@ +import os +import sys +import logging + +from parseConfigFile import parseConfigFile +from parseConfigFile import convertEnvFileToConfigFile + +import tempfile +import pickle +import subprocess +import platform + +""" +The SalomeRunner class in an API to configure SALOME environment then +start SALOME using a single python command. + +""" +class SalomeRunner: + """ + Initialize environment from a list of configuration files + identified by their names. + These files should be in appropriate (new .cfg) format. + However you can give old .sh environment files; in this case, + the SalomeRunner class will try to automatically convert them + to .cfg format before setting the environment. + """ + def __init__(self, configFileNames=[]): + for filename in configFileNames: + basename, extension = os.path.splitext(filename) + if extension == ".cfg": + self.__setEnvironmentFromConfigFile(filename) + elif extension == ".sh": + temp = tempfile.NamedTemporaryFile(suffix='.cfg') + try: + convertEnvFileToConfigFile(filename, temp.name) + self.__setEnvironmentFromConfigFile(temp.name) + finally: + # Automatically cleans up the file + temp.close() + else: + self._getLogger().warning("Unrecognized extension for configuration file: %s", filename) + # + + def go(self, args): + # Run this module as a script, in order to use appropriate Python interpreter + # according to current path (initialized from environment files). + absoluteAppliPath = os.environ['ABSOLUTE_APPLI_PATH'] + proc = subprocess.Popen(['python', absoluteAppliPath+'/bin/salome/salomeRunner.py', pickle.dumps(self), pickle.dumps(args)], shell=False, close_fds=True) + proc.wait() + # + + """Append value to PATH environment variable""" + def addToPath(self, value): + self.__addToReserved( 'PATH', value) + # + + """Append value to LD_LIBRARY_PATH environment variable""" + def addToLdLibraryPath(self, value): + self.__addToReserved('LD_LIBRARY_PATH', value) + # + + """Append value to PYTHONPATH environment variable""" + def addToPythonPath(self, value): + self.__addToReserved('PYTHONPATH', value) + # + + """Set environment variable to value""" + def setEnviron(self, name, value, overwrite=False): + env = os.getenv(name, '') + if env and not overwrite: + self._getLogger().warning("Environment variable already existing and not overwritten: %s", name) + return + + if env: + self._getLogger().info("Overwriting environment variable: %s", name) + + value = os.path.expandvars(value) # expand environment variables + self._getLogger().debug("Set environment variable: %s=%s", name, value) + os.environ[name] = value + # + + ################################### + # This begins the private section # + ################################### + + def _usage(self, unused=[]): + exeName = os.path.splitext(os.path.basename(__file__))[0] + + msg = '''\ +Usage: %s [command] [options] [--config=file1,...,filen] + +Commands: + start Launches SALOME virtual application [DEFAULT] + shell Executes a script under SALOME application environment + connect Connects a Python console to the active SALOME session + killall Kill all SALOME running sessions + info Display some information about SALOME + help Show this message + coffee Yes! SALOME can also make coffee!!"\ + +'''%exeName + + print msg + # + + def __parseArguments(self, args): + if len(args) == 0 or args[0].startswith("-"): + return None, args + + command = args[0] + options = args[1:] + + availableCommands = { + 'start' : '_runAppli', + 'shell' : '_runSession', + 'connect' : '_runConsole', + 'killall': '_killAll', + 'info': '_showInfo', + 'help': '_usage', + 'coffee' : '_makeCoffee' + } + + if not command in availableCommands.keys(): + self._getLogger().error("Unrecognized command: %s.", command) + self._usage() + sys.exit(1) + + return availableCommands[command], options + # + + """ + Run SALOME! + Args consist in a mandatory command followed by optionnal parameters. + See usage for details on commands. + """ + def _getStarted(self, args): + command, options = self.__parseArguments(args) + sys.argv = options + + if command is None: + if args and args[0] in ["-h","--help","help"]: + self._usage() + sys.exit(0) + # try to default to "start" command + command = "_runAppli" + + try: + getattr(self, command)(options) # run appropriate method + except AttributeError: + self._getLogger().error("Method %s is not implemented.", command) + sys.exit(1) + # + + def __setEnvironmentFromConfigFile(self, filename): + configVars, reservedDict = parseConfigFile(filename, reserved=['PATH', 'LD_LIBRARY_PATH', 'PYTHONPATH']) + + # set environment + for reserved in reservedDict: + a = filter(None, reservedDict[reserved]) # remove empty elements + reformattedVals = ':'.join(a) + self.__addToReserved(reserved, reformattedVals) + pass + + for key,val in configVars: + self.setEnviron(key, val, overwrite=True) + pass + + sys.path[:0] = os.environ['PYTHONPATH'].split(':') + # + + def __addToReserved(self, name, value): + if value == '': + return + + value = os.path.expandvars(value) # expand environment variables + self._getLogger().debug("Add to %s: %s", name, value) + env = os.getenv(name, None) + if env is None: + os.environ[name] = value + else: + os.environ[name] = value + os.pathsep + env + # + + def _runAppli(self, args=[]): + # Initialize SALOME environment + sys.argv = ['runSalome'] + args + import setenv + setenv.main(True) + + import runSalome + runSalome.runSalome() + # + + def _runSession(self, args=[]): + sys.argv = ['runSession'] + args + import runSession + runSession.configureSession(args) + + import setenv + setenv.main(True) + + if args: + exe = args[0] + # if exe does not contain any slashes (/), search in PATH + # if exe contains slashes: + # if exe begins with a slash, use this absolute path + # else build absolute path relative to current working directory + if (os.sep in exe) and (exe[0] is not os.sep): + args[0] = os.getcwd() + os.sep + exe + + proc = subprocess.Popen(args, shell=False, close_fds=True) + proc.wait() + else: + absoluteAppliPath = os.environ['ABSOLUTE_APPLI_PATH'] + cmd = ["/bin/bash", "--rcfile", absoluteAppliPath + "/.bashrc" ] + proc = subprocess.Popen(cmd, shell=False, close_fds=True) + proc.wait() + # + + def _runConsole(self, args=[]): + # Initialize SALOME environment + sys.argv = ['runConsole'] + args + import setenv + setenv.main(True) + + import runConsole + runConsole.connect() + # + + def _killAll(self, args=[]): + #self._runAppli(['-k'] + args) + from killSalome import killAllPorts + killAllPorts() + # + + def _showInfo(self, args=[]): + print "Running with python", platform.python_version() + self._runAppli(["--version"]) + # + + def _makeCoffee(self, args=[]): + print " (" + print " ) (" + print " ___...(-------)-....___" + print " .-\"\" ) ( \"\"-." + print " .-\'``\'|-._ ) _.-|" + print " / .--.| `\"\"---...........---\"\"` |" + print " / / | |" + print " | | | |" + print " \\ \\ | |" + print " `\\ `\\ | |" + print " `\\ `| |" + print " _/ /\\ /" + print " (__/ \\ /" + print " _..---\"\"` \\ /`\"\"---.._" + print " .-\' \\ / \'-." + print " : `-.__ __.-\' :" + print " : ) \"\"---...---\"\" ( :" + print " \'._ `\"--...___...--\"` _.\'" + print " \\\"\"--..__ __..--\"\"/" + print " \'._ \"\"\"----.....______.....----\"\"\" _.\'" + print " `\"\"--..,,_____ _____,,..--\"\"`" + print " `\"\"\"----\"\"\"`" + sys.exit(0) + # + + # Add the following two methods since logger is not pickable + # Ref: http://stackoverflow.com/questions/2999638/how-to-stop-attributes-from-being-pickled-in-python + def __getstate__(self): + d = dict(self.__dict__) + del d['_logger'] + return d + # + def __setstate__(self, d): + self.__dict__.update(d) # I *think* this is a safe way to do it + # + # Excluding self._logger from pickle operation imply using the following method to access logger + def _getLogger(self): + if not hasattr(self, '_logger'): + self._logger = logging.getLogger(__name__) + #self._logger.setLevel(logging.DEBUG) + return self._logger; + # + +### +import pickle +if __name__ == "__main__": + if len(sys.argv) == 3: + runner = pickle.loads(sys.argv[1]) + args = pickle.loads(sys.argv[2]) + runner._getStarted(args) + else: + SalomeRunner()._usage() +# diff --git a/bin/salome_session.py b/bin/salome_session.py index d2ca5b094..17e984b9e 100644 --- a/bin/salome_session.py +++ b/bin/salome_session.py @@ -36,6 +36,7 @@ _session = None def startSession(modules=[]): global _session if _session: return + from searchFreePort import searchFreePort searchFreePort() _session = SalomeSession(modules) return @@ -51,59 +52,6 @@ def getShortHostName(): from salome_utils import getShortHostName return getShortHostName() -def searchFreePort(): - """ - Search free port for SALOME session. - Returns first found free port number. - """ - print "Searching a free port for naming service:", - from salome_utils import generateFileName, getHostName - hostname = getHostName() - NSPORT = 2810 - limit = NSPORT+100 - while 1: - print "%s "%(NSPORT), - status = os.system("netstat -ltn | grep -E :%s"%(NSPORT)) - if status: - home = os.getenv("HOME") - appli = os.getenv("APPLI") - kwargs={} - if appli is not None: - home = os.path.join(os.path.realpath(home), appli,"USERS") - kwargs["with_username"]=True - omniorb_config = generateFileName(home, prefix="omniORB", - extension="cfg", - hidden=True, - with_hostname=True, - with_port=NSPORT, - **kwargs) - f = open(omniorb_config, "w") - f.write("ORBInitRef NameService=corbaname::%s:%s\n"%(hostname, NSPORT)) - f.close() - os.environ['OMNIORB_CONFIG'] = omniorb_config - last_running_config = generateFileName(home, prefix="omniORB", - suffix="last", - extension="cfg", - hidden=True, - **kwargs) - os.environ['LAST_RUNNING_CONFIG'] = last_running_config - if os.access(last_running_config,os.F_OK): - os.unlink(last_running_config) - pass - os.symlink(omniorb_config,last_running_config) - print "- Ok" - break - if NSPORT == limit: - msg = "" - msg += "Can not find a free port to launch omniNames\n" - msg += "Kill the running servers and try again.\n" - raise RuntimeError, msg - NSPORT = NSPORT+1 - pass - os.environ['NSHOST'] = hostname - os.environ['NSPORT'] = str(NSPORT) - return NSPORT - class SalomeSession(object): """Salome session launcher""" diff --git a/bin/salome_utils.py b/bin/salome_utils.py index 95e87f42c..295b05d24 100644 --- a/bin/salome_utils.py +++ b/bin/salome_utils.py @@ -194,8 +194,11 @@ def getPortNumber(use_default=True): return int( os.getenv( "NSPORT" ) ) except: pass - port = getPortFromORBcfg() - if port is not None: return port + try: + port = int( getPortFromORBcfg() ) + if port is not None: return port + except: + pass if use_default: return 2809 # '2809' is default port number return None diff --git a/bin/searchFreePort.py b/bin/searchFreePort.py new file mode 100644 index 000000000..32d858f31 --- /dev/null +++ b/bin/searchFreePort.py @@ -0,0 +1,111 @@ +#!/usr/bin/env python +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2012 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 +# + +def searchFreePort(args={}, save_config=1): + """ + Search free port for SALOME session. + Returns first found free port number. + """ + import sys, os, re, shutil + print "Searching for a free port for naming service:", + + # :NOTE: Under windows: + # netstat options -l and -t are unavailable + # grep command is unavailable + + from subprocess import Popen, PIPE + (stdout, stderr) = Popen(['netstat','-an'], stdout=PIPE).communicate() + import StringIO + buf = StringIO.StringIO(stdout) + ports = buf.readlines() + + # + def portIsUsed(port, data): + regObj = re.compile( ".*tcp.*:([0-9]+).*:.*listen", re.IGNORECASE ); + for item in data: + try: + p = int(regObj.match(item).group(1)) + if p == port: return True + pass + except: + pass + pass + return False + # + NSPORT=2810 + limit=NSPORT+100 + # + + while 1: + if not portIsUsed(NSPORT, ports): + print "%s - OK"%(NSPORT) + # + from salome_utils import generateFileName, getHostName + hostname = getHostName() + # + home = os.getenv("HOME") + appli = os.getenv("APPLI") + kwargs={} + if appli is not None: + home = os.path.join(os.path.realpath(home), appli,"USERS") + kwargs["with_username"]=True + # + from ORBConfigFile import writeORBConfigFile + omniorb_config, giopsize = writeORBConfigFile(home, hostname, NSPORT, kwargs) + + args['port'] = os.environ['NSPORT'] + # + if save_config: + last_running_config = generateFileName(home, prefix="omniORB", + suffix="last", + extension="cfg", + hidden=True, + **kwargs) + os.environ['LAST_RUNNING_CONFIG'] = last_running_config + try: + if sys.platform == "win32": + import shutil + shutil.copyfile(omniorb_config, last_running_config) + else: + try: + if os.access(last_running_config, os.F_OK): + os.remove(last_running_config) + except OSError: + pass + os.symlink(omniorb_config, last_running_config) + pass + pass + except: + pass + # + break + print "%s"%(NSPORT), + if NSPORT == limit: + msg = "\n" + msg += "Can't find a free port to launch omniNames\n" + msg += "Try to kill the running servers and then launch SALOME again.\n" + raise RuntimeError, msg + NSPORT=NSPORT+1 + pass + return diff --git a/bin/setenv.py b/bin/setenv.py index 44ac6dbe7..46bc337be 100755 --- a/bin/setenv.py +++ b/bin/setenv.py @@ -172,7 +172,8 @@ def set_env(args, modules_list, modules_root_dir, silent=False): for module in modules_list : if modules_root_dir.has_key(module): module_root_dir = modules_root_dir[module] - modules_root_dir_list[:0] = [module_root_dir] + if module_root_dir not in modules_root_dir_list: + modules_root_dir_list[:0] = [module_root_dir] if sys.platform == "win32": add_path(os.path.join(module_root_dir,get_lib_dir(),salome_subdir), "PATH") diff --git a/bin/shutdownSalome.py b/bin/shutdownSalome.py index b7d319696..ed81e00e8 100755 --- a/bin/shutdownSalome.py +++ b/bin/shutdownSalome.py @@ -27,9 +27,12 @@ # import time -import salome_kernel -orb, lcc, naming_service, cm = salome_kernel.salome_kernel_init() +from omniORB import CORBA +from LifeCycleCORBA import * + +orb = CORBA.ORB_init([''], CORBA.ORB_ID) +lcc = LifeCycleCORBA(orb) lcc.shutdownServers() -#give some time to shutdown to complete time.sleep(1) -salome_kernel.LifeCycleCORBA.killOmniNames() +LifeCycleCORBA.killOmniNames() +time.sleep(1) diff --git a/bin/waitNS.sh b/bin/waitNS.sh deleted file mode 100755 index b35ab3c28..000000000 --- a/bin/waitNS.sh +++ /dev/null @@ -1,31 +0,0 @@ -#! /bin/sh -# Copyright (C) 2007-2012 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 -# - -status=1 -while [ $status -ne 0 ]; do - ls $HOME/$APPLI/USERS/.omniORB_${USER}_last.cfg 2> /dev/null - status=$? - sleep 1 - echo -n "#" -done -./runSession waitNS.py diff --git a/configure.ac b/configure.ac index 719c66a7d..d3200df43 100644 --- a/configure.ac +++ b/configure.ac @@ -25,7 +25,7 @@ # ================================================================ #AC_PREREQ(2.59) # -AC_INIT([Salome2 Project], [6.5.0], [paul.rascle@edf.fr], [SalomeKERNEL]) +AC_INIT([Salome2 Project], [7.0.0], [paul.rascle@edf.fr], [SalomeKERNEL]) # AC_CONFIG_AUX_DIR defines an alternative directory where to find the auxiliary # scripts such as config.guess, install-sh, ... @@ -532,7 +532,7 @@ sed -i "s%\(\s*\)\(for searchdir in \$searchdirs; do\)%\1for sss in \$searchdirs # This could be helpfull to update de configuration. AC_OUTPUT([ \ KERNEL_version.h \ - salome_adm/unix/SALOMEconfig.ref \ + salome_adm/SALOMEconfig.ref \ salome_adm/Makefile \ salome_adm/cmake_files/Makefile \ salome_adm/unix/Makefile \ diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt new file mode 100755 index 000000000..b7c2d2d0e --- /dev/null +++ b/doc/CMakeLists.txt @@ -0,0 +1,21 @@ +# Copyright (C) 2012 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(salome) +ADD_SUBDIRECTORY(docutils) \ No newline at end of file diff --git a/doc/Makefile.am b/doc/Makefile.am index 2cdd838a3..bce7733f8 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -29,7 +29,7 @@ include $(top_srcdir)/salome_adm/unix/make_common_starter.am SUBDIRS = salome docutils -EXTRA_DIST = configuration_examples README.cluster-CCRT +EXTRA_DIST += configuration_examples README.cluster-CCRT docs: usr_docs diff --git a/doc/docutils/CMakeLists.txt b/doc/docutils/CMakeLists.txt new file mode 100755 index 000000000..71b6d67fb --- /dev/null +++ b/doc/docutils/CMakeLists.txt @@ -0,0 +1,66 @@ +# Copyright (C) 2012 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 +# + +SET(SPHINXOPTS +) +SET(SOURCEDIR + ${CMAKE_CURRENT_SOURCE_DIR} +) +SET(PAPEROPT_a4 + -D + latex_paper_size=a4 +) +SET(ALLSPHINXOPTS + -d + doctrees + ${PAPEROPT_a4} + ${SPHINXOPTS} + ${SOURCEDIR} +) + +SALOME_CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in" "${CMAKE_CURRENT_BINARY_DIR}/conf.py") + +IF(WINDOWS) + STRING(REPLACE "/" "\\" SCR "@SET PYTHONPATH=${CMAKE_INSTALL_PREFIX}\\lib\\python2.6\\site-packages\\salome\;%PYTHONPATH% + @SET PYTHONPATH=${CMAKE_INSTALL_PREFIX}\\bin\\salome\;%PYTHONPATH% + @SET PATH=${CMAKE_INSTALL_PREFIX}\\lib\\salome\;%PATH% + @SET PYTHONPATH=${OMNIORB_ROOT_USER}\\lib\\x86_win32\;%PYTHONPATH% + @SET PYTHONPATH=${OMNIORB_ROOT_USER}\\lib\\python\;%PYTHONPATH% + @SET PATH=${OMNIORB_ROOT_USER}\\lib\\x86_win32\;%PATH% + ") + SET(EXT "bat") + SET(CALL_STR "call") +ELSE(WINDOWS) + SET(SCR "export PYTHONPATH=${CMAKE_INSTALL_PREFIX}/lib/python2.6/site-packages/salome:\${PYTHONPATH} + export PYTHONPATH=${CMAKE_INSTALL_PREFIX}/bin/salome:\${PYTHONPATH} + export LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib/salome:\${LD_LIBRARY_PATH} + export PYTHONPATH=${OMNIORB_ROOT_USER}/lib:\${PYTHONPATH} + export PYTHONPATH=${OMNIORB_ROOT_USER}/lib/python2.6/site-packages:\${PYTHONPATH} + export LD_LIBRARY_PATH=${OMNIORB_ROOT_USER}/lib:\${LD_LIBRARY_PATH} + ") + SET(EXT "sh") + SET(CALL_STR ".") +ENDIF(WINDOWS) + +FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/env_s.${EXT} "${SCR}") + +ADD_CUSTOM_TARGET(html_docs ${CALL_STR} ${CMAKE_CURRENT_BINARY_DIR}/env_s.${EXT} && ${SPHINX_EXECUTABLE} -c ${CMAKE_BINARY_DIR}/doc/docutils -b html ${ALLSPHINXOPTS} html + COMMAND ${PYTHON_EXECUTABLE} -c \"import shutil\;shutil.rmtree('''${CMAKE_INSTALL_PREFIX}/share/doc/salome/tui/KERNEL/docutils''', True)\;shutil.copytree('''${CMAKE_CURRENT_BINARY_DIR}/html''', '''${CMAKE_INSTALL_PREFIX}/share/doc/salome/tui/KERNEL/docutils''')\" + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +) diff --git a/doc/docutils/Makefile.am b/doc/docutils/Makefile.am index 9764cb727..36acceb96 100644 --- a/doc/docutils/Makefile.am +++ b/doc/docutils/Makefile.am @@ -33,7 +33,7 @@ RSTFILES = \ kernel.rst \ parametric.rst -EXTRA_DIST = archives $(RSTFILES) +EXTRA_DIST += archives $(RSTFILES) SPHINXOPTS = SOURCEDIR = $(srcdir) diff --git a/doc/docutils/archives/KERNEL_Services.txt b/doc/docutils/archives/KERNEL_Services.txt index c848838ee..51bbf9da8 100644 --- a/doc/docutils/archives/KERNEL_Services.txt +++ b/doc/docutils/archives/KERNEL_Services.txt @@ -18,13 +18,13 @@ This document corresponds to SALOME2 3.2.0 ------------------------------------------------------------------------------- In a SALOME application, distributed components, servers and clients use -the CORBA middleware for comunication. CORBA interfaces are defined via idl +the CORBA middleware for communication. CORBA interfaces are defined via idl files. All the different CORBA interfaces are available for users in Python, see CORBA interfaces below. For some general purpose services, CORBA interfaces have been encapsulated in order to provide a simple interface (encapsulation is generally done in -C++ classes, and a Python SWIG interface is also generated from C++, to +C++ classes, and a Python SWIG interface is also generated from C++, to ensure a consistent behavior between C++ modules and Python modules or user script). @@ -53,7 +53,7 @@ In the embedded interpreter, it is already done, but there is no problem to do it several times, so it is preferable to add these instructions systematically in your scripts, to allow them to work in all configurations. -Container and component instanciation +Container and component instantiation ------------------------------------- See LifeCycleCORBA_ for the C++ interface (Python interface obtained with SWIG @@ -67,21 +67,21 @@ in the local container, "FactoryServer", created when SALOME starts:: import salome salome.salome_init() - + import LifeCycleCORBA lcc = LifeCycleCORBA.LifeCycleCORBA() obj=lcc.FindOrLoad_Component("FactoryServer","SalomeTestComponent") - + import Engines comp=obj._narrow(Engines.TestComponent) - + comp.Coucou(1) The answer is something like:: 'TestComponent_i : L = 1' - -The _narrow() instruction is not always mandatory in Python, but sometimes + +The _narrow() instruction is not always mandatory in Python, but sometimes useful to be sure you have got the right type of object. Here, Testcomponent_ interface is defined in CORBA module Engines. With this example, it works also without the _narrow() instruction:: diff --git a/doc/docutils/archives/SALOME_Application.txt b/doc/docutils/archives/SALOME_Application.txt index 0abcaed1e..c77bd6da2 100644 --- a/doc/docutils/archives/SALOME_Application.txt +++ b/doc/docutils/archives/SALOME_Application.txt @@ -26,7 +26,7 @@ General principles A SALOME application is defined by a set of modules (GEOM, SMESH, ASTER...). A SALOME User can define several SALOME Applications. These applications are -runnable from the same user account. These applications may share the same +runnable from the same user account. These applications may share the same KERNEL and modules. Thus, the application configuration is independant of KERNEL and must not be put in KERNEL_ROOT_DIR. @@ -62,7 +62,7 @@ First way - references to different module directories '''''''''''''''''''''''''''''''''''''''''''''''''''''' The script createAppli.sh in ${KERNEL_ROOT_DIR}/bin/salome creates an -application directory with the given path in parameter. ${APPLI} is a path +application directory with the given path in parameter. ${APPLI} is a path relative to ${HOME}. The directory is only a skeleton, the user has to edit several files to @@ -91,7 +91,7 @@ creates a virtual installation of SALOME in the application directory ${APPLI} (bin, lib, doc, share...), with, for each file (executable, script, data, library, resources...), symbolic links to the actual file. -Providing an existing an existing script for SALOME prerequisites (the same one +Providing an existing script for SALOME prerequisites (the same one used for modules compilation, or given with the modules installation), the installation works without further modification for a single computer (unless some modules needs a special environment not defined in the above script). @@ -109,7 +109,7 @@ following the computers). The ${APPLI} directory contains scripts for environment and runs. Environment scripts must be configured (by the user) on each computer. All the environment -scripts are in the ${APPLI}/env.d directory. +scripts are in the ${APPLI}/env.d directory. The script ${APPLI}/envd sources **all** the files (\*.sh) in ${APPLI}/env.d in alphanumeric order (after edition, think to remove backup files). the envd @@ -139,8 +139,8 @@ envSALOME.sh export SalomeAppConfig=${HOME}/${APPLI} - where SalomeAppConfig designates the directory containing SalomeApp.xml. - Note that ${APPLI} is already defined by the calling scripts when + where SalomeAppConfig designates the directory containing SalomeApp.xml. + Note that ${APPLI} is already defined by the calling scripts when env.d/envSalome.sh is sourced. User run scripts @@ -291,7 +291,7 @@ Add an external Python interpretor to a running session It's often easier to develop and try Python scripts outside the GUI embedded Python interpreter. Imagine, for instance, you are writing a script involving geometry and mesh modules. -first, launch a SALOME session with gui, then, on another terminal:: +First, launch a SALOME session with gui, then, on another terminal:: ./runSession python diff --git a/doc/docutils/archives/txt2html.sh b/doc/docutils/archives/txt2html.sh index 45db3d9bf..c6150772e 100755 --- a/doc/docutils/archives/txt2html.sh +++ b/doc/docutils/archives/txt2html.sh @@ -42,6 +42,7 @@ FILELIST="index SALOME_Application INSTALL kernel_resources + KERNEL_Services userguide" STYLESHEET=rst.css diff --git a/doc/docutils/archives/userguide.txt b/doc/docutils/archives/userguide.txt index b7134e840..119aa1581 100644 --- a/doc/docutils/archives/userguide.txt +++ b/doc/docutils/archives/userguide.txt @@ -44,7 +44,7 @@ Module Container definition of a container - + General concepts ================ @@ -92,24 +92,19 @@ Developer's guide - managing the development space - personalisation des procédures de construction Developer' guide - integration tools -==================================== -- Guide de l'intégrateur (développeur de nouveaux modules) -(on lui montre ici le principe de construction et les ressources à -disposition pour faire le travail) +==================================== +- Guide de l'intégrateur (développeur de nouveaux modules) : (on lui montre ici le principe de construction et les ressources à disposition pour faire le travail) - création d'un modules - intégration code boîte noire (perfect, solver) - - intégration bibliothèque de fonctions (hxx2salome, voir avec - N.Crouzet) - - intégration de modèles de données (xdata) + - intégration bibliothèque de fonctions (hxx2salome, voir avec N.Crouzet) + - intégration de modèles de données (xdata) End user's guide ================ - Guide de l'utilisateur - concept d'application (renvoie doc Paul) - - commandes avancées (showNS, exemple de contact de la - session, d'un engine, utilisation du lifeCycle, du module salome, - des modules geompy et smesh) + - commandes avancées (showNS, exemple de contact de la session, d'un engine, utilisation du lifeCycle, du module salome, des modules geompy et smesh) - utilisation en mode distribué (doc de B. Sechet) - GUI and TUI documentation @@ -130,7 +125,7 @@ End user's guide RST Exemples ============ -See INSTALL_ for general information on required configuration and +See INSTALL_ for general information on required configuration and prerequisites, compilation procedure, setting environment principles. .. _INSTALL: ./INSTALL.html diff --git a/doc/salome/CMakeLists.txt b/doc/salome/CMakeLists.txt new file mode 100755 index 000000000..19bbb94b0 --- /dev/null +++ b/doc/salome/CMakeLists.txt @@ -0,0 +1,21 @@ +# Copyright (C) 2012 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(gui) +ADD_SUBDIRECTORY(tui) \ No newline at end of file diff --git a/doc/salome/Makefile.am b/doc/salome/Makefile.am index a4d7dd4ec..d683bac5a 100644 --- a/doc/salome/Makefile.am +++ b/doc/salome/Makefile.am @@ -39,8 +39,8 @@ dev_docs: echo "Making dev_docs in tui"; \ (cd tui && $(MAKE) $(AM_MAKEFLAGS) dev_docs) -EXTRA_DIST= main.dox install.dox \ +EXTRA_DIST+= main.dox install.dox \ kernel_resources.dox kernel_services.dox kernel_services_cpphelpers.dox \ salome_application.dox unittests.dox \ - salome_file.dox kernel_salome.dox \ + salome_file.dox kernel_salome.dox running_salome.dox \ examples diff --git a/doc/salome/gui/CMakeLists.txt b/doc/salome/gui/CMakeLists.txt new file mode 100755 index 000000000..8bd8df903 --- /dev/null +++ b/doc/salome/gui/CMakeLists.txt @@ -0,0 +1,35 @@ +# Copyright (C) 2012 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 +# + +SET(top_builddir ${CMAKE_BINARY_DIR}) +SET(top_srcdir ${CMAKE_SOURCE_DIR}) +SET(srcdir ${CMAKE_CURRENT_SOURCE_DIR}) +SET(builddir ${CMAKE_CURRENT_BINARY_DIR}) +SET(datadir ${CMAKE_INSTALL_PREFIX}/share) +SET(docdir ${datadir}/doc/salome) + +CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/doxyfile) +CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/static/header.html.in ${CMAKE_CURRENT_BINARY_DIR}/static/header.html) + +ADD_CUSTOM_TARGET(usr_docs ${DOXYGEN_EXECUTABLE} + COMMAND ${PYTHON_EXECUTABLE} -c "import shutil, sys; shutil.rmtree(r'''${CMAKE_INSTALL_PREFIX}/share/doc/salome/gui/KERNEL''', True); shutil.copytree(r'''${CMAKE_CURRENT_BINARY_DIR}/KERNEL''', r'''${CMAKE_INSTALL_PREFIX}/share/doc/salome/gui/KERNEL'''); shutil.copy(r'''${CMAKE_CURRENT_SOURCE_DIR}/images/head.png''', r'''${CMAKE_INSTALL_PREFIX}/share/doc/salome/gui/KERNEL''')" + VERBATIM + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +) +ADD_DEPENDENCIES(usr_docs html_docs) diff --git a/doc/salome/gui/Makefile.am b/doc/salome/gui/Makefile.am index f5f8a47db..13cc6565e 100644 --- a/doc/salome/gui/Makefile.am +++ b/doc/salome/gui/Makefile.am @@ -22,7 +22,7 @@ include $(top_srcdir)/salome_adm/unix/make_common_starter.am -EXTRA_DIST = images static/footer.html static/doxygen.css +EXTRA_DIST += images static/footer.html static/doxygen.css guidocdir = $(docdir)/gui/KERNEL guidoc_DATA = images/head.png diff --git a/doc/salome/gui/images/icon_about.png b/doc/salome/gui/images/icon_about.png index fd6640bda..dfdc7e618 100755 Binary files a/doc/salome/gui/images/icon_about.png and b/doc/salome/gui/images/icon_about.png differ diff --git a/doc/salome/kernel_salome.dox b/doc/salome/kernel_salome.dox index 20acf889c..75deb2960 100644 --- a/doc/salome/kernel_salome.dox +++ b/doc/salome/kernel_salome.dox @@ -3,6 +3,18 @@ \page kernel_salome Using salome.py module +The Python module salome.py provides a functionality to access main +SALOME features from the Python console (either embedded in GUI +desktop or external one). + +To use salome.py module, import it into the Python interpreter and +initialize it by calling \c salome_init() function: + +\code +import salome +salome.salome_init() +\endcode + The salome.py Python module provides a set of variables and functions allowing access to different elements of the current SALOME session. @@ -100,6 +112,7 @@ study = salome.myStudyManager.GetStudyByName("/home/user/MyStudy.hdf") # ... \endcode +\anchor salome_myStudy \li \b myStudy Reference to the current (active) study This variable can be used to manipulate with the date of the study: @@ -284,13 +297,37 @@ name_1 = salome.generateName() # name_1 is something like "Study682" name_1 = salome.generateName("Obj") # name_1 is something like "Obj32" \endcode -\li \b sg SWIG interface to the SALOME GUI +\li \b GetComponentVersion() Get version of component data stored in +the study -This variable provides an access to some GUI functions. +This function allows to obtain the version of the component data +stored in the current study. +\note This function does not provide a current version of the +component being used but that one initially stored in the study +document. + +The first parameter specifies the name of the component. If the +specified component data is not stored in the study, the result value +is "no component data". If the version of data is undefined, the +result is "unknown". + +The second parameter (\c False by default), when set to \c True, +allows to retrieve all versions of the component data stored in the +study. This is useful to check if version information is valid (the +data might be updated and/or re-stored in %SALOME of versions different +from initial one). + +\code +# get initial version of GEOM module data stored in the study +geom_version = salome.GetComponentVersion('GEOM') +# get all versions of GEOM module data stored in the study +all_geom_versions = salome.GetComponentVersion('GEOM', True) +\endcode -\b Note, that this variable is only available if you use salome.py -Python module within the GUI desktop (since SWIG library is linked directly to the GUI library). -See GUI documentation for more information. +This function is introduced in %SALOME 6.6.0 (it does not work with +studies created before version 6.6.0). +\note The study should be initialized before calling this function +(see \ref salome_myStudy "salome.myStudy"). */ diff --git a/doc/salome/main.dox b/doc/salome/main.dox index 20bbff443..eea5b33e9 100644 --- a/doc/salome/main.dox +++ b/doc/salome/main.dox @@ -15,8 +15,9 @@ introductory documentation, listed below. application on several computers. See \subpage SALOME_Application to define your own configuration of %SALOME and run it on one or several computers. This is the recommended way of configuration. --# How to launch %SALOME in a %SALOME application\n - See \ref SALOME_Application. +-# How to launch %SALOME: + - In a %SALOME application, see \ref SALOME_Application. + - Using \c runSalome script, see \subpage running_salome_page -# How to use KERNEL services in Python scripts\n The %SALOME KERNEL offers a list of services available in Python. See \subpage KERNEL_Services. -# How to use KERNEL services from a C++ context\n diff --git a/doc/salome/running_salome.dox b/doc/salome/running_salome.dox new file mode 100644 index 000000000..d6713a336 --- /dev/null +++ b/doc/salome/running_salome.dox @@ -0,0 +1,115 @@ +/*! + +\page running_salome_page Running Salome + +There are two ways to run %SALOME: + +1) Using Salome Application Concept approach. + +For more details see \ref SALOME_Application. + +2) Using \c %runSalome script supplied with %SALOME KERNEL module distribution. + +To launch %SALOME using \c %runSalome script, you have first to +set-up proper environment for %SALOME. If you installed %SALOME using +%SALOME Installation Wizard (Linux), you can use \c salome.sh or +\c salome.csh script (that is located in the \c KERNEL_<version> +directory of your %SALOME installation), for example: + +\code +cd /home/user/salome_6.5.0/KERNEL_6.5.0 +source salome.csh +\endcode + +Launch %SALOME session using the \c %runSalome script located +in the \c SALOME/KERNEL/bin/salome directory: + +\code +runSalome [options] [STUDY_FILE] [PYTHON_FILE [PYTHON_FILE ...]] +\endcode + +Optionally, you can specify in the command line: +- Study (document) file to be opened in %SALOME session passing; +- One or more Python scripts to be executed after %SALOME + start-up. Python scripts will be executed in the new or opened study + in the order they appear in the command line. + +The \c %runSalome script supports large set of options that allow +specifying the way to launch %SALOME session. Complete description of +all options can be obtained using \c --help or -h option: + +\code +runSalome --help +\endcode + +Here below is a description of most important options: + +- \c --help or \c -h + +Print detail help information on the \c %runSalome script. + +- \c --version + +Print version of %SALOME platform. + +- \c --gui or \c -g + +Launch %SALOME sesssion in GUI mode (with GUI desktop). + +- \c --terminal or \c -t + +Launch %SALOME session in terminal mode (without GUI). + +- \c --resources=<file> or \c -r \c <file> + +Parse application settings from the <file> instead of default resource +file. Default resource file is situated in user's home directory; for +example, for %SALOME version 6.5.0, the file is ${HOME}/.config/salome/.SalomeApprc.6.5.0 + +- \c --modules=module1,module2,... or \c -m=module1,module2,... + +Specify the list of modules which will be used in the %SALOME session +being launched. Note, that list of modules is separated be comma +symbols, with no any spaces. + +- \c --xterm or \c -x + +The servers open in separate terminal window and log messages are displayed in this window. + +- --embedded=registry,study,moduleCatalog,cppContainer/ or + -e=registry,study,moduleCatalog,cppContainer + +Run listed %SALOME servers in the GUI embedded mode (default value is +registry,study,moduleCatalog,cppContainer). Note that logger, +pyContainer, and supervContainer servers cannot be embedded to +GUI. Note, that this option implies running %SALOME in GUI mode (\c -g +option); in terminal mode all servers are running in standalone mode. + +- --standalone=registry,study,moduleCatalog,cppContainer,pyContainer,supervContainer or + -s=registry,study,moduleCatalog,cppContainer,pyContainer,supervContainer + +Standalone CORBA servers (default: pyContainer,supervContainer). + +- \c --portkill or \c -p + +Kill %SALOME session launched with the current port. + +- \c --killall or \c -k + +Kill (stop) all running %SALOME sessions before launching new session. + +- \c --splash=<1/0> or \c -z <1/0> + +Use 1 to display splash screen [default] at start-up, 0 to disable +splash screen. This option is ignored in the terminal mode. + +- \c --pinter + +Launch with interactive Python console. + +- --interp=n or -i=n + +Number of additional Python interpreters to open, with session +environment propely set-up. + +*/ diff --git a/doc/salome/tui/CMakeLists.txt b/doc/salome/tui/CMakeLists.txt new file mode 100755 index 000000000..51ce739b3 --- /dev/null +++ b/doc/salome/tui/CMakeLists.txt @@ -0,0 +1,36 @@ +# Copyright (C) 2012 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 +# + +SET(top_builddir ${CMAKE_BINARY_DIR}) +SET(top_srcdir ${CMAKE_SOURCE_DIR}) +SET(srcdir ${CMAKE_CURRENT_SOURCE_DIR}) +SET(builddir ${CMAKE_CURRENT_BINARY_DIR}) +SET(datadir ${CMAKE_INSTALL_PREFIX}/share) +SET(docdir ${datadir}/doc/salome) + +CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/doxyfile) +CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/static/header.html.in ${CMAKE_CURRENT_BINARY_DIR}/static/header.html) + +ADD_CUSTOM_TARGET(dev_docs ${DOXYGEN_EXECUTABLE} -u + COMMAND ${DOXYGEN_EXECUTABLE} + COMMAND ${PYTHON_EXECUTABLE} -c "import os; os.remove(r'''${CMAKE_CURRENT_BINARY_DIR}/doxyfile.bak''')" + COMMAND ${PYTHON_EXECUTABLE} -c "import shutil, sys; shutil.rmtree(r'''${CMAKE_INSTALL_PREFIX}/share/doc/salome/tui/KERNEL''', True); shutil.copytree(r'''${CMAKE_CURRENT_BINARY_DIR}/KERNEL''', r'''${CMAKE_INSTALL_PREFIX}/share/doc/salome/tui/KERNEL'''); shutil.copy(r'''${CMAKE_CURRENT_SOURCE_DIR}/images/head.png''', r'''${CMAKE_INSTALL_PREFIX}/share/doc/salome/tui/KERNEL''')" + VERBATIM + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +) diff --git a/doc/salome/tui/Makefile.am b/doc/salome/tui/Makefile.am index eb465301e..d6ea2af93 100644 --- a/doc/salome/tui/Makefile.am +++ b/doc/salome/tui/Makefile.am @@ -27,7 +27,7 @@ # include $(top_srcdir)/salome_adm/unix/make_common_starter.am -EXTRA_DIST = images input static/footer.html static/doxygen.css +EXTRA_DIST += images input static/footer.html static/doxygen.css tuidocdir = $(docdir)/tui/KERNEL tuidoc_DATA = images/head.png diff --git a/doc/salome/tui/doxyfile.in b/doc/salome/tui/doxyfile.in index ae335beb4..973656204 100644 --- a/doc/salome/tui/doxyfile.in +++ b/doc/salome/tui/doxyfile.in @@ -1,32 +1,53 @@ -# Doxyfile 1.4.6 +# Copyright (C) 2007-2012 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 +# #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- PROJECT_NAME = "SALOME KERNEL Developer" -PROJECT_NUMBER = +PROJECT_NUMBER = OUTPUT_DIRECTORY = KERNEL CREATE_SUBDIRS = NO OUTPUT_LANGUAGE = English USE_WINDOWS_ENCODING = NO BRIEF_MEMBER_DESC = YES -REPEAT_BRIEF = NO -ABBREVIATE_BRIEF = +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = ALWAYS_DETAILED_SEC = YES INLINE_INHERITED_MEMB = YES FULL_PATH_NAMES = YES -STRIP_FROM_PATH = @top_builddir@ @top_srcdir@ -STRIP_FROM_INC_PATH = +STRIP_FROM_PATH = @top_srcdir@ @top_builddir@ +STRIP_FROM_INC_PATH = SHORT_NAMES = NO JAVADOC_AUTOBRIEF = YES +QT_AUTOBRIEF = YES MULTILINE_CPP_IS_BRIEF = NO DETAILS_AT_TOP = NO INHERIT_DOCS = YES SEPARATE_MEMBER_PAGES = NO TAB_SIZE = 5 -ALIASES = +ALIASES = OPTIMIZE_OUTPUT_FOR_C = YES -OPTIMIZE_OUTPUT_JAVA = NO +OPTIMIZE_OUTPUT_JAVA = YES BUILTIN_STL_SUPPORT = @DOXYGEN_SUPPORT_STL@ DISTRIBUTE_GROUP_DOC = NO SUBGROUPING = YES @@ -48,18 +69,18 @@ CASE_SENSE_NAMES = YES HIDE_SCOPE_NAMES = NO SHOW_INCLUDE_FILES = YES INLINE_INFO = YES -SORT_MEMBER_DOCS = NO +SORT_MEMBER_DOCS = YES SORT_BRIEF_DOCS = NO SORT_BY_SCOPE_NAME = YES -GENERATE_TODOLIST = NO -GENERATE_TESTLIST = NO -GENERATE_BUGLIST = NO -GENERATE_DEPRECATEDLIST= NO -ENABLED_SECTIONS = +GENERATE_TODOLIST = YES +GENERATE_TESTLIST = YES +GENERATE_BUGLIST = YES +GENERATE_DEPRECATEDLIST= YES +ENABLED_SECTIONS = MAX_INITIALIZER_LINES = 25 SHOW_USED_FILES = NO SHOW_DIRECTORIES = NO -FILE_VERSION_FILTER = +FILE_VERSION_FILTER = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages @@ -75,39 +96,41 @@ WARN_LOGFILE = log.txt #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- -INPUT = \ - @top_srcdir@/src/DSC \ - @srcdir@/input -FILE_PATTERNS = *.dox *.idl *.cxx *.hxx *.h *.hh *.i *c *.cc @DOXYGEN_PYTHON_EXTENSION@ +INPUT = @top_srcdir@/src \ + @top_srcdir@/bin \ + @top_srcdir@/idl \ + @top_builddir@/bin \ + @srcdir@/input +FILE_PATTERNS = *.idl *.hxx *.cxx *.h *.c *.hh *.cc @DOXYGEN_PYTHON_EXTENSION@ *.doc RECURSIVE = YES -EXCLUDE = +EXCLUDE = EXCLUDE_SYMLINKS = NO -EXCLUDE_PATTERNS = -EXAMPLE_PATH = -EXAMPLE_PATTERNS = +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = EXAMPLE_RECURSIVE = NO -IMAGE_PATH = -INPUT_FILTER = -FILTER_PATTERNS = -FILTER_SOURCE_FILES = NO +IMAGE_PATH = @srcdir@/images +INPUT_FILTER = +FILTER_PATTERNS = +FILTER_SOURCE_FILES = YES #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- -SOURCE_BROWSER = NO -INLINE_SOURCES = NO +SOURCE_BROWSER = YES +INLINE_SOURCES = YES STRIP_CODE_COMMENTS = YES -REFERENCED_BY_RELATION = NO +REFERENCED_BY_RELATION = YES REFERENCES_RELATION = YES -USE_HTAGS = NO +#USE_HTAGS = NO VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- ALPHABETICAL_INDEX = YES -COLS_IN_ALPHA_INDEX = 3 -IGNORE_PREFIX = +COLS_IN_ALPHA_INDEX = 2 +IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output @@ -120,8 +143,8 @@ HTML_FOOTER = @srcdir@/static/footer.html HTML_STYLESHEET = @srcdir@/static/doxygen.css HTML_ALIGN_MEMBERS = YES GENERATE_HTMLHELP = NO -CHM_FILE = -HHC_LOCATION = +CHM_FILE = +HHC_LOCATION = GENERATE_CHI = NO BINARY_TOC = YES TOC_EXPAND = YES @@ -139,8 +162,8 @@ LATEX_CMD_NAME = latex MAKEINDEX_CMD_NAME = makeindex COMPACT_LATEX = NO PAPER_TYPE = a4wide -EXTRA_PACKAGES = -LATEX_HEADER = +EXTRA_PACKAGES = +LATEX_HEADER = PDF_HYPERLINKS = NO USE_PDFLATEX = NO LATEX_BATCHMODE = NO @@ -153,8 +176,8 @@ GENERATE_RTF = NO RTF_OUTPUT = rtf COMPACT_RTF = NO RTF_HYPERLINKS = NO -RTF_STYLESHEET_FILE = -RTF_EXTENSIONS_FILE = +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output @@ -169,8 +192,8 @@ MAN_LINKS = NO #--------------------------------------------------------------------------- GENERATE_XML = NO XML_OUTPUT = xml -XML_SCHEMA = -XML_DTD = +XML_SCHEMA = +XML_DTD = XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- @@ -184,59 +207,59 @@ GENERATE_AUTOGEN_DEF = NO GENERATE_PERLMOD = NO PERLMOD_LATEX = NO PERLMOD_PRETTY = YES -PERLMOD_MAKEVAR_PREFIX = +PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- -# Configuration options related to the preprocessor +# Configuration options related to the preprocessor #--------------------------------------------------------------------------- ENABLE_PREPROCESSING = YES MACRO_EXPANSION = YES EXPAND_ONLY_PREDEF = NO SEARCH_INCLUDES = YES -INCLUDE_PATH = -INCLUDE_FILE_PATTERNS = -PREDEFINED = -EXPAND_AS_DEFINED = +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = +EXPAND_AS_DEFINED = SKIP_FUNCTION_MACROS = NO #--------------------------------------------------------------------------- -# Configuration::additions related to external references +# Configuration::additions related to external references #--------------------------------------------------------------------------- -TAGFILES = -GENERATE_TAGFILE = +TAGFILES = +GENERATE_TAGFILE = ALLEXTERNALS = NO EXTERNAL_GROUPS = YES PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- -# Configuration options related to the dot tool +# Configuration options related to the dot tool #--------------------------------------------------------------------------- CLASS_DIAGRAMS = YES HIDE_UNDOC_RELATIONS = NO HAVE_DOT = YES CLASS_GRAPH = YES -COLLABORATION_GRAPH = YES -GROUP_GRAPHS = NO -UML_LOOK = YES +COLLABORATION_GRAPH = NO +GROUP_GRAPHS = YES +UML_LOOK = NO TEMPLATE_RELATIONS = YES INCLUDE_GRAPH = YES -INCLUDED_BY_GRAPH = NO +INCLUDED_BY_GRAPH = YES CALL_GRAPH = NO GRAPHICAL_HIERARCHY = YES DIRECTORY_GRAPH = YES DOT_IMAGE_FORMAT = png DOT_FONTNAME = Arial -DOT_PATH = -DOTFILE_DIRS = +DOT_PATH = +DOTFILE_DIRS = MAX_DOT_GRAPH_WIDTH = 1024 -MAX_DOT_GRAPH_HEIGHT = 1200 +MAX_DOT_GRAPH_HEIGHT = 1000 MAX_DOT_GRAPH_DEPTH = 0 DOT_TRANSPARENT = NO DOT_MULTI_TARGETS = NO -GENERATE_LEGEND = NO +GENERATE_LEGEND = YES DOT_CLEANUP = YES #--------------------------------------------------------------------------- -# Configuration::additions related to the search engine +# Configuration::additions related to the search engine #--------------------------------------------------------------------------- SEARCHENGINE = NO diff --git a/idl/CMakeLists.txt b/idl/CMakeLists.txt new file mode 100755 index 000000000..8dc0b75a9 --- /dev/null +++ b/idl/CMakeLists.txt @@ -0,0 +1,95 @@ +# Copyright (C) 2012 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(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/UseOMNIORB.cmake) + +INCLUDE_DIRECTORIES( + ${OMNIORB_INCLUDE_DIRS} + ${CMAKE_CURRENT_BINARY_DIR} +) + +CONFIGURE_FILE(Calcium_Ports.idl.in Calcium_Ports.idl @ONLY) + +SET(SalomeIDLKernel_IDLSOURCES + SALOME_Exception.idl + SALOME_Comm.idl + SALOME_ModuleCatalog.idl + SALOME_RessourcesCatalog.idl + SALOMEDS.idl + SALOMEDS_Attributes.idl + SALOME_Component.idl + SALOME_ContainerManager.idl + SALOME_Registry.idl + Logger.idl + SALOME_GenericObj.idl + SALOME_Types.idl + SALOME_Session.idl + nstest.idl + DSC_Engines.idl + SALOME_Ports.idl + SALOME_PyNode.idl + Palm_Ports.idl + SALOME_PACOExtension.idl + SALOME_ParamPorts.idl + SALOME_Parametric.idl + SALOME_MPIObject.idl + SALOME_TestComponent.idl + SALOME_TestModuleCatalog.idl + ${CMAKE_CURRENT_BINARY_DIR}/Calcium_Ports.idl +) + +IF(MPI_IS_OK) + SET(SalomeIDLKernel_IDLSOURCES ${SalomeIDLKernel_IDLSOURCES} SALOME_MPIContainer.idl SALOME_TestMPIComponent.idl) +ENDIF(MPI_IS_OK) + +SET(IDL_INCLUDE_DIRS + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} +) + +SET(COMMON_FLAGS "${OMNIORB_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +SET(TYPE) +IF(WINDOWS) + SET(COMMON_FLAGS "${COMMON_FLAGS} -DNOGDI") + SET(TYPE STATIC) +ELSE(WINDOWS) + SET(TYPE SHARED) +ENDIF(WINDOWS) + +OMNIORB_ADD_MODULE(SalomeIDLKernel "${SalomeIDLKernel_IDLSOURCES}" "${IDL_INCLUDE_DIRS}" ${TYPE}) +TARGET_LINK_LIBRARIES(SalomeIDLKernel ${CORBA_LIBS}) +SET_TARGET_PROPERTIES(SalomeIDLKernel PROPERTIES COMPILE_FLAGS "${COMMON_FLAGS}") + +INSTALL(TARGETS SalomeIDLKernel DESTINATION ${KERNEL_salomelib_LIBS}) + +IF(WITH_PACO_PARALLEL) + SET(SalomeParallelIDLKernel_IDLSOURCES + SALOME_ComponentPaCO.idl + SALOME_PortsPaCO.idl + DSC_EnginesPaCO.idl + SALOME_ParamPortsPaCO.idl + SALOME_PACOExtensionPaCO.idl + SALOME_GenericObjPaCO.idl + ) + OMNIORB_ADD_MODULE(SalomeParallelIDLKernel "${SalomeIDLKernel_IDLSOURCES}" "${IDL_INCLUDE_DIRS}") + TARGET_LINK_LIBRARIES(SalomeParallelIDLKernel ${CORBA_LIBS}) + SET_TARGET_PROPERTIES(SalomeParallelIDLKernel PROPERTIES COMPILE_FLAGS "${OMNIORB_DEFINITIONS}") + + INSTALL(TARGETS SalomeParallelIDLKernel DESTINATION ${KERNEL_salomelib_LIBS}) +ENDIF(WITH_PACO_PARALLEL) diff --git a/idl/Makefile.am b/idl/Makefile.am index 1347ad5e0..cf953c8e7 100644 --- a/idl/Makefile.am +++ b/idl/Makefile.am @@ -69,7 +69,7 @@ OTHER_IDL_FILES = \ TypeData.idl # all the idl files are needed for make dist -EXTRA_DIST= $(BASEIDL_FILES) $(MPIIDL_FILES) $(OTHER_IDL_FILES) \ +EXTRA_DIST += $(BASEIDL_FILES) $(MPIIDL_FILES) $(OTHER_IDL_FILES) \ SALOME_Component.xml DSC_Engines.xml SALOME_Ports.xml \ SALOME_PACOExtension.xml SALOME_ParamPorts.xml \ SALOME_GenericObj.xml SALOME_Exception.xml diff --git a/idl/SALOMEDS_Attributes.idl b/idl/SALOMEDS_Attributes.idl index fbc70d655..9941794cb 100644 --- a/idl/SALOMEDS_Attributes.idl +++ b/idl/SALOMEDS_Attributes.idl @@ -1650,6 +1650,27 @@ module SALOMEDS \return units */ string GetUnits(); + + /*! + \brief Returns list of components which data was stored + (after previous sessions) in the study. + \return list of component names + */ + StringSeq GetStoredComponents(); + + /*! + \brief Returns version of component data stored in the study + \param comp component name + \return version of stored component data + */ + string GetComponentVersion( in string comp ); + + /*! + \brief Returns all versions of component data stored in the study + \param comp component name + \return versions of stored component data + */ + StringSeq GetComponentVersions( in string comp ); }; //========================================================================== diff --git a/idl/SALOME_Component.idl b/idl/SALOME_Component.idl index 9d55e154b..4a1701ddf 100644 --- a/idl/SALOME_Component.idl +++ b/idl/SALOME_Component.idl @@ -453,6 +453,17 @@ module Engines \return an information about the given object. */ string getObjectInfo(in long studyId, in string entry); + + //! Get version of the component + /*! + This method is supposed to be implemented in all derived classes; default implementation + returns "unknown" string that means that no version information about the component is available. + \note The version of the component is stored to the study, as a part of general persistence + mechanism; once stored, version information in the study cannot be changed. + + \return string containing component's version, e.g. "1.0" + */ + string getVersion(); } ; /*! diff --git a/resources/CMakeLists.txt b/resources/CMakeLists.txt new file mode 100755 index 000000000..d14075949 --- /dev/null +++ b/resources/CMakeLists.txt @@ -0,0 +1,40 @@ +# Copyright (C) 2012 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 +# + +# =============================================================== +# Files to be installed +# =============================================================== + +# These files are data, module or lib files +INSTALL(FILES CatalogModulePersonnel.xml_skel DESTINATION ${KERNEL_salomeres_DATA}) + +CONFIGURE_FILE(CatalogResources.xml.in CatalogResources.xml @ONLY) +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/CatalogResources.xml DESTINATION ${KERNEL_salomeres_DATA}) + +IF(NOT WITHONLYLAUNCHER) + INSTALL(FILES channel.cfg SALOMEDS_Resources DESTINATION ${KERNEL_salomeres_DATA}) + + CONFIGURE_FILE(KERNELCatalog.xml.in KERNELCatalog.xml @ONLY) + INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/KERNELCatalog.xml DESTINATION ${KERNEL_salomeres_DATA}) + +ENDIF(NOT WITHONLYLAUNCHER) + + + + diff --git a/resources/Makefile.am b/resources/Makefile.am index 1e746e530..1881203ef 100644 --- a/resources/Makefile.am +++ b/resources/Makefile.am @@ -52,4 +52,4 @@ else KERNELCatalog.xml endif -EXTRA_DIST = CatalogDataType.xml +EXTRA_DIST += CatalogDataType.xml diff --git a/salome_adm/CMakeLists.txt b/salome_adm/CMakeLists.txt new file mode 100755 index 000000000..6085559b6 --- /dev/null +++ b/salome_adm/CMakeLists.txt @@ -0,0 +1,24 @@ +# Copyright (C) 2012 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(unix) +ADD_SUBDIRECTORY(cmake_files) + +SALOME_CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/SALOMEconfig.ref.in" "${CMAKE_CURRENT_BINARY_DIR}/SALOMEconfig.h" INSTALL ${KERNEL_salomeinclude_HEADERS}) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/SALOMEconfig.ref.in DESTINATION salome_adm/unix RENAME SALOMEconfig.h.in) \ No newline at end of file diff --git a/salome_adm/Makefile.am b/salome_adm/Makefile.am index 01b7790d5..c58a20c5a 100644 --- a/salome_adm/Makefile.am +++ b/salome_adm/Makefile.am @@ -19,6 +19,29 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # +include $(top_srcdir)/salome_adm/unix/make_common_starter.am SUBDIRS = unix cmake_files AUTOMAKE_OPTIONS=filename-length-max=255 + +# rules for install and build (see make_common_starter.am) +salomeadmux_DATA = SALOMEconfig.h.in +salomeinclude_DATA = SALOMEconfig.h +BUILT_SOURCES=SALOMEconfig.ref SALOMEconfig.h SALOMEconfig.h.in + +mostlyclean-local: + -rm -rf SALOMEconfig.h SALOMEconfig.h.in + +SALOMEconfig.h.in : SALOMEconfig.ref.in + cp -pf $< $@; + +# test if SALOMEconfig.ref has changed (contents), at build time +SALOMEconfig.h: $(top_builddir)/salome_adm/SALOMEconfig.ref + @if ! [ -a $@ ]; then \ + echo cp -pf $< $@; \ + cp -pf $< $@; \ + fi; \ + if ! cmp -s $< $@; then \ + echo cp -pf $< $@; \ + cp -pf $< $@; \ + fi; diff --git a/salome_adm/SALOMEconfig.ref.in b/salome_adm/SALOMEconfig.ref.in new file mode 100755 index 000000000..8db6100ef --- /dev/null +++ b/salome_adm/SALOMEconfig.ref.in @@ -0,0 +1,65 @@ +// Copyright (C) 2007-2012 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 +// + +/* Debug mode ??? */ +#ifndef DEBUG +# define DEBUG +#endif + +/* CORBA headers include rules */ +#ifndef CORBA_CLIENT_HEADER +# define QUOTE(x) #x +# define CORBA_CLIENT_HEADER(x) QUOTE(x@IDL_CLN_H@) +# define CORBA_SERVER_HEADER(x) QUOTE(x@IDL_SRV_H@) +#endif + +/* Platform definition */ +#ifndef @MACHINE@ + #define @MACHINE@ +#endif + +// This is only to suppress warning messages with defines redefined (cause of omniORB that exports these names) +#ifdef PACKAGE +#undef PACKAGE +#endif +#ifdef PACKAGE_BUGREPORT +#undef PACKAGE_BUGREPORT +#endif +#ifdef PACKAGE_NAME +#undef PACKAGE_NAME +#endif +#ifdef PACKAGE_STRING +#undef PACKAGE_STRING +#endif +#ifdef PACKAGE_TARNAME +#undef PACKAGE_TARNAME +#endif +#ifdef PACKAGE_VERSION +#undef PACKAGE_VERSION +#endif +#ifdef VERSION +#undef VERSION +#endif + +#ifdef _POSIX_C_SOURCE +#undef _POSIX_C_SOURCE +#endif diff --git a/salome_adm/cmake_files/CMakeLists.txt b/salome_adm/cmake_files/CMakeLists.txt new file mode 100755 index 000000000..d78a6f18d --- /dev/null +++ b/salome_adm/cmake_files/CMakeLists.txt @@ -0,0 +1,50 @@ +# Copyright (C) 2012 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 +# + +# =============================================================== +# Files to be installed +# =============================================================== + +# These files are data, module or lib files +SET(DATA + am2cmake.py + FindBOOST.cmake + FindCPPUNIT.cmake + FindDOXYGEN.cmake + FindHDF5.cmake + FindKERNEL.cmake + FindLIBBATCH.cmake + FindLIBXML2.cmake + FindMPI.cmake + FindOMNIORB.cmake + UseOMNIORB.cmake + FindPLATFORM.cmake + FindPTHREADS.cmake + FindPYTHON.cmake + FindSWIG.cmake + FindSPHINX.cmake + install_python_from_idl.cmake + install_and_compile_python_file.cmake + InstallAndCompilePythonFile.cmake + SalomeMacros.cmake +) +INSTALL(FILES ${DATA} DESTINATION ${KERNEL_salomeadmcmake}) + +# These files are executable scripts +SALOME_INSTALL_SCRIPTS(prepare_generating_doc.py ${KERNEL_salomescript_SCRIPTS}) diff --git a/salome_adm/cmake_files/FindCPPUNIT.cmake b/salome_adm/cmake_files/FindCPPUNIT.cmake index 4193644cd..91594a7f8 100644 --- a/salome_adm/cmake_files/FindCPPUNIT.cmake +++ b/salome_adm/cmake_files/FindCPPUNIT.cmake @@ -52,9 +52,13 @@ ENDIF(WITHOUT_CPPUNIT OR WITH_CPPUNIT STREQUAL 0) IF(CPPUNIT_STATUS) IF(WITH_CPPUNIT) SET(CPPUNIT_ROOT_USER ${WITH_CPPUNIT}) - ELSE(WITH_CPPUNIT) - SET(CPPUNIT_ROOT_USER $ENV{CPPUNIT_ROOT}) ENDIF(WITH_CPPUNIT) + IF(NOT CPPUNIT_ROOT_USER) + SET(CPPUNIT_ROOT_USER $ENV{CPPUNIT_ROOT}) + ENDIF(NOT CPPUNIT_ROOT_USER) + IF(NOT CPPUNIT_ROOT_USER) + SET(CPPUNIT_ROOT_USER $ENV{CPPUNITHOME}) + ENDIF(NOT CPPUNIT_ROOT_USER) ENDIF(CPPUNIT_STATUS) # ----- @@ -92,7 +96,7 @@ IF(CPPUNIT_STATUS) IF(CPPUNIT_ROOT_USER) MESSAGE(STATUS "${CPPUNIT_INCLUDE_TO_FIND} not found in ${CPPUNIT_INCLUDE_PATHS}, check your CPPUNIT installation.") ELSE(CPPUNIT_ROOT_USER) - MESSAGE(STATUS "${CPPUNIT_INCLUDE_TO_FIND} not found on system, try to use WITH_CPPUNIT option or CPPUNIT_ROOT environment variable.") + MESSAGE(STATUS "${CPPUNIT_INCLUDE_TO_FIND} not found on system, try to use WITH_CPPUNIT option or CPPUNIT_ROOT (or CPPUNITHOME) environment variable.") ENDIF(CPPUNIT_ROOT_USER) ENDIF(CPPUNIT_INCLUDE_DIR) ENDIF(CPPUNIT_STATUS) diff --git a/salome_adm/cmake_files/FindLIBBATCH.cmake b/salome_adm/cmake_files/FindLIBBATCH.cmake index 6ebfb6891..aee305de4 100644 --- a/salome_adm/cmake_files/FindLIBBATCH.cmake +++ b/salome_adm/cmake_files/FindLIBBATCH.cmake @@ -79,7 +79,8 @@ IF(LIBBATCH_STATUS) FIND_PATH(LIBBATCH_INCLUDE_DIR ${LIBBATCH_INCLUDE_TO_FIND} PATHS ${LIBBATCH_INCLUDE_PATHS} ${LIBBATCH_FIND_PATHS_OPTION}) IF(LIBBATCH_INCLUDE_DIR) IF(LIBBATCH_ROOT_USER) - SET(LIBBATCH_INCLUDES -I${LIBBATCH_INCLUDE_DIR}) + SET(LIBBATCH_INCLUDES -I${LIBBATCH_INCLUDE_DIR}) # to be removed + SET(LIBBATCH_INCLUDE_DIRS ${LIBBATCH_INCLUDE_DIR}) ENDIF(LIBBATCH_ROOT_USER) MESSAGE(STATUS "${LIBBATCH_INCLUDE_TO_FIND} found in ${LIBBATCH_INCLUDE_DIR}") ELSE(LIBBATCH_INCLUDE_DIR) diff --git a/salome_adm/cmake_files/FindMPI.cmake b/salome_adm/cmake_files/FindMPI.cmake index 8818c5fac..a0b4af227 100644 --- a/salome_adm/cmake_files/FindMPI.cmake +++ b/salome_adm/cmake_files/FindMPI.cmake @@ -81,12 +81,14 @@ IF(MPI_STATUS) ENDIF(NOT MPI_INCLUDES) GET_FILENAME_COMPONENT(MPI_ROOT ${MPI_INCLUDES} PATH) ENDIF(MPI_ROOT_USER) - - MESSAGE(STATUS "MPI include ${MPI_INCLUDE_TO_FIND} found in ${MPI_INCLUDES}") - SET(MPI_INCLUDE_DIR ${MPI_INCLUDES}) - SET(MPI_INCLUDE_DIRS ${MPI_INCLUDES}) - SET(MPI_INCLUDES -I${MPI_INCLUDES})# to remove + IF(MPI_INCLUDES) + MESSAGE(STATUS "MPI include ${MPI_INCLUDE_TO_FIND} found in ${MPI_INCLUDES}") + + SET(MPI_INCLUDE_DIR ${MPI_INCLUDES}) + SET(MPI_INCLUDE_DIRS ${MPI_INCLUDES}) + SET(MPI_INCLUDES -I${MPI_INCLUDES})# to remove + ENDIF(MPI_INCLUDES) # ------ diff --git a/salome_adm/cmake_files/FindPLATFORM.cmake b/salome_adm/cmake_files/FindPLATFORM.cmake index b6a36caca..fa06d0ec3 100644 --- a/salome_adm/cmake_files/FindPLATFORM.cmake +++ b/salome_adm/cmake_files/FindPLATFORM.cmake @@ -79,29 +79,55 @@ IF(CMAKE_BUILD_TYPE) ENDIF(WINDOWS) ENDIF(CMAKE_BUILD_TYPE) -SET(PLATFORM_CPPFLAGS) -SET(PLATFORM_LDFLAGS) -SET(PLATFORM_LIBADD) +SET(PLATFORM_CPPFLAGS) # to be removed +SET(PLATFORM_LDFLAGS) # to be removed +SET(PLATFORM_LIBADD) # to be removed + +SET(PLATFORM_LIBS) +SET(PLATFORM_DEFINITIONS) + IF(WINDOWS) - SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} /W0) - SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -D_CRT_SECURE_NO_WARNINGS) # To disable windows warnings for strcpy, fopen, ... - SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -D_SCL_SECURE_NO_WARNINGS) # To disable windows warnings std::copy, std::transform, ... - SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -DWNT) - SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -DPPRO_NT) # For medfile - SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -D_USE_MATH_DEFINES) # At least for MEDMEM - SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -D_WIN32_WINNT=0x0500) # Windows 2000 or later API is required - SET(PLATFORM_LIBADD ${PLATFORM_LIBADD} Ws2_32.lib) - SET(PLATFORM_LIBADD ${PLATFORM_LIBADD} Userenv.lib) # At least for GEOM suit + SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} /W0) # to be removed + SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -D_CRT_SECURE_NO_WARNINGS) # To disable windows warnings for strcpy, fopen, ... # to be removed + SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -D_SCL_SECURE_NO_WARNINGS) # To disable windows warnings std::copy, std::transform, ... # to be removed + SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -DWNT) # to be removed + SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -DPPRO_NT) # For medfile # to be removed + SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -D_USE_MATH_DEFINES) # At least for MEDMEM # to be removed + SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -D_WIN32_WINNT=0x0500) # Windows 2000 or later API is required # to be removed + SET(PLATFORM_LIBADD ${PLATFORM_LIBADD} Ws2_32.lib) # to be removed + SET(PLATFORM_LIBADD ${PLATFORM_LIBADD} Userenv.lib) # At least for GEOM suit # to be removed + + SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} /W0") + SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -D_CRT_SECURE_NO_WARNINGS") # To disable windows warnings for strcpy, fopen, ... + SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -D_SCL_SECURE_NO_WARNINGS") # To disable windows warnings std::copy, std::transform, ... + SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -DWNT") + SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -DPPRO_NT") # For medfile + SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -D_USE_MATH_DEFINES") # At least for MEDMEM + SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -D_WIN32_WINNT=0x0500") # Windows 2000 or later API is required + SET(PLATFORM_LIBS ${PLATFORM_LIBS} Ws2_32.lib) + SET(PLATFORM_LIBS ${PLATFORM_LIBS} Userenv.lib) # At least for GEOM suit + + IF("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") # if platform is Windows 64 bit + SET(PLATFORM_CPPFLAGS "${PLATFORM_CPPFLAGS} -D_SECURE_SCL=0 -D_SECURE_SCL_THROWS=0 -D_HAS_ITERATOR_DEBUGGING=0") # To avoid runtime error during checking iterators # to be removed + SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -D_SECURE_SCL=0 -D_SECURE_SCL_THROWS=0 -D_HAS_ITERATOR_DEBUGGING=0") # To avoid runtime error during checking iterators + ENDIF("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") ELSE(WINDOWS) # SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -Wparentheses) # SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -Wreturn-type) # SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -Wmissing-declarations) # SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -Wunused) # SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -Wall) - SET(PLATFORM_LIBADD ${PLATFORM_LIBADD} -ldl) + SET(PLATFORM_LIBADD ${PLATFORM_LIBADD} -ldl) # to be removed + SET(PLATFORM_LIBS ${PLATFORM_LIBS} -ldl) ENDIF(WINDOWS) -SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -DSIZEOF_FORTRAN_INTEGER=4 -DSIZEOF_LONG=${CMAKE_SIZEOF_VOID_P} -DSIZEOF_INT=4) +SET(SIZE_OF_LONG ${CMAKE_SIZEOF_VOID_P}) # set sizeof(long) the same as size of pointers, because on all memory models (EXCLUDING WINDOWS 64 bit) it is equivalent values +IF("${CMAKE_SIZEOF_VOID_P}" EQUAL "8" AND WINDOWS) # if it platform Windows 64 bit + SET(SIZE_OF_LONG "4") # set sizeof(long) to 4 byte +ENDIF("${CMAKE_SIZEOF_VOID_P}" EQUAL "8" AND WINDOWS) + +SET(PLATFORM_CPPFLAGS "${PLATFORM_CPPFLAGS} -DSIZEOF_FORTRAN_INTEGER=4 -DSIZEOF_LONG=${SIZE_OF_LONG} -DSIZEOF_INT=4") # to be removed +SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -DSIZEOF_FORTRAN_INTEGER=4 -DSIZEOF_LONG=${SIZE_OF_LONG} -DSIZEOF_INT=4") SET(COMPILATION_WITH_CMAKE ON) diff --git a/salome_adm/cmake_files/FindPTHREADS.cmake b/salome_adm/cmake_files/FindPTHREADS.cmake index f9ba97e55..ce8231e4a 100644 --- a/salome_adm/cmake_files/FindPTHREADS.cmake +++ b/salome_adm/cmake_files/FindPTHREADS.cmake @@ -79,7 +79,8 @@ IF(PTHREADS_STATUS) FIND_PATH(PTHREADS_INCLUDE_DIR ${PTHREADS_INCLUDE_TO_FIND} PATHS ${PTHREADS_INCLUDE_PATHS} ${PTHREADS_FIND_PATHS_OPTION}) IF(PTHREADS_INCLUDE_DIR) IF(PTHREADS_ROOT_USER) - SET(PTHREAD_CFLAGS -I${PTHREADS_INCLUDE_DIR}) + SET(PTHREAD_CFLAGS -I${PTHREADS_INCLUDE_DIR}) # to remove + SET(PTHREAD_INCLUDE_DIRS ${PTHREADS_INCLUDE_DIR}) ENDIF(PTHREADS_ROOT_USER) MESSAGE(STATUS "${PTHREADS_INCLUDE_TO_FIND} found in ${PTHREADS_INCLUDE_DIR}") ELSE(PTHREADS_INCLUDE_DIR) diff --git a/salome_adm/cmake_files/FindSPHINX.cmake b/salome_adm/cmake_files/FindSPHINX.cmake index 354b8194d..b8f972b17 100755 --- a/salome_adm/cmake_files/FindSPHINX.cmake +++ b/salome_adm/cmake_files/FindSPHINX.cmake @@ -75,7 +75,14 @@ IF(SPHINX_STATUS) FIND_PROGRAM(SPHINX_EXECUTABLE ${SPHINX_EXECUTABLE_TO_FIND}) ENDIF(SPHINX_ROOT_USER) IF(SPHINX_EXECUTABLE) - MESSAGE(STATUS "${SPHINX_EXECUTABLE_TO_FIND} found: ${SPHINX_EXECUTABLE}") + EXECUTE_PROCESS(COMMAND ${SPHINX_EXECUTABLE} -v ERROR_VARIABLE STATUS_CHECK_SPHINX) + STRING(REGEX MATCH "^Sphinx v[0-9]+\\.[0-9]+\\.[0-9]+" IS_SPHINX_USABLE ${STATUS_CHECK_SPHINX}) + IF(IS_SPHINX_USABLE) + MESSAGE(STATUS "${SPHINX_EXECUTABLE_TO_FIND} found: ${SPHINX_EXECUTABLE}") + ELSE(IS_SPHINX_USABLE) + MESSAGE(STATUS "${SPHINX_EXECUTABLE_TO_FIND} found but NOT usable ! Check coherency between your python and Sphinx ! Sphinx DISABLED !") + SET(SPHINX_STATUS 0) + ENDIF(IS_SPHINX_USABLE) ELSE(SPHINX_EXECUTABLE) MESSAGE(STATUS "${SPHINX_EXECUTABLE_TO_FIND} not found, try to use WITH_SPHINX option or SPHINX_ROOT (or SPHINXHOME) environment variable") SET(SPHINX_STATUS 0) diff --git a/salome_adm/cmake_files/Makefile.am b/salome_adm/cmake_files/Makefile.am index b21d38c4e..22ede73e6 100644 --- a/salome_adm/cmake_files/Makefile.am +++ b/salome_adm/cmake_files/Makefile.am @@ -39,6 +39,7 @@ FindPTHREADS.cmake \ FindPYTHON.cmake \ FindSWIG.cmake \ FindSPHINX.cmake \ +SalomeMacros.cmake \ install_python_from_idl.cmake \ install_and_compile_python_file.cmake \ InstallAndCompilePythonFile.cmake diff --git a/salome_adm/cmake_files/SalomeMacros.cmake b/salome_adm/cmake_files/SalomeMacros.cmake new file mode 100755 index 000000000..b96926dff --- /dev/null +++ b/salome_adm/cmake_files/SalomeMacros.cmake @@ -0,0 +1,163 @@ +# Copyright (C) 2012 CEA/DEN, EDF R&D +# +# 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 +# + +#---------------------------------------------------------------------------- +# 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(SALOME_INSTALL_SCRIPTS_WORKING_DIRECTORY) + SET(PREFIX "${SALOME_INSTALL_SCRIPTS_WORKING_DIRECTORY}/") + ENDIF(SALOME_INSTALL_SCRIPTS_WORKING_DIRECTORY) + 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}\")") + INSTALL(CODE "SET(CMD \"import py_compile ; py_compile.compile('${CMAKE_INSTALL_PREFIX}/${path}/${file}')\")") + 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 with full paths. +# out_file: IN : output file with full paths. +# If INSTALL is specified, then 'out_file' will be installed to the 'dir' directory. +#---------------------------------------------------------------------------- +MACRO(SALOME_CONFIGURE_FILE IN_FILE OUT_FILE) + 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) \ No newline at end of file diff --git a/salome_adm/cmake_files/UseOMNIORB.cmake b/salome_adm/cmake_files/UseOMNIORB.cmake index 9cfcbb35b..d6f8e6f9c 100644 --- a/salome_adm/cmake_files/UseOMNIORB.cmake +++ b/salome_adm/cmake_files/UseOMNIORB.cmake @@ -36,19 +36,25 @@ ENDMACRO(OMNIORB_COMPILE_IDL_FORPYTHON_ON_INSTALL)") # MYMODULE is a string that will be used to create a target with sources containing *.cc coming from the compilation of ${MYIDLFILES} # MYIDLFILES containing all idl files to be compiled. # MYIDLCXXFLAGS containing all directories (only directories) where to find *.idl which depend ${MYIDLFILES}. -MACRO(OMNIORB_ADD_MODULE MYMODULE MYIDLFILES MYIDLCXXFLAGS) +# TYPE contains type of the library +MACRO(OMNIORB_ADD_MODULE MYMODULE MYIDLFILES MYIDLCXXFLAGS TYPE) SET(MYSOURCES) FOREACH(input ${MYIDLFILES}) - STRING(REGEX REPLACE ".idl" "" base ${input}) + GET_FILENAME_COMPONENT(base ${input} NAME_WE) +# STRING(REGEX REPLACE ".idl" "" base ${input}) SET(OMNIORB_IDLCXXFLAGS2 "${OMNIORB_IDLCXXFLAGS}") SET(src ${CMAKE_CURRENT_BINARY_DIR}/${base}SK.cc) SET(MYSOURCES ${MYSOURCES} ${src}) SET(outputs ${src}) SET(dynsrc ${CMAKE_CURRENT_BINARY_DIR}/${base}DynSK.cc) + SET(MYSOURCES ${MYSOURCES} ${dynsrc}) SET(outputs ${outputs} ${dynsrc}) SET(inc ${CMAKE_CURRENT_BINARY_DIR}/${base}.hh) SET(outputs ${outputs} ${inc}) - SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${input}) + GET_FILENAME_COMPONENT(path ${input} PATH) + IF(NOT path) + SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${input}) + ENDIF(NOT path) SET(flags ${OMNIORB_IDLCXXFLAGS2}) STRING(REGEX MATCH "-bcxx" ISBCXX ${flags}) IF(NOT ISBCXX) @@ -76,5 +82,6 @@ MACRO(OMNIORB_ADD_MODULE MYMODULE MYIDLFILES MYIDLCXXFLAGS) STRING(REPLACE "\\" "/" IDLPYFLAGS ${IDLPYFLAGS}) INSTALL(CODE "OMNIORB_COMPILE_IDL_FORPYTHON_ON_INSTALL( \"${OMNIORB_IDL_PYTHON}\" \"${IDLPYFLAGS}\" \"${input}\" \"${CMAKE_INSTALL_PREFIX}/\${INSTALL_PYIDL_DIR}\" )") ENDFOREACH(input ${MYIDLFILES}) - ADD_LIBRARY(${MYMODULE} SHARED ${MYSOURCES}) + ADD_LIBRARY(${MYMODULE} ${TYPE} ${MYSOURCES}) + ENDMACRO(OMNIORB_ADD_MODULE) diff --git a/salome_adm/cmake_files/am2cmake.py b/salome_adm/cmake_files/am2cmake.py index 20f0e9c7b..afb446bb0 100644 --- a/salome_adm/cmake_files/am2cmake.py +++ b/salome_adm/cmake_files/am2cmake.py @@ -370,6 +370,7 @@ class CMakeFile(object): "MEFISTO2D", "MeshDriverDAT", "MeshDriverMED", + "MeshDriverGMF", "MeshDriver", "MeshDriverSTL", "MeshDriverUNV", @@ -618,7 +619,7 @@ class CMakeFile(object): INCLUDE(${GEOM_ROOT_DIR}/adm_local/cmake_files/FindGEOM.cmake) INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMED.cmake) INCLUDE(${SMESH_ROOT_DIR}/adm_local/cmake_files/FindSMESH.cmake) - INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindBLSURF.cmake) + INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindCADSURF.cmake) """) pass if self.module in ["ghs3dplugin", "hexoticplugin"]: @@ -655,6 +656,11 @@ class CMakeFile(object): INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindSPHINX.cmake) """) pass + if self.module == "jobmanager": + newlines.append(""" + INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindSPHINX.cmake) + """) + pass if self.module == "hxx2salome": newlines.append(""" SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR}) @@ -796,9 +802,10 @@ class CMakeFile(object): pass # -- newlines.append(""" - set(VERSION 6.5.0) - set(SHORT_VERSION 6.5) - set(XVERSION 0x060500) + set(VERSION 7.0.0) + set(SHORT_VERSION 7.0) + set(XVERSION 0x070000) + set(VERSION_DEV 1) """) pass # -- @@ -826,8 +833,8 @@ class CMakeFile(object): ''') elif self.module == "kernel": newlines.append(r''' - SET(AM_CPPFLAGS ${AM_CPPFLAGS} -DHAVE_SALOME_CONFIG -I${CMAKE_BINARY_DIR}/salome_adm/unix -include SALOMEconfig.h) - SET(AM_CXXFLAGS ${AM_CXXFLAGS} -DHAVE_SALOME_CONFIG -I${CMAKE_BINARY_DIR}/salome_adm/unix -include SALOMEconfig.h) + SET(AM_CPPFLAGS ${AM_CPPFLAGS} -DHAVE_SALOME_CONFIG -I${CMAKE_BINARY_DIR}/salome_adm -include SALOMEconfig.h) + SET(AM_CXXFLAGS ${AM_CXXFLAGS} -DHAVE_SALOME_CONFIG -I${CMAKE_BINARY_DIR}/salome_adm -include SALOMEconfig.h) ''') else: if self.module not in ["yacs"]: @@ -1112,7 +1119,7 @@ class CMakeFile(object): ) ''') self.files.append("static/header.html.in") - elif self.root[-len(mod):] == upmod and operator.contains(self.root, 'doc') or mod in ['kernel', 'gui', 'geom', 'med', 'smesh', 'visu'] and self.root[-len('tui'):] == 'tui': + elif self.root[-len(mod):] == upmod and operator.contains(self.root, 'doc') or mod in ['kernel', 'gui', 'geom', 'med', 'smesh', 'visu', 'blsurfplugin'] and self.root[-len('tui'):] == 'tui' or operator.contains(self.root, 'doc') and mod in ['pyhello']: newlines.append(r''' SET(top_builddir ${CMAKE_BINARY_DIR} @@ -1133,7 +1140,8 @@ class CMakeFile(object): ${datadir}/doc/salome ) ''') - self.files.append("static/header.html.in") + if mod not in ['blsurfplugin']: + self.files.append("static/header.html.in") if mod in ['geom', 'smesh', 'visu','netgenplugin','blsurfplugin','hexoticplugin','ghs3dplugin',"ghs3dprlplugin"] and self.root[-len(mod):] == upmod: self.files.append("static/header_py.html.in") @@ -1212,7 +1220,7 @@ class CMakeFile(object): WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} )"""%(input, doc_gui_destination, doc_source, doc_gui_destination, head_source, doc_gui_destination)) from os import path - if mod in ['geom', 'smesh', 'visu', 'netgenplugin','blsurfplugin','hexoticplugin','ghs3dplugin','ghs3dprlplugin'] and self.root[-len(mod):] == upmod and operator.contains(self.root, 'doc'): + if mod in ['geom', 'smesh', 'visu', 'netgenplugin','blsurfplugin','hexoticplugin','ghs3dplugin','ghs3dprlplugin','pyhello'] and self.root[-len(mod):] == upmod and operator.contains(self.root, 'doc') or mod in ['pyhello'] and operator.contains(self.root, 'doc'): ign = r"""'*usr_docs*', '*CMakeFiles*', '*.cmake', 'doxyfile*', '*.vcproj', 'static', 'Makefile*'""" if mod in ['geom', 'smesh']: if mod == 'geom': @@ -1235,19 +1243,20 @@ class CMakeFile(object): VERBATIM WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} )"""%(prepare_generating_doc_src, prepare_generating_doc_src, tmp, upmod, tmp, tmp, input, tmp, doc_gui_destination, doc_gui_destination, ign, head_source, doc_gui_destination)) + newlines.append(r"""ADD_DEPENDENCIES(usr_docs html_docs)""") else: config_f = "" if mod in ['netgenplugin','blsurfplugin','hexoticplugin','ghs3dplugin', "ghs3dprlplugin"] : - config_f = "doxyfile_py" - else: - config_f = "doxyfile_idl" - newlines.append("""\t ADD_CUSTOM_TARGET(usr_docs ${DOXYGEN_EXECUTABLE} %s + config_f = "${DOXYGEN_EXECUTABLE} doxyfile_py" + elif mod not in ['pyhello']: + config_f = "${DOXYGEN_EXECUTABLE} doxyfile_idl" + newlines.append("""\t ADD_CUSTOM_TARGET(usr_docs %s COMMAND ${DOXYGEN_EXECUTABLE} doxyfile COMMAND ${PYTHON_EXECUTABLE} -c "import shutil, sys; shutil.rmtree(r'''%s''',True); shutil.copytree(r'''${CMAKE_CURRENT_BINARY_DIR}''',r'''%s''', ignore=shutil.ignore_patterns(%s)); shutil.copy(r'''%s''',r'''%s''')" VERBATIM WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} )"""%(config_f, doc_gui_destination, doc_gui_destination, ign, head_source, doc_gui_destination)) - elif mod == 'yacs' and operator.contains(self.root, upmod + '_SRC'+path.sep+'doc'): + elif mod in ['yacs', 'jobmanager'] and operator.contains(self.root, upmod + '_SRC'+path.sep+'doc'): from sys import platform params = ''; if platform == "win32": @@ -1265,21 +1274,19 @@ class CMakeFile(object): params = '-Q'; ext = "bat" prf = "call" + cmd = "STRING(REPLACE \"/\" \"\\\\\" SCR" else: ext = "sh" prf = ". " + cmd = "SET(SCR" doc_gui_destination = "${CMAKE_INSTALL_PREFIX}/share/doc/salome/tui/%s/docutils"%(upmod) scr = self.writeEnvScript(upmod) newlines.append(r""" - IF(WINDOWS) - STRING(REPLACE "/" "\\" SCR "%s") - ELSE(WINDOWS) - SET(SCR "%s") - ENDIF(WINDOWS) + %s "%s") FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/env_s.%s "${SCR}") - ADD_CUSTOM_TARGET(html_docs %s ${CMAKE_CURRENT_BINARY_DIR}/env_s.%s && ${SPHINX_EXECUTABLE} %s -c ${CMAKE_BINARY_DIR}/doc/docutils -W -b html ${ALLSPHINXOPTS} html + ADD_CUSTOM_TARGET(html_docs %s ${CMAKE_CURRENT_BINARY_DIR}/env_s.%s && ${SPHINX_EXECUTABLE} %s -c ${CMAKE_BINARY_DIR}/doc/docutils -b html ${ALLSPHINXOPTS} html COMMAND ${PYTHON_EXECUTABLE} -c \"import shutil\;shutil.rmtree('''%s''', True)\;shutil.copytree('''${CMAKE_CURRENT_BINARY_DIR}/html''', '''%s''')\" - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})"""%(scr,scr,ext,prf,ext,params, doc_gui_destination, doc_gui_destination)) + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})"""%(cmd, scr, ext, prf, ext, params, doc_gui_destination, doc_gui_destination)) @@ -1289,7 +1296,7 @@ class CMakeFile(object): # -- upmod = self.module.upper() - if mod in ['kernel', 'gui', 'med', 'smesh', 'visu'] and self.root[-len('tui'):] == 'tui': + if mod in ['kernel', 'gui', 'med', 'smesh', 'visu', 'blsurfplugin'] and self.root[-len('tui'):] == 'tui': if mod == 'kernel': tmp = """\tADD_CUSTOM_TARGET(dev_docs ${DOXYGEN_EXECUTABLE} -u COMMAND ${DOXYGEN_EXECUTABLE} @@ -1300,14 +1307,15 @@ class CMakeFile(object): if mod == 'visu': tmp1= r"""\n COMMAND ${PYTHON_EXECUTABLE} -c "from shutil import copy; copy(r'''${CMAKE_CURRENT_SOURCE_DIR}/images/visuscreen.png''', r'''%s''')" """%(doc_tui_destination) elif mod == 'smesh': - extra_srcdir = "${CMAKE_CURRENT_SOURCE_DIR}/extra" - tmp1= """\n COMMAND ${PYTHON_EXECUTABLE} -c "from shutil import copy; copy(r'''${CMAKE_CURRENT_SOURCE_DIR}/images/smeshscreen.png''', r'''%s'''); copy(r'''%s/AddNetgenInSalome2.pdf''', r'''%s'''); copy(r'''%s/PluginMeshers.html''', r'''%s''')" - COMMAND ${PYTHON_EXECUTABLE} -c "from shutil import copy; copy(r'''%s/AddNetgenInSalome2.ps''', r'''%s'''); copy(r'''%s/AddNetgenInSalome2.sxw''', r'''%s''')" """%(doc_tui_destination, extra_srcdir,doc_destination, extra_srcdir,doc_destination, extra_srcdir,doc_destination,extra_srcdir,doc_destination) + tmp1= """\n COMMAND ${PYTHON_EXECUTABLE} -c "from shutil import copy; copy(r'''${CMAKE_CURRENT_SOURCE_DIR}/images/smeshscreen.png''', r'''%s''')" """%(doc_tui_destination) else: tmp1="" doc_source = "${CMAKE_CURRENT_BINARY_DIR}/%s"%(upmod) + inst_head_command="" + if mod not in ['blsurfplugin']: + inst_head_command = "; shutil.copy(r'''%s''', r'''%s''')"%(head_source, doc_tui_destination) newlines.append(tmp + """ - COMMAND ${PYTHON_EXECUTABLE} -c "import shutil, sys; shutil.rmtree(r'''%s''', True); shutil.copytree(r'''%s''', r'''%s'''); shutil.copy(r'''%s''', r'''%s''')" """%(doc_tui_destination, doc_source, doc_tui_destination, head_source, doc_tui_destination) + tmp1 + """ + COMMAND ${PYTHON_EXECUTABLE} -c "import shutil, sys; shutil.rmtree(r'''%s''', True); shutil.copytree(r'''%s''', r'''%s''')%s" """%(doc_tui_destination, doc_source, doc_tui_destination, inst_head_command) + tmp1 + """ VERBATIM WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} )""") @@ -1922,7 +1930,7 @@ class CMakeFile(object): ENDIF(WINDOWS) ''') # -- - if self.module in ["geom", "med"]: + if self.module in ["geom", "med", "hexoticplugin", "blsurfplugin"]: newlines.append(r''' SET(var ${var} -I${CMAKE_CURRENT_SOURCE_DIR}) SET(var ${var} -I${CMAKE_CURRENT_BINARY_DIR}) @@ -2442,70 +2450,61 @@ class CMakeFile(object): f.close() return - def writeEnvScript(self, upmod): - from sys import platform, version_info - p_version = """%s.%s"""%(version_info[0],version_info[1]) - python_path ="PYTHONPATH" - path = "" - begin = "" - end = "" - delim = "" - cmd = "" - pdir = "" - omni = "" - omni_py = "" - if platform == "win32" : - path = "PATH" - begin = "%" - end = "%" - delim = ";" - cmd = "@SET " - omni = "/x86_win32" - omni_py = "/python" - pdir = "PDIR" + def writeEnvScript(self, upmod, buildmod=True): + import os, sys + p_version = sys.version[:3] + python_path = "PYTHONPATH" + root_dir = "%s_ROOT_DIR" % upmod + if sys.platform == "win32": + script_line = '@SET %(var)s=%(val)s;%%%(var)s%%\n' + var_line = '%%%s%%' + lib_path = "PATH" + omni = "x86_win32" + omni_py = "python" + pass else: - path = "LD_LIBRARY_PATH" - begin = "\${" - end = "}" - delim = ":" - cmd = "export " - omni_py = "/python" + p_version + "/" + "site-packages" - pdir = "INST_ROOT" - - - path_ = begin + path + end - root_dir_ = begin + upmod + "_ROOT_DIR" + end - python_path_ = begin + python_path + end - _python_path_ = delim + python_path_+ "\n" - _path_ = delim + path_+ "\n" - _pdir = begin + pdir + end - - - script = cmd + " " + python_path + "=" + root_dir_+"/lib/python" + p_version \ - + "/site-packages/salome" + _python_path_ - - script = script + cmd + " " + python_path + "=" + root_dir_+"/bin/salome" + \ - _python_path_ - - script = script + cmd + " "+ path + "=" + root_dir_+"/lib/salome"+ _path_ - + script_line = 'export %(var)s=%(val)s:\$%(var)s\n' + var_line = '\${%s}' + lib_path = "LD_LIBRARY_PATH" + omni = "" + omni_py = "/".join( ["python%s"%p_version , "site-packages"] ) + pass + # + script = "" + # + if buildmod: + script += script_line % { 'var':python_path, 'val':"/".join( ["${CMAKE_INSTALL_PREFIX}", "lib", "python%s"%p_version, "site-packages", "salome"] ) } + script += script_line % { 'var':python_path, 'val':"/".join( ["${CMAKE_INSTALL_PREFIX}", "bin", "salome"] ) } + script += script_line % { 'var':lib_path, 'val':"/".join( ["${CMAKE_INSTALL_PREFIX}", "lib", "salome"] ) } + pass + else: + script += script_line % { 'var':python_path, 'val':"/".join( [var_line % root_dir, "lib", "python%s"%p_version, "site-packages", "salome"] ) } + script += script_line % { 'var':python_path, 'val':"/".join( [var_line % root_dir, "bin", "salome"] ) } + script += script_line % { 'var':lib_path, 'val':"/".join( [var_line % root_dir, "lib", "salome"] ) } + pass + # if upmod == "KERNEL" : - script = script + cmd + " " + python_path + "=" + _pdir + \ - "/omniORB-4.1.5/lib" + omni + _python_path_ - - script = script + cmd + " " + python_path + "=" + _pdir + \ - "/omniORB-4.1.5/lib" + omni_py + _python_path_ - - script = script + cmd + " "+ path + "=" + _pdir+ "/omniORB-4.1.5/lib" + \ - omni + _path_ - + script += "\n" + if omni: + script += script_line % { 'var':python_path, 'val':"/".join( ["${OMNIORB_ROOT_USER}", "lib", omni] ) } + script += script_line % { 'var':lib_path, 'val':"/".join( ["${OMNIORB_ROOT_USER}", "lib", omni] ) } + pass + else: + script += script_line % { 'var':python_path, 'val':"/".join( ["${OMNIORB_ROOT_USER}", "lib"] ) } + script += script_line % { 'var':lib_path, 'val':"/".join( ["${OMNIORB_ROOT_USER}", "lib"] ) } + pass + script += script_line % { 'var':python_path, 'val':"/".join( ["${OMNIORB_ROOT_USER}", "lib", omni_py] ) } + pass + # if upmod == "GEOM" : - script = self.writeEnvScript("KERNEL") + script - script = self.writeEnvScript("GUI") + script - + script = self.writeEnvScript("KERNEL", False) + "\n" + script + script = self.writeEnvScript("GUI", False) + "\n" + script + pass + # if upmod == "SMESH" : - script = self.writeEnvScript("GEOM") + script - + script = self.writeEnvScript("GEOM", False) + "\n" + script + pass + return script pass @@ -2563,8 +2562,10 @@ if __name__ == "__main__": # -- for f in files: if f in ["Makefile.am", "Makefile.am.cmake"]: - convert = True - if getenv("AM2CMAKE_FORCE_GENERATION", "0")=="0": + convert = True # convert files by default + forced = getenv("AM2CMAKE_FORCE_GENERATION", "0")=="1" or \ + getenv("AM2CMAKE_FORCE_%s_GENERATION"%module.upper(), "0")=="1" + if not forced: # detect if conversion should be done if "CMakeLists.txt" in files: from os.path import join diff --git a/salome_adm/cmake_files/prepare_generating_doc.py b/salome_adm/cmake_files/prepare_generating_doc.py index fb218237a..8a88fec81 100755 --- a/salome_adm/cmake_files/prepare_generating_doc.py +++ b/salome_adm/cmake_files/prepare_generating_doc.py @@ -18,12 +18,55 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -import sys, re -outfile = open(sys.argv[1], 'wb') -isCom = False -for line in open(sys.argv[2], 'rb').readlines(): - if re.match('class '+sys.argv[3]+'DC', line): +# ... +# Usage: prepare_generating_doc.py +# ... +# 1. myClassDC is replaced by myClass +# 2. all methods of myClassDC become global methods of Python package +# ... +# myClass is passed as command line argument +# ... + +import os, sys, re + +# check command line +if len( sys.argv ) < 4: + sys.exit("Usage: %s " % os.path.basename(sys.argv[0])) + +# open input file +try: + infile = open(sys.argv[2], 'rb') +except: + sys.exit("File %s is not found" % sys.argv[2]) + pass + +# open output file +try: + outfile = open(sys.argv[1], 'wb') +except: + sys.exit("File %s cannot be opened for write" % sys.argv[1]) + pass + +# parse input file + +isCom = False +isShift = False + +for line in infile.readlines(): + dc_class = sys.argv[3] + dc_class_dc = dc_class+'DC' + + if isShift and ( re.match('^class\s+', line) or re.match('^def\s+', line) ): + # stop shifting lines as soon as myClassDC definition is over + isShift = False + pass + if re.match('class\s+%s' % dc_class_dc, line): + # start shifting lines + isShift = True + # omit this line (to remove myClassDC from the package) continue + + # process documentation n = line.find('"""') n1 = line[(n+2):].find('"""') if (n > -1) and (n1 > -1): @@ -31,13 +74,26 @@ for line in open(sys.argv[2], 'rb').readlines(): if isCom: if n > -1: isCom = False + pass continue else: if n > -1: isCom = True - continue - line = re.sub(r'^\s+#', '#', line) - line = re.sub(r'^\s+def', 'def', line) - line = re.sub(sys.argv[3]+'DC', sys.argv[3], line) + continue + pass + + # replacements + if isShift: + line = re.sub(r'^\s+#', '#', line) + line = re.sub(r'^\s+def', 'def', line) + pass + line = re.sub(dc_class_dc, dc_class, line) + + # write resulting line outfile.write(line) -outfile.close() \ No newline at end of file + + pass # end of for + +# close input and output files +infile.close() +outfile.close() diff --git a/salome_adm/unix/CMakeLists.txt b/salome_adm/unix/CMakeLists.txt new file mode 100755 index 000000000..a0b5ec4d1 --- /dev/null +++ b/salome_adm/unix/CMakeLists.txt @@ -0,0 +1,35 @@ +# Copyright (C) 2012 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(config_files) + +SET(DEPRECATED_FILES + DEPRECATED/F77config.h.in + DEPRECATED/sstream.in + DEPRECATED/envScript.in + DEPRECATED/depend.in + DEPRECATED/make_commence.in + DEPRECATED/make_conclude.in + DEPRECATED/make_module.in + DEPRECATED/make_omniorb.in +) + +# The deprecated files are deprecated for the KERNEL but not for the +# related modules (GUI, MED, ...), for now. Some files have to be installed. +INSTALL(FILES ${DEPRECATED_FILES} DESTINATION salome_adm/unix) diff --git a/salome_adm/unix/Makefile.am b/salome_adm/unix/Makefile.am index 7029d3f35..307ee59f1 100644 --- a/salome_adm/unix/Makefile.am +++ b/salome_adm/unix/Makefile.am @@ -34,28 +34,6 @@ DEPRECATED_FILES=\ DEPRECATED/make_module.in \ DEPRECATED/make_omniorb.in -# rules for install and build (see make_common_starter.am) -salomeadmux_DATA = SALOMEconfig.h.in -salomeinclude_DATA = SALOMEconfig.h -BUILT_SOURCES=SALOMEconfig.ref SALOMEconfig.h SALOMEconfig.h.in - -mostlyclean-local: - -rm -rf SALOMEconfig.h SALOMEconfig.h.in - -SALOMEconfig.h.in : SALOMEconfig.ref.in - cp -pf $< $@; - -# test if SALOMEconfig.ref has changed (contents), at build time -SALOMEconfig.h: $(top_builddir)/salome_adm/unix/SALOMEconfig.ref - @if ! [ -a $@ ]; then \ - echo cp -pf $< $@; \ - cp -pf $< $@; \ - fi; \ - if ! cmp -s $< $@; then \ - echo cp -pf $< $@; \ - cp -pf $< $@; \ - fi; - # The deprecated files are deprecated for the KERNEL but not for the # related modules (GUI, MED, ...), for now. Some files have to be installed. dist_salomeadmux_DATA=\ diff --git a/salome_adm/unix/config_files/CMakeLists.txt b/salome_adm/unix/config_files/CMakeLists.txt new file mode 100755 index 000000000..e7add33e2 --- /dev/null +++ b/salome_adm/unix/config_files/CMakeLists.txt @@ -0,0 +1,84 @@ +# Copyright (C) 2012 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 +# + +# The deprecated files are deprecated for the KERNEL but not for the +# related modules (GUI, MED, ...). Some files have to be installed. +SET(DEPRECATED_FILES + DEPRECATED/ac_cc_warnings.m4 + DEPRECATED/ac_cxx_bool.m4 + DEPRECATED/ac_cxx_mutable.m4 + DEPRECATED/ac_cxx_partial_specialization.m4 + DEPRECATED/ac_cxx_typename.m4 + DEPRECATED/check_mico.m4 + DEPRECATED/check_pthreads.m4 + DEPRECATED/config.sub + DEPRECATED/config.guess + DEPRECATED/install-sh + DEPRECATED/libtool.m4 + DEPRECATED/ltconfig + DEPRECATED/ltmain.sh + DEPRECATED/check_Salome.m4 + DEPRECATED/check_java.m4 + DEPRECATED/missing + DEPRECATED/mkinstalldirs +) + +SET(m4_DATA + ac_cxx_depend_flag.m4 + ac_cxx_have_sstream.m4 + ac_cxx_namespaces.m4 + ac_cxx_option.m4 + ac_cxx_template_options.m4 + ac_cxx_use_std_iostream.m4 + ac_cxx_warnings.m4 + ac_linker_options.m4 + ac_check_sizeof_fortran.m4 + acx_pthread.m4 + check_Kernel.m4 + check_boost.m4 + check_cas.m4 + check_corba.m4 + check_cppunit.m4 + check_f77.m4 + check_calcium.m4 + check_hdf5.m4 + check_htmlgen.m4 + check_sphinx.m4 + check_lam.m4 + check_libbatch.m4 + check_mpi.m4 + check_openmpi.m4 + check_mpich.m4 + check_omniorb.m4 + check_sockets.m4 + check_swig.m4 + check_vtk.m4 + check_withihm.m4 + enable_pthreads.m4 + production.m4 + pyembed.m4 + python.m4 + check_libxml.m4 + check_paco++.m4 + local_install.m4 + hack_libtool.m4 + check_tbb.m4 +) +INSTALL(FILES ${DEPRECATED_FILES} DESTINATION salome_adm/unix/config_files/DEPRECATED) +INSTALL(FILES ${m4_DATA} DESTINATION salome_adm/unix/config_files) diff --git a/salome_adm/unix/config_files/check_boost.m4 b/salome_adm/unix/config_files/check_boost.m4 index 36ab894e8..84eaf39ba 100644 --- a/salome_adm/unix/config_files/check_boost.m4 +++ b/salome_adm/unix/config_files/check_boost.m4 @@ -120,7 +120,7 @@ if test "x${boost_headers_ok}" = "xyes" ; then done fi if test "x${boost_lib_dir_ok}" = "xyes" ; then - LIBS="${LIBS_old} ${BOOST_LIBS} -lboost_thread${BOOST_LIBSUFFIX}" + LIBS="${LIBS_old} ${BOOST_LIBS} -lboost_thread${BOOST_LIBSUFFIX} -lboost_system${BOOST_LIBSUFFIX}" AC_TRY_LINK([#include ], [struct TBody{ void operator()(){} }; boost::thread(TBody())], boost_binaries_ok=yes, @@ -138,7 +138,7 @@ else AC_MSG_RESULT(\$BOOST_LIBSUFFIX = ${BOOST_LIBSUFFIX}) AC_MSG_RESULT(\$BOOST_LIBS = ${BOOST_LIBS}) AC_CHECK_FILE(${BOOSTDIR}/lib${LIB_SUFFIX}/libboost_thread${BOOST_LIBSUFFIX}.so, - BOOST_LIB_THREAD="${BOOST_LIBS} -lboost_thread${BOOST_LIBSUFFIX}", + BOOST_LIB_THREAD="${BOOST_LIBS} -lboost_thread${BOOST_LIBSUFFIX} -lboost_system${BOOST_LIBSUFFIX}", BOOST_LIB_THREAD="") AC_CHECK_FILE(${BOOSTDIR}/lib${LIB_SUFFIX}/libboost_signals${BOOST_LIBSUFFIX}.so, BOOST_LIB_SIGNALS="${BOOST_LIBS} -lboost_signals${BOOST_LIBSUFFIX}", diff --git a/salome_adm/unix/config_files/check_cas.m4 b/salome_adm/unix/config_files/check_cas.m4 index 7646fd377..98fa0bc5d 100644 --- a/salome_adm/unix/config_files/check_cas.m4 +++ b/salome_adm/unix/config_files/check_cas.m4 @@ -240,11 +240,11 @@ else CAS_OCAF="$CAS_LDPATH -lPTKernel -lTKernel -lTKCDF -lTKLCAF -lTKPCAF -lTKStdSchema" CAS_OCAFVIS="$CAS_LDPATH -lTKCAF -lTKPLCAF -lTKPShape -lTKStdLSchema -lTKShapeSchema" - if test -f $CASROOT/$casdir/lib/libStdPlugin.so ; then + if test -f ${CAS_LIBDIR}/libStdPlugin.so ; then # standard plugin library libStdPlugin has been added in CASCADE 5.2.3 CAS_STDPLUGIN="StdPlugin" CAS_OCAFVIS="$CAS_OCAFVIS -lStdPlugin -lStdLPlugin" - elif test -f $CASROOT/$casdir/lib/libTKStdSchema.so ; then + elif test -f ${CAS_LIBDIR}/libTKStdSchema.so ; then # standard plugin has been renamed in CASCADE 6.5 CAS_STDPLUGIN=TKStdSchema CAS_OCAFVIS="$CAS_OCAFVIS -lTKStdSchema -lTKStdLSchema" diff --git a/salome_adm/unix/make_common_starter.am b/salome_adm/unix/make_common_starter.am index 2f07b58af..c7c4007f8 100644 --- a/salome_adm/unix/make_common_starter.am +++ b/salome_adm/unix/make_common_starter.am @@ -26,8 +26,8 @@ # ============================================================ if !WITHONLYLAUNCHER - AM_CXXFLAGS = -I$(top_builddir)/salome_adm/unix -include SALOMEconfig.h - AM_CPPFLAGS = -I$(top_builddir)/salome_adm/unix -include SALOMEconfig.h + AM_CXXFLAGS = -I$(top_builddir)/salome_adm -include SALOMEconfig.h + AM_CPPFLAGS = -I$(top_builddir)/salome_adm -include SALOMEconfig.h else WITHONLYLAUNCHER AM_CXXFLAGS = AM_CPPFLAGS = @@ -76,3 +76,7 @@ sharedpkgpythondir =$(salomepythondir)/shared_modules # Documentation directory docdir = $(datadir)/doc/salome + +# Cmake files +CMAKEFILES = $(notdir $(wildcard $(srcdir)/CMakeLists.txt)) +EXTRA_DIST = $(CMAKEFILES) diff --git a/src/Basics/Basics_Utils.cxx b/src/Basics/Basics_Utils.cxx index 77eaacc19..673914693 100644 --- a/src/Basics/Basics_Utils.cxx +++ b/src/Basics/Basics_Utils.cxx @@ -123,6 +123,18 @@ namespace Kernel_Utils free (strings); } +#else + #if (_MSC_VER >= 1400) // Visual Studio 2005 + #include + int setenv(const char *name, const char *value, int rewrite) + { + std::stringstream sstr; + sstr<= 1400) // Visual Studio 2005 + BASICS_EXPORT int setenv(const char*, const char*, int); +#endif #endif } diff --git a/src/Basics/CMakeLists.txt b/src/Basics/CMakeLists.txt new file mode 100755 index 000000000..0ba895b59 --- /dev/null +++ b/src/Basics/CMakeLists.txt @@ -0,0 +1,41 @@ +# Copyright (C) 2012 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_DIRECTORIES( + ${PTHREAD_INCLUDE_DIRS} +) + +SET(SALOMEBasics_SOURCES + BasicsGenericDestructor.cxx + Basics_Utils.cxx + Basics_DirUtils.cxx + SALOME_Basics.hxx + BasicsGenericDestructor.hxx + Basics_Utils.hxx + Basics_DirUtils.hxx +) + +ADD_LIBRARY(SALOMEBasics SHARED ${SALOMEBasics_SOURCES}) +INSTALL(TARGETS SALOMEBasics DESTINATION ${KERNEL_salomelib_LIBS}) + +SET_TARGET_PROPERTIES(SALOMEBasics PROPERTIES COMPILE_FLAGS "${PTHREAD_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +TARGET_LINK_LIBRARIES(SALOMEBasics ${PTHREAD_LIBS} ${PLATFORM_LIBS}) + +FILE(GLOB SALOMEBasics_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") +INSTALL(FILES ${SALOMEBasics_HEADERS_HXX} DESTINATION ${KERNEL_salomeinclude_HEADERS}) \ No newline at end of file diff --git a/src/Basics/Test/CMakeLists.txt b/src/Basics/Test/CMakeLists.txt new file mode 100755 index 000000000..f5edb13b3 --- /dev/null +++ b/src/Basics/Test/CMakeLists.txt @@ -0,0 +1,20 @@ +# Copyright (C) 2012 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 + +FILE(GLOB SALOMEBasics_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") +INSTALL(FILES ${SALOMEBasics_HEADERS_HXX} DESTINATION ${KERNEL_salomeinclude_HEADERS}) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100755 index 000000000..931de8be9 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,119 @@ +# Copyright (C) 2012 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 +# + +SET(SUBDIR_BASE + Basics + SALOMELocalTrace + HDFPersist + KERNEL_PY +) + +SET(SUBDIR_CORBA + DF + Logger + SALOMETraceCollector + Utils + NamingService + GenericObj + Registry + ModuleCatalog + ResourcesManager + Notification + NOTIFICATION_SWIG + Container + TestContainer + Launcher + LifeCycleCORBA + LifeCycleCORBA_SWIG + SALOMEDSClient + TOOLSDS + SALOMEDSImpl + SALOMEDS + KernelHelpers + ModuleGenerator + Communication + Communication_SWIG + DSC +) + +SET(SUBDIR_CPPUNIT_BASE + Basics/Test + SALOMELocalTrace/Test +) + +SET(SUBDIR_CPPUNIT_CORBA + Logger/Test + SALOMETraceCollector/Test + Utils/Test + NamingService/Test + LifeCycleCORBA/Test + LifeCycleCORBA_SWIG/Test + SALOMEDSImpl/Test + SALOMEDS/Test + KernelHelpers/Test +) + +SET(SUBDIR_CPPUNIT_GENERAL UnitTests) +SET(SUBDIR_MPI MPIContainer TestMPIContainer) +SET(SUBDIR_PARALLEL ParallelContainer) + +IF(WITHONLYLAUNCHER) + SET(SUBDIRS Basics ResourcesManager Launcher) +ELSE(WITHONLYLAUNCHER) + SET(SUBDIRS ${SUBDIR_BASE}) +ENDIF(WITHONLYLAUNCHER) + +IF(CORBA_GEN) + SET(SUBDIRS ${SUBDIRS} ${SUBDIR_CORBA}) +ENDIF(CORBA_GEN) + +IF(MPI_IS_OK) + SET(SUBDIRS + ${SUBDIRS} + ${SUBDIR_MPI} + ) +ENDIF(MPI_IS_OK) + +IF(CPPUNIT_IS_OK) + IF(CORBA_GEN) + SET(SUBDIRS + ${SUBDIRS} + ${SUBDIR_CPPUNIT_BASE} + ${SUBDIR_CPPUNIT_CORBA} + ${SUBDIR_CPPUNIT_GENERAL} + ) + ELSE(CORBA_GEN) + SET(SUBDIRS + ${SUBDIRS} + ${SUBDIR_CPPUNIT_BASE} + ${SUBDIR_CPPUNIT_GENERAL} + ) + ENDIF(CORBA_GEN) +ENDIF(CPPUNIT_IS_OK) + +IF(WITH_PACO_PARALLEL) + SET(SUBDIRS + ${SUBDIRS} + ${SUBDIR_PARALLEL} + ) +ENDIF(WITH_PACO_PARALLEL) + +FOREACH(DIR ${SUBDIRS}) + ADD_SUBDIRECTORY(${DIR}) +ENDFOREACH(DIR ${SUBDIRS}) diff --git a/src/Communication/CMakeLists.txt b/src/Communication/CMakeLists.txt new file mode 100755 index 000000000..796ffdded --- /dev/null +++ b/src/Communication/CMakeLists.txt @@ -0,0 +1,76 @@ +# Copyright (C) 2012 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_DIRECTORIES( + ${PTHREAD_INCLUDE_DIRS} + ${OMNIORB_INCLUDE_DIRS} + ${MPI_INCLUDE_DIRS} + ${PYTHON_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR}/salome_adm + ${CMAKE_CURRENT_SOURCE_DIR}/../Basics + ${CMAKE_CURRENT_SOURCE_DIR}/../SALOMELocalTrace + ${CMAKE_CURRENT_SOURCE_DIR}/../Utils + ${CMAKE_BINARY_DIR}/idl +) + +SET(COMMON_LIBS + OpUtil + SALOMELocalTrace + SalomeIDLKernel +) + +SET(SalomeCommunication_SOURCES + SALOME_Comm_i.cxx + SALOME_Matrix_i.cxx + SenderFactory.cxx + MultiCommException.cxx + SALOMEMultiComm.cxx + ReceiverFactory.cxx + MatrixClient.cxx + MultiCommException.hxx + SALOME_Comm_i.hxx + SALOME_Matrix_i.hxx + SenderFactory.hxx + ReceiverFactory.hxx + MatrixClient.hxx + SALOMEMultiComm.hxx + Receivers.hxx + Receiver.hxx +) + +ADD_LIBRARY(SalomeCommunication SHARED ${SalomeCommunication_SOURCES}) +SET_TARGET_PROPERTIES(SalomeCommunication PROPERTIES COMPILE_FLAGS "${OMNIORB_DEFINITIONS} ${MPI_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +TARGET_LINK_LIBRARIES(SalomeCommunication ${COMMON_LIBS} ${PYTHON_LIBS} ${MPI_LIBS}) +INSTALL(TARGETS SalomeCommunication DESTINATION ${KERNEL_salomelib_LIBS}) + +SET(COMMON_HEADERS_HXX + MatrixClient.hxx + MultiCommException.hxx + Receiver.hxx + ReceiverFactory.hxx + Receivers.hxx + Receivers.cxx + SALOMEMultiComm.hxx + SALOME_Comm_i.hxx + SALOME_Communication.hxx + SALOME_Matrix_i.hxx + SenderFactory.hxx +) + +INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${KERNEL_salomeinclude_HEADERS}) diff --git a/src/Communication/Makefile.am b/src/Communication/Makefile.am index 6255807a8..391173d17 100644 --- a/src/Communication/Makefile.am +++ b/src/Communication/Makefile.am @@ -92,7 +92,7 @@ libSalomeCommunication_la_SOURCES =\ Receiver.hxx # the following file is needed by an include file (VERY DIRTY!) -EXTRA_DIST = Receivers.cxx +EXTRA_DIST += Receivers.cxx libSalomeCommunication_la_CPPFLAGS = $(COMMON_CPPFLAGS) $(OPT_CPPFLAGS) libSalomeCommunication_la_LDFLAGS = -no-undefined -version-info=0:0:0 $(OPT_LDFLAGS) diff --git a/src/Communication_SWIG/CMakeLists.txt b/src/Communication_SWIG/CMakeLists.txt new file mode 100755 index 000000000..8683fa5bd --- /dev/null +++ b/src/Communication_SWIG/CMakeLists.txt @@ -0,0 +1,62 @@ +# Copyright (C) 2012 CEA/DEN, EDF R&D +# +# 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_PACKAGE(SWIG REQUIRED) +INCLUDE(${SWIG_USE_FILE}) + +SET_SOURCE_FILES_PROPERTIES(libSALOME_Comm.i PROPERTIES CPLUSPLUS ON) +SET_SOURCE_FILES_PROPERTIES(libSALOME_Comm.i PROPERTIES SWIG_DEFINITIONS "-shadow") + +INCLUDE_DIRECTORIES( + ${PYTHON_INCLUDE_DIRS} + ${OMNIORB_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR}/salome_adm + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/../Communication + ${CMAKE_CURRENT_SOURCE_DIR}/../Basics + ${CMAKE_CURRENT_SOURCE_DIR}/../SALOMELocalTrace + ${CMAKE_CURRENT_SOURCE_DIR}/../Utils + ${CMAKE_BINARY_DIR}/idl +) +SET(_libSALOME_Comm_FLAGS "${OMNIORB_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +SET(_libSALOME_Comm_LIBS + SalomeCommunication + ${PYTHON_LIBS} +) + +IF(MPI_IS_OK) + INCLUDE_DIRECTORIES(${MPI_INCLUDE_DIRS}) + + SET(_libSALOME_Comm_FLAGS "${_libSALOME_Comm_FLAGS} ${MPI_DEFINITIONS}") + SET(_libSALOME_Comm_LIBS + ${_libSALOME_Comm_LIBS} + ${MPI_LIBS} + ) +ENDIF(MPI_IS_OK) + +SWIG_ADD_MODULE(libSALOME_Comm python libSALOME_Comm.i) +SWIG_LINK_LIBRARIES(libSALOME_Comm ${_libSALOME_Comm_LIBS}) +SET_TARGET_PROPERTIES(_libSALOME_Comm PROPERTIES COMPILE_FLAGS "${_libSALOME_Comm_FLAGS}") + +IF(${MACHINE} STREQUAL WINDOWS) + SET_TARGET_PROPERTIES(_libSALOME_Comm PROPERTIES DEBUG_OUTPUT_NAME _libSALOME_Comm_d) +ENDIF(${MACHINE} STREQUAL WINDOWS) + +INSTALL(TARGETS _libSALOME_Comm DESTINATION ${KERNEL_salomepythondir}) +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libSALOME_Comm.py DESTINATION ${KERNEL_salomepythondir}) \ No newline at end of file diff --git a/src/Communication_SWIG/Makefile.am b/src/Communication_SWIG/Makefile.am index 9f03d8b56..bdd171cdb 100644 --- a/src/Communication_SWIG/Makefile.am +++ b/src/Communication_SWIG/Makefile.am @@ -86,7 +86,7 @@ swig_wrap.cpp libSALOME_Comm.py : $(SWIGSOURCES) CLEANFILES = swig_wrap.cpp -EXTRA_DIST = $(SWIGSOURCES) +EXTRA_DIST += $(SWIGSOURCES) # # =============================================================== diff --git a/src/Container/CMakeLists.txt b/src/Container/CMakeLists.txt new file mode 100755 index 000000000..25a5a7c40 --- /dev/null +++ b/src/Container/CMakeLists.txt @@ -0,0 +1,120 @@ +# Copyright (C) 2012 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_DIRECTORIES( + ${PTHREAD_INCLUDE_DIRS} + ${OMNIORB_INCLUDE_DIRS} + ${HDF5_INCLUDE_DIRS} + ${LIBXML_INCLUDE_DIRS} + ${PYTHON_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR}/salome_adm + ${CMAKE_CURRENT_SOURCE_DIR}/../Basics + ${CMAKE_CURRENT_SOURCE_DIR}/../SALOMELocalTrace + ${CMAKE_CURRENT_SOURCE_DIR}/../NamingService + ${CMAKE_CURRENT_SOURCE_DIR}/../Utils + ${CMAKE_CURRENT_SOURCE_DIR}/../Registry + ${CMAKE_CURRENT_SOURCE_DIR}/../Notification + ${CMAKE_CURRENT_SOURCE_DIR}/../ResourcesManager + ${CMAKE_CURRENT_SOURCE_DIR}/../HDFPersist + ${CMAKE_CURRENT_SOURCE_DIR}/../GenericObj + ${CMAKE_BINARY_DIR}/idl +) + +SET(SCRIPTS + SALOME_ComponentPy.py + SALOME_PyNode.py + SALOME_Container.py +) + +SET(COMMON_FLAGS "${HDF5_DEFINITIONS} ${LIBXML_DEFINITIONS} ${OMNIORB_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +SET(COMMON_LIBS + Registry + SalomeNotification + SalomeResourcesManager + ResourcesManager + SalomeNS + OpUtil + SALOMELocalTrace + SALOMEBasics + SalomeHDFPersist + SalomeGenericObj + SalomeIDLKernel + ${CORBA_LIBS} + ${PYTHON_LIBS} +) + +IF(WITH_MPI_SEQ_CONTAINER) + SET(COMMON_FLAGS + ${COMMON_FLAGS} + ${MPI_DEFINITIONS} + ) + SET(COMMON_LIBS + ${COMMON_LIBS} + ${MPI_LIBS} + ) +ENDIF(WITH_MPI_SEQ_CONTAINER) + +IF(WITH_PACO_PARALLEL) + SET(COMMON_FLAGS + ${COMMON_FLAGS} + -DWITH_PACO_PARALLEL + ${PACO_DEFINITIONS} + ) + SET(COMMON_LIBS + ${COMMON_LIBS} + ${PACO_LIBS} + ) +ENDIF(WITH_PACO_PARALLEL) + +SET(SalomeContainer_SOURCES + Component_i.cxx + Container_i.cxx + SALOME_FileTransfer_i.cxx + SALOME_FileRef_i.cxx + Container_init_python.cxx + SALOME_ContainerManager.cxx + Salome_file_i.cxx +) + +ADD_LIBRARY(SalomeContainer SHARED ${SalomeContainer_SOURCES}) +SET_TARGET_PROPERTIES(SalomeContainer PROPERTIES COMPILE_FLAGS "${COMMON_FLAGS}") +TARGET_LINK_LIBRARIES(SalomeContainer ${COMMON_LIBS}) +INSTALL(TARGETS SalomeContainer DESTINATION ${KERNEL_salomelib_LIBS}) + +SET(SALOME_Container_LIBS + SalomeContainer + SALOMEBasics + ${COMMON_LIBS} + ${HDF5_LIBS} +) + +ADD_EXECUTABLE(SALOME_Container SALOME_Container.cxx SALOME_Container_SignalsHandler.cxx) +SET_TARGET_PROPERTIES(SALOME_Container PROPERTIES COMPILE_FLAGS "${COMMON_FLAGS}") +TARGET_LINK_LIBRARIES(SALOME_Container ${SALOME_Container_LIBS}) + +ADD_EXECUTABLE(TestSalome_file TestSalome_file.cxx) +SET_TARGET_PROPERTIES(TestSalome_file PROPERTIES COMPILE_FLAGS "${COMMON_FLAGS}") +TARGET_LINK_LIBRARIES(TestSalome_file SALOMETraceCollectorTest ${SALOME_Container_LIBS}) + +INSTALL(TARGETS SALOME_Container DESTINATION ${KERNEL_salomebin_BINS}) + +# Executable scripts to be installed +SALOME_INSTALL_SCRIPTS("${SCRIPTS}" ${KERNEL_salomescript_PYTHON}) +FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") +INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${KERNEL_salomeinclude_HEADERS}) diff --git a/src/Container/Component_i.cxx b/src/Container/Component_i.cxx index 3e77256aa..ed5b16b6d 100644 --- a/src/Container/Component_i.cxx +++ b/src/Container/Component_i.cxx @@ -1105,3 +1105,20 @@ void Engines_Component_i::setContainerName() name[slash]='_'; _containerName=name; } + +//============================================================================= +/*! + \brief Get version of the component + + This method is supposed to be implemented in all derived classes; default implementation + returns empty string that means that no version information about the component is available. + + \note The version of the component is stored to the study, as a part of general persistence + mechanism; once stored, version information in the study cannot be changed. + + \return string containing component's version, e.g. "1.0" +*/ +char* Engines_Component_i::getVersion() +{ + return CORBA::string_dup( "" ); +} diff --git a/src/Container/Makefile.am b/src/Container/Makefile.am index 7243153df..0edfb936e 100644 --- a/src/Container/Makefile.am +++ b/src/Container/Makefile.am @@ -33,7 +33,7 @@ include $(top_srcdir)/salome_adm/unix/make_common_starter.am # Header to be installed # =============================================================== # -# header files +# header files salomeinclude_HEADERS = \ SALOME_Component_i.hxx \ SALOME_Container_i.hxx \ @@ -51,8 +51,7 @@ dist_salomescript_PYTHON =\ SALOME_Container.py # These files are executable scripts -dist_salomescript_SCRIPTS=\ - SALOME_ContainerPy.py +dist_salomescript_SCRIPTS= # # =============================================================== @@ -92,7 +91,7 @@ COMMON_LIBS =\ @CORBA_LIBS@ \ $(PYTHON_LIBS) -if WITH_MPI_SEQ_CONTAINER +if WITH_MPI_SEQ_CONTAINER COMMON_CPPFLAGS += @MPI_INCLUDES@ COMMON_LIBS += @MPI_LIBS@ endif @@ -149,7 +148,7 @@ SALOME_Container_LDADD = \ $(CORBA_LIBS) \ $(PYTHON_LIBS) -if WITH_MPI_SEQ_CONTAINER +if WITH_MPI_SEQ_CONTAINER SALOME_Container_LDADD += $(MPI_LIBS) endif diff --git a/src/Container/SALOME_ComponentPy.py b/src/Container/SALOME_ComponentPy.py index 55ec0ff55..66c9de634 100755 --- a/src/Container/SALOME_ComponentPy.py +++ b/src/Container/SALOME_ComponentPy.py @@ -314,3 +314,9 @@ class SALOME_ComponentPy_i (Engines__POA.EngineComponent): def getObjectInfo(self, studyId, entry): return "" + #------------------------------------------------------------------------- + + def getVersion(self): + return "" # empty string means "unknown" version + + pass # end of SALOME_ComponentPy_i diff --git a/src/Container/SALOME_Component_i.hxx b/src/Container/SALOME_Component_i.hxx index 94fd62ce8..3581cd9d2 100644 --- a/src/Container/SALOME_Component_i.hxx +++ b/src/Container/SALOME_Component_i.hxx @@ -120,6 +120,9 @@ public: virtual bool hasObjectInfo() { return false; } virtual char* getObjectInfo(CORBA::Long studyId, const char* entry) { return CORBA::string_dup(""); } + // Version information + virtual char* getVersion(); + // --- local C++ methods PortableServer::ObjectId * getId(); diff --git a/src/Container/SALOME_ContainerManager.cxx b/src/Container/SALOME_ContainerManager.cxx index a513af413..3a6cebdf7 100644 --- a/src/Container/SALOME_ContainerManager.cxx +++ b/src/Container/SALOME_ContainerManager.cxx @@ -36,6 +36,9 @@ #include #include +#include +#include CORBA_CLIENT_HEADER(SALOME_Session) + #ifdef WNT #include #define getpid _getpid @@ -187,6 +190,17 @@ void SALOME_ContainerManager::Shutdown() void SALOME_ContainerManager::ShutdownContainers() { MESSAGE("ShutdownContainers"); + + SALOME::Session_var session = SALOME::Session::_nil(); + CORBA::Long pid = 0; + CORBA::Object_var objS = _NS->Resolve("/Kernel/Session"); + if (!CORBA::is_nil(objS)) + { + session = SALOME::Session::_narrow(objS); + if (!CORBA::is_nil(session)) + pid = session->getPID(); + } + bool isOK; isOK = _NS->Change_Directory("/Containers"); if( isOK ){ @@ -199,7 +213,7 @@ void SALOME_ContainerManager::ShutdownContainers() try { Engines::Container_var cont=Engines::Container::_narrow(obj); - if(!CORBA::is_nil(cont)) + if(!CORBA::is_nil(cont) && pid != cont->getPID()) lstCont.push_back((*iter)); } catch(const CORBA::Exception& e) diff --git a/src/Container/SALOME_ContainerPy.py b/src/Container/SALOME_ContainerPy.py deleted file mode 100755 index b9144dda9..000000000 --- a/src/Container/SALOME_ContainerPy.py +++ /dev/null @@ -1,339 +0,0 @@ -#! /usr/bin/env python -# -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2012 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 -# - -# SALOME Container : implementation of container and engine for Kernel -# File : SALOME_ContainerPy.py -# Author : Paul RASCLE, EDF -# Module : SALOME -# $Header$ -# -import os -import sys -import string - -from omniORB import CORBA, PortableServer -import SALOMEDS -import Engines, Engines__POA -from SALOME_NamingServicePy import * -from SALOME_ComponentPy import * - -from SALOME_utilities import * -from Utils_Identity import getShortHostName -from launchConfigureParser import verbose - -#============================================================================= - -#define an implementation of the container interface for the container implemented in Python - -class SALOME_ContainerPy_i (Engines__POA.Container): - _orb = None - _poa = None - _numInstance = 0 - _listInstances_map = {} - - #------------------------------------------------------------------------- - - def __init__(self, orb, poa, containerName): - MESSAGE( "SALOME_ContainerPy_i::__init__" ) - self._orb = orb - self._poa = poa - myMachine=getShortHostName() - Container_path = "/Containers/" + myMachine + "/" + containerName - self._containerName = Container_path - if verbose(): print "container name ",self._containerName - - naming_service = SALOME_NamingServicePy_i(self._orb) - self._naming_service = naming_service - MESSAGE( str(Container_path) ) - naming_service.Register(self._this(), Container_path) - - #------------------------------------------------------------------------- - - def start_impl(self, ContainerName): - MESSAGE( "SALOME_ContainerPy_i::start_impl " + str(ContainerName) ) - myMachine=getShortHostName() - theContainer = "/Containers/" + myMachine + "/" + ContainerName - try: - obj = self._naming_service.Resolve(theContainer) - except : - obj = None - MESSAGE( "SALOME_ContainerPy_i::start_impl " + str(ContainerName) + ".object not found in Naming Service" ) - if obj is None: - container = None - else: - container = obj._narrow(Engines.Container) - if container is None: - MESSAGE( "SALOME_ContainerPy_i::start_impl " + str(containerName) + ".object exists but is not a Container" ) - else : - MESSAGE( "SALOME_ContainerPy_i::start_impl " + str(ContainerName) + ".object found without new launch" ) - return container - #shstr = os.getenv( "PWD" ) + "/" - #shstr += "runSession ./SALOME_ContainerPy.py " - shstr = os.getenv("KERNEL_ROOT_DIR") + "/bin/salome/SALOME_ContainerPy.py "; - #shstr = "runSession SALOME_ContainerPy.py " - shstr += ContainerName - - # mpv: fix for SAL4731 - allways create new file to write log of server - num = 1 - fileName = "" - while 1: - fileName = "/tmp/"+ContainerName+"_%i.log"%num - if not os.path.exists(fileName): - break - num += 1 - pass - - shstr += " > " - shstr += fileName - shstr += " 2>&1 &" - - #shstr += " > /tmp/" - #shstr += ContainerName - #shstr += ".log 2>&1 &" - - MESSAGE( "SALOME_ContainerPy_i::start_impl " + "os.system(" + str(shstr) + ")" ) - os.system( shstr ) - count = 21 - while container is None : - time.sleep(1) - count = count - 1 - MESSAGE( str(count) + ". Waiting for " + str(theContainer) ) - try : - obj = self._naming_service.Resolve(theContainer) - except : - obj = None - if obj is None: - container = None - else: - container = obj._narrow(Engines.Container) - if container is None: - MESSAGE( str(containerName) + ".object exists but is not a Container" ) - return container - if count == 0 : - return container - - #------------------------------------------------------------------------- - - def instance(self, nameToRegister, componentName): - MESSAGE( "SALOME_ContainerPy_i::instance " + str(nameToRegister) + ' ' + str(componentName) ) - self._numInstance = self._numInstance +1 - instanceName = nameToRegister + "_inst_" + `self._numInstance` - - component=__import__(componentName) - factory=getattr(component,componentName) - comp_i=factory(self._orb, self._poa, self._this(), self._containerName, - instanceName, nameToRegister) - - MESSAGE( "SALOME_ContainerPy_i::instance : component created") - comp_o = comp_i._this() - return comp_o - - #------------------------------------------------------------------------- - - def load_impl(self, nameToRegister, componentName): - MESSAGE( "SALOME_ContainerPy_i::load_impl " + str(nameToRegister) + ' ' + str(componentName) ) - self._numInstance = self._numInstance +1 - instanceName = nameToRegister + "_inst_" + `self._numInstance` - interfaceName = nameToRegister - the_command = "import " + nameToRegister + "\n" - the_command = the_command + "comp_i = " + nameToRegister + "." + nameToRegister - the_command = the_command + "(self._orb, self._poa, self._this(), self._containerName, instanceName, interfaceName)\n" - MESSAGE( "SALOME_ContainerPy_i::load_impl :" + str (the_command) ) - exec the_command - comp_o = comp_i._this() - return comp_o - - #------------------------------------------------------------------------- - - def import_component(self, componentName): - MESSAGE( "SALOME_Container_i::import_component" ) - reason = "" - try: - if verbose(): print "try import %s" % componentName - # try import component - module=__import__(componentName) - if verbose(): print "import %s is done successfully" % componentName - # if import successfully, check that component is loadable - if not hasattr(module, componentName): - reason = "module %s is not loadable" % componentName - print reason - pass - pass - except: - import traceback - print "cannot import %s" % componentName - traceback.print_exc() - reason = "cannot import %s" % componentName - return reason - - #------------------------------------------------------------------------- - - def load_component_Library(self, componentName): - MESSAGE( "SALOME_ContainerPy_i::load_component_Library " + str(componentName) ) - ret = 0 - instanceName = componentName + "_inst_" + `self._numInstance` - interfaceName = componentName - reason = self.import_component(componentName) - return reason == "", reason - - #------------------------------------------------------------------------- - - def create_component_instance_env(self, componentName, studyId, env): - return self.create_component_instance(componentName, studyId), "" - - def create_component_instance(self, componentName, studyId): - MESSAGE( "SALOME_ContainerPy_i::create_component_instance ==> " + str(componentName) + ' ' + str(studyId) ) - if studyId < 0: - MESSAGE( "Study ID is lower than 0!" ) - return None - else: - self._numInstance = self._numInstance +1 - instanceName = componentName + "_inst_" + `self._numInstance` - comp_iors="" - try: - component=__import__(componentName) - factory=getattr(component,componentName) - comp_i=factory(self._orb, - self._poa, - self._this(), - self._containerName, - instanceName, - componentName) - - MESSAGE( "SALOME_Container_i::create_component_instance : OK") - comp_o = comp_i._this() - self._listInstances_map[instanceName] = comp_i - except: - import traceback - traceback.print_exc() - MESSAGE( "SALOME_Container_i::create_component_instance : NOT OK") - return comp_o - - #------------------------------------------------------------------------- - - def find_component_instance(self, registeredName, studyId): - anEngine = None - keysList = self._listInstances_map.keys() - i = 0 - while i < len(keysList): - instance = keysList[i] - if find(instance,registeredName) == 0: - anEngine = self._listInstances_map[instance] - if studyId == anEngine.getStudyId(): - return anEngine._this() - i = i + 1 - return anEngine._this() - - - #------------------------------------------------------------------------- - - def remove_impl(self, component): - MESSAGE( "SALOME_ContainerPy_i::remove_impl" ) - instanceName = component._get_instanceName() - MESSAGE( "unload component " + str(instanceName) ) - self._listInstances_map.remove(instanceName) - component.destroy() - self._naming_service.Destroy_Name(str(instanceName)) - - #------------------------------------------------------------------------- - - def finalize_removal(self): - MESSAGE( "SALOME_ContainerPy_i::finalize_removal" ) - return None - - #------------------------------------------------------------------------- - - def ping(self): - MESSAGE( "SALOME_ContainerPy_i::ping() pid " + str(os.getpid()) ) - return None - - #------------------------------------------------------------------------- - - def getPID(self): - return os.getpid() - - #------------------------------------------------------------------------- - - def _get_name(self): - MESSAGE( "SALOME_ContainerPy_i::_get_name" ) - return self._containerName - - #------------------------------------------------------------------------- - - def getHostName(self): - MESSAGE( "SALOME_ContainerPy_i::_get_MachineName" ) - self._machineName = "localhost" - return self._machineName - - #------------------------------------------------------------------------- - - def _get_machineName(self): - MESSAGE( "SALOME_ContainerPy_i::_get_MachineName" ) - self._machineName = "localhost" - return self._machineName - - #------------------------------------------------------------------------- - - def Shutdown(self): - self._naming_service.Destroy_Name(self._containerName); - self._naming_service.Destroy_FullDirectory(self._containerName); - self._orb.shutdown(0) - pass - - def _get_logfilename(self): - return self._logfilename - def _set_logfilename(self,logfilename): - self._logfilename=logfilename - def _get_workingdir(self): - return os.getcwd() - -#============================================================================= - -if __name__ == "__main__": - # change the stdout buffering to line buffering (same as C++ cout buffering) - sys.stdout=os.fdopen(1,"w",1) - #initialise the ORB and find the root POA - if verbose():print "Starting ",sys.argv[1] - orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID) - poa = orb.resolve_initial_references("RootPOA") - if verbose():print "ORB and POA initialized" - - #create an instance of SALOME_ContainerPy_i and a Container reference - #containerName = "FactoryServerPy" - MESSAGE( str(sys.argv) ) - containerName = sys.argv[1] - cpy_i = SALOME_ContainerPy_i(orb, poa, containerName) - if verbose():print "SALOME_ContainerPy_i instance created ",cpy_i - cpy_o = cpy_i._this() - if verbose():print "SALOME_ContainerPy_i instance activated ",cpy_o - sys.stdout.flush() - sys.stderr.flush() - - #activate the POA - poaManager = poa._get_the_POAManager() - poaManager.activate() - - #Block for ever - orb.run() - if verbose():print "SALOME_ContainerPy_i shutdown" diff --git a/src/DF/CMakeLists.txt b/src/DF/CMakeLists.txt new file mode 100755 index 000000000..013773a91 --- /dev/null +++ b/src/DF/CMakeLists.txt @@ -0,0 +1,50 @@ +# Copyright (C) 2012 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_DIRECTORIES( + ${BOOST_INCLUDE_DIRS} +) + +SET(DF_SOURCES + DF_Attribute.cxx + DF_Label.cxx + DF_Document.cxx + DF_Application.cxx + DF_ChildIterator.cxx + DF_Container.cxx + DF_Attribute.hxx + DF_Label.hxx + DF_Application.hxx + DF_Document.hxx + DF_ChildIterator.hxx + DF_Container.hxx + DF_definitions.hxx +) + +ADD_LIBRARY(DF SHARED ${DF_SOURCES}) +SET_TARGET_PROPERTIES(DF PROPERTIES COMPILE_FLAGS "${BOOST_DEFINITIONS}") +INSTALL(TARGETS DF DESTINATION ${KERNEL_salomelib_LIBS}) + +ADD_EXECUTABLE(testDF testDF.cxx) +SET_TARGET_PROPERTIES(testDF PROPERTIES COMPILE_FLAGS "${BOOST_DEFINITIONS}") +TARGET_LINK_LIBRARIES(testDF DF) +INSTALL(TARGETS testDF DESTINATION ${KERNEL_salomebin_BINS}) + +FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") +INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${KERNEL_salomeinclude_HEADERS}) diff --git a/src/DSC/CMakeLists.txt b/src/DSC/CMakeLists.txt new file mode 100755 index 000000000..97881f53e --- /dev/null +++ b/src/DSC/CMakeLists.txt @@ -0,0 +1,45 @@ +# Copyright (C) 2012 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 +# + +SET(SUBDIRS_COMMON + DSC_Basic +) + +IF(NOT WINDOWS) + SET(SUBDIRS_ADD + DSC_User + DSC_Python + ) +ENDIF(NOT WINDOWS) + +IF(WITH_PACO_PARALLEL) + SET(SUBDIR_PAR + ParallelDSC + ) +ENDIF(WITH_PACO_PARALLEL) + +SET(SUBDIRS + ${SUBDIRS_COMMON} + ${SUBDIRS_ADD} + ${SUBDIR_PAR} +) + +FOREACH(DIR ${SUBDIRS}) + ADD_SUBDIRECTORY(${DIR}) +ENDFOREACH(DIR ${SUBDIRS}) diff --git a/src/DSC/DSC_Basic/CMakeLists.txt b/src/DSC/DSC_Basic/CMakeLists.txt new file mode 100755 index 000000000..2889e0613 --- /dev/null +++ b/src/DSC/DSC_Basic/CMakeLists.txt @@ -0,0 +1,64 @@ +# Copyright (C) 2012 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_DIRECTORIES( + ${PTHREAD_INCLUDE_DIRS} + ${OMNIORB_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR}/salome_adm + ${CMAKE_SOURCE_DIR}/src/Container + ${CMAKE_SOURCE_DIR}/src/GenericObj + ${CMAKE_SOURCE_DIR}/src/Notification + ${CMAKE_SOURCE_DIR}/src/SALOMELocalTrace + ${CMAKE_SOURCE_DIR}/src/Basics + ${CMAKE_SOURCE_DIR}/src/NamingService + ${CMAKE_SOURCE_DIR}/src/Utils + ${CMAKE_BINARY_DIR}/idl +) + +SET(SalomeDSCContainer_SOURCES + DSC_i.cxx + DSC_interface.cxx + PortProperties_i.cxx +) + +ADD_LIBRARY(SalomeDSCContainer SHARED ${SalomeDSCContainer_SOURCES}) +SET_TARGET_PROPERTIES(SalomeDSCContainer PROPERTIES COMPILE_FLAGS "${OMNIORB_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +TARGET_LINK_LIBRARIES(SalomeDSCContainer SalomeContainer ${OMNIORB_LIBS}) +INSTALL(TARGETS SalomeDSCContainer DESTINATION ${KERNEL_salomelib_LIBS}) + +SET(SALOME_ConnectionManagerServer_SOURCES + SALOME_ConnectionManagerServer.cxx + ConnectionManager_i.cxx +) + +SET(SALOME_ConnectionManagerServer_LIBS + SalomeIDLKernel + SalomeNS + SALOMELocalTrace + SalomeContainer + ${OMNIORB_LIBS} +) + +ADD_EXECUTABLE(SALOME_ConnectionManagerServer ${SALOME_ConnectionManagerServer_SOURCES}) +SET_TARGET_PROPERTIES(SALOME_ConnectionManagerServer PROPERTIES COMPILE_FLAGS "${OMNIORB_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +TARGET_LINK_LIBRARIES(SALOME_ConnectionManagerServer ${SALOME_ConnectionManagerServer_LIBS}) +INSTALL(TARGETS SALOME_ConnectionManagerServer DESTINATION ${KERNEL_salomebin_BINS}) + +FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") +INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${KERNEL_salomeinclude_HEADERS}) diff --git a/src/DSC/DSC_Python/CMakeLists.txt b/src/DSC/DSC_Python/CMakeLists.txt new file mode 100755 index 000000000..2b83e1961 --- /dev/null +++ b/src/DSC/DSC_Python/CMakeLists.txt @@ -0,0 +1,67 @@ +# Copyright (C) 2012 CEA/DEN, EDF R&D +# +# 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_PACKAGE(SWIG REQUIRED) +INCLUDE(${SWIG_USE_FILE}) + +SET_SOURCE_FILES_PROPERTIES(calcium.i PROPERTIES CPLUSPLUS ON) +SET(CMAKE_SWIG_FLAGS "-noexcept") +SET_SOURCE_FILES_PROPERTIES(calciumPYTHON_wrap.cxx PROPERTIES COMPILE_FLAGS "${OMNIORB_DEFINITIONS} ${BOOST_DEFINITIONS}") + +INCLUDE_DIRECTORIES( + ${OMNIORB_INCLUDE_DIRS} + ${PYTHON_INCLUDE_DIRS} + ${BOOST_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR}/salome_adm + ${CMAKE_SOURCE_DIR}/src/DSC/DSC_User + ${CMAKE_SOURCE_DIR}/src/DSC/DSC_User/Datastream + ${CMAKE_SOURCE_DIR}/src/DSC/DSC_User/Datastream/Palm + ${CMAKE_SOURCE_DIR}/src/DSC/DSC_User/Datastream/Calcium + ${CMAKE_BINARY_DIR}/src/DSC/DSC_User/Datastream/Calcium + ${CMAKE_SOURCE_DIR}/src/DSC/DSC_User/Basic + ${CMAKE_SOURCE_DIR}/src/DSC/DSC_Basic + ${CMAKE_SOURCE_DIR}/src/SALOMELocalTrace + ${CMAKE_SOURCE_DIR}/src/Basics + ${CMAKE_SOURCE_DIR}/src/Utils + ${CMAKE_SOURCE_DIR}/src/Container + ${CMAKE_SOURCE_DIR}/src/GenericObj + ${CMAKE_SOURCE_DIR}/src/Notification + ${CMAKE_BINARY_DIR}/idl + ) + +SET(_calcium_LIBS + CalciumC + SalomeDatastream + SalomeDSCSupervBasic + SalomeDSCSuperv + SalomeDSCContainer + SalomeContainer + ${CORBA_LIBS} +) + +SWIG_ADD_MODULE(calcium python calcium.i) +SWIG_LINK_LIBRARIES(calcium ${_calcium_LIBS}) +SET_TARGET_PROPERTIES(_calcium PROPERTIES COMPILE_FLAGS "${OMNIORB_DEFINITIONS} ${BOOST_DEFINITIONS}") +INSTALL(TARGETS _calcium DESTINATION ${KERNEL_salomepythondir}) + +SET(SCRIPTS + dsccalcium.py +) +SALOME_INSTALL_SCRIPTS( ${SCRIPTS} ${KERNEL_salomepythondir}) +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/calcium.py DESTINATION ${KERNEL_salomepythondir}) diff --git a/src/DSC/DSC_Python/Makefile.am b/src/DSC/DSC_Python/Makefile.am index db96c558c..071c9e3d3 100644 --- a/src/DSC/DSC_Python/Makefile.am +++ b/src/DSC/DSC_Python/Makefile.am @@ -72,7 +72,7 @@ _calcium_la_LIBADD = ../DSC_User/Datastream/Calcium/libCalciumC.la \ _calcium_la_CPPFLAGS = $(PYTHON_INCLUDES) $(COMMON_CPPFLAGS) -EXTRA_DIST=calcium_wrap.cpp calcium.i +EXTRA_DIST+=calcium_wrap.cpp calcium.i calcium_wrap.cpp calcium.py:calcium.i $(SWIG) $(MY_SWIG_FLAGS) -o calcium_wrap.cpp $< diff --git a/src/DSC/DSC_Python/calcium.i b/src/DSC/DSC_Python/calcium.i index 29a74ffab..5e7e7de73 100644 --- a/src/DSC/DSC_Python/calcium.i +++ b/src/DSC/DSC_Python/calcium.i @@ -888,6 +888,7 @@ int cp_cd(Superv_Component_i *component,char *instanceName); int cp_een(Superv_Component_i *component,int dep,float t,int n,char *nom,int nval,int *eval); int cp_edb(Superv_Component_i *component,int dep,double t,int n,char *nom,int nval,double *eval); int cp_ere(Superv_Component_i *component,int dep,float t,int n,char *nom,int nval,float *eval); +int cp_erd(Superv_Component_i *component,int dep,float t,int n,char *nom,int nval,float *eval); int cp_ecp(Superv_Component_i *component,int dep,float t,int n,char *nom,int nval,float *ecpval); int cp_elo(Superv_Component_i *component,int dep,float t,int n,char *nom,int nval,int *eval); int cp_ech(Superv_Component_i *component,int dep,float t,int n,char *nom,int nval,char** eval,int strSize); @@ -898,6 +899,7 @@ int cp_eln(Superv_Component_i *component,int dep,float t,int n,char *nom,int nv int cp_len(Superv_Component_i *component,int dep,float *ti,float *tf,int *niter,char *nom,int nmax,int *nval,int *lval); int cp_ldb(Superv_Component_i *component,int dep,double *ti,double *tf,int *niter,char *nom,int nmax,int *nval,double *lval); int cp_lre(Superv_Component_i *component,int dep,float *ti,float *tf,int *niter,char *nom,int nmax,int *nval,float *lval); +int cp_lrd(Superv_Component_i *component,int dep,float *ti,float *tf,int *niter,char *nom,int nmax,int *nval,float *lval); int cp_lcp(Superv_Component_i *component,int dep,float *ti,float *tf,int *niter,char *nom,int nmax,int *nval,float *lcpval); int cp_llo(Superv_Component_i *component,int dep,float *ti,float *tf,int *niter,char *nom,int nmax,int *nval,int *lval); int cp_lch(Superv_Component_i *component,int dep,float *ti,float *tf,int *niter,char *nom,int nmax,int *nval,char** lval,int strSize); diff --git a/src/DSC/DSC_User/Basic/CMakeLists.txt b/src/DSC/DSC_User/Basic/CMakeLists.txt new file mode 100755 index 000000000..3a2808cbb --- /dev/null +++ b/src/DSC/DSC_User/Basic/CMakeLists.txt @@ -0,0 +1,45 @@ +# Copyright (C) 2012 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_DIRECTORIES( + ${OMNIORB_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR}/idl + ${CMAKE_BINARY_DIR}/salome_adm + ${CMAKE_SOURCE_DIR}/src/DSC/DSC_Basic + ${CMAKE_SOURCE_DIR}/src/DSC/DSC_User + ${CMAKE_SOURCE_DIR}/src/Container + ${CMAKE_SOURCE_DIR}/src/GenericObj + ${CMAKE_SOURCE_DIR}/src/Notification + ${CMAKE_SOURCE_DIR}/src/SALOMELocalTrace + ${CMAKE_SOURCE_DIR}/src/Basics + ${CMAKE_SOURCE_DIR}/src/Utils) + +SET(SalomeDSCSupervBasic_SOURCES + basic_port_factory.cxx + data_short_port_uses.cxx + data_short_port_provides.cxx +) + +ADD_LIBRARY(SalomeDSCSupervBasic SHARED ${SalomeDSCSupervBasic_SOURCES}) +SET_TARGET_PROPERTIES(SalomeDSCSupervBasic PROPERTIES COMPILE_FLAGS "${OMNIORB_DEFINITIONS}") +TARGET_LINK_LIBRARIES(SalomeDSCSupervBasic SalomeDSCSuperv) +INSTALL(TARGETS SalomeDSCSupervBasic DESTINATION ${KERNEL_salomelib_LIBS}) + +FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") +INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${KERNEL_salomeinclude_HEADERS}) diff --git a/src/DSC/DSC_User/CMakeLists.txt b/src/DSC/DSC_User/CMakeLists.txt new file mode 100755 index 000000000..779f14330 --- /dev/null +++ b/src/DSC/DSC_User/CMakeLists.txt @@ -0,0 +1,58 @@ +# Copyright (C) 2012 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(Basic) +ADD_SUBDIRECTORY(Datastream) + +INCLUDE_DIRECTORIES( + ${BOOST_INCLUDE_DIRS} + ${OMNIORB_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR}/salome_adm + ${CMAKE_SOURCE_DIR}/src/Container + ${CMAKE_SOURCE_DIR}/src/GenericObj + ${CMAKE_SOURCE_DIR}/src/Notification + ${CMAKE_SOURCE_DIR}/src/DSC/DSC_Basic + ${CMAKE_SOURCE_DIR}/src/SALOMELocalTrace + ${CMAKE_SOURCE_DIR}/src/Basics + ${CMAKE_SOURCE_DIR}/src/Utils + ${CMAKE_BINARY_DIR}/idl +) + +SET(COMMON_FLAGS + ${OMNIORB_DEFINITIONS} + ${BOOST_DEFINITIONS} +) +SET(SalomeDSCSuperv_SOURCES + base_port.cxx + uses_port.cxx + provides_port.cxx + Superv_Component_i.cxx +) + +ADD_LIBRARY(SalomeDSCSuperv SHARED ${SalomeDSCSuperv_SOURCES}) +SET_TARGET_PROPERTIES(SalomeDSCSuperv PROPERTIES COMPILE_FLAGS "${COMMON_FLAGS} ${PLATFORM_DEFINITIONS}") +TARGET_LINK_LIBRARIES(SalomeDSCSuperv SalomeDSCContainer ${PLATFORM_LIBS}) +INSTALL(TARGETS SalomeDSCSuperv DESTINATION ${KERNEL_salomelib_LIBS}) + +ADD_EXECUTABLE(test_DSC_Exception test_DSC_Exception.cxx) +SET_TARGET_PROPERTIES(test_DSC_Exception PROPERTIES COMPILE_FLAGS "${COMMON_FLAGS} ${PLATFORM_DEFINITIONS}") +TARGET_LINK_LIBRARIES(test_DSC_Exception OpUtil SALOMELocalTrace ${OMNIORB_FLAGS} ${PLATFORM_LIBS}) + +FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") +INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${KERNEL_salomeinclude_HEADERS}) diff --git a/src/DSC/DSC_User/Datastream/CMakeLists.txt b/src/DSC/DSC_User/Datastream/CMakeLists.txt new file mode 100755 index 000000000..99c0dac48 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/CMakeLists.txt @@ -0,0 +1,58 @@ +# Copyright (C) 2012 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(Palm) +ADD_SUBDIRECTORY(Calcium) + +INCLUDE_DIRECTORIES( + ${BOOST_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR}/salome_adm + ${CMAKE_SOURCE_DIR}/src/DSC/DSC_User + ${CMAKE_BINARY_DIR}/src/DSC/DSC_User/Datastream/Palm + ${CMAKE_BINARY_DIR}/src/DSC/DSC_User/Datastream/Calcium + ${CMAKE_CURRENT_SOURCE_DIR}/.. +) + +# This local variable defines the list of dependant libraries common to all target in this package. +SET(COMMON_LIBS + SalomePalm + SalomeCalcium + SalomeDSCSuperv +) + +ADD_LIBRARY(SalomeDatastream SHARED fake.cc) +SET_TARGET_PROPERTIES(SalomeDatastream PROPERTIES COMPILE_FLAGS "${BOOST_DEFINITIONS}") +TARGET_LINK_LIBRARIES(SalomeDatastream ${COMMON_LIBS}) +INSTALL(TARGETS SalomeDatastream DESTINATION ${KERNEL_salomelib_LIBS}) + +SET(COMMON_HEADERS_HXX + AdjacentFunctor.hxx + ConstTraits.hxx + CorbaTypeManipulator.hxx + CouplingPolicy.hxx + DataIdFilter.hxx + DisplayPair.hxx + FindKeyPredicate.hxx + GenericPort.hxx + GenericProvidesPort.hxx + GenericUsesPort.hxx + IteratorTraits.hxx +) + +INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${KERNEL_salomeinclude_HEADERS}) diff --git a/src/DSC/DSC_User/Datastream/Calcium/CMakeLists.txt b/src/DSC/DSC_User/Datastream/Calcium/CMakeLists.txt new file mode 100755 index 000000000..f0613a763 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/CMakeLists.txt @@ -0,0 +1,114 @@ +# Copyright (C) 2012 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_DIRECTORIES( + ${BOOST_INCLUDE_DIRS} + ${OMNIORB_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}/salome_adm + ${CMAKE_SOURCE_DIR}/src/DSC/DSC_User + ${CMAKE_SOURCE_DIR}/src/DSC/DSC_User/Datastream + ${CMAKE_SOURCE_DIR}/src/DSC/DSC_User/Datastream/Palm + ${CMAKE_SOURCE_DIR}/src/DSC/DSC_User/Datastream/Calcium + ${CMAKE_SOURCE_DIR}/src/DSC/DSC_User/Basic + ${CMAKE_SOURCE_DIR}/src/DSC/DSC_Basic + ${CMAKE_SOURCE_DIR}/src/SALOMELocalTrace + ${CMAKE_SOURCE_DIR}/src/Basics + ${CMAKE_SOURCE_DIR}/src/Utils + ${CMAKE_SOURCE_DIR}/src/Container + ${CMAKE_SOURCE_DIR}/src/GenericObj + ${CMAKE_SOURCE_DIR}/src/Notification + ${CMAKE_BINARY_DIR}/idl + ${CMAKE_BINARY_DIR}/src/DSC/DSC_User/Datastream/Calcium +) + +SET(SalomeCalcium_SOURCES + calcium_port_factory.cxx + calcium_uses_port.cxx + calcium_provides_port.cxx + calcium_repository_types.cxx + CalciumCouplingPolicy.cxx + CorbaTypes2CalciumTypes.cxx + CalciumCxxInterface.cxx + CalciumTypes2CorbaTypes.cxx + CalciumCInterface.cxx + CalciumProvidesPort.cxx + Calcium.cxx + calcium_destructors_port_uses.cxx +) +ADD_LIBRARY(SalomeCalcium SHARED ${SalomeCalcium_SOURCES}) +SET_TARGET_PROPERTIES(SalomeCalcium PROPERTIES COMPILE_FLAGS "${BOOST_DEFINITIONS} ${OMNIORB_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +TARGET_LINK_LIBRARIES(SalomeCalcium ${PTHREAD_LIBS} ${CORBA_LIBS} ${PLATFORM_LIBS}) + +SET(CalciumC_SOURCES + CalciumC.c + Calcium.cxx + calciumf.c +) +ADD_LIBRARY(CalciumC SHARED ${CalciumC_SOURCES}) +SET_TARGET_PROPERTIES(CalciumC PROPERTIES COMPILE_FLAGS "${BOOST_DEFINITIONS} ${OMNIORB_DEFINITIONS} ${PLATFORM_DEFINITIONS}") + +INSTALL(TARGETS CalciumC DESTINATION ${KERNEL_salomelib_LIBS}) + +ADD_EXECUTABLE(test_DataIdContainer test_DataIdContainer.cxx) +SET_TARGET_PROPERTIES(test_DataIdContainer PROPERTIES COMPILE_FLAGS "${BOOST_DEFINITIONS} ${OMNIORB_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +TARGET_LINK_LIBRARIES(test_DataIdContainer SalomeDSCSuperv SalomeContainer SalomeCalcium OpUtil SALOMELocalTrace ${CORBA_LIBS} ${PLATFORM_LIBS}) + +CONFIGURE_FILE(calcium_integer_port_uses.hxx.in calcium_integer_port_uses.hxx @ONLY) +CONFIGURE_FILE(CalciumProvidesPort.hxx.in CalciumProvidesPort.hxx @ONLY) +CONFIGURE_FILE(CalciumFortranInt.h.in CalciumFortranInt.h @ONLY) + +SET(COMMON_HEADERS + Calcium.hxx + CalciumCInterface.hxx + CalciumCouplingPolicy.hxx + CalciumCxxInterface.hxx + CalciumException.hxx + CalciumGenericProvidesPort.hxx + CalciumGenericUsesPort.hxx + CalciumInterface.hxx + CalciumMacroCInterface.hxx + CalciumPortTraits.hxx + CalciumTypes.hxx + CalciumTypes2CorbaTypes.hxx + Copy2CorbaSpace.hxx + Copy2UserSpace.hxx + CorbaTypes2CalciumTypes.hxx + calcium_complex_port_uses.hxx + calcium_double_port_uses.hxx + calcium_intc_port_uses.hxx + calcium_logical_port_uses.hxx + calcium_long_port_uses.hxx + calcium_port_factory.hxx + calcium_provides_port.hxx + calcium_real_port_uses.hxx + calcium_string_port_uses.hxx + calcium_uses_port.hxx + calcium.h + calcium.hf + calciumE.h + calciumP.h + calciumf.h + fortoc.h + version.h + ${CMAKE_CURRENT_BINARY_DIR}/CalciumFortranInt.h + ${CMAKE_CURRENT_BINARY_DIR}/CalciumProvidesPort.hxx + ${CMAKE_CURRENT_BINARY_DIR}/calcium_integer_port_uses.hxx +) +INSTALL(FILES ${COMMON_HEADERS} DESTINATION ${KERNEL_salomeinclude_HEADERS}) diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumC.c b/src/DSC/DSC_User/Datastream/Calcium/CalciumC.c index 24a766e73..105c2a93b 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/CalciumC.c +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumC.c @@ -120,12 +120,16 @@ void ecp_lch_free (char* * data) { \ /*REVERIFIER MAINTENANT 0 COPY avec int2integer*/ CALCIUM_EXT_LECT_INTERFACE_C_(len,float,int,int2integer,); CALCIUM_EXT_LECT_INTERFACE_C_(lre,float,float,float,); +/*Permet d'envoyer/recevoir des réels sur un port Double */ +CALCIUM_EXT_LECT_INTERFACE_C_(lrd,float ,float ,float2double,); CALCIUM_EXT_LECT_INTERFACE_C_(ldb,double,double,double,); + CALCIUM_EXT_LECT_INTERFACE_C_(llo,float,int,bool,); CALCIUM_EXT_LECT_INTERFACE_C_(lcp,float,float,cplx,); /* CALCIUM_EXT_LECT_INTERFACE_C_(lch,float,char,STAR[]); */ + /**************************************/ /* INTERFACES DE LECTURE AVEC RECOPIE */ /**************************************/ @@ -204,7 +208,10 @@ CALCIUM_LECT_INTERFACE_C_(llg,float ,int,long ,long2integer,,); CALCIUM_LECT_INTERFACE_C_(lln,float ,int,long ,long,,); CALCIUM_LECT_INTERFACE_C_(lre,float ,int,float ,float,,); +/*Permet d'envoyer/recevoir des réels sur un port Double */ +CALCIUM_LECT_INTERFACE_C_(lrd,float ,int,float ,float2double,,); CALCIUM_LECT_INTERFACE_C_(ldb,double,int,double ,double,,); + CALCIUM_LECT_INTERFACE_C_(llo,float ,int,int ,bool,,); CALCIUM_LECT_INTERFACE_C_(lcp,float ,int,float ,cplx,,); #define STAR * @@ -222,6 +229,7 @@ CALCIUM_LECT_INTERFACE_C_(lin_fort_,float ,cal_int,int ,int2integer,,); CALCIUM_LECT_INTERFACE_C_(llg_fort_,float ,cal_int,long ,long2integer,,); CALCIUM_LECT_INTERFACE_C_(lre_fort_,float ,cal_int,float ,float,,); +CALCIUM_LECT_INTERFACE_C_(lrd_fort_,float ,cal_int,float ,float2double,,); CALCIUM_LECT_INTERFACE_C_(ldb_fort_,double,cal_int,double ,double,,); CALCIUM_LECT_INTERFACE_C_(llo_fort_,float ,cal_int,int ,bool,,); /*int pour bool ou cal_int */ CALCIUM_LECT_INTERFACE_C_(lcp_fort_,float ,cal_int,float ,cplx,,); @@ -305,7 +313,10 @@ CALCIUM_ECR_INTERFACE_C_(een,float ,int,int ,int2integer,,); sinon problème de conversion de 64bits vers 32bits */ CALCIUM_ECR_INTERFACE_C_(elg,float ,int,long ,long2integer,,); CALCIUM_ECR_INTERFACE_C_(ere,float ,int,float ,float,,); +/*Permet d'envoyer/recevoir des réels sur un port Double */ +CALCIUM_ECR_INTERFACE_C_(erd,float ,int,float ,float2double,,); CALCIUM_ECR_INTERFACE_C_(edb,double,int,double,double,,); + CALCIUM_ECR_INTERFACE_C_(elo,float ,int,int ,bool,,); CALCIUM_ECR_INTERFACE_C_(ecp,float ,int,float ,cplx,,); CALCIUM_ECR_INTERFACE_C_(ech,float ,int,char ,str,STAR,LCH_LAST_PARAM ); @@ -321,6 +332,7 @@ CALCIUM_ECR_INTERFACE_C_(een_fort_,float ,cal_int,cal_int,integer,,); CALCIUM_ECR_INTERFACE_C_(elg_fort_,float ,cal_int,long ,long2integer,,); CALCIUM_ECR_INTERFACE_C_(ein_fort_,float ,cal_int,int ,int2integer,,); CALCIUM_ECR_INTERFACE_C_(ere_fort_,float ,cal_int,float ,float,,); +CALCIUM_ECR_INTERFACE_C_(erd_fort_,float ,cal_int,float ,float2double,,); CALCIUM_ECR_INTERFACE_C_(edb_fort_,double,cal_int,double,double,,); CALCIUM_ECR_INTERFACE_C_(elo_fort_,float ,cal_int,int ,bool,,); CALCIUM_ECR_INTERFACE_C_(ecp_fort_,float ,cal_int,float ,cplx,,); diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumCInterface.cxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumCInterface.cxx index a9974edcf..107e5f479 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/CalciumCInterface.cxx +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumCInterface.cxx @@ -66,6 +66,9 @@ CALCIUM_C2CPP_INTERFACE_CXX_(long2integer, integer, long,); CALCIUM_C2CPP_INTERFACE_CXX_(float,float,float, ); CALCIUM_C2CPP_INTERFACE_CXX_(double,double,double,); + +CALCIUM_C2CPP_INTERFACE_CXX_(float2double,double,float, ); + /* Fonnctionne mais essai suivant pour simplification de Calcium.c CALCIUM_C2CPP_INTERFACE_(bool,bool,);*/ CALCIUM_C2CPP_INTERFACE_CXX_(bool,bool,int,); CALCIUM_C2CPP_INTERFACE_CXX_(cplx,cplx,float,); diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumCInterface.hxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumCInterface.hxx index e6eca1ae3..84e117aba 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/CalciumCInterface.hxx +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumCInterface.hxx @@ -80,6 +80,9 @@ CALCIUM_C2CPP_INTERFACE_HXX_(long2integer,integer, long,); CALCIUM_C2CPP_INTERFACE_HXX_(float,float,float, ); CALCIUM_C2CPP_INTERFACE_HXX_(double,double,double,); + +CALCIUM_C2CPP_INTERFACE_HXX_(float2double,double,float, ); + /* Fonctionne mais essai suivant pour simplification de Calcium.c CALCIUM_C2CPP_INTERFACE_(bool,bool,);*/ CALCIUM_C2CPP_INTERFACE_HXX_(bool,bool,int,); CALCIUM_C2CPP_INTERFACE_HXX_(cplx,cplx,float,); diff --git a/src/DSC/DSC_User/Datastream/Calcium/Makefile.am b/src/DSC/DSC_User/Datastream/Calcium/Makefile.am index deff2298c..0e12027b3 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/Makefile.am +++ b/src/DSC/DSC_User/Datastream/Calcium/Makefile.am @@ -66,7 +66,7 @@ salomeinclude_HEADERS = calcium_port_factory.hxx \ nodist_salomeinclude_HEADERS = calcium_integer_port_uses.hxx CalciumProvidesPort.hxx CalciumFortranInt.h -EXTRA_DIST=fortoc.h calcium_integer_port_uses.hxx.in CalciumProvidesPort.hxx.in CalciumFortranInt.h.in +EXTRA_DIST+=fortoc.h calcium_integer_port_uses.hxx.in CalciumProvidesPort.hxx.in CalciumFortranInt.h.in calcium_integer_port_uses.hxx: calcium_integer_port_uses.hxx.in CalciumProvidesPort.hxx : CalciumProvidesPort.hxx.in diff --git a/src/DSC/DSC_User/Datastream/Calcium/calcium.h b/src/DSC/DSC_User/Datastream/Calcium/calcium.h index f103fe937..4a43be266 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/calcium.h +++ b/src/DSC/DSC_User/Datastream/Calcium/calcium.h @@ -169,6 +169,29 @@ extern int cp_lre( #endif ); +extern int cp_lrd( +/* ------ */ +#if CPNeedPrototype + void * component /* Pointeur de type Superv_Component_i* sur le */ + /* composant SALOME Supervisable */, + int /* E Type de dependance ou de lecture */ + /* CP_TEMPS, CP_ITERATION, CP_SEQUENTIEL */, + float * /* E/S Borne inf de l'intervalle de lecture */ + /* Retourne le pas lu dans le cas de */ + /* lecture sequentielle */, + float * /* E Borne Sup de l'intervalle de lecture */, + int * /* E/S Pas d'iteration a lire */ + /* Retourne le pas lu dans le cas de */ + /* lecture sequentielle */, + char * /* E Nom de la variable a lire */, + int /* E Nombre max de valeurs a lire */, + int * /* S Nombre de valeurs rellement lues */, + float * /* S Tableau de flottants pour stocker les */ + /* valeurs lues */ +#endif +); + + extern int cp_ldb( /* ------ */ #if CPNeedPrototype @@ -470,6 +493,22 @@ extern int cp_ere( #endif ); +extern int cp_erd( +/* ------ */ +#if CPNeedPrototype + void * component /* Pointeur de type Superv_Component_i* sur le */ + /* composant SALOME Supervisable */, + int /* E Type de dependance */ + /* CP_TEMPS, CP_ITERATION */, + float /* E Pas de temps a ecrire */, + int /* E Pas d'iteration a ecrire */, + char * /* E Nom de la variable a ecrire */, + int /* E Nombre de valeurs a ecrire */, + float * /* E Tableau de flottants a ecrire */ +#endif +); + + extern int cp_edb( /* ------ */ #if CPNeedPrototype diff --git a/src/DSC/DSC_User/Datastream/Calcium/calciumf.c b/src/DSC/DSC_User/Datastream/Calcium/calciumf.c index 5b63bb3e2..e01915c73 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/calciumf.c +++ b/src/DSC/DSC_User/Datastream/Calcium/calciumf.c @@ -155,6 +155,8 @@ void F_FUNC(cpldb,CPLDB)(long *compo,cal_int *dep,double *ti,double *tf,cal_int cal_int *max,cal_int *n, double *tab,cal_int *err STR_PLEN(nom)); void F_FUNC(cplre,CPLRE)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom), cal_int *max,cal_int *n, float *tab,cal_int *err STR_PLEN(nom)); +void F_FUNC(cplrd,CPLRD)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom), + cal_int *max,cal_int *n, double *tab,cal_int *err STR_PLEN(nom)); void F_FUNC(cplcp,CPLCP)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom), cal_int *max,cal_int *n, float *tab,cal_int *err STR_PLEN(nom)); void F_FUNC(cplch,CPLCH)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom), @@ -241,6 +243,14 @@ void F_FUNC(cplre,CPLRE)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *i free_str1(cnom); } +void F_FUNC(cplrd,CPLRD)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom), + cal_int *max,cal_int *n, double *tab,cal_int *err STR_PLEN(nom)) +{ + char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom)); + *err=cp_lrd_fort_((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,(float *)tab); + free_str1(cnom); +} + void F_FUNC(cplcp,CPLCP)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom), cal_int *max,cal_int *n, float *tab,cal_int *err STR_PLEN(nom)) { @@ -289,6 +299,7 @@ void F_FUNC(cpech,CPECH)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PS STR_PLEN(nom) STR_PLEN(tab)); void F_FUNC(cpedb,CPEDB)(long *compo,cal_int *dep,double *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, double *tab,cal_int *err STR_PLEN(nom)); void F_FUNC(cpere,CPERE)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, float *tab,cal_int *err STR_PLEN(nom)); +void F_FUNC(cperd,CPERD)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, double *tab,cal_int *err STR_PLEN(nom)); void F_FUNC(cpecp,CPECP)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, float *tab,cal_int *err STR_PLEN(nom)); void F_FUNC(cpein,CPEIN)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, int *tab,cal_int *err STR_PLEN(nom)); void F_FUNC(cpelg,CPELG)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, long *tab,cal_int *err STR_PLEN(nom)); @@ -347,6 +358,15 @@ void F_FUNC(cpere,CPERE)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PS free_str1(cnom); } +void F_FUNC(cperd,CPERD)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, double *tab,cal_int *err STR_PLEN(nom)) +{ + float tti=0.; + if(*dep == CP_TEMPS)tti=*ti; + char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom)); + *err=cp_erd_fort_((void *)*compo,*dep,tti,*iter,cnom,*n,(float *)tab); + free_str1(cnom); +} + void F_FUNC(cpecp,CPECP)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, float *tab,cal_int *err STR_PLEN(nom)) { float tti=0.; diff --git a/src/DSC/DSC_User/Datastream/Calcium/calciumf.h b/src/DSC/DSC_User/Datastream/Calcium/calciumf.h index da9574643..07f110137 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/calciumf.h +++ b/src/DSC/DSC_User/Datastream/Calcium/calciumf.h @@ -47,6 +47,7 @@ CALCIUM_ECR_INTERFACE_C_H(elg_fort_,float ,cal_int,long ,long2integer,,); CALCIUM_ECR_INTERFACE_C_H(eln_fort_,float ,cal_int,long ,long,,); CALCIUM_ECR_INTERFACE_C_H(ein_fort_,float ,cal_int,int ,int2integer,,); CALCIUM_ECR_INTERFACE_C_H(ere_fort_,float ,cal_int,float ,float,,); +CALCIUM_ECR_INTERFACE_C_H(erd_fort_,float ,cal_int,float ,float2double,,); CALCIUM_ECR_INTERFACE_C_H(edb_fort_,double,cal_int,double,double,,); CALCIUM_ECR_INTERFACE_C_H(elo_fort_,float ,cal_int,int ,bool,,); /*int pour bool ou cal_int */ CALCIUM_ECR_INTERFACE_C_H(ecp_fort_,float ,cal_int,float ,cplx,,); @@ -69,6 +70,7 @@ CALCIUM_LECT_INTERFACE_C_H(llg_fort_,float ,cal_int,long ,long2integer,,); CALCIUM_LECT_INTERFACE_C_H(lln_fort_,float ,cal_int,long ,long,,); CALCIUM_LECT_INTERFACE_C_H(lin_fort_,float ,cal_int,int ,int2integer,,); CALCIUM_LECT_INTERFACE_C_H(lre_fort_,float ,cal_int,float ,float,,); +CALCIUM_LECT_INTERFACE_C_H(lrd_fort_,float ,cal_int,float ,float2double,,); CALCIUM_LECT_INTERFACE_C_H(ldb_fort_,double,cal_int,double ,double,,); CALCIUM_LECT_INTERFACE_C_H(llo_fort_,float ,cal_int,int ,bool,,); /*int pour bool ou cal_int */ CALCIUM_LECT_INTERFACE_C_H(lcp_fort_,float ,cal_int,float ,cplx,,); diff --git a/src/DSC/DSC_User/Datastream/Palm/CMakeLists.txt b/src/DSC/DSC_User/Datastream/Palm/CMakeLists.txt new file mode 100755 index 000000000..4976d94df --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Palm/CMakeLists.txt @@ -0,0 +1,44 @@ +# Copyright (C) 2012 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_DIRECTORIES( + ${OMNIORB_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR}/salome_adm + ${CMAKE_SOURCE_DIR}/src/DSC/DSC_User + ${CMAKE_SOURCE_DIR}/src/DSC/DSC_User/Datastream + ${CMAKE_SOURCE_DIR}/src/DSC/DSC_Basic + ${CMAKE_SOURCE_DIR}/src/Container + ${CMAKE_SOURCE_DIR}/src/GenericObj + ${CMAKE_SOURCE_DIR}/src/Notification + ${CMAKE_SOURCE_DIR}/src/SALOMELocalTrace + ${CMAKE_SOURCE_DIR}/src/Basics + ${CMAKE_SOURCE_DIR}/src/Utils + ${CMAKE_BINARY_DIR}/idl +) + +ADD_LIBRARY(SalomePalm SHARED palm_port_factory.cxx) +SET_TARGET_PROPERTIES(SalomePalm PROPERTIES COMPILE_FLAGS "${OMNIORB_DEFINITIONS}") + +ADD_EXECUTABLE(test_DataIdContainer test_DataIdContainer.cxx) +SET_TARGET_PROPERTIES(test_DataIdContainer PROPERTIES COMPILE_FLAGS "${OMNIORB_DEFINITIONS}") +TARGET_LINK_LIBRARIES(test_DataIdContainer ${OMNIORB_LIBS}) + +FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") +INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${KERNEL_salomeinclude_HEADERS}) + diff --git a/src/DSC/Makefile.am b/src/DSC/Makefile.am index e182b2dc8..e2f44cabb 100644 --- a/src/DSC/Makefile.am +++ b/src/DSC/Makefile.am @@ -24,6 +24,8 @@ # Author : André RIBES (EDF) # Module : KERNEL # +include $(top_srcdir)/salome_adm/unix/make_common_starter.am + SUBDIRS_COMMON = DSC_Basic if !WINDOWS @@ -36,6 +38,6 @@ endif SUBDIRS = $(SUBDIRS_COMMON) $(SUBDIRS_ADD) $(SUBDIR_PAR) -EXTRA_DIST= DSC.dox +EXTRA_DIST+= DSC.dox DIST_SUBDIRS = DSC_Basic DSC_User DSC_Python ParallelDSC diff --git a/src/DSC/ParallelDSC/CMakeLists.txt b/src/DSC/ParallelDSC/CMakeLists.txt new file mode 100755 index 000000000..bb64c8313 --- /dev/null +++ b/src/DSC/ParallelDSC/CMakeLists.txt @@ -0,0 +1,54 @@ +# Copyright (C) 2012 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_DIRECTORIES( + ${MPI_INCLUDE_DIRS} + ${PACO_INCLUDE_DIRS} + ${OMNIORB_INCLUDE_DIRS} + ${CMAKE_SOURCE_DIR}/src/Container + ${CMAKE_SOURCE_DIR}/src/ParallelContainer + ${CMAKE_SOURCE_DIR}/src/Notification + ${CMAKE_SOURCE_DIR}/src/SALOMELocalTrace + ${CMAKE_SOURCE_DIR}/src/Basics + ${CMAKE_SOURCE_DIR}/src/NamingService + ${CMAKE_SOURCE_DIR}/src/Utils + ${CMAKE_SOURCE_DIR}/src/DSC/DSC_Basic + ${CMAKE_SOURCE_DIR}/src/GenericObj + ${CMAKE_BINARY_DIR}/idl + ${CMAKE_SOURCE_DIR}/src/Registry + ${CMAKE_SOURCE_DIR}/src/Utils +) + +SET(COMMON_FLAGS + ${OMNIORB_DEFINITIONS} + ${MPI_DEFINITIONS} + ${PACO_DEFINITIONS} +) +SET(SalomeParallelDSCContainer_SOURCES + ParallelDSC_i.cxx + Param_Double_Port_provides_i.cxx + Param_Double_Port_uses_i.cxx +) + +ADD_LIBRARY(SalomeParallelDSCContainer SHARED ${SalomeParallelDSCContainer_SOURCES}) +SET_TARGET_PROPERTIES(SalomeParallelDSCContainer PROPERTIES COMPILE_FLAGS "${COMMON_FLAGS}") +INSTALL(TARGETS SalomeParallelDSCContainer DESTINATION ${KERNEL_salomelib_LIBS}) + +FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") +INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${KERNEL_salomeinclude_HEADERS}) diff --git a/src/GenericObj/CMakeLists.txt b/src/GenericObj/CMakeLists.txt new file mode 100755 index 000000000..203be8e04 --- /dev/null +++ b/src/GenericObj/CMakeLists.txt @@ -0,0 +1,35 @@ +# Copyright (C) 2012 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_DIRECTORIES( + ${OMNIORB_INCLUDE_DIRS} + ${PTHREAD_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR}/salome_adm + ${CMAKE_CURRENT_SOURCE_DIR}/../Basics + ${CMAKE_CURRENT_SOURCE_DIR}/../SALOMELocalTrace + ${CMAKE_BINARY_DIR}/idl +) + +ADD_LIBRARY(SalomeGenericObj SHARED SALOME_GenericObj_i.cc) +SET_TARGET_PROPERTIES(SalomeGenericObj PROPERTIES COMPILE_FLAGS "${OMNIORB_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +TARGET_LINK_LIBRARIES(SalomeGenericObj SALOMELocalTrace SalomeIDLKernel) +INSTALL(TARGETS SalomeGenericObj DESTINATION ${KERNEL_salomelib_LIBS}) + +INSTALL(FILES SALOME_GenericObj_i.hh DESTINATION ${KERNEL_salomeinclude_HEADERS}) + diff --git a/src/HDFPersist/CMakeLists.txt b/src/HDFPersist/CMakeLists.txt new file mode 100755 index 000000000..30aef7f00 --- /dev/null +++ b/src/HDFPersist/CMakeLists.txt @@ -0,0 +1,84 @@ +# Copyright (C) 2012 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_DIRECTORIES( + ${HDF5_INCLUDE_DIRS} +) + +SET(SalomeHDFPersist_SOURCES + HDFfileCreate.c + HDFfileClose.c + HDFfileOpen.c + HDFfileMount.c + HDFfileUmount.c + HDFgroupCreate.c + HDFgroupOpen.c + HDFgroupClose.c + HDFdatasetOpen.c + HDFdatasetClose.c + HDFdatasetCreate.c + HDFdatasetWrite.c + HDFdatasetRead.c + HDFdatasetGetDim.c + HDFdatasetGetSize.c + HDFdatasetGetType.c + HDFdatasetGetnDim.c + HDFdatasetGetOrder.c + HDFarrayGetType.c + HDFarrayGetTypeId.c + HDFarrayCreate.c + HDFarrayClose.c + HDFarrayGetnDim.c + HDFarrayGetDim.c + HDFattrOpen.c + HDFattrClose.c + HDFattrWrite.c + HDFattrCreate.c + HDFattrRead.c + HDFattrGetType.c + HDFattrGetSize.c + HDFerrorModeLock.c + HDFnObjects.c + HDFobjectIdentify.c + HDFobjectType.c + HDFobject.cc + HDFarray.cc + HDFinternalObject.cc + HDFattribute.cc + HDFcontainerObject.cc + HDFdataset.cc + HDFfile.cc + HDFgroup.cc + HDFexplorer.cc + HDFconvert.cc + HDFascii.cc +) + +ADD_LIBRARY(SalomeHDFPersist SHARED ${SalomeHDFPersist_SOURCES}) +SET_TARGET_PROPERTIES(SalomeHDFPersist PROPERTIES COMPILE_FLAGS "-D${MACHINE} ${HDF5_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +TARGET_LINK_LIBRARIES(SalomeHDFPersist ${HDF5_LIBS} ${PLATFORM_LIBS}) +INSTALL(TARGETS SalomeHDFPersist DESTINATION ${KERNEL_salomelib_LIBS}) + +FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") +FILE(GLOB COMMON_HEADERS_H "${CMAKE_CURRENT_SOURCE_DIR}/*.h") +SET(COMMON_HEADERS + ${COMMON_HEADERS_HXX} + ${COMMON_HEADERS_H} +) +INSTALL(FILES ${COMMON_HEADERS} DESTINATION ${KERNEL_salomeinclude_HEADERS}) diff --git a/src/HDFPersist/HDFascii.cc b/src/HDFPersist/HDFascii.cc index cc08ea933..c8fd3acfd 100644 --- a/src/HDFPersist/HDFascii.cc +++ b/src/HDFPersist/HDFascii.cc @@ -408,7 +408,7 @@ char* HDFascii::ConvertFromASCIIToHDF(const char* thePath, fscanf(fp, "%s", id_of_end); if(strcmp(id_of_end, ASCIIHDF_ID_END) != 0) { std::cout << "ConvertFromASCIIToHDF : Can not find the end ASCII token " << std::endl; - return false; + return NULL; } hdf_file->CloseOnDisk(); diff --git a/src/HDFPersist/Makefile.am b/src/HDFPersist/Makefile.am index dd302fb1d..d65b85edd 100644 --- a/src/HDFPersist/Makefile.am +++ b/src/HDFPersist/Makefile.am @@ -102,7 +102,7 @@ libSalomeHDFPersist_la_CPPFLAGS = @HDF5_INCLUDES@ -D@MACHINE@ libSalomeHDFPersist_la_LIBADD = @HDF5_LIBS@ -EXTRA_DIST = \ +EXTRA_DIST += \ test1.c \ test2.c \ test3.cxx \ diff --git a/src/KERNEL_PY/CMakeLists.txt b/src/KERNEL_PY/CMakeLists.txt new file mode 100755 index 000000000..676b5842e --- /dev/null +++ b/src/KERNEL_PY/CMakeLists.txt @@ -0,0 +1,49 @@ +# Copyright (C) 2012 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(kernel) + +SET(salomepython_PYTHON + salome_shared_modules.py + import_hook.py + omnipatch.py +) + +IF(CORBA_GEN) + SET(salomepython_PYTHON + ${salomepython_PYTHON} + Help.py + PyInterp.py + batchmode_salome.py + salome_test.py + salome_kernel.py + salome_study.py + salome_iapp.py + salome_ComponentGUI.py + iparameters.py + salome_version.py + salome_notebook.py + salome_pynode.py + salome_genericobj.py + ) +ENDIF(CORBA_GEN) + +SALOME_INSTALL_SCRIPTS("${salomepython_PYTHON}" ${KERNEL_salomepythondir}) +SALOME_INSTALL_SCRIPTS(kernel_shared_modules.py ${KERNEL_sharedpkgpython_PYTHON}) +SALOME_INSTALL_SCRIPTS(__init__.py ${KERNEL_salomepythondir}/salome) diff --git a/src/KERNEL_PY/kernel/CMakeLists.txt b/src/KERNEL_PY/kernel/CMakeLists.txt new file mode 100755 index 000000000..40ac0b228 --- /dev/null +++ b/src/KERNEL_PY/kernel/CMakeLists.txt @@ -0,0 +1,49 @@ +# Copyright (C) 2012 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(parametric) + +CONFIGURE_FILE(logconfig.py.in logconfig.py @ONLY) +CONFIGURE_FILE(kernelpy_autotest.sh.in kernelpy_autotest.sh @ONLY) + +# This first set of modules could be used in any context, you just +# have to get a python environement. +SET(mypkgpython_PYTHON + __init__.py + deprecation.py + logger.py + termcolor.py + unittester.py + pyunittester.py + enumerate.py + uiexception.py + datamodeler.py + testdata.py + diclookup.py + threadhelper.py + syshelper.py +) +# This set of modules required a running SALOME application. +SET(mypkgpython_PYTHON + ${mypkgpython_PYTHON} + studyedit.py + services.py +) +SALOME_INSTALL_SCRIPTS("${mypkgpython_PYTHON}" ${KERNEL_salomepythondir}/salome/kernel) +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/logconfig.py DESTINATION ${KERNEL_salomepythondir}/salome/kernel) \ No newline at end of file diff --git a/src/KERNEL_PY/kernel/parametric/CMakeLists.txt b/src/KERNEL_PY/kernel/parametric/CMakeLists.txt new file mode 100755 index 000000000..fc6392119 --- /dev/null +++ b/src/KERNEL_PY/kernel/parametric/CMakeLists.txt @@ -0,0 +1,28 @@ +# Copyright (C) 2012 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 +# + +SET(mypkgpython_PYTHON + __init__.py + study_exchange_vars.py + compo_utils.py + pyscript_utils.py +) + +# Executable scripts to be installed +SALOME_INSTALL_SCRIPTS("${mypkgpython_PYTHON}" ${KERNEL_salomepythondir}/salome/kernel/parametric) diff --git a/src/KERNEL_PY/salome.py b/src/KERNEL_PY/salome.py deleted file mode 100755 index ea45e9bca..000000000 --- a/src/KERNEL_PY/salome.py +++ /dev/null @@ -1,189 +0,0 @@ -# -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2012 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 -# - -# ================================================================================ -# WARNING: this file is deprecated and should not be used any more. It has been -# replaced by the file __init__.py of the python package named "salome". -# To prevent any error, a warning is raised in the case where this file is imported -raise RuntimeError("WRN - the file salome.py is deprecated. It should NOT be used any more.") -# ================================================================================ - - -# File : salome.py -# Author : Paul RASCLE, EDF -# Module : SALOME -# $Header$ -# -""" -Module salome gives access to Salome ressources. - -variables: - - - salome.orb : CORBA - - salome.naming_service : instance of naming Service class - - methods: - - Resolve(name) : find a CORBA object (ior) by its pathname - - Register(name) : register a CORBA object under a pathname - - - salome.lcc : instance of lifeCycleCORBA class - - methods: - - FindOrLoadComponent(server,name) : - obtain an Engine (CORBA object) - or launch the Engine if not found, - with a Server name and an Engine name - - - salome.sg : salome object to communicate with the graphical user interface (if any) - - methods: - - updateObjBrowser(bool): - - getActiveStudyId(): - - getActiveStudyName(): - - - SelectedCount(): returns number of selected objects - - getSelected(i): returns entry of selected object number i - - getAllSelected(): returns list of entry of selected objects - - AddIObject(Entry): select an existing Interactive object - - RemoveIObject(Entry): remove object from selection - - ClearIObjects(): clear selection - - - Display(*Entry): - - DisplayOnly(Entry): - - Erase(Entry): - - DisplayAll(): - - EraseAll(): - - - IDToObject(Entry): returns CORBA reference from entry - - - salome.myStudyName : active Study Name - - salome.myStudyId : active Study Id - - salome.myStudy : the active Study itself (CORBA ior) - - methods : defined in SALOMEDS.idl - -""" -## @package salome -# Module salome gives access to Salome ressources. -# -# \param salome.orb : CORBA orb object -# \param salome.naming_service : instance of naming Service class (SALOME_NamingServicePy::SALOME_NamingServicePy_i) -# \param salome.lcc : instance of lifeCycleCORBA class (SALOME_LifeCycleCORBA) -# \param salome.sg : Salome object to communicate with the graphical user interface, if running (see interface in salome_iapp::SalomeOutsideGUI) -# \param salome.myStudyName : active Study Name -# \param salome.myStudyId : active Study Id -# \param salome.myStudy : the active Study (interface SALOMEDS::Study) - -# -from salome_kernel import * -from salome_study import * -from salome_iapp import * - - -# -# The next block is workaround for the problem of shared symbols loading for the extension modules (e.g. SWIG-generated) -# that causes RTTI unavailable in some cases. To solve this problem, sys.setdlopenflags() function is used. -# Depending on the Python version and platform, the dlopen flags can be defined in the dl, DLFUN or ctypes module. -# -import sys -flags = None -if not flags: - try: - # dl module can be unavailable - import dl - flags = dl.RTLD_NOW | dl.RTLD_GLOBAL - except: - pass - pass -if not flags: - try: - # DLFCN module can be unavailable - import DLFCN - flags = DLFCN.RTLD_NOW | DLFCN.RTLD_GLOBAL - except: - pass - pass -if not flags: - try: - # ctypes module can be unavailable - import ctypes - flags = ctypes.RTLD_GLOBAL - except: - pass - pass - -if flags: - sys.setdlopenflags(flags) - pass - -orb, lcc, naming_service, cm,sg=None,None,None,None,None -myStudyManager, myStudyId, myStudy, myStudyName=None,None,None,None - -salome_initial=1 -def salome_init(theStudyId=0,embedded=0): - """ - Performs only once SALOME general purpose intialisation for scripts. - optional argument : theStudyId - When in embedded interpreter inside IAPP, theStudyId is not used - When used without GUI (external interpreter) - 0 : create a new study (default). - n (>0) : try connection to study with Id = n, or create a new one - if study not found. - If study creation, its Id may be different from theStudyId ! - Provides: - orb reference to CORBA - lcc a LifeCycleCorba instance - naming_service a naming service instance - cm reference to the container manager - sg access to SALOME GUI (when linked with IAPP GUI) - myStudyManager the study manager - myStudyId active study identifier - myStudy active study itself (CORBA reference) - myStudyName active study name - """ - global salome_initial - global orb, lcc, naming_service, cm - global sg - global myStudyManager, myStudyId, myStudy, myStudyName - - try: - if salome_initial: - salome_initial=0 - sg = salome_iapp_init(embedded) - orb, lcc, naming_service, cm = salome_kernel_init() - myStudyManager, myStudyId, myStudy, myStudyName =salome_study_init(theStudyId) - pass - pass - except RuntimeError, inst: - # wait a little to avoid trace mix - import time - time.sleep(0.2) - x = inst - print "salome.salome_init():", x - print """ - ============================================ - May be there is no running SALOME session - salome.salome_init() is intented to be used - within an already running session - ============================================ - """ - raise - -#to expose all objects to pydoc -__all__=dir() diff --git a/src/KERNEL_PY/salome_study.py b/src/KERNEL_PY/salome_study.py index 5de40bc3a..f6ebc622a 100644 --- a/src/KERNEL_PY/salome_study.py +++ b/src/KERNEL_PY/salome_study.py @@ -227,6 +227,27 @@ def CheckCopyPaste(theSO, theInfo ,theComponentPaste): #-------------------------------------------------------------------------- +def GetComponentVersion(theComponent, all_versions = False): + # returns the document list tree (as list) + props = myStudy.GetProperties() + stored_components = props.GetStoredComponents() + version = "no component data" # vsr: better raise an exception in this case? + if theComponent in stored_components: + if all_versions: + version = props.GetComponentVersions(theComponent) + for i in range(len(version)): + if not version[i]: version[i] = "unknown" + pass + pass + else: + version = props.GetComponentVersion(theComponent) + if not version: version = "unknown" + pass + pass + return version + + #-------------------------------------------------------------------------- + def FindFileInDataDir(filename): import os datadir = os.getenv("DATA_DIR") diff --git a/src/KernelHelpers/CMakeLists.txt b/src/KernelHelpers/CMakeLists.txt new file mode 100755 index 000000000..09e211bb3 --- /dev/null +++ b/src/KernelHelpers/CMakeLists.txt @@ -0,0 +1,65 @@ +# Copyright (C) 2012 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_DIRECTORIES( + ${PTHREAD_INCLUDE_DIRS} + ${OMNIORB_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR}/salome_adm + ${CMAKE_CURRENT_SOURCE_DIR}/../NamingService + ${CMAKE_CURRENT_SOURCE_DIR}/../SALOMELocalTrace + ${CMAKE_CURRENT_SOURCE_DIR}/../Basics + ${CMAKE_CURRENT_SOURCE_DIR}/../Utils + ${CMAKE_CURRENT_SOURCE_DIR}/../LifeCycleCORBA + ${CMAKE_CURRENT_SOURCE_DIR}/../Container + ${CMAKE_CURRENT_SOURCE_DIR}/../Notification + ${CMAKE_CURRENT_SOURCE_DIR}/../GenericObj + ${CMAKE_BINARY_DIR}/idl +) + +SET(SalomeKernelHelpers_LIBS + ${OMNIORB_LIBS} + SalomeNS + SALOMELocalTrace + SALOMEBasics + OpUtil + SalomeLifeCycleCORBA + SalomeContainer + SalomeNotification + SalomeGenericObj + SalomeIDLKernel +) + +SET(SalomeKernelHelpers_SOURCES + SALOME_KernelServices.cxx + SALOME_StudyEditor.cxx + SALOMEDS_DriverDefaultImpl.cxx +) + +ADD_LIBRARY(SalomeKernelHelpers SHARED ${SalomeKernelHelpers_SOURCES}) +SET_TARGET_PROPERTIES(SalomeKernelHelpers PROPERTIES COMPILE_FLAGS "${OMNIORB_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +TARGET_LINK_LIBRARIES(SalomeKernelHelpers ${SalomeKernelHelpers_LIBS}) +INSTALL(TARGETS SalomeKernelHelpers DESTINATION ${KERNEL_salomelib_LIBS}) + +ADD_EXECUTABLE(KernelHelpersUseCases KernelHelpersUseCases.cxx) +SET_TARGET_PROPERTIES(KernelHelpersUseCases PROPERTIES COMPILE_FLAGS "${OMNIORB_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +TARGET_LINK_LIBRARIES(KernelHelpersUseCases SalomeKernelHelpers ${SalomeKernelHelpers_LIBS}) +INSTALL(TARGETS KernelHelpersUseCases DESTINATION ${KERNEL_salomebin_BINS}) + +FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") +INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${KERNEL_salomeinclude_HEADERS}) diff --git a/src/KernelHelpers/Test/CMakeLists.txt b/src/KernelHelpers/Test/CMakeLists.txt new file mode 100755 index 000000000..f0291aaf5 --- /dev/null +++ b/src/KernelHelpers/Test/CMakeLists.txt @@ -0,0 +1,68 @@ +# Copyright (C) 2012 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_DIRECTORIES( + ${CPPUNIT_INCLUDE_DIRS} + ${PTHREAD_INCLUDE_DIRS} + ${OMNIORB_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR}/salome_adm + ${CMAKE_SOURCE_DIR}/src/Basics/Test + ${CMAKE_CURRENT_SOURCE_DIR}/.. + ${CMAKE_SOURCE_DIR}/src/NamingService + ${CMAKE_SOURCE_DIR}/src/SALOMELocalTrace + ${CMAKE_SOURCE_DIR}/src/Basics + ${CMAKE_SOURCE_DIR}/src/Utils + ${CMAKE_SOURCE_DIR}/src/LifeCycleCORBA + ${CMAKE_SOURCE_DIR}/src/Container + ${CMAKE_SOURCE_DIR}/src/Notification + ${CMAKE_SOURCE_DIR}/src/GenericObj + ${CMAKE_BINARY_DIR}/idl +) + +SET(SalomeKernelHelpersTest_LIBS + ${CPPUNIT_LIBS} + SalomeKernelHelpers + ${OMNIORB_LIBS} + SalomeNS + SALOMELocalTrace + SALOMEBasics + OpUtil + SalomeLifeCycleCORBA + SalomeContainer + SalomeNotification + SalomeGenericObj + SalomeIDLKernel +) + +ADD_LIBRARY(SalomeKernelHelpersTest SHARED KernelHelpersUnitTests.cxx) +SET_TARGET_PROPERTIES(SalomeKernelHelpersTest PROPERTIES COMPILE_FLAGS "${CPPUNIT_DEFINITIONS} ${OMNIORB_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +TARGET_LINK_LIBRARIES(SalomeKernelHelpersTest ${SalomeKernelHelpersTest_LIBS}) +INSTALL(TARGETS SalomeKernelHelpersTest DESTINATION ${KERNEL_salomelib_LIBS}) + +ADD_EXECUTABLE(TestKernelHelpers TestKernelHelpers.cxx) +SET_TARGET_PROPERTIES(TestKernelHelpers PROPERTIES COMPILE_FLAGS "${CPPUNIT_DEFINITIONS} ${OMNIORB_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +TARGET_LINK_LIBRARIES(TestKernelHelpers SalomeKernelHelpersTest ${SalomeKernelHelpersTest_LIBS}) +ADD_TEST(TestKernelHelpers TestKernelHelpers) +INSTALL(TARGETS TestKernelHelpers DESTINATION ${KERNEL_salomebin_BINS}) + +# Executable scripts to be installed +SALOME_INSTALL_SCRIPTS(TestKernelHelpers.py ${KERNEL_salomescript_PYTHON}) + +FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") +INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${KERNEL_salomeinclude_HEADERS}) diff --git a/src/KernelHelpers/Test/KernelHelpersUnitTests.hxx b/src/KernelHelpers/Test/KernelHelpersUnitTests.hxx index 4e9b96696..045e1149f 100644 --- a/src/KernelHelpers/Test/KernelHelpersUnitTests.hxx +++ b/src/KernelHelpers/Test/KernelHelpersUnitTests.hxx @@ -25,7 +25,17 @@ #include -class KernelHelpersUnitTests : public CppUnit::TestFixture +#ifdef WIN32 +# if defined KERNELHELPERSTEST_EXPORTS || defined SalomeKernelHelpersTest_EXPORTS +# define KERNELHELPERSTEST_EXPORT __declspec( dllexport ) +# else +# define KERNELHELPERSTEST_EXPORT __declspec( dllimport ) +# endif +#else +# define KERNELHELPERSTEST_EXPORT +#endif + +class KERNELHELPERSTEST_EXPORT KernelHelpersUnitTests : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE( KernelHelpersUnitTests ); CPPUNIT_TEST( TEST_corba ); diff --git a/src/Launcher/BatchTest.cxx b/src/Launcher/BatchTest.cxx index 37076b0fb..d765f51e8 100644 --- a/src/Launcher/BatchTest.cxx +++ b/src/Launcher/BatchTest.cxx @@ -478,6 +478,8 @@ BatchTest::test_jobsubmit_mpi() mpiImpl = new MpiImpl_MPICH2(); else if(mpi_type == "openmpi") mpiImpl = new MpiImpl_OPENMPI(); + else if(mpi_type == "ompi") + mpiImpl = new MpiImpl_OMPI(); else if(mpi_type == "slurmmpi") mpiImpl = new MpiImpl_SLURM(); else diff --git a/src/Launcher/CMakeLists.txt b/src/Launcher/CMakeLists.txt new file mode 100755 index 000000000..b314fdcc1 --- /dev/null +++ b/src/Launcher/CMakeLists.txt @@ -0,0 +1,122 @@ +# Copyright (C) 2012 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_DIRECTORIES( + ${LIBXML_INCLUDE_DIRS} + ${OMNIORB_INCLUDE_DIRS} + ${PYTHON_INCLUDE_DIRS} + ${PTHREAD_INCLUDE_DIRS} + ${MPI_INCLUDE_DIRS} + ${LIBBATCH_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR}/salome_adm + ${CMAKE_CURRENT_SOURCE_DIR}/../Basics + ${CMAKE_CURRENT_SOURCE_DIR}/../SALOMELocalTrace + ${CMAKE_CURRENT_SOURCE_DIR}/../NamingService + ${CMAKE_CURRENT_SOURCE_DIR}/../Utils + ${CMAKE_CURRENT_SOURCE_DIR}/../Registry + ${CMAKE_CURRENT_SOURCE_DIR}/../Notification + ${CMAKE_CURRENT_SOURCE_DIR}/../Container + ${CMAKE_CURRENT_SOURCE_DIR}/../ResourcesManager + ${CMAKE_BINARY_DIR}/idl +) +SET(WITH_LIBBATCH_FLAG) +IF(WITH_LIBBATCH) + SET(WITH_LIBBATCH_FLAG "-DWITH_LIBBATCH") +ENDIF(WITH_LIBBATCH) + +# This local variable defines the list of FLAGS common to all target in this package. +SET(COMMON_FLAGS "${MPI_DEFINITIONS} ${LIBXML_DEFINITIONS} ${OMNIORB_DEFINITIONS} ${WITH_LIBBATCH_FLAG} ${PLATFORM_DEFINITIONS}") + +# This local variable defines the list of dependant libraries common to all target in this package. +SET(COMMON_LIBS + Registry + SalomeNotification + SalomeContainer + SalomeResourcesManager + SalomeNS + OpUtil + SALOMELocalTrace + SALOMEBasics + SalomeIDLKernel + ${LIBBATCH_LIBS} + ${MPI_LIBS} + ${OMNIORB_LIBS} + ${LIBXML_LIBS} + ${PYTHON_LIBS} +) + +SET(Launcher_SOURCES + SALOME_Launcher_Parser.cxx + SALOME_Launcher_Handler.cxx + Launcher_Utils.hxx + Launcher_Job.cxx + Launcher_Job_Command.cxx + Launcher_Job_SALOME.cxx + Launcher_Job_PythonSALOME.cxx + Launcher_Job_YACSFile.cxx + Launcher.cxx +) +SET(Launcher_FLAGS "${MPI_DEFINITIONS} ${LIBXML_DEFINITIONS} ${LIBBATCH_DEFINITIONS} ${WITH_LIBBATCH_FLAG} ${PLATFORM_DEFINITIONS}") + +ADD_LIBRARY(Launcher SHARED ${Launcher_SOURCES}) +SET_TARGET_PROPERTIES(Launcher PROPERTIES COMPILE_FLAGS "${Launcher_FLAGS}") +TARGET_LINK_LIBRARIES(Launcher ResourcesManager ${LIBBATCH_LIBS} ${MPI_LIBS} ${LIBXML_LIBS}) +INSTALL(TARGETS Launcher DESTINATION ${KERNEL_salomelib_LIBS}) + +SET(TestLauncher_LIBS + ${LIBXML_LIBS} + ResourcesManager + Launcher + OpUtil + ${LIBBATCH_LIBS} +) + +ADD_EXECUTABLE(TestLauncher TestLauncher.cxx) +SET_TARGET_PROPERTIES(TestLauncher PROPERTIES COMPILE_FLAGS "${LIBXML_DEFINITIONS} ${LIBBATCH_DEFINITIONS} ${WITH_LIBBATCH_FLAG} ${PLATFORM_DEFINITIONS}") +TARGET_LINK_LIBRARIES(TestLauncher ${TestLauncher_LIBS}) +INSTALL(TARGETS TestLauncher DESTINATION ${KERNEL_salomebin_BINS}) + +IF(NOT WITHONLYLAUNCHER) + ADD_LIBRARY(SalomeLauncher SHARED BatchTest.cxx SALOME_Launcher.cxx) + SET_TARGET_PROPERTIES(SalomeLauncher PROPERTIES COMPILE_FLAGS "${COMMON_FLAGS}") + TARGET_LINK_LIBRARIES(SalomeLauncher Launcher ${COMMON_LIBS}) + INSTALL(TARGETS SalomeLauncher DESTINATION ${KERNEL_salomelib_LIBS}) + + SET(SALOME_LauncherServer_LIBS + Launcher + SalomeLauncher + SALOMEBasics + SALOMELocalTrace + ${LIBBATCH_LIBS} + ${MPI_LIBS} + ${OMNIORB_LIBS} + ${LIBXML_LIBS} + ${PYTHON_LIBS} + ) + + + + ADD_EXECUTABLE(SALOME_LauncherServer SALOME_LauncherServer.cxx) + SET_TARGET_PROPERTIES(SALOME_LauncherServer PROPERTIES COMPILE_FLAGS "${COMMON_FLAGS}") + TARGET_LINK_LIBRARIES(SALOME_LauncherServer ${SALOME_LauncherServer_LIBS}) + INSTALL(TARGETS SALOME_LauncherServer DESTINATION ${KERNEL_salomebin_BINS}) +ENDIF(NOT WITHONLYLAUNCHER) + +FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") +INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${KERNEL_salomeinclude_HEADERS}) diff --git a/src/Launcher/Launcher.cxx b/src/Launcher/Launcher.cxx index 62bfe647b..d749f8258 100644 --- a/src/Launcher/Launcher.cxx +++ b/src/Launcher/Launcher.cxx @@ -403,6 +403,9 @@ Launcher_cpp::FactoryBatchManager(ParserResourcesType& params) case openmpi: mpi = "openmpi"; break; + case ompi: + mpi = "ompi"; + break; case slurmmpi: mpi = "slurmmpi"; break; diff --git a/src/Launcher/Launcher_Job_Command.cxx b/src/Launcher/Launcher_Job_Command.cxx index f325898ed..6f2fecebd 100644 --- a/src/Launcher/Launcher_Job_Command.cxx +++ b/src/Launcher/Launcher_Job_Command.cxx @@ -20,6 +20,7 @@ // Author: André RIBES - EDF R&D // #include "Launcher_Job_Command.hxx" +#include "Basics_DirUtils.hxx" #ifdef WITH_LIBBATCH #include @@ -54,7 +55,7 @@ Launcher::Job_Command::buildCommandScript(Batch::Parametre params, std::string l // File name std::string launch_date_port_file = launch_date; - std::string launch_script = "/tmp/runCommand_" + _job_file_name + "_" + launch_date + ".sh"; + std::string launch_script = Kernel_Utils::GetTmpDir() + "runCommand_" + _job_file_name + "_" + launch_date + ".sh"; std::ofstream launch_script_stream; launch_script_stream.open(launch_script.c_str(), std::ofstream::out); diff --git a/src/Launcher/Launcher_Job_SALOME.cxx b/src/Launcher/Launcher_Job_SALOME.cxx index b0c70f5b5..85f6e1015 100644 --- a/src/Launcher/Launcher_Job_SALOME.cxx +++ b/src/Launcher/Launcher_Job_SALOME.cxx @@ -20,6 +20,7 @@ // Author: André RIBES - EDF R&D // #include "Launcher_Job_SALOME.hxx" +#include "Basics_DirUtils.hxx" #ifdef WITH_LIBBATCH #include @@ -64,7 +65,7 @@ Launcher::Job_SALOME::buildSalomeScript(Batch::Parametre params) // parameters std::string work_directory = params[Batch::WORKDIR].str(); - std::string launch_script = "/tmp/runSalome_" + _job_file_name + "_" + _launch_date + ".sh"; + std::string launch_script = Kernel_Utils::GetTmpDir() + "runSalome_" + _job_file_name + "_" + _launch_date + ".sh"; std::ofstream launch_script_stream; launch_script_stream.open(launch_script.c_str(), std::ofstream::out diff --git a/src/LifeCycleCORBA/CMakeLists.txt b/src/LifeCycleCORBA/CMakeLists.txt new file mode 100755 index 000000000..a635b4061 --- /dev/null +++ b/src/LifeCycleCORBA/CMakeLists.txt @@ -0,0 +1,67 @@ +# Copyright (C) 2012 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_DIRECTORIES( + ${LIBXML_INCLUDE_DIRS} + ${OMNIORB_INCLUDE_DIRS} + ${PTHREAD_INCLUDE_DIRS} + ${PYTHON_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR}/salome_adm + ${CMAKE_CURRENT_SOURCE_DIR}/../Basics + ${CMAKE_CURRENT_SOURCE_DIR}/../SALOMELocalTrace + ${CMAKE_CURRENT_SOURCE_DIR}/../SALOMETraceCollector + ${CMAKE_CURRENT_SOURCE_DIR}/../NamingService + ${CMAKE_CURRENT_SOURCE_DIR}/../Utils + ${CMAKE_CURRENT_SOURCE_DIR}/../GenericObj + ${CMAKE_CURRENT_SOURCE_DIR}/../Container + ${CMAKE_CURRENT_SOURCE_DIR}/../ResourcesManager + ${CMAKE_CURRENT_SOURCE_DIR}/../Batch + ${CMAKE_CURRENT_SOURCE_DIR}/../Notification + ${CMAKE_CURRENT_SOURCE_DIR}/../Registry + ${CMAKE_BINARY_DIR}/idl +) + +SET(COMMON_LIBS + SalomeContainer + SalomeResourcesManager + SalomeNS + OpUtil + SALOMELocalTrace + SALOMEBasics + SalomeGenericObj + SalomeIDLKernel +) + +ADD_LIBRARY(SalomeLifeCycleCORBA SHARED SALOME_LifeCycleCORBA.cxx SALOME_FileTransferCORBA.cxx) +SET_TARGET_PROPERTIES(SalomeLifeCycleCORBA PROPERTIES COMPILE_FLAGS "${LIBXML_DEFINITIONS} ${OMNIORB_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +TARGET_LINK_LIBRARIES(SalomeLifeCycleCORBA ${COMMON_LIBS}) +INSTALL(TARGETS SalomeLifeCycleCORBA DESTINATION ${KERNEL_salomelib_LIBS}) + +ADD_EXECUTABLE(Test_LifeCycleCORBA Test_LifeCycleCORBA.cxx) +SET_TARGET_PROPERTIES(Test_LifeCycleCORBA PROPERTIES COMPILE_FLAGS "${LIBXML_DEFINITIONS} ${OMNIORB_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +TARGET_LINK_LIBRARIES(Test_LifeCycleCORBA SalomeLifeCycleCORBA Registry SalomeNotification SalomeContainer ${COMMON_LIBS} ${OMNIORB_LIBS}) + +ADD_EXECUTABLE(TestContainerManager TestContainerManager.cxx) +SET_TARGET_PROPERTIES(TestContainerManager PROPERTIES COMPILE_FLAGS "${LIBXML_DEFINITIONS} ${OMNIORB_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +TARGET_LINK_LIBRARIES(TestContainerManager SalomeLifeCycleCORBA Registry SalomeNotification SalomeContainer ${COMMON_LIBS} ${OMNIORB_LIBS}) + +INSTALL(TARGETS Test_LifeCycleCORBA TestContainerManager DESTINATION ${KERNEL_salomebin_BINS}) + +FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") +INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${KERNEL_salomeinclude_HEADERS}) diff --git a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx index 2afca3b7f..6d138af19 100644 --- a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx +++ b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx @@ -100,11 +100,13 @@ SALOME_LifeCycleCORBA::SALOME_LifeCycleCORBA(SALOME_NamingService *ns) CORBA::Object_var obj = _NS->Resolve(SALOME_ContainerManager::_ContainerManagerNameInNS); - ASSERT( !CORBA::is_nil(obj)); + if (CORBA::is_nil(obj)) + throw SALOME_Exception("Error: Cannot resolve ContainerManager in Naming Service"); _ContManager=Engines::ContainerManager::_narrow(obj); obj = _NS->Resolve(SALOME_ResourcesManager::_ResourcesManagerNameInNS); - ASSERT( !CORBA::is_nil(obj)); + if (CORBA::is_nil(obj)) + throw SALOME_Exception("Error: Cannot resolve ResourceManager in Naming Service"); _ResManager=Engines::ResourcesManager::_narrow(obj); } @@ -550,6 +552,7 @@ void SALOME_LifeCycleCORBA::shutdownServers() if (!CORBA::is_nil(session)) { pid = session->getPID(); + session->Shutdown(); } } @@ -644,6 +647,7 @@ void SALOME_LifeCycleCORBA::shutdownServers() // ignore and continue } + /* // 6) Session if ( !CORBA::is_nil( session ) ) { try @@ -655,6 +659,7 @@ void SALOME_LifeCycleCORBA::shutdownServers() // ignore and continue } } + */ // 7) Logger int argc = 0; diff --git a/src/LifeCycleCORBA/Test/CMakeLists.txt b/src/LifeCycleCORBA/Test/CMakeLists.txt new file mode 100755 index 000000000..47c04bd74 --- /dev/null +++ b/src/LifeCycleCORBA/Test/CMakeLists.txt @@ -0,0 +1,72 @@ +# Copyright (C) 2012 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_DIRECTORIES( + ${PTHREAD_INCLUDE_DIRS} + ${CPPUNIT_INCLUDE_DIRS} + ${OMNIORB_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR}/salome_adm + ${CMAKE_CURRENT_SOURCE_DIR}/../../Basics + ${CMAKE_CURRENT_SOURCE_DIR}/../../Basics/Test + ${CMAKE_CURRENT_SOURCE_DIR}/../../SALOMELocalTrace + ${CMAKE_CURRENT_SOURCE_DIR}/../../SALOMELocalTrace/Test + ${CMAKE_CURRENT_SOURCE_DIR}/../../SALOMETraceCollector + ${CMAKE_CURRENT_SOURCE_DIR}/../../SALOMETraceCollector/Test + ${CMAKE_CURRENT_SOURCE_DIR}/../../NamingService + ${CMAKE_CURRENT_SOURCE_DIR}/../../NamingService/Test + ${CMAKE_CURRENT_SOURCE_DIR}/../../Utils + ${CMAKE_CURRENT_SOURCE_DIR}/../../Utils/Test + ${CMAKE_CURRENT_SOURCE_DIR}/../../ResourcesManager + ${CMAKE_CURRENT_SOURCE_DIR}/../../LifeCycleCORBA + ${CMAKE_BINARY_DIR}/idl +) + +SET(COMMON_LIBS + ${CPPUNIT_LIBS} + SALOMEBasics + SalomeResourcesManager + SalomeContainer + SalomeNS + Registry + SalomeNotification + UtilsTest + OpUtil + SALOMELocalTraceTest + SALOMELocalTrace + SALOMETraceCollectorTest + SalomeIDLKernel + SalomeLifeCycleCORBA + ${OMNIORB_LIBS} +) + +ADD_LIBRARY(LifeCycleCORBATest SHARED LifeCycleCORBATest.cxx) +SET_TARGET_PROPERTIES(LifeCycleCORBATest PROPERTIES COMPILE_FLAGS "${CPPUNIT_DEFINITIONS} ${OMNIORB_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +TARGET_LINK_LIBRARIES(LifeCycleCORBATest ${COMMON_LIBS}) +INSTALL(TARGETS LifeCycleCORBATest DESTINATION ${KERNEL_salomelib_LIBS}) + +ADD_EXECUTABLE(TestLifeCycleCORBA TestLifeCycleCORBA.cxx) +SET_TARGET_PROPERTIES(TestLifeCycleCORBA PROPERTIES COMPILE_FLAGS "${CPPUNIT_DEFINITIONS} ${OMNIORB_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +TARGET_LINK_LIBRARIES(TestLifeCycleCORBA LifeCycleCORBATest NamingServiceTest SalomeLifeCycleCORBA ${COMMON_LIBS}) +INSTALL(TARGETS TestLifeCycleCORBA DESTINATION ${KERNEL_salomebin_BINS}) + +# Executable scripts to be installed +SALOME_INSTALL_SCRIPTS(TestLifeCycleCORBA.py ${KERNEL_salomescript_PYTHON}) + +FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") +INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${KERNEL_salomeinclude_HEADERS}) diff --git a/src/LifeCycleCORBA/Test/LifeCycleCORBATest.cxx b/src/LifeCycleCORBA/Test/LifeCycleCORBATest.cxx index e359aef8c..1212c0fb7 100644 --- a/src/LifeCycleCORBA/Test/LifeCycleCORBATest.cxx +++ b/src/LifeCycleCORBA/Test/LifeCycleCORBATest.cxx @@ -44,6 +44,9 @@ #define MYDEVTRACE #define DEVTRACE(msg) #endif +#ifdef WIN32 +#define setenv Kernel_Utils::setenv +#endif #define TRACEFILE "/tmp/traceUnitTest.log" diff --git a/src/LifeCycleCORBA/Test/LifeCycleCORBATest.hxx b/src/LifeCycleCORBA/Test/LifeCycleCORBATest.hxx index 3be0ebab6..054680653 100644 --- a/src/LifeCycleCORBA/Test/LifeCycleCORBATest.hxx +++ b/src/LifeCycleCORBA/Test/LifeCycleCORBATest.hxx @@ -30,7 +30,17 @@ #include CORBA_CLIENT_HEADER(SALOME_TestComponent) #include "SALOME_NamingService.hxx" -class LifeCycleCORBATest : public CppUnit::TestFixture +#ifdef WIN32 +# if defined LIFECYCLECORBATEST_EXPORTS || defined LifeCycleCORBATest_EXPORTS +# define LIFECYCLECORBATEST_EXPORT __declspec( dllexport ) +# else +# define LIFECYCLECORBATEST_EXPORT __declspec( dllimport ) +# endif +#else +# define LIFECYCLECORBATEST_EXPORT +#endif + +class LIFECYCLECORBATEST_EXPORT LifeCycleCORBATest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE( LifeCycleCORBATest ); CPPUNIT_TEST( testFindOrLoad_Component_LaunchContainer ); diff --git a/src/LifeCycleCORBA_SWIG/CMakeLists.txt b/src/LifeCycleCORBA_SWIG/CMakeLists.txt new file mode 100755 index 000000000..57da32c34 --- /dev/null +++ b/src/LifeCycleCORBA_SWIG/CMakeLists.txt @@ -0,0 +1,57 @@ +# Copyright (C) 2012 CEA/DEN, EDF R&D +# +# 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_PACKAGE(SWIG REQUIRED) +INCLUDE(${SWIG_USE_FILE}) + +SET_SOURCE_FILES_PROPERTIES(libSALOME_LifeCycleCORBA.i PROPERTIES CPLUSPLUS ON) +SET_SOURCE_FILES_PROPERTIES(libSALOME_LifeCycleCORBA.i PROPERTIES SWIG_DEFINITIONS "-shadow") +SET_SOURCE_FILES_PROPERTIES(libSALOME_LifeCycleCORBAPYTHON_wrap.cxx PROPERTIES COMPILE_FLAGS "${OMNIORB_DEFINITIONS}") + +INCLUDE_DIRECTORIES( + ${PYTHON_INCLUDE_DIRS} + ${PTHREAD_INCLUDE_DIRS} + ${OMNIORB_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR}/salome_adm + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/../NamingService + ${CMAKE_CURRENT_SOURCE_DIR}/../LifeCycleCORBA + ${CMAKE_CURRENT_SOURCE_DIR}/../Basics + ${CMAKE_CURRENT_SOURCE_DIR}/../SALOMELocalTrace + ${CMAKE_CURRENT_SOURCE_DIR}/../Utils + ${CMAKE_BINARY_DIR}/idl + ) + +SWIG_ADD_MODULE(libSALOME_LifeCycleCORBA python libSALOME_LifeCycleCORBA.i) +SWIG_LINK_LIBRARIES(libSALOME_LifeCycleCORBA ${PYTHON_LIBS} SalomeLifeCycleCORBA) +SET_TARGET_PROPERTIES(_libSALOME_LifeCycleCORBA PROPERTIES COMPILE_FLAGS "${PLATFORM_LIBS}") +SET_TARGET_PROPERTIES(_libSALOME_LifeCycleCORBA PROPERTIES COMPILE_FLAGS "${PLATFORM_DEFINITIONS}") + +IF(${MACHINE} STREQUAL WINDOWS) + SET_TARGET_PROPERTIES(_libSALOME_LifeCycleCORBA PROPERTIES DEBUG_OUTPUT_NAME _libSALOME_LifeCycleCORBA_d) +ENDIF(${MACHINE} STREQUAL WINDOWS) + +INSTALL(TARGETS _libSALOME_LifeCycleCORBA DESTINATION ${KERNEL_salomepythondir}) +SET(SCRIPTS + LifeCycleCORBA.py + TestLifeCycleCORBA.py +) +SALOME_INSTALL_SCRIPTS("${SCRIPTS}" ${KERNEL_salomescript_PYTHON}) +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libSALOME_LifeCycleCORBA.py DESTINATION ${KERNEL_salomepythondir}) diff --git a/src/LifeCycleCORBA_SWIG/Makefile.am b/src/LifeCycleCORBA_SWIG/Makefile.am index 81a420ca4..2c1b96b8c 100644 --- a/src/LifeCycleCORBA_SWIG/Makefile.am +++ b/src/LifeCycleCORBA_SWIG/Makefile.am @@ -79,7 +79,7 @@ swig_wrap.cpp libSALOME_LifeCycleCORBA.py : $(SWIGSOURCES) CLEANFILES = swig_wrap.cpp -EXTRA_DIST = $(SWIGSOURCES) +EXTRA_DIST += $(SWIGSOURCES) # # =============================================================== diff --git a/src/LifeCycleCORBA_SWIG/Test/CMakeLists.txt b/src/LifeCycleCORBA_SWIG/Test/CMakeLists.txt new file mode 100755 index 000000000..d16803029 --- /dev/null +++ b/src/LifeCycleCORBA_SWIG/Test/CMakeLists.txt @@ -0,0 +1,27 @@ +# Copyright (C) 2012 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 + +# Scripts to be installed +SET(SCRIPTS + LifeCycleCORBA_SWIGTest.py + testresourcemanager.py + testcontainermanager.py + TestLifeCycleCORBA_SWIG.py +) + +SALOME_INSTALL_SCRIPTS("${SCRIPTS}" ${KERNEL_salomescript_PYTHON}) diff --git a/src/Logger/CMakeLists.txt b/src/Logger/CMakeLists.txt new file mode 100755 index 000000000..6b7c86d3c --- /dev/null +++ b/src/Logger/CMakeLists.txt @@ -0,0 +1,53 @@ +# Copyright (C) 2012 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_DIRECTORIES( + ${PTHREAD_INCLUDE_DIRS} + ${OMNIORB_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR}/salome_adm + ${CMAKE_CURRENT_SOURCE_DIR}/../Basics + ${CMAKE_CURRENT_SOURCE_DIR}/../SALOMELocalTrace + ${CMAKE_BINARY_DIR}/idl +) + +ADD_LIBRARY(SalomeLoggerServer SHARED SALOME_Trace.cxx SALOME_Logger_Server.cxx) +SET_TARGET_PROPERTIES(SalomeLoggerServer PROPERTIES COMPILE_FLAGS "${OMNIORB_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +TARGET_LINK_LIBRARIES(SalomeLoggerServer SalomeIDLKernel ${OMNIORB_LIBS} ${PLATFORM_LIBS}) +INSTALL(TARGETS SalomeLoggerServer DESTINATION ${KERNEL_salomelib_LIBS}) + +SET(SALOME_Logger_Server_SOURCES + SALOME_Logger_Server_main.cxx + SALOME_Logger_Server.hxx +) + +SET(SALOME_Logger_Server_LIBS + SalomeLoggerServer + SalomeIDLKernel + ${OMNIORB_LIBS} +) + +ADD_EXECUTABLE(SALOME_Logger_Server ${SALOME_Logger_Server_SOURCES}) +SET_TARGET_PROPERTIES(SALOME_Logger_Server PROPERTIES COMPILE_FLAGS "${OMNIORB_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +TARGET_LINK_LIBRARIES(SALOME_Logger_Server ${SALOME_Logger_Server_LIBS}) +INSTALL(TARGETS SALOME_Logger_Server DESTINATION ${KERNEL_salomebin_BINS}) + +# Executable scripts to be installed +SALOME_INSTALL_SCRIPTS(SALOME_Trace.py ${KERNEL_salomescript_PYTHON}) + +INSTALL(FILES SALOME_Trace.hxx DESTINATION ${KERNEL_salomeinclude_HEADERS}) diff --git a/src/Logger/Test/CMakeLists.txt b/src/Logger/Test/CMakeLists.txt new file mode 100755 index 000000000..1805bf2fd --- /dev/null +++ b/src/Logger/Test/CMakeLists.txt @@ -0,0 +1,21 @@ +# Copyright (C) 2012 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 +# + +# Executable scripts to be installed +SALOME_INSTALL_SCRIPTS(TestKiller.py ${KERNEL_salomescript_PYTHON}) diff --git a/src/MPIContainer/CMakeLists.txt b/src/MPIContainer/CMakeLists.txt new file mode 100755 index 000000000..890118060 --- /dev/null +++ b/src/MPIContainer/CMakeLists.txt @@ -0,0 +1,69 @@ +# Copyright (C) 2012 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_DIRECTORIES( + ${MPI_INCLUDE_DIRS} + ${PYTHON_INCLUDE_DIRS} + ${OMNIORB_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR}/salome_adm + ${CMAKE_CURRENT_SOURCE_DIR}/../Basics + ${CMAKE_CURRENT_SOURCE_DIR}/../SALOMELocalTrace + ${CMAKE_CURRENT_SOURCE_DIR}/../NamingService + ${CMAKE_CURRENT_SOURCE_DIR}/../Utils + ${CMAKE_CURRENT_SOURCE_DIR}/../Registry + ${CMAKE_CURRENT_SOURCE_DIR}/../Notification + ${CMAKE_CURRENT_SOURCE_DIR}/../ResourcesManager + ${CMAKE_CURRENT_SOURCE_DIR}/../Container + ${CMAKE_CURRENT_SOURCE_DIR}/../GenericObj + ${CMAKE_BINARY_DIR}/idl +) + +SET(COMMON_LIBS + Registry + SalomeNotification + SalomeResourcesManager + SalomeNS + OpUtil + SALOMELocalTrace + SALOMEBasics + SalomeContainer + SalomeGenericObj + SalomeIDLKernel + ${CORBA_LIBS} +) + +ADD_LIBRARY(SalomeMPIContainer SHARED MPIObject_i.cxx MPIContainer_i.cxx) +SET_TARGET_PROPERTIES(SalomeMPIContainer PROPERTIES COMPILE_FLAGS "${MPI_DEFINITIONS} ${OMNIORB_DEFINITIONS}") +TARGET_LINK_LIBRARIES(SalomeMPIContainer ${COMMON_LIBS}) +INSTALL(TARGETS SalomeMPIContainer DESTINATION ${KERNEL_salomelib_LIBS}) + +ADD_EXECUTABLE(SALOME_MPIContainer SALOME_MPIContainer.cxx) +SET_TARGET_PROPERTIES(SALOME_MPIContainer PROPERTIES COMPILE_FLAGS "${MPI_DEFINITIONS} ${OMNIORB_DEFINITIONS}") +TARGET_LINK_LIBRARIES(SALOME_MPIContainer SalomeMPIContainer ${COMMON_LIBS} ${PYTHON_LIBS} ${MPI_LIBS}) + +ADD_EXECUTABLE(testMPI2 testMPI2.cxx) +SET_TARGET_PROPERTIES(testMPI2 PROPERTIES COMPILE_FLAGS "${MPI_DEFINITIONS}") +TARGET_LINK_LIBRARIES(testMPI2 ${MPI_LIBS}) + +INSTALL(TARGETS SALOME_MPIContainer testMPI2 DESTINATION ${KERNEL_salomebin_BINS}) + +INSTALL(FILES launch_testMPI2.csh DESTINATION ${KERNEL_salomescript_SCRIPTS}) + +FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") +INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${KERNEL_salomeinclude_HEADERS}) diff --git a/src/MPIContainer/MPIContainer_i.cxx b/src/MPIContainer/MPIContainer_i.cxx index f72a0b5b8..8ce73d65c 100644 --- a/src/MPIContainer/MPIContainer_i.cxx +++ b/src/MPIContainer/MPIContainer_i.cxx @@ -35,6 +35,11 @@ #include #include #include // must be before Python.h ! + +#ifdef _XOPEN_SOURCE +#undef _XOPEN_SOURCE +#endif + #include #include "Container_init_python.hxx" diff --git a/src/Makefile.am b/src/Makefile.am index 30d72430e..598d9e790 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -25,6 +25,9 @@ # Module : KERNEL # $Header$ # + +include $(top_srcdir)/salome_adm/unix/make_common_starter.am + SUBDIR_BASE = \ Basics \ SALOMELocalTrace \ @@ -129,4 +132,4 @@ if WITH_PACO_PARALLEL endif endif -EXTRA_DIST = win32pm +EXTRA_DIST += win32pm diff --git a/src/ModuleCatalog/CMakeLists.txt b/src/ModuleCatalog/CMakeLists.txt new file mode 100755 index 000000000..3e8f048ef --- /dev/null +++ b/src/ModuleCatalog/CMakeLists.txt @@ -0,0 +1,68 @@ +# Copyright (C) 2012 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_DIRECTORIES( + ${PTHREAD_INCLUDE_DIRS} + ${OMNIORB_INCLUDE_DIRS} + ${LIBXML_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR}/salome_adm + ${CMAKE_CURRENT_SOURCE_DIR}/../Basics + ${CMAKE_CURRENT_SOURCE_DIR}/../SALOMELocalTrace + ${CMAKE_CURRENT_SOURCE_DIR}/../NamingService + ${CMAKE_CURRENT_SOURCE_DIR}/../Utils + ${CMAKE_BINARY_DIR}/idl +) + +# This local variable defines the list of dependant libraries common to all target in this package. +SET(COMMON_LIBS + SalomeNS + OpUtil + SALOMELocalTrace + SALOMEBasics + SalomeIDLKernel + ${LIBXML_LIBS} +) + +SET(SalomeCatalog_SOURCES + SALOME_ModuleCatalog_Handler.cxx + SALOME_ModuleCatalog_Parser_IO.cxx + SALOME_ModuleCatalog_impl.cxx + SALOME_ModuleCatalog_Acomponent_impl.cxx +) + +ADD_LIBRARY(SalomeCatalog SHARED ${SalomeCatalog_SOURCES}) +SET_TARGET_PROPERTIES(SalomeCatalog PROPERTIES COMPILE_FLAGS "${LIBXML_DEFINITIONS} ${OMNIORB_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +TARGET_LINK_LIBRARIES(SalomeCatalog ${COMMON_LIBS}) +INSTALL(TARGETS SalomeCatalog DESTINATION ${KERNEL_salomelib_LIBS}) + +ADD_EXECUTABLE(SALOME_ModuleCatalog_Server SALOME_ModuleCatalog_Server.cxx) +SET_TARGET_PROPERTIES(SALOME_ModuleCatalog_Server PROPERTIES COMPILE_FLAGS "${LIBXML_DEFINITIONS} ${OMNIORB_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +TARGET_LINK_LIBRARIES(SALOME_ModuleCatalog_Server SalomeCatalog ${COMMON_LIBS} ${OMNIORB_LIBS}) + +ADD_EXECUTABLE(SALOME_ModuleCatalog_Client SALOME_ModuleCatalog_Client.cxx) +SET_TARGET_PROPERTIES(SALOME_ModuleCatalog_Client PROPERTIES COMPILE_FLAGS "${LIBXML_DEFINITIONS} ${OMNIORB_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +TARGET_LINK_LIBRARIES(SALOME_ModuleCatalog_Client SalomeCatalog ${COMMON_LIBS} ${OMNIORB_LIBS}) + +INSTALL(TARGETS SALOME_ModuleCatalog_Server SALOME_ModuleCatalog_Client DESTINATION ${KERNEL_salomebin_BINS}) + +# Executable scripts to be installed +SALOME_INSTALL_SCRIPTS(TestModuleCatalog.py ${KERNEL_salomescript_PYTHON}) + +FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") +INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${KERNEL_salomeinclude_HEADERS}) diff --git a/src/ModuleGenerator/CMakeLists.txt b/src/ModuleGenerator/CMakeLists.txt new file mode 100755 index 000000000..8fed90f7f --- /dev/null +++ b/src/ModuleGenerator/CMakeLists.txt @@ -0,0 +1,25 @@ +# Copyright (C) 2012 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 +# + +CONFIGURE_FILE(testIDLparser.in testIDLparser @ONLY) + +# =============================================================== +# Files to be installed +# =============================================================== +SALOME_INSTALL_SCRIPTS(IDLparser.py ${KERNEL_salomescript_PYTHON}) diff --git a/src/ModuleGenerator/Makefile.am b/src/ModuleGenerator/Makefile.am index be3b14f33..31d036665 100644 --- a/src/ModuleGenerator/Makefile.am +++ b/src/ModuleGenerator/Makefile.am @@ -29,7 +29,7 @@ include $(top_srcdir)/salome_adm/unix/make_common_starter.am dist_salomescript_PYTHON = IDLparser.py -EXTRA_DIST = tests +EXTRA_DIST += tests install-data-hook: @for f in $(dist_salomescript_PYTHON) ; do \ diff --git a/src/NOTIFICATION_SWIG/CMakeLists.txt b/src/NOTIFICATION_SWIG/CMakeLists.txt new file mode 100755 index 000000000..8d22ebc63 --- /dev/null +++ b/src/NOTIFICATION_SWIG/CMakeLists.txt @@ -0,0 +1,50 @@ +# Copyright (C) 2012 CEA/DEN, EDF R&D +# +# 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_PACKAGE(SWIG REQUIRED) +INCLUDE(${SWIG_USE_FILE}) + +SET_SOURCE_FILES_PROPERTIES(NOTIFICATION.i PROPERTIES CPLUSPLUS ON) +SET_SOURCE_FILES_PROPERTIES(NOTIFICATION.i PROPERTIES SWIG_DEFINITIONS "-shadow") +SET_SOURCE_FILES_PROPERTIES(NOTIFICATIONPYTHON_wrap.cxx PROPERTIES COMPILE_FLAGS "${OMNIORB_DEFINITIONS} -DHAVE_CONFIG_H") + +INCLUDE_DIRECTORIES( + ${PYTHON_INCLUDE_DIRS} + ${PTHREAD_INCLUDE_DIRS} + ${OMNIORB_INCLUDE_DIRS} + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_BINARY_DIR}/salome_adm + ${CMAKE_CURRENT_SOURCE_DIR}/../Notification + ${CMAKE_CURRENT_SOURCE_DIR}/../Basics + ${CMAKE_CURRENT_SOURCE_DIR}/../SALOMELocalTrace + ) + +SWIG_ADD_MODULE(libNOTIFICATION python NOTIFICATION.i NOTIFICATION_Swig.cxx) +SWIG_LINK_LIBRARIES(libNOTIFICATION ${PYTHON_LIBS} SalomeNotification) +SET_TARGET_PROPERTIES(_libNOTIFICATION PROPERTIES COMPILE_FLAGS "${OMNIORB_DEFINITIONS} ${PLATFORM_DEFINITIONS}") + +IF(${MACHINE} STREQUAL WINDOWS) + SET_TARGET_PROPERTIES(_libNOTIFICATION PROPERTIES DEBUG_OUTPUT_NAME _libNOTIFICATION_d) +ENDIF(${MACHINE} STREQUAL WINDOWS) + +INSTALL(TARGETS _libNOTIFICATION DESTINATION ${KERNEL_salomepythondir}) + +FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") +INSTALL(FILES ${COMON_HEADERS_HXX} DESTINATION ${MED_salomeinclude_HEADERS}) +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libNOTIFICATION.py DESTINATION ${KERNEL_salomepythondir}) \ No newline at end of file diff --git a/src/NOTIFICATION_SWIG/Makefile.am b/src/NOTIFICATION_SWIG/Makefile.am index 2957b8e7e..2036a6038 100644 --- a/src/NOTIFICATION_SWIG/Makefile.am +++ b/src/NOTIFICATION_SWIG/Makefile.am @@ -61,4 +61,4 @@ swig_wrap.cpp libNOTIFICATION.py : $(SWIGSOURCES) CLEANFILES = swig_wrap.cpp -EXTRA_DIST = $(SWIGSOURCES) +EXTRA_DIST += $(SWIGSOURCES) diff --git a/src/NamingService/CMakeLists.txt b/src/NamingService/CMakeLists.txt new file mode 100755 index 000000000..b2542217b --- /dev/null +++ b/src/NamingService/CMakeLists.txt @@ -0,0 +1,45 @@ +# Copyright (C) 2012 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_DIRECTORIES( + ${OMNIORB_INCLUDE_DIRS} + ${PTHREAD_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR}/salome_adm + ${CMAKE_CURRENT_SOURCE_DIR}/../Basics + ${CMAKE_CURRENT_SOURCE_DIR}/../SALOMELocalTrace + ${CMAKE_CURRENT_SOURCE_DIR}/../Utils + ${CMAKE_BINARY_DIR}/idl + ) + +SET(SalomeNS_SOURCES + SALOME_NamingService.cxx + ServiceUnreachable.cxx + NamingService_WaitForServerReadiness.cxx +) + +ADD_LIBRARY(SalomeNS SHARED ${SalomeNS_SOURCES}) +SET_TARGET_PROPERTIES(SalomeNS PROPERTIES COMPILE_FLAGS "${OMNIORB_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +TARGET_LINK_LIBRARIES(SalomeNS OpUtil) +INSTALL(TARGETS SalomeNS DESTINATION ${KERNEL_salomelib_LIBS}) + +# Executable scripts to be installed +SALOME_INSTALL_SCRIPTS(SALOME_NamingServicePy.py ${KERNEL_salomescript_PYTHON}) + +FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") +INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${KERNEL_salomeinclude_HEADERS}) diff --git a/src/NamingService/Test/CMakeLists.txt b/src/NamingService/Test/CMakeLists.txt new file mode 100755 index 000000000..6f675c91d --- /dev/null +++ b/src/NamingService/Test/CMakeLists.txt @@ -0,0 +1,70 @@ +# Copyright (C) 2012 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_DIRECTORIES( + ${PTHREAD_INCLUDE_DIRS} + ${CPPUNIT_INCLUDE_DIRS} + ${OMNIORB_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR}/salome_adm + ${CMAKE_CURRENT_SOURCE_DIR}/../../NamingService + ${CMAKE_CURRENT_SOURCE_DIR}/../../Basics + ${CMAKE_CURRENT_SOURCE_DIR}/../../SALOMELocalTrace + ${CMAKE_CURRENT_SOURCE_DIR}/../../Utils + ${CMAKE_BINARY_DIR}/idl + ${CMAKE_CURRENT_SOURCE_DIR}/../../SALOMELocalTrace/Test + ${CMAKE_CURRENT_SOURCE_DIR}/../../SALOMETraceCollector/Test + ${CMAKE_CURRENT_SOURCE_DIR}/../../Utils/Test + ${CMAKE_CURRENT_SOURCE_DIR}/../../Basics/Test +) + +# This local variable defines the list of dependant libraries common to all target in this package. +SET(COMMON_LIBS + ${CPPUNIT_LIBS} + SalomeNS + ${OMNIORB_LIBS} +) + +ADD_LIBRARY(NamingServiceTest SHARED NamingServiceTest.cxx) +SET_TARGET_PROPERTIES(NamingServiceTest PROPERTIES COMPILE_FLAGS "${CPPUNIT_DEFINITIONS} ${OMNIORB_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +TARGET_LINK_LIBRARIES(NamingServiceTest ${COMMON_LIBS} ${PLATFORM_LIBS}) +INSTALL(TARGETS NamingServiceTest DESTINATION ${KERNEL_salomelib_LIBS}) + +SET(TestNamingService_LIBS + NamingServiceTest + SalomeNS + SALOMELocalTraceTest + SALOMELocalTrace + SALOMETraceCollectorTest + UtilsTest + OpUtil + SALOMEBasics + SalomeIDLKernel + ${COMMON_LIBS} +) + +ADD_EXECUTABLE(TestNamingService TestNamingService.cxx) +SET_TARGET_PROPERTIES(TestNamingService PROPERTIES COMPILE_FLAGS "${CPPUNIT_DEFINITIONS} ${OMNIORB_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +TARGET_LINK_LIBRARIES(TestNamingService ${TestNamingService_LIBS} ${PLATFORM_LIBS}) +INSTALL(TARGETS TestNamingService DESTINATION ${KERNEL_salomebin_BINS}) + +# Executable scripts to be installed +SALOME_INSTALL_SCRIPTS(TestNamingService.py ${KERNEL_salomescript_PYTHON}) + +FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") +INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${KERNEL_salomeinclude_HEADERS}) diff --git a/src/NamingService/Test/NamingServiceTest.cxx b/src/NamingService/Test/NamingServiceTest.cxx index 033f8f87e..b36194d05 100644 --- a/src/NamingService/Test/NamingServiceTest.cxx +++ b/src/NamingService/Test/NamingServiceTest.cxx @@ -23,6 +23,7 @@ #include "NamingServiceTest.hxx" #include "Utils_ORB_INIT.hxx" #include "Utils_SINGLETON.hxx" +#include "Basics_Utils.hxx" #include #include @@ -43,6 +44,10 @@ #define DEVTRACE(msg) #endif +#ifdef WIN32 +#define setenv Kernel_Utils::setenv +#endif + #define TRACEFILE "/tmp/traceUnitTest.log" // ============================================================================ diff --git a/src/NamingService/Test/NamingServiceTest.hxx b/src/NamingService/Test/NamingServiceTest.hxx index 69ea3df88..ecd42a73d 100644 --- a/src/NamingService/Test/NamingServiceTest.hxx +++ b/src/NamingService/Test/NamingServiceTest.hxx @@ -29,7 +29,17 @@ #include #include CORBA_SERVER_HEADER(nstest) -class NSTEST_echo_i : public virtual POA_NSTEST::echo, +#ifdef WIN32 +# if defined NAMINGSERVICETEST_EXPORTS || defined NamingServiceTest_EXPORTS +# define NAMINGSERVICETEST_EXPORT __declspec( dllexport ) +# else +# define NAMINGSERVICETEST_EXPORT __declspec( dllimport ) +# endif +#else +# define NAMINGSERVICETEST_EXPORT +#endif + +class NAMINGSERVICETEST_EXPORT NSTEST_echo_i : public virtual POA_NSTEST::echo, public virtual PortableServer::ServantBase { public: @@ -52,7 +62,7 @@ private: int _num; }; -class NamingServiceTest : public CppUnit::TestFixture +class NAMINGSERVICETEST_EXPORT NamingServiceTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE( NamingServiceTest ); CPPUNIT_TEST( testConstructorDefault ); diff --git a/src/Notification/CMakeLists.txt b/src/Notification/CMakeLists.txt new file mode 100755 index 000000000..571ff7814 --- /dev/null +++ b/src/Notification/CMakeLists.txt @@ -0,0 +1,49 @@ +# Copyright (C) 2012 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_DIRECTORIES( + ${OMNIORB_INCLUDE_DIRS} + ${PTHREAD_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR}/salome_adm + ${CMAKE_CURRENT_SOURCE_DIR}/../Basics + ${CMAKE_CURRENT_SOURCE_DIR}/../SALOMELocalTrace + ${CMAKE_CURRENT_SOURCE_DIR}/../Utils + ) + +SET(COMMON_LIBS + OpUtil + SALOMELocalTrace + SALOMEBasics + ${OMNIORB_LIBS} +) + +SET(SalomeNotification_SOURCES + NOTIFICATION.cxx + NOTIFICATION_Supplier.cxx + NOTIFICATION_Consumer.cxx +) + +ADD_LIBRARY(SalomeNotification SHARED ${SalomeNotification_SOURCES}) +SET_TARGET_PROPERTIES(SalomeNotification PROPERTIES COMPILE_FLAGS "${OMNIORB_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +TARGET_LINK_LIBRARIES(SalomeNotification ${COMMON_LIBS}) +INSTALL(TARGETS SalomeNotification DESTINATION ${KERNEL_salomelib_LIBS}) + +FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") +SET(COMMON_HEADERS ${COMMON_HEADERS_HXX} CosNotifyShorthands.h) +INSTALL(FILES ${COMMON_HEADERS} DESTINATION ${KERNEL_salomeinclude_HEADERS}) diff --git a/src/ParallelContainer/CMakeLists.txt b/src/ParallelContainer/CMakeLists.txt new file mode 100755 index 000000000..bbaad6bfc --- /dev/null +++ b/src/ParallelContainer/CMakeLists.txt @@ -0,0 +1,106 @@ +# Copyright (C) 2012 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_DIRECTORIES( + ${OMNIORB_INCLUDE_DIRS} + ${MPI_INCLUDE_DIRS} + ${PYTHON_INCLUDE_DIRS} + ${PACO_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR}/salome_adm + ${CMAKE_SOURCE_DIR}/src/Container + ${CMAKE_SOURCE_DIR}/src/Notification + ${CMAKE_SOURCE_DIR}/src/SALOMELocalTrace + ${CMAKE_SOURCE_DIR}/src/Basics + ${CMAKE_SOURCE_DIR}/src/NamingService + ${CMAKE_SOURCE_DIR}/src/Registry + ${CMAKE_SOURCE_DIR}/src/Utils + ${CMAKE_SOURCE_DIR}/src/GenericObj + ${CMAKE_CURRENT_SOURCE_DIR}/../HDFPersist + ${CMAKE_BINARY_DIR}/idl + ${CMAKE_SOURCE_DIR}/src/SALOMETraceCollector + ${PACOPATH}/lib +) + +# This local variable defines the list of dependant libraries common to all target in this package. +SET(COMMON_LIBS + SalomeContainer + SalomeNS + SALOMELocalTrace + SALOMEBasics + SalomeHDFPersist + SalomeParallelIDLKernel + SalomeIDLKernel + ${CORBA_LIBS} + ${PACO_LIBS} + ${PYTHON_LIBS} +) + +SET(SalomeParallelContainer_SOURCES + SALOME_ParallelComponent_i.cxx + SALOME_ParallelContainer_i.cxx + SALOME_ParallelContainerProxy_i.cxx + Parallel_Salome_file_i.cxx + SALOME_ParallelGlobalProcessVar_i.cxx +) + +ADD_LIBRARY(SalomeParallelContainer SHARED ${SalomeParallelContainer_SOURCES}) +SET_TARGET_PROPERTIES(SalomeParallelContainer PROPERTIES COMPILE_FLAGS "${ONMIORB_DEFINITIONS} ${MPI_DEFINITIONS} ${PACO_DEFINITIONS}") +TARGET_LINK_LIBRARIES(SalomeParallelContainer ${COMMON_LIBS} ${MPI_LIBS}) +INSTALL(TARGETS Registry DESTINATION ${KERNEL_salomelib_LIBS}) + +IF(MPI_IS_OK) + SET(SALOME_ParallelContainerProxyMpi_LIBS + SalomeParallelContainer + ${PaCO_dummy} + ${PaCO_mpi} + ${PaCO_omnithread} + ${MPI_LIBS} + ${COMMON_LIBS} + ) + ADD_EXECUTABLE(SALOME_ParallelContainerProxyMpi SALOME_Registry_Server.cxx) + SET_TARGET_PROPERTIES(SALOME_ParallelContainerProxyMpi PROPERTIES COMPILE_FLAGS "${ONMIORB_DEFINITIONS} ${MPI_DEFINITIONS} ${PACO_DEFINITIONS}") + TARGET_LINK_LIBRARIES(SALOME_ParallelContainerProxyMpi ${SALOME_ParallelContainerProxyMpi_LIBS}) + + ADD_EXECUTABLE(SALOME_ParallelContainerNodeMpi SALOME_ParallelContainerNodeMpi.cxx) + SET_TARGET_PROPERTIES(SALOME_ParallelContainerNodeMpi PROPERTIES COMPILE_FLAGS "${ONMIORB_DEFINITIONS} ${MPI_DEFINITIONS} ${PACO_DEFINITIONS}") + TARGET_LINK_LIBRARIES(SALOME_ParallelContainerNodeMpi ${SALOME_ParallelContainerProxyMpi_LIBS}) + + INSTALL(TARGETS SALOME_ParallelContainerProxyMpi SALOME_ParallelContainerNodeMpi DESTINATION ${KERNEL_salomebin_BINS}) +ENDIF(MPI_IS_OK) + +SET(SALOME_ParallelContainerProxyDummy_LIBS + SalomeParallelContainer + ${PaCO_dummy} + ${PaCO_omnithread} + ${COMMON_LIBS} +) + +ADD_EXECUTABLE(SALOME_ParallelContainerProxyDummy SALOME_ParallelContainerProxyDummy.cxx) +SET_TARGET_PROPERTIES(SALOME_ParallelContainerProxyDummy PROPERTIES COMPILE_FLAGS "${ONMIORB_DEFINITIONS} ${MPI_DEFINITIONS} ${PACO_DEFINITIONS}") +TARGET_LINK_LIBRARIES(SALOME_ParallelContainerProxyDummy ${SALOME_ParallelContainerProxyDummy_LIBS}) + +ADD_EXECUTABLE(SALOME_ParallelContainerNodeDummy SALOME_ParallelContainerNodeDummy.cxx) +SET_TARGET_PROPERTIES(SALOME_ParallelContainerNodeDummy PROPERTIES COMPILE_FLAGS "${ONMIORB_DEFINITIONS} ${MPI_DEFINITIONS} ${PACO_DEFINITIONS}") +TARGET_LINK_LIBRARIES(SALOME_ParallelContainerNodeDummy ${SALOME_ParallelContainerProxyDummy_LIBS}) + +INSTALL(TARGETS SALOME_ParallelContainerNodeDummy SALOME_ParallelContainerProxyDummy DESTINATION ${KERNEL_salomebin_BINS}) + +FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") +INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${KERNEL_salomeinclude_HEADERS}) + diff --git a/src/Registry/CMakeLists.txt b/src/Registry/CMakeLists.txt new file mode 100755 index 000000000..154880672 --- /dev/null +++ b/src/Registry/CMakeLists.txt @@ -0,0 +1,53 @@ +# Copyright (C) 2012 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_DIRECTORIES( + ${PTHREAD_INCLUDE_DIRS} + ${OMNIORB_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR}/salome_adm + ${CMAKE_CURRENT_SOURCE_DIR}/../Basics + ${CMAKE_CURRENT_SOURCE_DIR}/../SALOMELocalTrace + ${CMAKE_CURRENT_SOURCE_DIR}/../NamingService + ${CMAKE_CURRENT_SOURCE_DIR}/../Utils + ${CMAKE_BINARY_DIR}/idl +) + +ADD_LIBRARY(Registry SHARED RegistryConnexion.cxx RegistryService.cxx) +SET_TARGET_PROPERTIES(Registry PROPERTIES COMPILE_FLAGS "${OMNIORB_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +TARGET_LINK_LIBRARIES(Registry SalomeNS OpUtil SALOMELocalTrace SalomeIDLKernel ${PLATFORM_LIBS}) +INSTALL(TARGETS Registry DESTINATION ${KERNEL_salomelib_LIBS}) + +SET(SALOME_Registry_Server_LIBS + SalomeIDLKernel + Registry + SalomeNS + OpUtil + SALOMELocalTrace + SALOMEBasics + ${OMNIORB_LIBS} + ${PLATFORM_LIBS} +) + +ADD_EXECUTABLE(SALOME_Registry_Server SALOME_Registry_Server.cxx) +SET_TARGET_PROPERTIES(SALOME_Registry_Server PROPERTIES COMPILE_FLAGS "${OMNIORB_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +TARGET_LINK_LIBRARIES(SALOME_Registry_Server ${SALOME_Registry_Server_LIBS}) +INSTALL(TARGETS SALOME_Registry_Server DESTINATION ${KERNEL_salomebin_BINS}) + +FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") +INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${KERNEL_salomeinclude_HEADERS}) diff --git a/src/ResourcesManager/CMakeLists.txt b/src/ResourcesManager/CMakeLists.txt new file mode 100755 index 000000000..10cb294ad --- /dev/null +++ b/src/ResourcesManager/CMakeLists.txt @@ -0,0 +1,64 @@ +# Copyright (C) 2012 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_DIRECTORIES( + ${LIBXML_INCLUDE_DIRS} + ${PTHREAD_INCLUDE_DIRS} + ${OMNIORB_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR}/salome_adm + ${CMAKE_CURRENT_SOURCE_DIR}/../Basics + ${CMAKE_CURRENT_SOURCE_DIR}/../SALOMELocalTrace + ${CMAKE_CURRENT_SOURCE_DIR}/../NamingService + ${CMAKE_CURRENT_SOURCE_DIR}/../Utils + ${CMAKE_BINARY_DIR}/idl +) + +# This local variable defines the list of FLAGS common to all target in this package. +SET(COMMON_FLAGS "${OMNIORB_DEFINITIONS} ${LIBXML_DEFINITIONS} ${PLATFORM_DEFINITIONS}") + +# This local variable defines the list of dependant libraries common to all target in this package. +SET(COMMON_LIBS + SalomeNS + OpUtil + SALOMEBasics + SalomeIDLKernel + ${LIBXML_LIBS} +) + +SET(ResourcesManager_SOURCES + SALOME_ResourcesCatalog_Parser.cxx + SALOME_ResourcesCatalog_Handler.cxx + SALOME_LoadRateManager.cxx + ResourcesManager.cxx +) + +ADD_LIBRARY(ResourcesManager SHARED ${ResourcesManager_SOURCES}) +SET_TARGET_PROPERTIES(ResourcesManager PROPERTIES COMPILE_FLAGS "${LIBXML_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +TARGET_LINK_LIBRARIES(ResourcesManager SALOMEBasics OpUtil ${LIBXML_LIBS}) +INSTALL(TARGETS ResourcesManager DESTINATION ${KERNEL_salomelib_LIBS}) + +IF(NOT WITHONLYLAUNCHER) + ADD_LIBRARY(SalomeResourcesManager SHARED SALOME_ResourcesManager.cxx) + SET_TARGET_PROPERTIES(SalomeResourcesManager PROPERTIES COMPILE_FLAGS "${COMMON_FLAGS}") + TARGET_LINK_LIBRARIES(SalomeResourcesManager ResourcesManager ${COMMON_LIBS}) + INSTALL(TARGETS SalomeResourcesManager DESTINATION ${KERNEL_salomelib_LIBS}) +ENDIF(NOT WITHONLYLAUNCHER) + +FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") +INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${KERNEL_salomeinclude_HEADERS}) diff --git a/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx b/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx index f65db96c0..ae42569dd 100755 --- a/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx +++ b/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx @@ -248,6 +248,8 @@ SALOME_ResourcesCatalog_Handler::ProcessCluster(xmlNodePtr cluster_descr, Parser resource.mpi = mpich2; else if (anMpi == "openmpi") resource.mpi = openmpi; + else if (anMpi == "ompi") + resource.mpi = ompi; else if (anMpi == "slurmmpi") resource.mpi = slurmmpi; else if (anMpi == "prun") @@ -543,6 +545,8 @@ SALOME_ResourcesCatalog_Handler::ProcessMachine(xmlNodePtr machine_descr, Parser resource.mpi = mpich2; else if (anMpi == "openmpi") resource.mpi = openmpi; + else if (anMpi == "ompi") + resource.mpi = ompi; else if (anMpi == "slurmmpi") resource.mpi = slurmmpi; else if (anMpi == "prun") @@ -768,6 +772,9 @@ void SALOME_ResourcesCatalog_Handler::PrepareDocToXmlFile(xmlDocPtr theDoc) case openmpi: xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "openmpi"); break; + case ompi: + xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "ompi"); + break; case slurmmpi: xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "slurmmpi"); break; diff --git a/src/ResourcesManager/SALOME_ResourcesCatalog_Parser.cxx b/src/ResourcesManager/SALOME_ResourcesCatalog_Parser.cxx index 50360f72f..9cf3cfa99 100644 --- a/src/ResourcesManager/SALOME_ResourcesCatalog_Parser.cxx +++ b/src/ResourcesManager/SALOME_ResourcesCatalog_Parser.cxx @@ -263,6 +263,8 @@ ParserResourcesType::PrintMpiImplType() const return "mpich2"; else if (mpi == openmpi) return "openmpi"; + else if (mpi == ompi) + return "ompi"; else if (mpi == slurmmpi) return "slurmmpi"; else diff --git a/src/ResourcesManager/SALOME_ResourcesCatalog_Parser.hxx b/src/ResourcesManager/SALOME_ResourcesCatalog_Parser.hxx index 20a390db1..1ac87b340 100755 --- a/src/ResourcesManager/SALOME_ResourcesCatalog_Parser.hxx +++ b/src/ResourcesManager/SALOME_ResourcesCatalog_Parser.hxx @@ -47,7 +47,7 @@ enum AccessModeType {interactive, batch}; enum BatchType {none, pbs, lsf, sge, ssh_batch, ccc, ll, slurm, vishnu}; -enum MpiImplType {nompi, lam, mpich1, mpich2, openmpi, slurmmpi, prun}; +enum MpiImplType {nompi, lam, mpich1, mpich2, openmpi, ompi, slurmmpi, prun}; class RESOURCESMANAGER_EXPORT ResourceDataToSort { diff --git a/src/ResourcesManager/SALOME_ResourcesManager.cxx b/src/ResourcesManager/SALOME_ResourcesManager.cxx index eb932fdc8..30a1c1b44 100644 --- a/src/ResourcesManager/SALOME_ResourcesManager.cxx +++ b/src/ResourcesManager/SALOME_ResourcesManager.cxx @@ -237,6 +237,8 @@ SALOME_ResourcesManager::GetResourceDefinition(const char * name) p_ptr->mpiImpl = "mpich2"; else if( resource.mpi == openmpi ) p_ptr->mpiImpl = "openmpi"; + else if( resource.mpi == ompi ) + p_ptr->mpiImpl = "ompi"; else if( resource.mpi == slurmmpi ) p_ptr->mpiImpl = "slurmmpi"; else if( resource.mpi == prun ) @@ -315,6 +317,8 @@ SALOME_ResourcesManager::AddResource(const Engines::ResourceDefinition& new_reso resource.mpi = mpich2; else if (anMpi == "openmpi") resource.mpi = openmpi; + else if (anMpi == "ompi") + resource.mpi = ompi; else if (anMpi == "slurmmpi") resource.mpi = slurmmpi; else if (anMpi == "prun") @@ -499,7 +503,7 @@ SALOME_ResourcesManager::getMachineFile(std::string resource_name, cluster_it++; } } - else if (resource.mpi == openmpi) + else if ((resource.mpi == openmpi) || (resource.mpi == ompi)) { // Creating machine file machine_file_name = tmpnam(NULL); diff --git a/src/SALOMEDS/CMakeLists.txt b/src/SALOMEDS/CMakeLists.txt new file mode 100755 index 000000000..e1d4820db --- /dev/null +++ b/src/SALOMEDS/CMakeLists.txt @@ -0,0 +1,269 @@ +# Copyright (C) 2012 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_DIRECTORIES( + ${PTHREAD_INCLUDE_DIRS} + ${OMNIORB_INCLUDE_DIRS} + ${HDF5_INCLUDE_DIRS} + ${BOOST_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR}/salome_adm + ${CMAKE_CURRENT_SOURCE_DIR}/../HDFPersist + ${CMAKE_CURRENT_SOURCE_DIR}/../Basics + ${CMAKE_CURRENT_SOURCE_DIR}/../SALOMELocalTrace + ${CMAKE_CURRENT_SOURCE_DIR}/../Utils + ${CMAKE_CURRENT_SOURCE_DIR}/../DF + ${CMAKE_CURRENT_SOURCE_DIR}/../SALOMEDSImpl + ${CMAKE_CURRENT_SOURCE_DIR}/../NamingService + ${CMAKE_CURRENT_SOURCE_DIR}/../GenericObj + ${CMAKE_CURRENT_SOURCE_DIR}/../SALOMEDSClient + ${CMAKE_CURRENT_SOURCE_DIR}/../LifeCycleCORBA + ${CMAKE_BINARY_DIR}/idl +) + +SET(COMMON_FLAGS "${OMNIORB_DEFINITIONS} ${HDF5_DEFINITIONS} ${BOOST_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +SET(COMMON_LIBS + TOOLSDS + SalomeNS + OpUtil + SALOMELocalTrace + SALOMEBasics + SalomeHDFPersist + DF + SalomeDSImpl + SalomeGenericObj + SalomeLifeCycleCORBA + SalomeIDLKernel + ${HDF5_LIBS} +) + +SET(SalomeDS_SOURCES + SALOMEDS.cxx + SALOMEDS_Driver_i.cxx + SALOMEDS_StudyManager_i.cxx + SALOMEDS_UseCaseBuilder_i.cxx + SALOMEDS_UseCaseIterator_i.cxx + SALOMEDS_ChildIterator_i.cxx + SALOMEDS_SComponentIterator_i.cxx + SALOMEDS_Study_i.cxx + SALOMEDS_StudyBuilder_i.cxx + SALOMEDS_SObject_i.cxx + SALOMEDS_SComponent_i.cxx + SALOMEDS_GenericAttribute_i.cxx + SALOMEDS_AttributeComment_i.cxx + SALOMEDS_AttributeExternalFileDef_i.cxx + SALOMEDS_AttributeFileType_i.cxx + SALOMEDS_AttributeIOR_i.cxx + SALOMEDS_AttributeInteger_i.cxx + SALOMEDS_AttributeName_i.cxx + SALOMEDS_AttributePersistentRef_i.cxx + SALOMEDS_AttributeReal_i.cxx + SALOMEDS_AttributeSequenceOfReal_i.cxx + SALOMEDS_AttributeSequenceOfInteger_i.cxx + SALOMEDS_AttributeDrawable_i.cxx + SALOMEDS_AttributeSelectable_i.cxx + SALOMEDS_AttributeOpened_i.cxx + SALOMEDS_AttributeFlags_i.cxx + SALOMEDS_AttributeGraphic_i.cxx + SALOMEDS_AttributeExpandable_i.cxx + SALOMEDS_AttributeTextColor_i.cxx + SALOMEDS_AttributeTextHighlightColor_i.cxx + SALOMEDS_AttributePixMap_i.cxx + SALOMEDS_AttributeTreeNode_i.cxx + SALOMEDS_AttributeLocalID_i.cxx + SALOMEDS_AttributeUserID_i.cxx + SALOMEDS_AttributeTarget_i.cxx + SALOMEDS_AttributeTableOfInteger_i.cxx + SALOMEDS_AttributeTableOfReal_i.cxx + SALOMEDS_AttributeTableOfString_i.cxx + SALOMEDS_AttributeStudyProperties_i.cxx + SALOMEDS_AttributePythonObject_i.cxx + SALOMEDS_AttributeParameter_i.cxx + SALOMEDS_AttributeString_i.cxx + SALOMEDS_SObject.cxx + SALOMEDS_SComponent.cxx + SALOMEDS_GenericAttribute.cxx + SALOMEDS_ChildIterator.cxx + SALOMEDS_SComponentIterator.cxx + SALOMEDS_UseCaseIterator.cxx + SALOMEDS_UseCaseBuilder.cxx + SALOMEDS_StudyBuilder.cxx + SALOMEDS_Study.cxx + SALOMEDS_StudyManager.cxx + SALOMEDS_AttributeStudyProperties.cxx + SALOMEDS_AttributeComment.cxx + SALOMEDS_AttributeDrawable.cxx + SALOMEDS_AttributeExpandable.cxx + SALOMEDS_AttributeExternalFileDef.cxx + SALOMEDS_AttributeFileType.cxx + SALOMEDS_AttributeFlags.cxx + SALOMEDS_AttributeGraphic.cxx + SALOMEDS_AttributeIOR.cxx + SALOMEDS_AttributeInteger.cxx + SALOMEDS_AttributeLocalID.cxx + SALOMEDS_AttributeName.cxx + SALOMEDS_AttributeOpened.cxx + SALOMEDS_AttributePythonObject.cxx + SALOMEDS_AttributeReal.cxx + SALOMEDS_AttributeSelectable.cxx + SALOMEDS_AttributeSequenceOfInteger.cxx + SALOMEDS_AttributePersistentRef.cxx + SALOMEDS_AttributePixMap.cxx + SALOMEDS_AttributeSequenceOfReal.cxx + SALOMEDS_AttributeTableOfInteger.cxx + SALOMEDS_AttributeTableOfReal.cxx + SALOMEDS_AttributeTableOfString.cxx + SALOMEDS_AttributeTarget.cxx + SALOMEDS_AttributeTextColor.cxx + SALOMEDS_AttributeTextHighlightColor.cxx + SALOMEDS_AttributeTreeNode.cxx + SALOMEDS_AttributeUserID.cxx + SALOMEDS_TMPFile_i.cxx + SALOMEDS_AttributeParameter.cxx + SALOMEDS_AttributeString.cxx + SALOMEDS_IParameters.cxx + SALOMEDS_AttLong_i.hxx + SALOMEDS_AttReal_i.hxx + SALOMEDS_AttributeComment.hxx + SALOMEDS_AttributeComment_i.hxx + SALOMEDS_AttributeDrawable.hxx + SALOMEDS_AttributeDrawable_i.hxx + SALOMEDS_AttributeExpandable.hxx + SALOMEDS_AttributeExpandable_i.hxx + SALOMEDS_AttributeExternalFileDef.hxx + SALOMEDS_AttributeExternalFileDef_i.hxx + SALOMEDS_AttributeFileType.hxx + SALOMEDS_AttributeFileType_i.hxx + SALOMEDS_AttributeFlags.hxx + SALOMEDS_AttributeFlags_i.hxx + SALOMEDS_AttributeGraphic.hxx + SALOMEDS_AttributeGraphic_i.hxx + SALOMEDS_AttributeInteger.hxx + SALOMEDS_AttributeInteger_i.hxx + SALOMEDS_AttributeIOR.hxx + SALOMEDS_AttributeIOR_i.hxx + SALOMEDS_AttributeLocalID.hxx + SALOMEDS_AttributeLocalID_i.hxx + SALOMEDS_AttributeName.hxx + SALOMEDS_AttributeName_i.hxx + SALOMEDS_AttributeOpened.hxx + SALOMEDS_AttributeOpened_i.hxx + SALOMEDS_AttributePersistentRef.hxx + SALOMEDS_AttributePersistentRef_i.hxx + SALOMEDS_AttributePixMap.hxx + SALOMEDS_AttributePixMap_i.hxx + SALOMEDS_AttributePythonObject.hxx + SALOMEDS_AttributePythonObject_i.hxx + SALOMEDS_AttributeReal.hxx + SALOMEDS_AttributeReal_i.hxx + SALOMEDS_AttributeSelectable.hxx + SALOMEDS_AttributeSelectable_i.hxx + SALOMEDS_AttributeSequenceOfInteger.hxx + SALOMEDS_AttributeSequenceOfInteger_i.hxx + SALOMEDS_AttributeSequenceOfReal.hxx + SALOMEDS_AttributeSequenceOfReal_i.hxx + SALOMEDS_Attributes.hxx + SALOMEDS_AttributeStudyProperties.hxx + SALOMEDS_AttributeStudyProperties_i.hxx + SALOMEDS_AttributeTableOfInteger.hxx + SALOMEDS_AttributeTableOfInteger_i.hxx + SALOMEDS_AttributeTableOfReal.hxx + SALOMEDS_AttributeTableOfReal_i.hxx + SALOMEDS_AttributeTableOfString.hxx + SALOMEDS_AttributeTableOfString_i.hxx + SALOMEDS_AttributeTarget.hxx + SALOMEDS_AttributeTarget_i.hxx + SALOMEDS_AttributeTextColor.hxx + SALOMEDS_AttributeTextColor_i.hxx + SALOMEDS_AttributeTextHighlightColor.hxx + SALOMEDS_AttributeTextHighlightColor_i.hxx + SALOMEDS_AttributeTreeNode.hxx + SALOMEDS_AttributeTreeNode_i.hxx + SALOMEDS_AttributeUserID.hxx + SALOMEDS_AttributeUserID_i.hxx + SALOMEDS_BasicAttributeFactory.hxx + SALOMEDS_BasicAttribute_i.hxx + SALOMEDS_Callback_i.hxx + SALOMEDS_ChildIterator.hxx + SALOMEDS_ChildIterator_i.hxx + SALOMEDS_ClientAttributes.hxx + SALOMEDS_Driver_i.hxx + SALOMEDS_GenericAttribute.hxx + SALOMEDS_GenericAttribute_i.hxx + SALOMEDS.hxx + SALOMEDS_SComponent.hxx + SALOMEDS_SComponent_i.hxx + SALOMEDS_SComponentIterator.hxx + SALOMEDS_SComponentIterator_i.hxx + SALOMEDS_SObject.hxx + SALOMEDS_SObject_i.hxx + SALOMEDS_StudyBuilder.hxx + SALOMEDS_StudyBuilder_i.hxx + SALOMEDS_Study.hxx + SALOMEDS_Study_i.hxx + SALOMEDS_StudyManager.hxx + SALOMEDS_StudyManager_i.hxx + SALOMEDS_UseCaseBuilder.hxx + SALOMEDS_UseCaseBuilder_i.hxx + SALOMEDS_UseCaseIterator.hxx + SALOMEDS_UseCaseIterator_i.hxx + SALOMEDS_AttributeParameter.hxx + SALOMEDS_AttributeParameter_i.hxx + SALOMEDS_AttributeString.hxx + SALOMEDS_AttributeString_i.hxx + SALOMEDS_TMPFile_i.hxx +) + +IF(WINDOWS) + SET(COMMON_FLAGS "${COMMON_FLAGS} -DNOGDI") +ENDIF(WINDOWS) + +ADD_LIBRARY(SalomeDS SHARED ${SalomeDS_SOURCES}) +SET_TARGET_PROPERTIES(SalomeDS PROPERTIES COMPILE_FLAGS "${COMMON_FLAGS}") +TARGET_LINK_LIBRARIES(SalomeDS ${COMMON_LIBS}) +INSTALL(TARGETS SalomeDS DESTINATION ${KERNEL_salomelib_LIBS}) + +ADD_EXECUTABLE(SALOMEDS_Server SALOMEDS_Server.cxx) +SET_TARGET_PROPERTIES(SALOMEDS_Server PROPERTIES COMPILE_FLAGS "${COMMON_FLAGS}") +TARGET_LINK_LIBRARIES(SALOMEDS_Server SalomeDS SALOMEBasics ${COMMON_LIBS} ${OMNIORB_LIBS}) + +ADD_EXECUTABLE(SALOMEDS_Client SALOMEDS_Client.cxx) +SET_TARGET_PROPERTIES(SALOMEDS_Client PROPERTIES COMPILE_FLAGS "${COMMON_FLAGS}") +TARGET_LINK_LIBRARIES(SALOMEDS_Client SalomeDS SALOMEBasics ${COMMON_LIBS} ${OMNIORB_LIBS}) + +INSTALL(TARGETS SALOMEDS_Server SALOMEDS_Client DESTINATION ${KERNEL_salomebin_BINS}) + +# Executable scripts to be installed +SALOME_INSTALL_SCRIPTS(SALOME_DriverPy.py ${KERNEL_salomescript_PYTHON}) + +SET(COMMON_HEADERS_HXX + SALOMEDS_StudyManager_i.hxx + SALOMEDS_Driver_i.hxx + SALOMEDS_StudyManager.hxx + SALOMEDS_Study_i.hxx + SALOMEDS_Study.hxx + SALOMEDS_SObject_i.hxx + SALOMEDS_SObject.hxx + SALOMEDS_SComponent_i.hxx + SALOMEDS_SComponent.hxx + SALOMEDS_GenericAttribute_i.hxx + SALOMEDS_GenericAttribute.hxx + SALOMEDS_IParameters.hxx + SALOMEDS_Defines.hxx +) +INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${KERNEL_salomeinclude_HEADERS}) diff --git a/src/SALOMEDS/Makefile.am b/src/SALOMEDS/Makefile.am index bfc45db68..e064be049 100644 --- a/src/SALOMEDS/Makefile.am +++ b/src/SALOMEDS/Makefile.am @@ -75,7 +75,6 @@ COMMON_CPPFLAGS=\ # This local variable defines the list of dependant libraries common to all target in this package. COMMON_LIBS =\ - ../TOOLSDS/libTOOLSDS.la \ ../NamingService/libSalomeNS.la \ ../Utils/libOpUtil.la \ ../SALOMELocalTrace/libSALOMELocalTrace.la \ diff --git a/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.cxx b/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.cxx index af20553fa..bdb5760d7 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.cxx @@ -319,3 +319,49 @@ std::string SALOMEDS_AttributeStudyProperties::GetUnits() anUnits = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->GetUnits(); return anUnits; } + +std::vector SALOMEDS_AttributeStudyProperties::GetStoredComponents() +{ + std::vector aComponents; + if (_isLocal) { + SALOMEDS::Locker lock; + aComponents = dynamic_cast(_local_impl)->GetStoredComponents(); + } + else { + SALOMEDS::StringSeq_var components = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->GetStoredComponents(); + int length = components->length(); + for (int i = 0; i < length; i++) { + aComponents.push_back(components[i].in()); + } + } + return aComponents; +} + +std::string SALOMEDS_AttributeStudyProperties::GetComponentVersion( const std::string& theComponent ) +{ + std::string aVersion; + if (_isLocal) { + SALOMEDS::Locker lock; + aVersion = dynamic_cast(_local_impl)->GetComponentVersion(theComponent); + } + else + aVersion = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->GetComponentVersion(theComponent.c_str()); + return aVersion; +} + +std::vector SALOMEDS_AttributeStudyProperties::GetComponentVersions( const std::string& theComponent ) +{ + std::vector aVersions; + if (_isLocal) { + SALOMEDS::Locker lock; + aVersions = dynamic_cast(_local_impl)->GetComponentVersions(theComponent); + } + else { + SALOMEDS::StringSeq_var versions = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->GetComponentVersions(theComponent.c_str()); + int length = versions->length(); + for (int i = 0; i < length; i++) { + aVersions.push_back(versions[i].in()); + } + } + return aVersions; +} diff --git a/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.hxx b/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.hxx index 4ebd180bd..b02e0fbff 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.hxx @@ -82,7 +82,9 @@ public: virtual void SetComment(const std::string& theComment); virtual std::string GetComment(); - + virtual std::vector GetStoredComponents(); + virtual std::string GetComponentVersion( const std::string& theComponent ); + virtual std::vector GetComponentVersions( const std::string& theComponent ); }; diff --git a/src/SALOMEDS/SALOMEDS_AttributeStudyProperties_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeStudyProperties_i.cxx index a6bd88294..3c02784de 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeStudyProperties_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeStudyProperties_i.cxx @@ -218,3 +218,34 @@ char* SALOMEDS_AttributeStudyProperties_i::GetUnits() return c_s._retn(); } +SALOMEDS::StringSeq* SALOMEDS_AttributeStudyProperties_i::GetStoredComponents() +{ + SALOMEDS::Locker lock; + std::vector components = dynamic_cast(_impl)->GetStoredComponents(); + SALOMEDS::StringSeq_var c_components = new SALOMEDS::StringSeq(); + c_components->length(components.size()); + for (int i = 0; i < components.size(); i++) { + c_components[i] = CORBA::string_dup(components[i].c_str()); + } + return c_components._retn(); +} + +char* SALOMEDS_AttributeStudyProperties_i::GetComponentVersion(const char* theComponent) +{ + SALOMEDS::Locker lock; + std::string version = dynamic_cast(_impl)->GetComponentVersion(theComponent); + CORBA::String_var c_version = CORBA::string_dup(version.c_str()); + return c_version._retn(); +} + +SALOMEDS::StringSeq* SALOMEDS_AttributeStudyProperties_i::GetComponentVersions(const char* theComponent) +{ + SALOMEDS::Locker lock; + std::vector versions = dynamic_cast(_impl)->GetComponentVersions(theComponent); + SALOMEDS::StringSeq_var c_versions = new SALOMEDS::StringSeq(); + c_versions->length(versions.size()); + for (int i = 0; i < versions.size(); i++) { + c_versions[i] = CORBA::string_dup(versions[i].c_str()); + } + return c_versions._retn(); +} diff --git a/src/SALOMEDS/SALOMEDS_AttributeStudyProperties_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeStudyProperties_i.hxx index 7c6198ee1..ead14d9e8 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeStudyProperties_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeStudyProperties_i.hxx @@ -73,6 +73,10 @@ public: virtual void SetUnits(const char* theUnits); virtual char* GetUnits(); + + virtual SALOMEDS::StringSeq* GetStoredComponents(); + virtual char* GetComponentVersion(const char* theComponent); + virtual SALOMEDS::StringSeq* GetComponentVersions(const char* theComponent); }; diff --git a/src/SALOMEDS/SALOMEDS_Driver_i.cxx b/src/SALOMEDS/SALOMEDS_Driver_i.cxx index 87bdec277..e072cedb3 100644 --- a/src/SALOMEDS/SALOMEDS_Driver_i.cxx +++ b/src/SALOMEDS/SALOMEDS_Driver_i.cxx @@ -29,21 +29,33 @@ #include "SALOMEDS.hxx" #include -SALOMEDS_Driver_i::SALOMEDS_Driver_i(SALOMEDS::Driver_ptr theDriver, CORBA::ORB_ptr theORB) +SALOMEDS_Driver_i::SALOMEDS_Driver_i(Engines::EngineComponent_ptr theEngine, CORBA::ORB_ptr theORB) { + // engine should not be null - component is supposed to be inherited from Engines::EngineComponent + _engine = Engines::EngineComponent::_duplicate(theEngine); + // driver can be null - if component interface does not inherit SALOMEDS::Driver + _driver = SALOMEDS::Driver::_narrow(theEngine); + _orb = CORBA::ORB::_duplicate(theORB); +} + +SALOMEDS_Driver_i::SALOMEDS_Driver_i(SALOMEDS::Driver_ptr theDriver, CORBA::ORB_ptr theORB) +{ + // driver can be null - if component interface does not inherit SALOMEDS::Driver _driver = SALOMEDS::Driver::_duplicate(theDriver); - _orb = CORBA::ORB::_duplicate(theORB); + // engine can be null - since it is narrowed from SALOMEDS::Driver ptr which can be null + _engine = Engines::EngineComponent::_narrow(theDriver); + _orb = CORBA::ORB::_duplicate(theORB); } SALOMEDS_Driver_i::~SALOMEDS_Driver_i() { } -std::string SALOMEDS_Driver_i::GetIOR() +std::string SALOMEDS_Driver_i::GetIOR() { std::string ior = ""; - if ( !CORBA::is_nil(_driver) ) { - CORBA::String_var cior = _orb->object_to_string(_driver); + if ( !CORBA::is_nil(_engine) ) { + CORBA::String_var cior = _orb->object_to_string(_engine); ior = cior; } return ior; @@ -53,7 +65,7 @@ SALOMEDSImpl_TMPFile* SALOMEDS_Driver_i::Save(const SALOMEDSImpl_SComponent& the const std::string& theURL, long& theStreamLength, bool isMultiFile) -{ +{ SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (theComponent, _orb); CORBA::String_var url = CORBA::string_dup(theURL.c_str()); @@ -90,7 +102,7 @@ SALOMEDSImpl_TMPFile* SALOMEDS_Driver_i::SaveASCII(const SALOMEDSImpl_SComponent return aTMPFile; } - + bool SALOMEDS_Driver_i::Load(const SALOMEDSImpl_SComponent& theComponent, const unsigned char* theStream, const long theStreamLength, @@ -102,9 +114,9 @@ bool SALOMEDS_Driver_i::Load(const SALOMEDSImpl_SComponent& theComponent, CORBA::Octet* anOctetBuf = (CORBA::Octet*)theStream; SALOMEDS::TMPFile_var aStream; - if (theStreamLength > 0) - aStream = new SALOMEDS::TMPFile(theStreamLength, theStreamLength, anOctetBuf, 0); - else + if (theStreamLength > 0) + aStream = new SALOMEDS::TMPFile(theStreamLength, theStreamLength, anOctetBuf, 0); + else aStream = new SALOMEDS::TMPFile(0); SALOMEDS::unlock(); @@ -128,9 +140,9 @@ bool SALOMEDS_Driver_i::LoadASCII(const SALOMEDSImpl_SComponent& theComponent, CORBA::Octet* anOctetBuf = (CORBA::Octet*)theStream; SALOMEDS::TMPFile_var aStream; - if(theStreamLength > 0) - aStream = new SALOMEDS::TMPFile(theStreamLength, theStreamLength, anOctetBuf, 0); - else + if(theStreamLength > 0) + aStream = new SALOMEDS::TMPFile(theStreamLength, theStreamLength, anOctetBuf, 0); + else aStream = new SALOMEDS::TMPFile(0); SALOMEDS::unlock(); @@ -153,7 +165,7 @@ void SALOMEDS_Driver_i::Close(const SALOMEDSImpl_SComponent& theComponent) SALOMEDS::lock(); } -std::string SALOMEDS_Driver_i::ComponentDataType() +std::string SALOMEDS_Driver_i::ComponentDataType() { std::string dtype = ""; if ( !CORBA::is_nil(_driver) ) { @@ -163,6 +175,11 @@ std::string SALOMEDS_Driver_i::ComponentDataType() return dtype; } +std::string SALOMEDS_Driver_i::Version() +{ + return !CORBA::is_nil( _engine ) ? _engine->getVersion() : std::string(""); +} + std::string SALOMEDS_Driver_i::IORToLocalPersistentID(const SALOMEDSImpl_SObject& theSObject, const std::string& IORString, bool isMultiFile, @@ -223,7 +240,7 @@ bool SALOMEDS_Driver_i::CanCopy(const SALOMEDSImpl_SObject& theObject) } -SALOMEDSImpl_TMPFile* SALOMEDS_Driver_i::CopyFrom(const SALOMEDSImpl_SObject& theObject, +SALOMEDSImpl_TMPFile* SALOMEDS_Driver_i::CopyFrom(const SALOMEDSImpl_SObject& theObject, int& theObjectID, long& theStreamLength) { @@ -265,9 +282,9 @@ std::string SALOMEDS_Driver_i::PasteInto(const unsigned char* theStream, CORBA::Octet* anOctetBuf = (CORBA::Octet*)theStream; SALOMEDS::TMPFile_var aStream; - if(theStreamLength > 0) - aStream = new SALOMEDS::TMPFile(theStreamLength, theStreamLength, anOctetBuf, 0); - else + if(theStreamLength > 0) + aStream = new SALOMEDS::TMPFile(theStreamLength, theStreamLength, anOctetBuf, 0); + else aStream = new SALOMEDS::TMPFile(0); SALOMEDS::unlock(); @@ -284,8 +301,8 @@ std::string SALOMEDS_Driver_i::PasteInto(const unsigned char* theStream, return entry; } -SALOMEDSImpl_TMPFile* SALOMEDS_Driver_i::DumpPython(SALOMEDSImpl_Study* theStudy, - bool isPublished, +SALOMEDSImpl_TMPFile* SALOMEDS_Driver_i::DumpPython(SALOMEDSImpl_Study* theStudy, + bool isPublished, bool isMultiFile, bool& isValidScript, long& theStreamLength) @@ -298,9 +315,8 @@ SALOMEDSImpl_TMPFile* SALOMEDS_Driver_i::DumpPython(SALOMEDSImpl_Study* theStudy Engines::TMPFile_var aStream; CORBA::Boolean aValidScript = true; // VSR: maybe should be false by default ??? - Engines::EngineComponent_ptr aComponent = Engines::EngineComponent::_narrow(_driver); - if ( !CORBA::is_nil( aComponent ) ) - aStream = aComponent->DumpPython(st.in(), isPublished, isMultiFile, aValidScript); + if ( !CORBA::is_nil( _engine ) ) + aStream = _engine->DumpPython(st.in(), isPublished, isMultiFile, aValidScript); SALOMEDSImpl_TMPFile* aTMPFile = new Engines_TMPFile_i(aStream._retn()); theStreamLength = aTMPFile->Size(); @@ -315,14 +331,14 @@ SALOMEDSImpl_TMPFile* SALOMEDS_Driver_i::DumpPython(SALOMEDSImpl_Study* theStudy // SALOMEDS_DriverFactory //############################################################################################################### -SALOMEDS_DriverFactory_i::SALOMEDS_DriverFactory_i(CORBA::ORB_ptr theORB) +SALOMEDS_DriverFactory_i::SALOMEDS_DriverFactory_i(CORBA::ORB_ptr theORB) { _orb = CORBA::ORB::_duplicate(theORB); _name_service = new SALOME_NamingService(_orb); } -SALOMEDS_DriverFactory_i::~SALOMEDS_DriverFactory_i() +SALOMEDS_DriverFactory_i::~SALOMEDS_DriverFactory_i() { delete _name_service; } @@ -340,12 +356,12 @@ SALOMEDSImpl_Driver* SALOMEDS_DriverFactory_i::GetDriverByType(const std::string SALOMEDS::lock(); if (CORBA::is_nil(obj)) { - obj = SALOME_LifeCycleCORBA(_name_service).FindOrLoad_Component("FactoryServerPy", theComponentType.c_str()); + obj = SALOME_LifeCycleCORBA(_name_service).FindOrLoad_Component("FactoryServer", theComponentType.c_str()); } if (!CORBA::is_nil(obj)) { - SALOMEDS::Driver_var aDriver = SALOMEDS::Driver::_narrow(obj); - return new SALOMEDS_Driver_i(aDriver, _orb); + Engines::EngineComponent_var anEngine = Engines::EngineComponent::_narrow(obj); + return new SALOMEDS_Driver_i(anEngine, _orb); } return NULL; @@ -355,10 +371,10 @@ SALOMEDSImpl_Driver* SALOMEDS_DriverFactory_i::GetDriverByIOR(const std::string& { CORBA::Object_var obj; obj = _orb->string_to_object(theIOR.c_str()); - + if (!CORBA::is_nil(obj)) { - SALOMEDS::Driver_var aDriver = SALOMEDS::Driver::_narrow(obj); - return new SALOMEDS_Driver_i(aDriver, _orb); + Engines::EngineComponent_var anEngine = Engines::EngineComponent::_narrow(obj); + return new SALOMEDS_Driver_i(anEngine, _orb); } return NULL; diff --git a/src/SALOMEDS/SALOMEDS_Driver_i.hxx b/src/SALOMEDS/SALOMEDS_Driver_i.hxx index a17b9b846..e4de665be 100644 --- a/src/SALOMEDS/SALOMEDS_Driver_i.hxx +++ b/src/SALOMEDS/SALOMEDS_Driver_i.hxx @@ -37,12 +37,12 @@ class Standard_EXPORT SALOMEDS_Driver_i : public virtual SALOMEDSImpl_Driver { protected: SALOMEDS::Driver_var _driver; + Engines::EngineComponent_var _engine; CORBA::ORB_var _orb; public: - + SALOMEDS_Driver_i(Engines::EngineComponent_ptr theEngine, CORBA::ORB_ptr theORB); SALOMEDS_Driver_i(SALOMEDS::Driver_ptr theDriver, CORBA::ORB_ptr theORB); - ~SALOMEDS_Driver_i(); virtual std::string GetIOR(); @@ -73,6 +73,8 @@ public: virtual std::string ComponentDataType(); + virtual std::string Version(); + virtual std::string IORToLocalPersistentID(const SALOMEDSImpl_SObject& theSObject, const std::string& IORString, bool isMultiFile, diff --git a/src/SALOMEDS/SALOMEDS_StudyBuilder.cxx b/src/SALOMEDS/SALOMEDS_StudyBuilder.cxx index 5e54ef02e..fb6ee94c0 100644 --- a/src/SALOMEDS/SALOMEDS_StudyBuilder.cxx +++ b/src/SALOMEDS/SALOMEDS_StudyBuilder.cxx @@ -194,12 +194,13 @@ void SALOMEDS_StudyBuilder::LoadWith(const _PTR(SComponent)& theSCO, const std:: SALOMEDS_SComponent* aSCO = dynamic_cast(theSCO.get()); CORBA::Object_var obj = _orb->string_to_object(theIOR.c_str()); + Engines::EngineComponent_var anEngine = Engines::EngineComponent::_narrow(obj); SALOMEDS::Driver_var aDriver = SALOMEDS::Driver::_narrow(obj); if (_isLocal) { SALOMEDS::Locker lock; - SALOMEDS_Driver_i* drv = new SALOMEDS_Driver_i(aDriver, _orb); + SALOMEDS_Driver_i* drv = new SALOMEDS_Driver_i(anEngine, _orb); SALOMEDSImpl_SComponent aSCO_impl = *(dynamic_cast(aSCO->GetLocalImpl())); bool isDone = _local_impl->LoadWith(aSCO_impl, drv); delete drv; diff --git a/src/SALOMEDS/SALOMEDS_StudyManager.cxx b/src/SALOMEDS/SALOMEDS_StudyManager.cxx index 813d0820e..814f58bc3 100644 --- a/src/SALOMEDS/SALOMEDS_StudyManager.cxx +++ b/src/SALOMEDS/SALOMEDS_StudyManager.cxx @@ -317,7 +317,7 @@ SALOMEDS_Driver_i* GetDriver(const SALOMEDSImpl_SObject& theObject, CORBA::ORB_p std::string IOREngine = aSCO.GetIOR(); if(!IOREngine.empty()) { CORBA::Object_var obj = orb->string_to_object(IOREngine.c_str()); - SALOMEDS::Driver_var Engine = SALOMEDS::Driver::_narrow(obj) ; + Engines::EngineComponent_var Engine = Engines::EngineComponent::_narrow(obj) ; driver = new SALOMEDS_Driver_i(Engine, orb); } } diff --git a/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx b/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx index c26919c8e..9ba8b7e71 100644 --- a/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx +++ b/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx @@ -451,7 +451,7 @@ SALOMEDS_Driver_i* GetDriver(const SALOMEDSImpl_SObject& theObject, CORBA::ORB_p std::string IOREngine = aSCO.GetIOR(); if(!IOREngine.empty()) { CORBA::Object_var obj = orb->string_to_object(IOREngine.c_str()); - SALOMEDS::Driver_var Engine = SALOMEDS::Driver::_narrow(obj) ; + Engines::EngineComponent_var Engine = Engines::EngineComponent::_narrow(obj) ; driver = new SALOMEDS_Driver_i(Engine, orb); } } diff --git a/src/SALOMEDS/SALOME_DriverPy.py b/src/SALOMEDS/SALOME_DriverPy.py index 7e820dd27..e879aeb69 100644 --- a/src/SALOMEDS/SALOME_DriverPy.py +++ b/src/SALOMEDS/SALOME_DriverPy.py @@ -46,6 +46,12 @@ class SALOME_DriverPy_i(SALOMEDS__POA.Driver): def ComponentDataType(self): return self._ComponentDataType + def Version(self): + try: + return self.getVersion() + except: + return "" + def Save(self, theComponent, theURL, isMultiFile): return "" diff --git a/src/SALOMEDS/Test/CMakeLists.txt b/src/SALOMEDS/Test/CMakeLists.txt new file mode 100755 index 000000000..069385256 --- /dev/null +++ b/src/SALOMEDS/Test/CMakeLists.txt @@ -0,0 +1,87 @@ +# Copyright (C) 2012 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_DIRECTORIES( + ${PTHREAD_INCLUDE_DIRS} + ${CPPUNIT_INCLUDE_DIRS} + ${OMNIORB_INCLUDE_DIRS} + ${BOOST_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR}/salome_adm + ${CMAKE_CURRENT_SOURCE_DIR}/../../Basics + ${CMAKE_CURRENT_SOURCE_DIR}/../../Basics/Test + ${CMAKE_CURRENT_SOURCE_DIR}/../../SALOMELocalTrace + ${CMAKE_CURRENT_SOURCE_DIR}/../../SALOMELocalTrace/Test + ${CMAKE_CURRENT_SOURCE_DIR}/../../SALOMETraceCollector + ${CMAKE_CURRENT_SOURCE_DIR}/../../SALOMETraceCollector/Test + ${CMAKE_CURRENT_SOURCE_DIR}/../../NamingService + ${CMAKE_CURRENT_SOURCE_DIR}/../../NamingService/Test + ${CMAKE_CURRENT_SOURCE_DIR}/../../Utils + ${CMAKE_CURRENT_SOURCE_DIR}/../../Utils/Test + ${CMAKE_CURRENT_SOURCE_DIR}/../../ResourcesManager + ${CMAKE_CURRENT_SOURCE_DIR}/../../LifeCycleCORBA + ${CMAKE_CURRENT_SOURCE_DIR}/../../SALOMEDS + ${CMAKE_CURRENT_SOURCE_DIR}/../../SALOMEDSClient + ${CMAKE_CURRENT_SOURCE_DIR}/../../DF + ${CMAKE_CURRENT_SOURCE_DIR}/../../SALOMEDSImpl + ${CMAKE_CURRENT_SOURCE_DIR}/../../SALOMEDSImpl/Test + ${CMAKE_BINARY_DIR}/idl +) + +# This local variable defines the list of dependant libraries common to all target in this package. +SET(COMMON_LIBS + ${CPPUNIT_LIBS} + SALOMEBasics + SalomeResourcesManager + SalomeContainer + SalomeNS + Registry + SalomeNotification + UtilsTest + OpUtil + SALOMELocalTraceTest + SALOMELocalTrace + SALOMETraceCollectorTest + SALOMEDSImplTest + DF + SalomeDSImpl + SalomeDSClient + SalomeDS + SalomeIDLKernel +) + +SET(COMMON_FLAGS "${CPPUNIT_DEFINITIONS} ${OMNIORB_DEFINITIONS} ${BOOST_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +IF(WINDOWS) + SET(COMMON_FLAGS "${COMMON_FLAGS} -DNOGDI") +ENDIF(WINDOWS) + +ADD_LIBRARY(SALOMEDSTest SHARED SALOMEDSTest.cxx) +SET_TARGET_PROPERTIES(SALOMEDSTest PROPERTIES COMPILE_FLAGS "${COMMON_FLAGS}") +TARGET_LINK_LIBRARIES(SALOMEDSTest ${COMMON_LIBS}) +INSTALL(TARGETS SALOMEDSTest DESTINATION ${KERNEL_salomelib_LIBS}) + +ADD_EXECUTABLE(TestSALOMEDS TestSALOMEDS.cxx) +SET_TARGET_PROPERTIES(TestSALOMEDS PROPERTIES COMPILE_FLAGS "${CPPUNIT_DEFINITIONS} ${OMNIORB_DEFINITIONS} ${BOOST_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +TARGET_LINK_LIBRARIES(TestSALOMEDS SALOMEDSTest SALOMEBasics ${COMMON_LIBS} ${OMNIORB_LIBS}) +INSTALL(TARGETS TestSALOMEDS DESTINATION ${KERNEL_salomebin_BINS}) + +# Executable scripts to be installed +SALOME_INSTALL_SCRIPTS(TestSALOMEDS.py ${KERNEL_salomescript_PYTHON}) + +FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") +INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${KERNEL_salomeinclude_HEADERS}) diff --git a/src/SALOMEDS/Test/Makefile.am b/src/SALOMEDS/Test/Makefile.am index 3076b5821..4394dd9cc 100644 --- a/src/SALOMEDS/Test/Makefile.am +++ b/src/SALOMEDS/Test/Makefile.am @@ -96,7 +96,7 @@ libSALOMEDSTest_la_CPPFLAGS = $(COMMON_CPPFLAGS) libSALOMEDSTest_la_LDFLAGS = -no-undefined -version-info=0:0:0 libSALOMEDSTest_la_LIBADD = $(COMMON_LIBS) -EXTRA_DIST = \ +EXTRA_DIST += \ SALOMEDSTest_AttributeComment.cxx \ SALOMEDSTest_AttributeDrawable.cxx \ SALOMEDSTest_AttributeExpandable.cxx \ diff --git a/src/SALOMEDS/Test/SALOMEDSTest.hxx b/src/SALOMEDS/Test/SALOMEDSTest.hxx index 6d433f199..fc544d636 100644 --- a/src/SALOMEDS/Test/SALOMEDSTest.hxx +++ b/src/SALOMEDS/Test/SALOMEDSTest.hxx @@ -28,7 +28,17 @@ #include #include CORBA_SERVER_HEADER(SALOMEDS) -class SALOMEDSTest : public CppUnit::TestFixture +#ifdef WIN32 +# if defined SALOMEDSTEST_EXPORTS || defined SALOMEDSTest_EXPORTS +# define SALOMEDSTEST_EXPORT __declspec( dllexport ) +# else +# define SALOMEDSTEST_EXPORT __declspec( dllimport ) +# endif +#else +# define SALOMEDSTEST_EXPORT +#endif + +class SALOMEDSTEST_EXPORT SALOMEDSTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE( SALOMEDSTest ); @@ -130,7 +140,7 @@ CORBA::ORB_var _orb; -class SALOMEDSTest_Embedded : public SALOMEDSTest +class SALOMEDSTEST_EXPORT SALOMEDSTest_Embedded : public SALOMEDSTest { CPPUNIT_TEST_SUITE( SALOMEDSTest_Embedded ); diff --git a/src/SALOMEDS/Test/TestSALOMEDS.cxx b/src/SALOMEDS/Test/TestSALOMEDS.cxx index 117a494bc..c9421cca1 100644 --- a/src/SALOMEDS/Test/TestSALOMEDS.cxx +++ b/src/SALOMEDS/Test/TestSALOMEDS.cxx @@ -53,6 +53,9 @@ CPPUNIT_TEST_SUITE_REGISTRATION( SALOMEDSTest_Embedded ); #include "NamingService_WaitForServerReadiness.hxx" #include "SALOMEDS_StudyManager_i.hxx" +#ifdef WIN32 +#define setenv Kernel_Utils::setenv +#endif // ============================================================================ /*! @@ -84,8 +87,13 @@ int main(int argc, char* argv[]) ORB_INIT &init = *SINGLETON_::Instance() ; ASSERT(SINGLETON_::IsAlreadyExisting()); CORBA::ORB_var orb = init(argc , argv ) ; - - sleep(15); + + #ifndef WIN32 + sleep(15); + #else + Sleep(15000); + #endif + std::string host; // = Kernel_Utils::GetHostname(); char* wait_Superv = getenv("SALOMEDS_UNITTESTS_WAIT_SUPERVISOR"); diff --git a/src/SALOMEDSClient/CMakeLists.txt b/src/SALOMEDSClient/CMakeLists.txt new file mode 100755 index 000000000..84df7a383 --- /dev/null +++ b/src/SALOMEDSClient/CMakeLists.txt @@ -0,0 +1,33 @@ +# Copyright (C) 2012 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_DIRECTORIES( + ${OMNIORB_INCLUDE_DIRS} + ${BOOST_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR}/salome_adm + ${CMAKE_BINARY_DIR}/idl +) + +ADD_LIBRARY(SalomeDSClient SHARED SALOMEDSClient_ClientFactory.cxx) +SET_TARGET_PROPERTIES(SalomeDSClient PROPERTIES COMPILE_FLAGS "${OMNIORB_DEFINITIONS} ${OMNIORB_DEFINITIONS}") +TARGET_LINK_LIBRARIES(SalomeDSClient SalomeIDLKernel) +INSTALL(TARGETS SalomeDSClient DESTINATION ${KERNEL_salomelib_LIBS}) + +FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") +INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${KERNEL_salomeinclude_HEADERS}) diff --git a/src/SALOMEDSClient/SALOMEDSClient_AttributeStudyProperties.hxx b/src/SALOMEDSClient/SALOMEDSClient_AttributeStudyProperties.hxx index de3f9a5cb..41284ca6e 100644 --- a/src/SALOMEDSClient/SALOMEDSClient_AttributeStudyProperties.hxx +++ b/src/SALOMEDSClient/SALOMEDSClient_AttributeStudyProperties.hxx @@ -67,7 +67,9 @@ public: virtual void SetComment(const std::string& theComment) = 0; virtual std::string GetComment() = 0; - + virtual std::vector GetStoredComponents() = 0; + virtual std::string GetComponentVersion( const std::string& theComponent ) = 0; + virtual std::vector GetComponentVersions( const std::string& theComponent ) = 0; }; diff --git a/src/SALOMEDSImpl/CMakeLists.txt b/src/SALOMEDSImpl/CMakeLists.txt new file mode 100755 index 000000000..d3daf020f --- /dev/null +++ b/src/SALOMEDSImpl/CMakeLists.txt @@ -0,0 +1,169 @@ +# Copyright (C) 2012 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_DIRECTORIES( + ${OMNIORB_INCLUDE_DIRS} + ${PTHREAD_INCLUDE_DIRS} + ${HDF5_INCLUDE_DIRS} + ${BOOST_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR}/salome_adm + ${CMAKE_CURRENT_SOURCE_DIR}/../Basics + ${CMAKE_CURRENT_SOURCE_DIR}/../SALOMELocalTrace + ${CMAKE_CURRENT_SOURCE_DIR}/../HDFPersist + ${CMAKE_CURRENT_SOURCE_DIR}/../DF + ${CMAKE_CURRENT_SOURCE_DIR}/../GenericObj + ${CMAKE_BINARY_DIR}/idl + ${CMAKE_BINARY_DIR} +) + +# This local variable defines the list of FLAGS common to all target in this package. +SET(COMMON_FLAGS "${HDF5_DEFINITIONS} ${OMNIORB_DEFINITIONS} ${BOOST_DEFINITIONS} ${PLATFORM_DEFINITIONS}") + +# This local variable defines the list of dependant libraries common to all target in this package. +SET(COMMON_LIBS + SALOMEBasics + SalomeHDFPersist + DF + SalomeGenericObj + SalomeIDLKernel + ${HDF5_LIBS} +) + +SET(SalomeDSImpl_SOURCES + SALOMEDSImpl_Tool.cxx + SALOMEDSImpl_Callback.cxx + SALOMEDSImpl_StudyHandle.cxx + SALOMEDSImpl_GenericAttribute.cxx + SALOMEDSImpl_SObject.cxx + SALOMEDSImpl_SComponent.cxx + SALOMEDSImpl_ChildIterator.cxx + SALOMEDSImpl_AttributeIOR.cxx + SALOMEDSImpl_AttributeExternalFileDef.cxx + SALOMEDSImpl_AttributeFileType.cxx + SALOMEDSImpl_AttributePersistentRef.cxx + SALOMEDSImpl_AttributeSequenceOfReal.cxx + SALOMEDSImpl_AttributeSequenceOfInteger.cxx + SALOMEDSImpl_AttributeDrawable.cxx + SALOMEDSImpl_AttributeSelectable.cxx + SALOMEDSImpl_AttributeExpandable.cxx + SALOMEDSImpl_AttributeOpened.cxx + SALOMEDSImpl_AttributeFlags.cxx + SALOMEDSImpl_AttributeGraphic.cxx + SALOMEDSImpl_AttributeTextColor.cxx + SALOMEDSImpl_AttributeTextHighlightColor.cxx + SALOMEDSImpl_AttributePixMap.cxx + SALOMEDSImpl_AttributeLocalID.cxx + SALOMEDSImpl_AttributeTarget.cxx + SALOMEDSImpl_AttributeTableOfInteger.cxx + SALOMEDSImpl_AttributeTableOfReal.cxx + SALOMEDSImpl_AttributeTableOfString.cxx + SALOMEDSImpl_AttributeStudyProperties.cxx + SALOMEDSImpl_AttributePythonObject.cxx + SALOMEDSImpl_AttributeReal.cxx + SALOMEDSImpl_AttributeInteger.cxx + SALOMEDSImpl_AttributeUserID.cxx + SALOMEDSImpl_AttributeTreeNode.cxx + SALOMEDSImpl_AttributeName.cxx + SALOMEDSImpl_AttributeComment.cxx + SALOMEDSImpl_AttributeReference.cxx + SALOMEDSImpl_AttributeParameter.cxx + SALOMEDSImpl_AttributeString.cxx + SALOMEDSImpl_ChildNodeIterator.cxx + SALOMEDSImpl_UseCaseBuilder.cxx + SALOMEDSImpl_UseCaseIterator.cxx + SALOMEDSImpl_SComponentIterator.cxx + SALOMEDSImpl_StudyBuilder.cxx + SALOMEDSImpl_Study.cxx + SALOMEDSImpl_StudyManager.cxx + SALOMEDSImpl_IParameters.cxx + SALOMEDSImpl_TMPFile.cxx + SALOMEDSImpl_GenericVariable.cxx + SALOMEDSImpl_ScalarVariable.cxx + SALOMEDSImpl_AttributeComment.hxx + SALOMEDSImpl_AttributeDrawable.hxx + SALOMEDSImpl_AttributeExpandable.hxx + SALOMEDSImpl_AttributeExternalFileDef.hxx + SALOMEDSImpl_AttributeFileType.hxx + SALOMEDSImpl_AttributeFlags.hxx + SALOMEDSImpl_AttributeGraphic.hxx + SALOMEDSImpl_AttributeInteger.hxx + SALOMEDSImpl_AttributeIOR.hxx + SALOMEDSImpl_AttributeLocalID.hxx + SALOMEDSImpl_AttributeName.hxx + SALOMEDSImpl_AttributeOpened.hxx + SALOMEDSImpl_AttributePersistentRef.hxx + SALOMEDSImpl_AttributePixMap.hxx + SALOMEDSImpl_AttributePythonObject.hxx + SALOMEDSImpl_AttributeReal.hxx + SALOMEDSImpl_AttributeReference.hxx + SALOMEDSImpl_AttributeSelectable.hxx + SALOMEDSImpl_AttributeSequenceOfInteger.hxx + SALOMEDSImpl_AttributeSequenceOfReal.hxx + SALOMEDSImpl_Attributes.hxx + SALOMEDSImpl_AttributeStudyProperties.hxx + SALOMEDSImpl_AttributeTable.hxx + SALOMEDSImpl_AttributeTableOfInteger.hxx + SALOMEDSImpl_AttributeTableOfReal.hxx + SALOMEDSImpl_AttributeTableOfString.hxx + SALOMEDSImpl_AttributeTarget.hxx + SALOMEDSImpl_AttributeTextColor.hxx + SALOMEDSImpl_AttributeTextHighlightColor.hxx + SALOMEDSImpl_AttributeTreeNode.hxx + SALOMEDSImpl_AttributeUserID.hxx + SALOMEDSImpl_AttributeParameter.hxx + SALOMEDSImpl_AttributeString.hxx + SALOMEDSImpl_Callback.hxx + SALOMEDSImpl_ChildIterator.hxx + SALOMEDSImpl_ChildNodeIterator.hxx + SALOMEDSImpl_Defines.hxx + SALOMEDSImpl_Driver.hxx + SALOMEDSImpl_GenericAttribute.hxx + SALOMEDSImpl_SComponent.hxx + SALOMEDSImpl_SComponentIterator.hxx + SALOMEDSImpl_SObject.hxx + SALOMEDSImpl_StudyBuilder.hxx + SALOMEDSImpl_StudyHandle.hxx + SALOMEDSImpl_Study.hxx + SALOMEDSImpl_StudyManager.hxx + SALOMEDSImpl_Tool.hxx + SALOMEDSImpl_UseCaseBuilder.hxx + SALOMEDSImpl_UseCaseIterator.hxx + SALOMEDSImpl_GenericVariable.hxx + SALOMEDSImpl_ScalarVariable.hxx +) + +ADD_LIBRARY(SalomeDSImpl SHARED ${SalomeDSImpl_SOURCES}) +SET_TARGET_PROPERTIES(SalomeDSImpl PROPERTIES COMPILE_FLAGS "${COMMON_FLAGS}") +TARGET_LINK_LIBRARIES(SalomeDSImpl SALOMELocalTrace ${COMMON_LIBS} ${OMNIORB_LIBS} ${PLATFORM_LIBS}) +INSTALL(TARGETS SalomeDSImpl DESTINATION ${KERNEL_salomelib_LIBS}) + +ADD_EXECUTABLE(testDS testDS.cxx) +SET_TARGET_PROPERTIES(testDS PROPERTIES COMPILE_FLAGS "${COMMON_FLAGS}") +TARGET_LINK_LIBRARIES(testDS SalomeDSImpl ${COMMON_LIBS} ${OMNIORB_LIBS} ${PLATFORM_LIBS}) +INSTALL(TARGETS testDS DESTINATION ${KERNEL_salomebin_BINS}) + +FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") +SET(NOINST_HEADERS_HXX + SALOMEDSImpl_Tool.hxx + SALOMEDSImpl_StudyHandle.hxx +) +FOREACH(HEADER ${NOINST_HEADERS_HXX}) + LIST(REMOVE_ITEM COMMON_HEADERS_HXX ${CMAKE_CURRENT_SOURCE_DIR}/${HEADER}) +ENDFOREACH(HEADER ${NOINST_HEADERS_HXX}) +INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${KERNEL_salomeinclude_HEADERS}) diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeStudyProperties.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeStudyProperties.cxx index 60e44a608..b48581b99 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeStudyProperties.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeStudyProperties.cxx @@ -60,6 +60,7 @@ void SALOMEDSImpl_AttributeStudyProperties::Init() myMonth.clear(); myYear.clear(); myMode = 0; // none + myComponentVersions.clear(); } void SALOMEDSImpl_AttributeStudyProperties::SetModification(const std::string& theUserName, @@ -102,9 +103,7 @@ void SALOMEDSImpl_AttributeStudyProperties::GetModifications std::string SALOMEDSImpl_AttributeStudyProperties::GetCreatorName() const { - if (myUserName.size() == 0) - return std::string(""); - return myUserName[0]; + return myUserName.empty() ? std::string("") : myUserName[0]; } bool SALOMEDSImpl_AttributeStudyProperties::GetCreationDate @@ -136,6 +135,7 @@ void SALOMEDSImpl_AttributeStudyProperties::ChangeCreatorName(const std::string& void SALOMEDSImpl_AttributeStudyProperties::SetCreationMode(const int theMode) { + if (theMode == myMode) return; CheckLocked(); Backup(); myMode = theMode; @@ -175,7 +175,8 @@ bool SALOMEDSImpl_AttributeStudyProperties::IsLocked() const return myLocked; } -bool SALOMEDSImpl_AttributeStudyProperties::IsLockChanged(const bool theErase) { +bool SALOMEDSImpl_AttributeStudyProperties::IsLockChanged(const bool theErase) +{ if (!myLockChanged) return false; if (theErase) myLockChanged = false; return true; @@ -204,6 +205,7 @@ void SALOMEDSImpl_AttributeStudyProperties::Restore(DF_Attribute* with) myYear.push_back(aYears[i]); } myMode = aProp->GetCreationMode(); + myComponentVersions = aProp->GetComponentsVersions(); // myModified = aProp->GetModified(); // myLocked = aProp->IsLocked(); } @@ -227,6 +229,7 @@ void SALOMEDSImpl_AttributeStudyProperties::Paste(DF_Attribute* into) } aProp->SetCreationMode(myMode); + aProp->SetComponentsVersions( myComponentVersions ); // aProp->SetModified(myModified); // aProp->SetLocked(myLocked); } @@ -244,11 +247,26 @@ std::string SALOMEDSImpl_AttributeStudyProperties::Save() std::string units = GetUnits(); std::string comment = GetComment(); + + int aLength1 = 0; + std::map versions; + versionMap::const_iterator it; + for (aLength1 = 0, it = myComponentVersions.begin(); it != myComponentVersions.end(); ++it ) { + std::string vlist = ""; + versionList vl = it->second; + versionList::const_iterator vlit; + for ( vlit = vl.begin(); vlit != vl.end(); ++vlit ) { + if ( vlist != "" ) vlist += ";"; + vlist += *vlit; + } + versions[ it->first ] = vlist; + aLength1 += it->first.size() + vlist.size() + 2; + } unitsSize = units.size(); commentSize = comment.size(); - char* aProperty = new char[3 + aLength + 12 * aNames.size() + 1 + unitsSize + 1 + commentSize]; + char* aProperty = new char[3 + aLength + 12 * aNames.size() + 1 + unitsSize + 1 + commentSize + 1 + aLength1 ]; char crMode = (char)GetCreationMode(); @@ -283,9 +301,19 @@ std::string SALOMEDSImpl_AttributeStudyProperties::Save() if(comment.size() > 0) { sprintf(&(aProperty[a]),"%s",comment.c_str()); a = strlen(aProperty); - a++; } + aProperty[a++] = 30; //delimeter of the component versions + + std::map::const_iterator versionsIt; + for ( versionsIt = versions.begin(); versionsIt != versions.end(); ++versionsIt ) { + sprintf(&(aProperty[a]),"%s=%s", + (char*)(versionsIt->first.c_str()), + (char*)(versionsIt->second.c_str())); + a = strlen(aProperty); + aProperty[a++] = 1; + } + aProperty[a] = 0; std::string prop(aProperty); delete aProperty; @@ -293,26 +321,81 @@ std::string SALOMEDSImpl_AttributeStudyProperties::Save() return prop; } -void SALOMEDSImpl_AttributeStudyProperties::SetUnits(const std::string& theUnits) { +void SALOMEDSImpl_AttributeStudyProperties::SetUnits(const std::string& theUnits) +{ if(myUnits == theUnits) return; + + CheckLocked(); + Backup(); + myUnits = theUnits; } -std::string SALOMEDSImpl_AttributeStudyProperties::GetUnits() { +std::string SALOMEDSImpl_AttributeStudyProperties::GetUnits() const +{ return myUnits; } -void SALOMEDSImpl_AttributeStudyProperties::SetComment(const std::string& theComment) { +void SALOMEDSImpl_AttributeStudyProperties::SetComment(const std::string& theComment) +{ if(myComment == theComment) return; + + CheckLocked(); + Backup(); + myComment = theComment; } -std::string SALOMEDSImpl_AttributeStudyProperties::GetComment() { +std::string SALOMEDSImpl_AttributeStudyProperties::GetComment() const +{ return myComment; } +void SALOMEDSImpl_AttributeStudyProperties::SetComponentVersion(const std::string& theComponent, const std::string& theVersion) +{ + if (!theComponent.empty()) { + CheckLocked(); + Backup(); + if (myComponentVersions.find(theComponent) == myComponentVersions.end()) myComponentVersions[theComponent] = versionList(); + if (myComponentVersions[theComponent].empty() || myComponentVersions[theComponent].back() != theVersion) + myComponentVersions[theComponent].push_back(theVersion); + } +} + +std::vector SALOMEDSImpl_AttributeStudyProperties::GetStoredComponents() const +{ + std::vector components; + versionMap::const_iterator it; + for (it = myComponentVersions.begin(); it != myComponentVersions.end(); ++it) + components.push_back(it->first); + return components; +} + +std::string SALOMEDSImpl_AttributeStudyProperties::GetComponentVersion(const std::string& theComponent) const +{ + versionList versions = GetComponentVersions(theComponent); + return versions.size() > 0 ? versions[0] : std::string(""); +} + +std::vector SALOMEDSImpl_AttributeStudyProperties::GetComponentVersions(const std::string& theComponent) const +{ + versionList versions; + versionMap::const_iterator it = myComponentVersions.find(theComponent); + if ( it != myComponentVersions.end() ) versions = it->second; + return versions; +} + +std::map< std::string, std::vector > SALOMEDSImpl_AttributeStudyProperties::GetComponentsVersions() const +{ + return myComponentVersions; +} + +void SALOMEDSImpl_AttributeStudyProperties::SetComponentsVersions( const std::map< std::string, std::vector >& theVersions ) +{ + myComponentVersions = theVersions; +} void SALOMEDSImpl_AttributeStudyProperties::Load(const std::string& value) { @@ -322,7 +405,16 @@ void SALOMEDSImpl_AttributeStudyProperties::Load(const std::string& value) SetCreationMode(crMode); int anIndex; - for (anIndex = 2; anIndex + 2 < value.size() ;) { + // number 13 below is minimal size of modification data record, which has form: + // mmhhddMMyyyyname1, where + // - mm: minute = 2 bytes + // - hh: hour = 2 bytes + // - dd: day = 2 bytes + // - MM: month = 2 bytes + // - yyyy: year = 4 bytes + // - name: user's name = arbitrary value, minimal length is 0 bytes + // - 1 : records delimiter = 1 byte + for (anIndex = 2; anIndex + 13 < value.size() ;) { char str[10]; int aMinute, aHour, aDay, aMonth, aYear; str[0] = aCopy[anIndex++]; @@ -359,7 +451,7 @@ void SALOMEDSImpl_AttributeStudyProperties::Load(const std::string& value) break; } - //Case then study contains units and comment properties + //Case when study contains units and comment properties if( anIndex < value.size() ) { anIndex++; //skip the delimeter of the sections: char(30) int unitsSize; @@ -375,7 +467,7 @@ void SALOMEDSImpl_AttributeStudyProperties::Load(const std::string& value) anIndex += unitsSize + 1; int commentSize; - for(commentSize = 0; aCopy[anIndex+commentSize] != 0; commentSize++); + for(commentSize = 0; aCopy[anIndex+commentSize] != 0 && aCopy[anIndex+commentSize] != 30; commentSize++); if(commentSize > 0) { char *aComment = new char[commentSize+1]; @@ -384,7 +476,40 @@ void SALOMEDSImpl_AttributeStudyProperties::Load(const std::string& value) SetComment(aComment); delete [] (aComment); } - anIndex += commentSize; + anIndex += commentSize + 1; + } + + //Case when study contains components versions + if( anIndex < value.size() ) { + while ( anIndex < value.size() && aCopy[anIndex] != 0 ) { + int modSize; + for(modSize = 0; aCopy[anIndex+modSize] != '='; modSize++); + int verSize; + for(verSize = 0; aCopy[anIndex+modSize+1+verSize] != 1; verSize++); + + if(modSize > 0) { + char *aModule = new char[modSize+1]; + strncpy(aModule, &(aCopy[anIndex]), modSize); + aModule[modSize] = 0; + char *aVersions = new char[verSize+1]; + if ( verSize > 0 ) + strncpy(aVersions, &(aCopy[anIndex+modSize+1]), verSize); + aVersions[verSize] = 0; + + std::string mVersions = aVersions; + int start = 0, idx = mVersions.find( ';', start ); + while ( idx != std::string::npos ) { + SetComponentVersion( aModule, mVersions.substr( start, idx-start ) ); + start = idx + 1; + idx = mVersions.find( ';', start ); + } + SetComponentVersion( aModule, mVersions.substr( start ) ); + + delete [] (aModule); + delete [] (aVersions); + anIndex += modSize + 1 + verSize + 1; + } + } } if (aCopy[1] == 'l') { diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeStudyProperties.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeStudyProperties.hxx index 4be09cd27..8cb4b69bb 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeStudyProperties.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeStudyProperties.hxx @@ -32,6 +32,7 @@ #include "DF_Label.hxx" #include #include +#include #include "SALOMEDSImpl_GenericAttribute.hxx" class SALOMEDSIMPL_EXPORT SALOMEDSImpl_AttributeStudyProperties : public SALOMEDSImpl_GenericAttribute @@ -73,10 +74,10 @@ public: void ChangeCreatorName(const std::string& theUserName); void SetUnits(const std::string& theUnits); - std::string GetUnits(); + std::string GetUnits() const; void SetComment(const std::string& theComment); - std::string GetComment(); + std::string GetComment() const; void SetCreationMode(const int theMode); int GetCreationMode() const; @@ -89,11 +90,20 @@ public: bool IsLocked() const; bool IsLockChanged(const bool theErase); + void SetComponentsVersions( const std::map< std::string, std::vector >& theVersions ); + void SetComponentVersion(const std::string& theComponent, const std::string& theVersion); + std::vector GetStoredComponents() const; + std::string GetComponentVersion(const std::string& theComponent) const; + std::vector GetComponentVersions(const std::string& theComponent) const; + std::map< std::string, std::vector > GetComponentsVersions() const; + void Restore(DF_Attribute* with); DF_Attribute* NewEmpty() const; void Paste(DF_Attribute* into); private: + typedef std::vector versionList; + typedef std::map versionMap; std::vector myUserName; std::vector myMinute; @@ -103,11 +113,11 @@ private: std::vector myYear; std::string myUnits; std::string myComment; - int myMode; - int myModified; - bool myLocked; - bool myLockChanged; - + int myMode; + int myModified; + bool myLocked; + bool myLockChanged; + versionMap myComponentVersions; }; #endif diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Driver.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_Driver.hxx index 84be82bcb..b204337bb 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Driver.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Driver.hxx @@ -62,6 +62,7 @@ public: virtual std::string ComponentDataType() = 0; + virtual std::string Version() = 0; virtual std::string IORToLocalPersistentID(const SALOMEDSImpl_SObject& theSObject, const std::string& IORString, diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx index d52b629eb..cae31faee 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx @@ -40,6 +40,7 @@ #include "SALOMEDSImpl_SComponent.hxx" #include "SALOMEDSImpl_GenericAttribute.hxx" #include "SALOMEDSImpl_ScalarVariable.hxx" +#include "SALOMEDSImpl_IParameters.hxx" #include #include "HDFOI.hxx" @@ -56,6 +57,42 @@ static void Translate_IOR_to_persistentID (const SALOMEDSImpl_SObject&, SALOMEDSImpl_Driver*, bool isMultiFile, bool isASCII); static void ReadNoteBookVariables(SALOMEDSImpl_Study* theStudy, HDFgroup* theGroup); +namespace { + class StudyUnlocker + { + public: + StudyUnlocker( SALOMEDSImpl_Study* study ): myStudy( study ), myLocked( false ) + { + myPrevLocked = myStudy->GetProperties()->IsLocked(); + resume(); + } + ~StudyUnlocker() + { + suspend(); + } + void suspend() + { + if (myLocked) { + myStudy->GetProperties()->SetLocked(true); + myPrevLocked = myLocked; + myLocked = false; + } + } + void resume() + { + if (myPrevLocked) { + myStudy->GetProperties()->SetLocked(false); + myLocked = myPrevLocked; + myPrevLocked = false; + } + } + private: + SALOMEDSImpl_Study* myStudy; + bool myLocked; + bool myPrevLocked; + }; +} + //============================================================================ /*! Function : SALOMEDSImpl_StudyManager * Purpose : SALOMEDSImpl_StudyManager constructor @@ -209,6 +246,20 @@ SALOMEDSImpl_Study* SALOMEDSImpl_StudyManager::Open(const std::string& aUrl) delete hdf_file; // all related hdf objects will be deleted + // unlock study if it is locked, to set components versions + StudyUnlocker unlock(Study); + + //For old studies we have to add "unknown" version tag for all stored components + SALOMEDSImpl_SComponentIterator itcomponent = Study->NewComponentIterator(); + for (; itcomponent.More(); itcomponent.Next()) + { + SALOMEDSImpl_SComponent sco = itcomponent.Value(); + std::string aCompType = sco.GetComment(); + if ( aCompType == SALOMEDSImpl_IParameters::getDefaultVisualComponent() ) continue; + if ( Study->GetProperties()->GetComponentVersions( aCompType ).empty() ) + Study->GetProperties()->SetComponentVersion( aCompType, "" ); // empty version means "unknown" + } + return Study; } @@ -398,15 +449,17 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveProperties(SALOMEDSImpl_Study* aStudy, // add modifications list (user and date of save) SALOMEDSImpl_AttributeStudyProperties* aProp = aStudy->GetProperties(); - int aLocked = aProp->IsLocked(); - if (aLocked) aProp->SetLocked(false); + // unlock study if it is locked, to set modification date + StudyUnlocker unlock(aStudy); + int month=0,day=0,year=0,hh=0,mn=0,ss=0; SALOMEDSImpl_Tool::GetSystemDate(year, month, day, hh, mn, ss); aProp->SetModification(SALOMEDSImpl_Tool::GetUserName(), - mn, hh, day, month, year); - - if (aLocked) aProp->SetLocked(true); + mn, hh, day, month, year); + + // lock study back if it was locked initially, to write correct value of Locked flag + unlock.suspend(); std::vector aNames; std::vector aMinutes, aHours, aDays, aMonths, aYears; @@ -416,10 +469,27 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveProperties(SALOMEDSImpl_Study* aStudy, std::string units = aProp->GetUnits(); std::string comment = aProp->GetComment(); - int aLength = 0, anIndex, i, unitsSize = 0, commentSize = 0; + std::map< std::string, std::vector > allVersions = aProp->GetComponentsVersions(); + std::map versions; + + int aLength = 0, aLength1 = 0, anIndex, i, unitsSize = 0, commentSize = 0; + for(i=1; i<=aNames.size(); i++) aLength += aNames[i-1].size() + 1; - + + std::map< std::string, std::vector >::const_iterator it; + for (it = allVersions.begin(); it != allVersions.end(); ++it ) { + std::string vlist = ""; + std::vector vl = it->second; + std::vector::const_iterator vlit; + for ( vlit = vl.begin(); vlit != vl.end(); ++vlit ) { + if ( vlist != "" ) vlist += ";"; + vlist += *vlit; + } + versions[ it->first ] = vlist; + aLength1 += it->first.size() + vlist.size() + 2; + } + unitsSize = units.size(); commentSize = comment.size(); @@ -431,13 +501,16 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveProperties(SALOMEDSImpl_Study* aStudy, //....................................................., //....................................................., //minutes, hours, day, months, year, user name, char(1), char(30) <- !!!! used to define end of section with modifications !!!! - //units, char(1), comment, char(0) + //units, char(1), comment, char(30) <- !!!! used to define start of section with components' versions !!!! + //component=versions, char(1), + //component=versions, char(1), + //..........................., + //component=versions, char(1), char(0) //string length: 1 byte = locked flag, 1 byte = modified flag, (12 + name length + 1) for each name and date, 1 byte (char(30) section delimeter) // unit length + 1, comment length, "zero" byte - char* aProperty = new char[3 + aLength + 12 * aNames.size() + 1 + unitsSize + 1 + commentSize ]; - + char* aProperty = new char[3 + aLength + 12 * aNames.size() + 1 + unitsSize + 1 + commentSize + 1 + aLength1 ]; sprintf(aProperty,"%c%c", (char)aProp->GetCreationMode(), (aProp->IsLocked())?'l':'u'); @@ -470,11 +543,21 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveProperties(SALOMEDSImpl_Study* aStudy, if(comment.size() > 0) { sprintf(&(aProperty[a]),"%s",comment.c_str()); a = strlen(aProperty); - a++; + } + + aProperty[a++] = 30; //delimeter of the component versions + + std::map::const_iterator versionsIt; + for ( versionsIt = versions.begin(); versionsIt != versions.end(); ++versionsIt ) { + sprintf(&(aProperty[a]),"%s=%s", + (char*)(versionsIt->first.c_str()), + (char*)(versionsIt->second.c_str())); + a = a + versionsIt->first.size() + versionsIt->second.size() + 1; + aProperty[a++] = 1; } aProperty[a] = 0; - + name_len = (hdf_int32) a; size[0] = name_len + 1 ; hdf_dataset = new HDFdataset("AttributeStudyProperties",hdf_group,HDF_STRING,size,1); @@ -531,11 +614,14 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const std::string& aStudyUrl, // Store previous URL std::string anOldName = aStudy->Name(); + // Map to store components' versions + std::map componentVersions; + //Create a temporary url to which the study is saved std::string aUrl = SALOMEDSImpl_Tool::GetTmpDir() + SALOMEDSImpl_Tool::GetNameFromPath(aStudyUrl); - int aLocked = aStudy->GetProperties()->IsLocked(); - if (aLocked) aStudy->GetProperties()->SetLocked(false); + // unlock study if it is locked, as some attributes need to be modified + StudyUnlocker unlock(aStudy); SALOMEDSImpl_StudyBuilder* SB= aStudy->NewBuilder(); std::map aMapTypeDriver; @@ -543,19 +629,19 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const std::string& aStudyUrl, try { // mpv 15.12.2003: for saving components we have to load all data from all modules - SALOMEDSImpl_SComponentIterator itcomponent1 = aStudy->NewComponentIterator(); - for (; itcomponent1.More(); itcomponent1.Next()) + SALOMEDSImpl_SComponentIterator itcomponent = aStudy->NewComponentIterator(); + for (; itcomponent.More(); itcomponent.Next()) { - SALOMEDSImpl_SComponent sco = itcomponent1.Value(); + SALOMEDSImpl_SComponent sco = itcomponent.Value(); // if there is an associated Engine call its method for saving std::string IOREngine; try { + SALOMEDSImpl_Driver* aDriver = NULL; + std::string aCompType = sco.GetComment(); if (!sco.ComponentIOR(IOREngine)) { - std::string aCompType = sco.GetComment(); if (!aCompType.empty()) { - SALOMEDSImpl_Driver* aDriver = aFactory->GetDriverByType(aCompType); - aMapTypeDriver[aCompType] = aDriver; + aDriver = aFactory->GetDriverByType(aCompType); if (aDriver != NULL) { if(!SB->LoadWith(sco, aDriver)) { @@ -565,6 +651,10 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const std::string& aStudyUrl, } } } + else { + aDriver = aFactory->GetDriverByIOR(IOREngine); + } + aMapTypeDriver[aCompType] = aDriver; } catch(...) { _errorCode = "Can not restore information to resave it"; return false; @@ -586,9 +676,7 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const std::string& aStudyUrl, hdf_group_datacomponent = new HDFgroup("DATACOMPONENT",hdf_file); hdf_group_datacomponent->CreateOnDisk(); - SALOMEDSImpl_SComponentIterator itcomponent = aStudy->NewComponentIterator(); - - for (; itcomponent.More(); itcomponent.Next()) + for (itcomponent.Init(); itcomponent.More(); itcomponent.Next()) { SALOMEDSImpl_SComponent sco = itcomponent.Value(); @@ -600,20 +688,15 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const std::string& aStudyUrl, std::string IOREngine; if (sco.ComponentIOR(IOREngine)) { - SALOMEDSImpl_Driver* Engine = NULL; - if(aMapTypeDriver.find(componentDataType) != aMapTypeDriver.end()) { - // we have found the associated engine to write the data - Engine = aMapTypeDriver[componentDataType]; - } - else { - Engine = aFactory->GetDriverByIOR(IOREngine); - } - + // Engine should be already in the map as it was to added before + SALOMEDSImpl_Driver* Engine = aMapTypeDriver[componentDataType]; if (Engine != NULL) { SALOMEDSImpl_TMPFile* aStream = NULL; long length = 0; + componentVersions[ componentDataType ] = Engine->Version(); + if (theASCII) aStream = Engine->SaveASCII(sco, SALOMEDSImpl_Tool::GetDirFromPath(aUrl), length, @@ -666,10 +749,9 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const std::string& aStudyUrl, hdf_group_study_structure = new HDFgroup("STUDY_STRUCTURE",hdf_file); hdf_group_study_structure->CreateOnDisk(); // save component attributes - SALOMEDSImpl_SComponentIterator itcomp = aStudy->NewComponentIterator(); - for (; itcomp.More(); itcomp.Next()) + for (itcomponent.Init(); itcomponent.More(); itcomponent.Next()) { - SALOMEDSImpl_SComponent SC = itcomp.Value(); + SALOMEDSImpl_SComponent SC = itcomponent.Value(); std::string scid = SC.GetID(); hdf_sco_group2 = new HDFgroup((char*)scid.c_str(), hdf_group_study_structure); hdf_sco_group2->CreateOnDisk(); @@ -752,8 +834,15 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const std::string& aStudyUrl, } hdf_notebook_vars->CloseOnDisk(); hdf_notebook_vars = 0; //will be deleted by hdf_sco_group destructor - - if (aLocked) aStudy->GetProperties()->SetLocked(true); + + // record component versions + std::map::const_iterator itVersions; + for ( itVersions = componentVersions.begin(); itVersions != componentVersions.end(); ++itVersions ) + aStudy->GetProperties()->SetComponentVersion( itVersions->first, itVersions->second ); + + // lock study back if it was locked initially, to write correct value of Locked flag + unlock.suspend(); + //----------------------------------------------------------------------- //6 - Write the Study Properties //----------------------------------------------------------------------- diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_UseCaseBuilder.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_UseCaseBuilder.cxx index 1d86d349a..a7ab40d02 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_UseCaseBuilder.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_UseCaseBuilder.cxx @@ -160,7 +160,7 @@ bool SALOMEDSImpl_UseCaseBuilder::AppendTo(const SALOMEDSImpl_SObject& theFather DF_Label aFatherLabel = theFather.GetLabel(), aLabel = theObject.GetLabel(); if(aFatherLabel == aLabel) return false; - SALOMEDSImpl_AttributeTreeNode *aFather = false, *aNode = false; + SALOMEDSImpl_AttributeTreeNode *aFather = NULL, *aNode = NULL; if(aFatherLabel.IsNull()) return false; if(!(aFather=(SALOMEDSImpl_AttributeTreeNode*)aFatherLabel.FindAttribute(_root->ID()))) return false; diff --git a/src/SALOMEDSImpl/Test/CMakeLists.txt b/src/SALOMEDSImpl/Test/CMakeLists.txt new file mode 100755 index 000000000..d5397c2f0 --- /dev/null +++ b/src/SALOMEDSImpl/Test/CMakeLists.txt @@ -0,0 +1,79 @@ +# Copyright (C) 2012 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_DIRECTORIES( + ${PTHREAD_INCLUDE_DIRS} + ${CPPUNIT_INCLUDE_DIRS} + ${OMNIORB_INCLUDE_DIRS} + ${BOOST_INCLUDE_DIRS} + ${CMAKE_CURRENT_SOURCE_DIR}/../../Basics + ${CMAKE_CURRENT_SOURCE_DIR}/../../Basics/Test + ${CMAKE_CURRENT_SOURCE_DIR}/../../SALOMELocalTrace + ${CMAKE_CURRENT_SOURCE_DIR}/../../SALOMELocalTrace/Test + ${CMAKE_CURRENT_SOURCE_DIR}/../../SALOMETraceCollector + ${CMAKE_CURRENT_SOURCE_DIR}/../../SALOMETraceCollector/Test + ${CMAKE_CURRENT_SOURCE_DIR}/../../NamingService + ${CMAKE_CURRENT_SOURCE_DIR}/../../NamingService/Test + ${CMAKE_CURRENT_SOURCE_DIR}/../../Utils + ${CMAKE_CURRENT_SOURCE_DIR}/../../Utils/Test + ${CMAKE_CURRENT_SOURCE_DIR}/../../ResourcesManager + ${CMAKE_CURRENT_SOURCE_DIR}/../../LifeCycleCORBA + ${CMAKE_CURRENT_SOURCE_DIR}/../../DF + ${CMAKE_CURRENT_SOURCE_DIR}/../../SALOMEDSImpl + ${CMAKE_BINARY_DIR}/idl +) + +# This local variable defines the list of FLAGS common to all target in this package. +SET(COMMON_FLAGS "${CPPUNIT_DEFINITIONS} ${OMNIORB_DEFINITIONS} ${BOOST_DEFINITIONS} ${PLATFORM_DEFINITIONS}") + +# This local variable defines the list of dependant libraries common to all target in this package. +SET(COMMON_LIBS + ${CPPUNIT_LIBS} + SALOMEBasics + SalomeResourcesManager + SalomeContainer + SalomeNS + Registry + SalomeNotification + UtilsTest + OpUtil + SALOMELocalTraceTest + SALOMELocalTrace + SALOMETraceCollectorTest + DF + SalomeDSImpl + SalomeHDFPersist + SalomeIDLKernel +) + +ADD_LIBRARY(SALOMEDSImplTest SHARED SALOMEDSImplTest.cxx) +SET_TARGET_PROPERTIES(SALOMEDSImplTest PROPERTIES COMPILE_FLAGS "${COMMON_FLAGS}") +TARGET_LINK_LIBRARIES(SALOMEDSImplTest ${COMMON_LIBS}) +INSTALL(TARGETS SALOMEDSImplTest DESTINATION ${KERNEL_salomelib_LIBS}) + +ADD_EXECUTABLE(TestSALOMEDSImpl TestSALOMEDSImpl.cxx) +SET_TARGET_PROPERTIES(TestSALOMEDSImpl PROPERTIES COMPILE_FLAGS "${COMMON_FLAGS}") +TARGET_LINK_LIBRARIES(TestSALOMEDSImpl SALOMEDSImplTest SalomeDSImpl NamingServiceTest ${COMMON_LIBS}) +INSTALL(TARGETS TestSALOMEDSImpl DESTINATION ${KERNEL_salomebin_BINS}) + +# Executable scripts to be installed +SALOME_INSTALL_SCRIPTS(TestSALOMEDSImpl.py ${KERNEL_salomescript_PYTHON}) + +FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") +INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${KERNEL_salomeinclude_HEADERS}) diff --git a/src/SALOMEDSImpl/Test/SALOMEDSImplTest.hxx b/src/SALOMEDSImpl/Test/SALOMEDSImplTest.hxx index 07944d285..826e13afc 100644 --- a/src/SALOMEDSImpl/Test/SALOMEDSImplTest.hxx +++ b/src/SALOMEDSImpl/Test/SALOMEDSImplTest.hxx @@ -25,7 +25,17 @@ #include -class SALOMEDSImplTest : public CppUnit::TestFixture +#ifdef WIN32 +# if defined SALOMEDSIMPLTEST_EXPORTS || defined SALOMEDSImplTest_EXPORTS +# define SALOMEDSIMPLTEST_EXPORT __declspec( dllexport ) +# else +# define SALOMEDSIMPLTEST_EXPORT __declspec( dllimport ) +# endif +#else +# define SALOMEDSIMPLTEST_EXPORT +#endif + +class SALOMEDSIMPLTEST_EXPORT SALOMEDSImplTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE( SALOMEDSImplTest ); CPPUNIT_TEST( testAttributeParameter ); diff --git a/src/SALOMELocalTrace/CMakeLists.txt b/src/SALOMELocalTrace/CMakeLists.txt new file mode 100755 index 000000000..6ac53683f --- /dev/null +++ b/src/SALOMELocalTrace/CMakeLists.txt @@ -0,0 +1,49 @@ +# Copyright (C) 2012 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_DIRECTORIES( + ${CMAKE_CURRENT_SOURCE_DIR}/../Basics + ${PTHREAD_INCLUDE_DIRS} +) + +SET(COMMON_HEADERS + utilities.h + LocalTraceBufferPool.hxx + BaseTraceCollector.hxx + SALOME_LocalTrace.hxx +) + +SET(SALOMELocalTrace_SOURCES + BaseTraceCollector.cxx + BaseTraceCollector.hxx + LocalTraceCollector.cxx + LocalTraceCollector.hxx + FileTraceCollector.cxx + FileTraceCollector.hxx + LocalTraceBufferPool.cxx + LocalTraceBufferPool.hxx + SALOME_LocalTrace.hxx +) + +ADD_LIBRARY(SALOMELocalTrace SHARED ${SALOMELocalTrace_SOURCES}) +SET_TARGET_PROPERTIES(SALOMELocalTrace PROPERTIES COMPILE_FLAGS "${PTHREAD_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +TARGET_LINK_LIBRARIES(SALOMELocalTrace SALOMEBasics ${PLATFORM_LIBS} ${PTHREAD_LIBS}) +INSTALL(TARGETS SALOMELocalTrace DESTINATION ${KERNEL_salomelib_LIBS}) + +INSTALL(FILES ${COMMON_HEADERS} DESTINATION ${KERNEL_salomeinclude_HEADERS}) diff --git a/src/SALOMELocalTrace/Test/CMakeLists.txt b/src/SALOMELocalTrace/Test/CMakeLists.txt new file mode 100755 index 000000000..a80528ca3 --- /dev/null +++ b/src/SALOMELocalTrace/Test/CMakeLists.txt @@ -0,0 +1,42 @@ +# Copyright (C) 2012 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_DIRECTORIES( + ${CPPUNIT_INCLUDE_DIRS} + ${PTHREAD_INCLUDE_DIRS} + ${CMAKE_CURRENT_SOURCE_DIR}/../../Basics + ${CMAKE_CURRENT_SOURCE_DIR}/../../Basics/Test + ${CMAKE_CURRENT_SOURCE_DIR}/../../SALOMELocalTrace +) + +ADD_LIBRARY(SALOMELocalTraceTest SHARED SALOMELocalTraceTest.cxx) +SET_TARGET_PROPERTIES(SALOMELocalTraceTest PROPERTIES COMPILE_FLAGS "${CPPUNIT_DEFINITIONS} ${PTHREAD_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +TARGET_LINK_LIBRARIES(SALOMELocalTraceTest SALOMELocalTrace ${CPPUNIT_LIBS} ${PTHREAD_LIBS} ${PLATFORM_LIBS}) +INSTALL(TARGETS SALOMELocalTraceTest DESTINATION ${KERNEL_salomelib_LIBS}) + +ADD_EXECUTABLE(TestSALOMELocalTrace TestSALOMELocalTrace.cxx) +SET_TARGET_PROPERTIES(TestSALOMELocalTrace PROPERTIES COMPILE_FLAGS "${CPPUNIT_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +TARGET_LINK_LIBRARIES(TestSALOMELocalTrace SALOMELocalTraceTest SALOMELocalTrace SALOMEBasics ${CPPUNIT_LIBS} ${PLATFORM_LIBS}) +INSTALL(TARGETS TestSALOMELocalTrace DESTINATION ${KERNEL_salomebin_BINS}) + +# Executable scripts to be installed +SALOME_INSTALL_SCRIPTS(TestSALOMELocalTrace.py ${KERNEL_salomescript_PYTHON}) + +FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") +INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${KERNEL_salomeinclude_HEADERS}) diff --git a/src/SALOMELocalTrace/Test/SALOMELocalTraceTest.cxx b/src/SALOMELocalTrace/Test/SALOMELocalTraceTest.cxx index 0e685195c..7d9747cf5 100644 --- a/src/SALOMELocalTrace/Test/SALOMELocalTraceTest.cxx +++ b/src/SALOMELocalTrace/Test/SALOMELocalTraceTest.cxx @@ -28,7 +28,11 @@ #include #include "LocalTraceBufferPool.hxx" #include "utilities.h" +#include "Basics_Utils.hxx" +#ifdef WIN32 +#define setenv Kernel_Utils::setenv +#endif // ============================================================================ /*! @@ -100,11 +104,10 @@ SALOMELocalTraceTest::testLoadBufferPoolLocal() std::string s = "local"; CPPUNIT_ASSERT(! setenv("SALOME_trace",s.c_str(),1)); // 1: overwrite - // --- numThread thread creation for trace generation. - int numThread = 2; - pthread_t threads[numThread]; + // --- NUM_THREADS thread creation for trace generation. + pthread_t threads[NUM_THREADS]; int rc, t; - for(t=0;t -class SALOMELocalTraceTest : public CppUnit::TestFixture +#ifdef WIN32 +# if defined SALOMELOCALTRACETEST_EXPORTS || defined SALOMELocalTraceTest_EXPORTS +# define SALOMELOCALTRACETEST_EXPORT __declspec( dllexport ) +# else +# define SALOMELOCALTRACETEST_EXPORT __declspec( dllimport ) +# endif +#else +# define SALOMELOCALTRACETEST_EXPORT +#endif + +class SALOMELOCALTRACETEST_EXPORT SALOMELocalTraceTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE( SALOMELocalTraceTest ); CPPUNIT_TEST( testSingletonBufferPool ); diff --git a/src/SALOMETraceCollector/CMakeLists.txt b/src/SALOMETraceCollector/CMakeLists.txt new file mode 100755 index 000000000..6e9ea5bfe --- /dev/null +++ b/src/SALOMETraceCollector/CMakeLists.txt @@ -0,0 +1,36 @@ +# Copyright (C) 2012 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_DIRECTORIES( + ${OMNIORB_INCLUDE_DIRS} + ${PTHREAD_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR}/salome_adm + ${CMAKE_CURRENT_SOURCE_DIR}/../Basics + ${CMAKE_CURRENT_SOURCE_DIR}/../SALOMELocalTrace + ${CMAKE_BINARY_DIR}/idl +) + +ADD_LIBRARY(with_loggerTraceCollector SHARED SALOMETraceCollector.cxx TraceCollector_WaitForServerReadiness.cxx) +SET_TARGET_PROPERTIES(with_loggerTraceCollector PROPERTIES COMPILE_FLAGS "${OMNIORB_DEFINITIONS} ${PTHREAD_DEFINITIONS} ${PLATFORM_DEFINITIONS}") + +TARGET_LINK_LIBRARIES(with_loggerTraceCollector SALOMELocalTrace SalomeIDLKernel ${OMNIORB_LIBS} ${PTHREAD_LIBS}) +INSTALL(TARGETS with_loggerTraceCollector DESTINATION ${KERNEL_salomelib_LIBS}) + +FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") +INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${KERNEL_salomeinclude_HEADERS}) diff --git a/src/SALOMETraceCollector/Test/CMakeLists.txt b/src/SALOMETraceCollector/Test/CMakeLists.txt new file mode 100755 index 000000000..570a8595d --- /dev/null +++ b/src/SALOMETraceCollector/Test/CMakeLists.txt @@ -0,0 +1,52 @@ +# Copyright (C) 2012 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_DIRECTORIES( + ${CPPUNIT_INCLUDE_DIRS} + ${PTHREAD_INCLUDE_DIRS} + ${CMAKE_CURRENT_SOURCE_DIR}/../../Basics + ${CMAKE_CURRENT_SOURCE_DIR}/../../Basics/Test + ${CMAKE_CURRENT_SOURCE_DIR}/../../SALOMELocalTrace + ${CMAKE_CURRENT_SOURCE_DIR}/../../SALOMELocalTrace/Test + ${CMAKE_CURRENT_SOURCE_DIR}/../../SALOMETraceCollector +) + +SET(COMMON_LIBS + SALOMELocalTraceTest + SALOMELocalTrace + SALOMEBasics + ${PTHREAD_LIBS} + ${PLATFORM_LIBS} +) + +ADD_LIBRARY(SALOMETraceCollectorTest SHARED SALOMETraceCollectorTest.cxx) +SET_TARGET_PROPERTIES(SALOMETraceCollectorTest PROPERTIES COMPILE_FLAGS "${PTHREAD_DEFINITIONS} ${CPPUNIT_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +TARGET_LINK_LIBRARIES(SALOMETraceCollectorTest ${COMMON_LIBS}) +INSTALL(TARGETS SALOMETraceCollectorTest DESTINATION ${KERNEL_salomelib_LIBS}) + +ADD_EXECUTABLE(TestSALOMETraceCollector TestSALOMETraceCollector.cxx) +SET_TARGET_PROPERTIES(TestSALOMETraceCollector PROPERTIES COMPILE_FLAGS "${CPPUNIT_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +TARGET_LINK_LIBRARIES(TestSALOMETraceCollector SALOMETraceCollectorTest ${COMMON_LIBS}) +INSTALL(TARGETS TestSALOMETraceCollector DESTINATION ${KERNEL_salomebin_BINS}) + +# Executable scripts to be installed +SALOME_INSTALL_SCRIPTS(TestSALOMETraceCollector.py ${KERNEL_salomescript_PYTHON}) + +FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") +INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${KERNEL_salomeinclude_HEADERS}) diff --git a/src/SALOMETraceCollector/Test/SALOMETraceCollectorTest.cxx b/src/SALOMETraceCollector/Test/SALOMETraceCollectorTest.cxx index 61c0ee91b..4a448f8ba 100644 --- a/src/SALOMETraceCollector/Test/SALOMETraceCollectorTest.cxx +++ b/src/SALOMETraceCollector/Test/SALOMETraceCollectorTest.cxx @@ -28,7 +28,11 @@ #include #include "LocalTraceBufferPool.hxx" #include "utilities.h" +#include "Basics_Utils.hxx" +#ifdef WIN32 +#define setenv Kernel_Utils::setenv +#endif // ============================================================================ /*! @@ -109,4 +113,7 @@ void *PrintHello(void *threadid) << " - iter " << i); #endif pthread_exit(NULL); + #ifdef WIN32 + return NULL; + #endif } diff --git a/src/SALOMETraceCollector/Test/SALOMETraceCollectorTest.hxx b/src/SALOMETraceCollector/Test/SALOMETraceCollectorTest.hxx index 78009a065..ebfedb099 100644 --- a/src/SALOMETraceCollector/Test/SALOMETraceCollectorTest.hxx +++ b/src/SALOMETraceCollector/Test/SALOMETraceCollectorTest.hxx @@ -25,7 +25,17 @@ #include -class SALOMETraceCollectorTest : public CppUnit::TestFixture +#ifdef WIN32 +# if defined SALOMETRACECOLLECTORTEST_EXPORTS || defined SALOMETraceCollectorTest_EXPORTS +# define SALOMETRACECOLLECTORTEST_EXPORT __declspec( dllexport ) +# else +# define SALOMETRACECOLLECTORTEST_EXPORT __declspec( dllimport ) +# endif +#else +# define SALOMETRACECOLLECTORTEST_EXPORT +#endif + +class SALOMETRACECOLLECTORTEST_EXPORT SALOMETraceCollectorTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE( SALOMETraceCollectorTest ); CPPUNIT_TEST( testLoadBufferPoolCORBA ); diff --git a/src/TOOLSDS/CMakeLists.txt b/src/TOOLSDS/CMakeLists.txt new file mode 100755 index 000000000..496d9a42d --- /dev/null +++ b/src/TOOLSDS/CMakeLists.txt @@ -0,0 +1,38 @@ +# Copyright (C) 2012 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_DIRECTORIES( + ${OMNIORB_INCLUDE_DIRS} + ${HDF5_INCLUDE_DIRS} + ${PTHREAD_INCLUDE_DIRS} + ${BOOST_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR}/salome_adm + ${CMAKE_CURRENT_SOURCE_DIR}/../SALOMELocalTrace + ${CMAKE_CURRENT_SOURCE_DIR}/../Basics + ${CMAKE_CURRENT_SOURCE_DIR}/../Utils + ${CMAKE_BINARY_DIR}/idl +) + +ADD_LIBRARY(TOOLSDS SHARED SALOMEDS_Tool.cxx) +SET_TARGET_PROPERTIES(TOOLSDS PROPERTIES COMPILE_FLAGS "${OMNIORB_DEFINITIONS} ${HDF5_DEFINITIONS} ${BOOST_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +TARGET_LINK_LIBRARIES(TOOLSDS OpUtil SalomeIDLKernel ${OMNIORB_LIBS}) +INSTALL(TARGETS TOOLSDS DESTINATION ${KERNEL_salomelib_LIBS}) + +FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") +INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${KERNEL_salomeinclude_HEADERS}) diff --git a/src/TestContainer/CMakeLists.txt b/src/TestContainer/CMakeLists.txt new file mode 100755 index 000000000..bc43229ea --- /dev/null +++ b/src/TestContainer/CMakeLists.txt @@ -0,0 +1,73 @@ +# Copyright (C) 2012 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_DIRECTORIES( + ${PTHREAD_INCLUDE_DIRS} + ${OMNIORB_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR}/salome_adm + ${CMAKE_CURRENT_SOURCE_DIR}/../Basics + ${CMAKE_CURRENT_SOURCE_DIR}/../SALOMELocalTrace + ${CMAKE_CURRENT_SOURCE_DIR}/../NamingService + ${CMAKE_CURRENT_SOURCE_DIR}/../Utils + ${CMAKE_CURRENT_SOURCE_DIR}/../Registry + ${CMAKE_CURRENT_SOURCE_DIR}/../Notification + ${CMAKE_CURRENT_SOURCE_DIR}/../ResourcesManager + ${CMAKE_CURRENT_SOURCE_DIR}/../Container + ${CMAKE_CURRENT_SOURCE_DIR}/../GenericObj + ${CMAKE_BINARY_DIR}/idl +) + +SET(SalomeTestComponentEngine_SOURCES + SALOME_TestComponent.hxx + SALOME_TestComponent_i.cxx + SALOME_TestComponent_i.hxx +) + +SET(COMMON_LIBS + SalomeContainer + Registry + SalomeNotification + SalomeResourcesManager + SalomeNS + SALOMELocalTrace + SALOMEBasics + SalomeGenericObj + SalomeIDLKernel +) + +ADD_LIBRARY(SalomeTestComponentEngine SHARED ${SalomeTestComponentEngine_SOURCES}) +SET_TARGET_PROPERTIES(SalomeTestComponentEngine PROPERTIES COMPILE_FLAGS "${OMNIORB_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +TARGET_LINK_LIBRARIES(SalomeTestComponentEngine ${COMMON_LIBS}) +INSTALL(TARGETS SalomeTestComponentEngine DESTINATION ${KERNEL_salomelib_LIBS}) + +ADD_EXECUTABLE(TestLogger TestLogger.cxx) +SET_TARGET_PROPERTIES(TestLogger PROPERTIES COMPILE_FLAGS "${OMNIORB_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +TARGET_LINK_LIBRARIES(TestLogger SalomeTestComponentEngine SALOMEBasics ${COMMON_LIBS} ${OMNIORB_LIBS}) + +ADD_EXECUTABLE(TestContainer TestContainer.cxx) +SET_TARGET_PROPERTIES(TestContainer PROPERTIES COMPILE_FLAGS "${OMNIORB_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +TARGET_LINK_LIBRARIES(TestContainer SalomeTestComponentEngine SALOMEBasics ${COMMON_LIBS} ${OMNIORB_LIBS}) +INSTALL(TARGETS TestLogger TestContainer DESTINATION ${KERNEL_salomebin_BINS}) + +# Executable scripts to be installed +SET(SCRIPTS + SALOME_TestComponentPy.py + TestLogger.py +) +SALOME_INSTALL_SCRIPTS("${SCRIPTS}" ${KERNEL_salomescript_PYTHON}) diff --git a/src/TestContainer/Makefile.am b/src/TestContainer/Makefile.am index e78d59328..538723422 100644 --- a/src/TestContainer/Makefile.am +++ b/src/TestContainer/Makefile.am @@ -33,11 +33,10 @@ include $(top_srcdir)/salome_adm/unix/make_common_starter.am # Files to be installed # =============================================================== # -# header files +# header files # Scripts to be installed dist_salomescript_PYTHON = \ SALOME_TestComponentPy.py \ - TestComponentPy.py \ TestLogger.py # diff --git a/src/TestContainer/TestComponentPy.py b/src/TestContainer/TestComponentPy.py deleted file mode 100755 index 05f9fcaa0..000000000 --- a/src/TestContainer/TestComponentPy.py +++ /dev/null @@ -1,73 +0,0 @@ -#! /usr/bin/env python -# Copyright (C) 2007-2012 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 -# - -# SALOME TestContainer : test of container creation and its life cycle -# File : TestComponentPy.py -# Author : Paul RASCLE, EDF -# Module : SALOME -# $Header$ -# -import os -import sys -import string -from omniORB import CORBA -import CosNaming -import Engines -from Utils_Identity import getShortHostName - - -#initialise the ORB -orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID) - -#obtain a reference to the root naming context -obj = orb.resolve_initial_references("NameService") -rootContext = obj._narrow(CosNaming.NamingContext) - -if rootContext is None: - print "Name Service Reference is invalid" - sys.exit(1) - -#resolve the name /Containers.dir/FactoryServerPy.object -machineName=getShortHostName() -containerName = "FactoryServerPy" -name = [CosNaming.NameComponent("Containers","dir"), - CosNaming.NameComponent(machineName,"dir"), - CosNaming.NameComponent(containerName,"object")] - -try: - obj = rootContext.resolve(name) -except CosNaming.NamingContext.NotFound, ex: - print containerName , " not found in Naming Service" - sys.exit(1) - -container = obj._narrow(Engines.Container) -print container.getHostName() -comp = container.load_impl("SALOME_TestComponentPy","SALOME_TestComponentPy") -print comp._get_instanceName() -comp.ping() -comptest = comp._narrow(Engines.TestComponent) -if comptest is None: - print "probleme cast" -print comptest.Coucou(1) - - diff --git a/src/TestMPIContainer/CMakeLists.txt b/src/TestMPIContainer/CMakeLists.txt new file mode 100755 index 000000000..65038b42f --- /dev/null +++ b/src/TestMPIContainer/CMakeLists.txt @@ -0,0 +1,65 @@ +# Copyright (C) 2012 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_DIRECTORIES( + ${MPI_INCLUDE_DIRS} + ${OMNIORB_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR}/salome_adm + ${CMAKE_CURRENT_SOURCE_DIR}/../Basics + ${CMAKE_CURRENT_SOURCE_DIR}/../SALOMELocalTrace + ${CMAKE_CURRENT_SOURCE_DIR}/../NamingService + ${CMAKE_CURRENT_SOURCE_DIR}/../Utils + ${CMAKE_CURRENT_SOURCE_DIR}/../Registry + ${CMAKE_CURRENT_SOURCE_DIR}/../Notification + ${CMAKE_CURRENT_SOURCE_DIR}/../ResourcesManager + ${CMAKE_CURRENT_SOURCE_DIR}/../Container + ${CMAKE_CURRENT_SOURCE_DIR}/../MPIContainer + ${CMAKE_CURRENT_SOURCE_DIR}/../GenericObj + ${CMAKE_BINARY_DIR}/idl +) + +SET(COMMON_FLAGS "${OMNIORB_DEFINITIONS} ${MPI_DEFINITIONS}") + +SET(COMMON_LIBS + Registry + SalomeNotification + SalomeResourcesManager + SalomeNS + OpUtil + SALOMELocalTrace + SALOMEBasics + SalomeContainer + SalomeMPIContainer + SalomeGenericObj + SalomeIDLKernel + ${OMNIORB_LIBS} +) + +ADD_LIBRARY(SalomeTestMPIComponentEngine SHARED TestMPIComponentEngine.cxx) +SET_TARGET_PROPERTIES(SalomeTestMPIComponentEngine PROPERTIES COMPILE_FLAGS "${COMMON_FLAGS}") +TARGET_LINK_LIBRARIES(SalomeTestMPIComponentEngine ${COMMON_LIBS}) +INSTALL(TARGETS SalomeTestMPIComponentEngine DESTINATION ${KERNEL_salomelib_LIBS}) + +ADD_EXECUTABLE(TestMPIContainer TestMPIContainer.cxx) +SET_TARGET_PROPERTIES(TestMPIContainer PROPERTIES COMPILE_FLAGS "${COMMON_FLAGS}") +TARGET_LINK_LIBRARIES(TestMPIContainer SalomeTestMPIComponentEngine ${COMMON_LIBS} ${MPI_LIBS}) +INSTALL(TARGETS TestMPIContainer DESTINATION ${KERNEL_salomebin_BINS}) + +FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") +INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${KERNEL_salomeinclude_HEADERS}) diff --git a/src/UnitTests/CMakeLists.txt b/src/UnitTests/CMakeLists.txt new file mode 100755 index 000000000..11545cfff --- /dev/null +++ b/src/UnitTests/CMakeLists.txt @@ -0,0 +1,96 @@ +# Copyright (C) 2012 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_DIRECTORIES( + ${PTHREAD_INCLUDE_DIRS} + ${CPPUNIT_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR}/salome_adm + ${CMAKE_CURRENT_SOURCE_DIR}/../Basics + ${CMAKE_CURRENT_SOURCE_DIR}/../Basics/Test + ${CMAKE_CURRENT_SOURCE_DIR}/../SALOMELocalTrace + ${CMAKE_CURRENT_SOURCE_DIR}/../SALOMELocalTrace/Test +) + +# =============================================================== +# Files to be installed +# =============================================================== + +# Executable scripts to be installed +SALOME_INSTALL_SCRIPTS(UnitTests.py ${KERNEL_salomescript_SCRIPTS}) + +# =============================================================== +# Executables targets +# =============================================================== + +SET(COMMON_FLAGS "${CPPUNIT_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +SET(COMMON_LIBS + ${CPPUNIT_LIBS} + SALOMEBasics + SALOMELocalTrace + SALOMELocalTraceTest +) + +IF(CORBA_GEN) + INCLUDE_DIRECTORIES( + ${OMNIORB_INCLUDE_DIRS} + ${CMAKE_CURRENT_SOURCE_DIR}/../SALOMETraceCollector + ${CMAKE_CURRENT_SOURCE_DIR}/../SALOMETraceCollector/Test + ${CMAKE_CURRENT_SOURCE_DIR}/../NamingService + ${CMAKE_CURRENT_SOURCE_DIR}/../NamingService/Test + ${CMAKE_CURRENT_SOURCE_DIR}/../Utils + ${CMAKE_CURRENT_SOURCE_DIR}/../Utils/Test + ${CMAKE_CURRENT_SOURCE_DIR}/../LifeCycleCORBA + ${CMAKE_CURRENT_SOURCE_DIR}/../LifeCycleCORBA/Test + ${CMAKE_CURRENT_SOURCE_DIR}/../SALOMDESImpl + ${CMAKE_CURRENT_SOURCE_DIR}/../SALOMEDSImpl/Test + ${CMAKE_CURRENT_SOURCE_DIR}/../SALOMDES + ${CMAKE_CURRENT_SOURCE_DIR}/../SALOMEDS/Test + ${CMAKE_BINARY_DIR}/idl + ${CMAKE_CURRENT_SOURCE_DIR}/../Registry + ${CMAKE_CURRENT_SOURCE_DIR}/../Notification + ${CMAKE_CURRENT_SOURCE_DIR}/../ResourcesManager + ) + SET(COMMON_FLAGS "${COMMON_FLAGS} -DWITH_CORBA ${OMNIORB_DEFINITIONS}") + + SET(COMMON_LIBS + ${COMMON_LIBS} + Registry + SalomeNotification + SalomeResourcesManager + SalomeNS + NamingServiceTest + SalomeContainer + SALOMETraceCollectorTest + OpUtil + UtilsTest + SalomeLifeCycleCORBA + LifeCycleCORBATest + SalomeDSImpl + SALOMEDSImplTest + SalomeDS + SALOMEDSTest + SalomeIDLKernel + ${OMNIORB_LIBS} + ) +ENDIF(CORBA_GEN) + +ADD_EXECUTABLE(UnitTests UnitTests.cxx) +SET_TARGET_PROPERTIES(UnitTests PROPERTIES COMPILE_FLAGS "${COMMON_FLAGS}") +TARGET_LINK_LIBRARIES(UnitTests ${COMMON_LIBS}) +INSTALL(TARGETS UnitTests DESTINATION ${KERNEL_salomebin_BINS}) diff --git a/src/Utils/CMakeLists.txt b/src/Utils/CMakeLists.txt new file mode 100755 index 000000000..269d62c59 --- /dev/null +++ b/src/Utils/CMakeLists.txt @@ -0,0 +1,53 @@ +# Copyright (C) 2012 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_DIRECTORIES( + ${OMNIORB_INCLUDE_DIRS} + ${PTHREAD_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR}/salome_adm + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/../Basics + ${CMAKE_CURRENT_SOURCE_DIR}/../SALOMELocalTrace + ${CMAKE_BINARY_DIR}/idl +) +SET(OpUtil_SOURCES + Utils_Timer.cxx + duplicate.cxx + Utils_CommException.cxx + Utils_SALOME_Exception.cxx + Utils_Identity.cxx + Utils_ORB_INIT.cxx + Utils_DESTRUCTEUR_GENERIQUE.cxx + Utils_ExceptHandlers.cxx + Utils_Mutex.cxx +) + +ADD_LIBRARY(OpUtil SHARED ${OpUtil_SOURCES}) +SET_TARGET_PROPERTIES(OpUtil PROPERTIES COMPILE_FLAGS "${OMNIORB_DEFINITIONS} ${PTHREAD_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +TARGET_LINK_LIBRARIES(OpUtil SALOMELocalTrace SalomeIDLKernel ${OMNIORB_LIBS} ${PTHREAD_LIBS}) +INSTALL(TARGETS OpUtil DESTINATION ${KERNEL_salomelib_LIBS}) + +SET(COMMON_SCRIPTS + Utils_Identity.py + SALOME_utilities.py +) +SALOME_INSTALL_SCRIPTS("${COMMON_SCRIPTS}" ${KERNEL_salomescript_PYTHON}) + +FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") +INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${KERNEL_salomeinclude_HEADERS}) diff --git a/src/Utils/Test/CMakeLists.txt b/src/Utils/Test/CMakeLists.txt new file mode 100755 index 000000000..73f5f6bfe --- /dev/null +++ b/src/Utils/Test/CMakeLists.txt @@ -0,0 +1,55 @@ +# Copyright (C) 2012 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_DIRECTORIES( + ${PTHREAD_INCLUDE_DIRS} + ${CPPUNIT_INCLUDE_DIRS} + ${CMAKE_CURRENT_SOURCE_DIR}/../../Basics + ${CMAKE_CURRENT_SOURCE_DIR}/../../Basics/Test + ${CMAKE_CURRENT_SOURCE_DIR}/../../SALOMELocalTrace + ${CMAKE_CURRENT_SOURCE_DIR}/../../SALOMELocalTrace/Test + ${CMAKE_CURRENT_SOURCE_DIR}/../../SALOMETraceCollector + ${CMAKE_CURRENT_SOURCE_DIR}/../../SALOMETraceCollector/Test + ${CMAKE_CURRENT_SOURCE_DIR}/../../Utils + ${CMAKE_CURRENT_SOURCE_DIR}/../../Utils/Test +) + +SET(COMMON_LIBS + ${CPPUNIT_LIBS} + OpUtil + SALOMELocalTraceTest + SALOMELocalTrace + SALOMETraceCollectorTest + SALOMEBasics +) + +ADD_LIBRARY(UtilsTest SHARED UtilsTest.cxx) +SET_TARGET_PROPERTIES(UtilsTest PROPERTIES COMPILE_FLAGS "${CPPUNIT_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +TARGET_LINK_LIBRARIES(UtilsTest ${COMMON_LIBS} ${PLATFORM_LIBS}) +INSTALL(TARGETS UtilsTest DESTINATION ${KERNEL_salomelib_LIBS}) + +ADD_EXECUTABLE(TestUtils TestUtils.cxx) +SET_TARGET_PROPERTIES(TestUtils PROPERTIES COMPILE_FLAGS "${CPPUNIT_DEFINITIONS} ${PLATFORM_DEFINITIONS}") +TARGET_LINK_LIBRARIES(TestUtils ${COMMON_LIBS} UtilsTest ${OMNIORB_LIBS} ${PLATFORM_LIBS}) +INSTALL(TARGETS TestUtils DESTINATION ${KERNEL_salomebin_BINS}) + +SALOME_INSTALL_SCRIPTS(TestUtils.py ${KERNEL_salomescript_PYTHON}) + +FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") +INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${KERNEL_salomeinclude_HEADERS}) diff --git a/src/Utils/Test/TestUtils.py b/src/Utils/Test/TestUtils.py index cc6c1a1d4..36fe782ec 100644 --- a/src/Utils/Test/TestUtils.py +++ b/src/Utils/Test/TestUtils.py @@ -46,6 +46,6 @@ clt.waitLogger("Logger") command = ['TestUtils'] ret = os.spawnvp(os.P_WAIT, command[0], command) -# kill Test process +# kill Test process TestKiller.killProcess(runSalome.process_id) diff --git a/src/Utils/Test/UtilsTest.cxx b/src/Utils/Test/UtilsTest.cxx index b5d8fb506..de2a9b78d 100644 --- a/src/Utils/Test/UtilsTest.cxx +++ b/src/Utils/Test/UtilsTest.cxx @@ -27,8 +27,12 @@ #include #include #include "Utils_SALOME_Exception.hxx" +#include "Basics_Utils.hxx" #include "utilities.h" +#ifdef WIN32 +#define setenv Kernel_Utils::setenv +#endif #define TRACEFILE "/tmp/traceUnitTest.log" diff --git a/src/Utils/Test/UtilsTest.hxx b/src/Utils/Test/UtilsTest.hxx index 9724e2609..5c320c432 100644 --- a/src/Utils/Test/UtilsTest.hxx +++ b/src/Utils/Test/UtilsTest.hxx @@ -25,7 +25,17 @@ #include -class UtilsTest : public CppUnit::TestFixture +#ifdef WIN32 +# if defined UTILSTEST_EXPORTS || defined UtilsTest_EXPORTS +# define UTILSTEST_EXPORT __declspec( dllexport ) +# else +# define UTILSTEST_EXPORT __declspec( dllimport ) +# endif +#else +# define UTILSTEST_EXPORT +#endif + +class UTILSTEST_EXPORT UtilsTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE( UtilsTest ); CPPUNIT_TEST( testSALOME_ExceptionThrow );