]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
- Merge from TAG CCAR_cm3_end
authorribes <ribes>
Wed, 6 May 2009 14:59:19 +0000 (14:59 +0000)
committerribes <ribes>
Wed, 6 May 2009 14:59:19 +0000 (14:59 +0000)
- Bug fix when waiting a parallel container
- Better installation of python files for parallel containers
- A parallel container is now correctly deleted in the naming service
when it is shutdown

141 files changed:
bin/Makefile.am
bin/appliskel/runRemote.sh
bin/nameserver.py
bin/runSalome.py
doc/salome/Makefile.am
doc/salome/gui/Makefile.am
doc/salome/gui/static/footer.html
doc/salome/tui/Makefile.am
doc/salome/tui/doxyfile.in
doc/salome/tui/static/footer.html
idl/Makefile.am
idl/SALOME_Component.idl
idl/SALOME_ContainerManager.idl
idl/SALOME_MPIContainer.idl
resources/KERNELCatalog.xml.in
salome_adm/cmake_files/FindBOOST.cmake
salome_adm/cmake_files/FindCPPUNIT.cmake
salome_adm/cmake_files/FindHDF5.cmake
salome_adm/cmake_files/FindLIBXML2.cmake
salome_adm/cmake_files/FindOMNIORB.cmake
salome_adm/cmake_files/FindPLATFORM.cmake
salome_adm/cmake_files/FindPTHREADS.cmake
salome_adm/cmake_files/FindPYTHON.cmake
salome_adm/cmake_files/FindSWIG.cmake
salome_adm/cmake_files/Makefile.am
salome_adm/cmake_files/am2cmake.py
salome_adm/cmake_files/install_and_compile_python_file.cmake [new file with mode: 0644]
salome_adm/unix/config_files/ac_cxx_depend_flag.m4
salome_adm/unix/config_files/ac_cxx_warnings.m4
salome_adm/unix/config_files/check_openmpi.m4
salome_adm/unix/config_files/production.m4
src/Basics/SALOME_Basics.hxx
src/Batch/Batch_Defines.hxx
src/Batch/Batch_FactBatchManager_Local_RSH.cxx
src/Batch/Batch_FactBatchManager_eLSF.cxx
src/Batch/Batch_FactBatchManager_ePBS.cxx
src/Batch_SWIG/Makefile.am
src/Communication/SALOME_Communication.hxx
src/Container/Container_i.cxx
src/Container/Makefile.am
src/Container/SALOME_Component_i.hxx
src/Container/SALOME_Container.cxx
src/Container/SALOME_Container.hxx
src/Container/SALOME_ContainerManager.cxx
src/Container/SALOME_ContainerManager.hxx
src/Container/SALOME_Container_i.hxx
src/Container/SALOME_FileTransfer_i.cxx
src/Container/SALOME_FileTransfer_i.hxx
src/Container/Salome_file_i.hxx
src/DF/DF_definitions.hxx
src/DSC/DSC_Basic/DSC_Basic.hxx
src/DSC/DSC_Python/Makefile.am
src/DSC/DSC_User/Datastream/Calcium/calciumf.c
src/GenericObj/SALOME_GenericObj_i.hh
src/HDFPersist/HDFexport.hxx
src/KERNEL_PY/Makefile.am
src/KERNEL_PY/salome_test.py
src/KERNEL_PY/salome_version.py
src/Launcher/BatchTest.cxx
src/Launcher/BatchTest.hxx
src/Launcher/Launcher.cxx
src/Launcher/Launcher.hxx
src/Launcher/SALOME_Launcher.cxx
src/Launcher/SALOME_Launcher_Handler.cxx
src/Launcher/SALOME_Launcher_defs.hxx
src/LifeCycleCORBA/SALOME_FileTransferCORBA.cxx
src/LifeCycleCORBA/SALOME_FileTransferCORBA.hxx
src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx
src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx
src/LifeCycleCORBA/Test/LifeCycleCORBATest.cxx
src/LifeCycleCORBA/TestContainerManager.cxx
src/LifeCycleCORBA_SWIG/LifeCycleCORBA.py
src/LifeCycleCORBA_SWIG/Makefile.am
src/LifeCycleCORBA_SWIG/Test/LifeCycleCORBA_SWIGTest.py
src/LifeCycleCORBA_SWIG/Test/Makefile.am
src/LifeCycleCORBA_SWIG/Test/testcontainermanager.py [new file with mode: 0644]
src/LifeCycleCORBA_SWIG/Test/testresourcemanager.py [new file with mode: 0644]
src/LifeCycleCORBA_SWIG/libSALOME_LifeCycleCORBA.i
src/Logger/Makefile.am
src/Logger/SALOME_Logger_Server.hxx
src/Logger/SALOME_Trace.cxx
src/Logger/SALOME_Trace.hxx
src/Logger/Test/Makefile.am
src/MPIContainer/MPIContainer_i.cxx
src/MPIContainer/MPIContainer_i.hxx
src/MPIContainer/MPIObject_i.cxx
src/MPIContainer/MPIObject_i.hxx
src/Makefile.am
src/ModuleCatalog/Makefile.am
src/ModuleCatalog/SALOME_ModuleCatalog.hxx
src/ModuleGenerator/Makefile.am
src/NOTIFICATION_SWIG/SALOME_NOTIFICATION_SWIG.hxx
src/NamingService/Makefile.am
src/NamingService/SALOME_NamingService_defs.hxx
src/NamingService/Test/Makefile.am
src/Notification/SALOME_NOTIFICATION.hxx
src/ParallelContainer/SALOME_ParallelComponent_i.hxx
src/ParallelContainer/SALOME_ParallelContainerProxy_i.cxx
src/ParallelContainer/SALOME_ParallelContainer_i.cxx
src/ParallelContainer/SALOME_ParallelContainer_i.hxx
src/Registry/SALOME_Registry.hxx
src/ResourcesManager/ResourcesManager.cxx
src/ResourcesManager/ResourcesManager.hxx
src/ResourcesManager/ResourcesManager_Defs.hxx
src/ResourcesManager/SALOME_LoadRateManager.cxx
src/ResourcesManager/SALOME_LoadRateManager.hxx
src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx
src/ResourcesManager/SALOME_ResourcesCatalog_Handler.hxx
src/ResourcesManager/SALOME_ResourcesCatalog_Parser.cxx
src/ResourcesManager/SALOME_ResourcesCatalog_Parser.hxx
src/ResourcesManager/SALOME_ResourcesManager.cxx
src/ResourcesManager/SALOME_ResourcesManager.hxx
src/SALOMEDS/Makefile.am
src/SALOMEDS/SALOMEDS_AttributeTableOfInteger_i.cxx
src/SALOMEDS/SALOMEDS_AttributeTableOfReal_i.cxx
src/SALOMEDS/SALOMEDS_AttributeTableOfString_i.cxx
src/SALOMEDS/SALOMEDS_Defines.hxx
src/SALOMEDS/SALOMEDS_StudyManager_i.cxx
src/SALOMEDS/SALOMEDS_Study_i.cxx
src/SALOMEDS/Test/Makefile.am
src/SALOMEDSClient/SALOMEDSClient_definitions.hxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeParameter.cxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfInteger.cxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfReal.cxx
src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfString.cxx
src/SALOMEDSImpl/SALOMEDSImpl_Defines.hxx
src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx
src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.hxx
src/SALOMEDSImpl/Test/Makefile.am
src/SALOMELocalTrace/SALOME_LocalTrace.hxx
src/SALOMELocalTrace/Test/Makefile.am
src/SALOMETraceCollector/SALOMETraceCollector.hxx
src/SALOMETraceCollector/Test/Makefile.am
src/TOOLSDS/SALOMEDS_Tool.hxx
src/TestContainer/Makefile.am
src/TestContainer/SALOME_TestComponent.hxx
src/UnitTests/Makefile.am
src/Utils/Makefile.am
src/Utils/SALOME_Utils.hxx
src/Utils/Test/Makefile.am
src/Utils/Utils_SALOME_Exception.hxx

index a62a38534e961474c521903137cecd93fc26d36e..000aeda4b0128f8bd0345c4e10760e1f578b036d 100644 (file)
@@ -42,11 +42,20 @@ nodist_salomescript_DATA =  \
 
 # These files are executable scripts
 dist_salomescript_SCRIPTS =            \
-       addToKillList.py                \
        appli_clean.sh                  \
-       appli_gen.py                    \
        appli_install.sh                \
        createAppli.sh                  \
+       runIDLparser                    \
+       runNS.sh                        \
+       runSalome                       \
+       runSalome.csh                   \
+       runSalome.ksh                   \
+       waitNS.sh
+
+# These files are python files
+dist_salomescript_PYTHON =             \
+       addToKillList.py                \
+       appli_gen.py                    \
        envSalome.py                    \
        killSalome.py                   \
        killSalomeWithPort.py           \
@@ -55,12 +64,7 @@ dist_salomescript_SCRIPTS =          \
        nameserver.py                   \
        NSparam.py                      \
        orbmodule.py                    \
-       runIDLparser                    \
        runNS.py                        \
-       runNS.sh                        \
-       runSalome                       \
-       runSalome.csh                   \
-       runSalome.ksh                   \
        runSalome.py                    \
        salomeConsole.py                \
        salome_session.py               \
@@ -71,8 +75,7 @@ dist_salomescript_SCRIPTS =           \
        shutdownSalome.py               \
        virtual_salome.py               \
        waitContainers.py               \
-       waitNS.py                       \
-       waitNS.sh
+       waitNS.py
 
 EXTRA_DIST = appliskel
 
@@ -95,3 +98,7 @@ uninstall-local:
          rm -rf $(DESTDIR)$(salomescriptdir)/appliskel; \
        fi;
 
+install-data-hook:
+       @for f in $(dist_salomescript_PYTHON) ; do \
+          chmod -f a+x $(DESTDIR)$(salomescriptdir)/$$f ; \
+        done
index dd5258e4fe2ffb3598d9106404acff2933c22503..53034f950c452744a180031c1431e35a3a2a5812 100755 (executable)
@@ -57,7 +57,7 @@ export NSHOST
 NSPORT=$2
 export NSPORT
 initref="NameService=corbaname::"$1":$2"
-echo "ORBInitRef $initref" > $OMNIORB_CONFIG
+echo "InitRef = $initref" > $OMNIORB_CONFIG
 
 #go to the requested working directory if any
 if test "x$3" == "xWORKINGDIR"; then
index 46986f89709a350c00c3d7ac5f4ebf532a8ec5ad..32fa88627c868f4b99e9fe506836df53de0acc5d 100755 (executable)
@@ -95,7 +95,7 @@ class NamingServer(Server):
         #print "port=", aPort
         if sys.platform == "win32":
           #print "start omniNames -start " + aPort + " -logdir " + upath
-          self.CMD=['omniNames -start ' , aPort , ' -logdir ' , '\"' + upath + '\"', ' -errlog', '\"' + upath+'/omniNameErrors.log' + '\"']
+          self.CMD=['omniNames -start ' , aPort , ' -nohostname ', ' -logdir ' , '\"' + upath + '\"', ' -errlog', '\"' + upath+'/omniNameErrors.log' + '\"']
           #os.system("start omniNames -start " + aPort + " -logdir " + upath)
         else:
           #self.CMD=['omniNames -start ' , aPort , ' -logdir ' , upath , ' &']
index bf9cfc5fe7d5fba2c0889ebbebaa2d1bf2ddb52c..f5b95927f250134fbc056d59b2bc2318c0450518 100755 (executable)
@@ -705,8 +705,7 @@ def useSalome(args, modules_list, modules_root_dir):
                 scrname = toimport[ i ]
                 if len(scrname) > 2 and (len(scrname) - string.rfind(scrname, ".py") == 3):
                     print 'executing',scrname
-                    doexec = 'execfile(\"%s\")'%scrname
-                    exec doexec
+                    execfile(scrname,globals())
                 else:
                     print 'importing',scrname
                     doimport = 'import ' + scrname
index 4d433e927454456397a7159e22df5b8112a2e2d4..3c59afb8b93991a5773d29326515036f303db137 100644 (file)
@@ -41,4 +41,4 @@ dev_docs:
 EXTRA_DIST= main.dox install.dox \
            kernel_resources.dox kernel_services.dox \
            salome_application.dox unittests.dox \
-           salome_file.dox batch.dox
+           salome_file.dox
index 6205e23b6f59821d9afd2d49dc207b73568061c2..aad10ecc268a4dc6082b15a5c3a8506aa9d52a3b 100644 (file)
@@ -25,3 +25,8 @@ dist-hook:
        cp -Rp $(srcdir)/static $(distdir) ; \
        rm -rf $(distdir)/static/CVS
 
+# VSR: nullify these make targets to avoid 'make distcheck' failure
+dvi:
+pdf:
+ps:
+
index 56d52a61ad5a331e8853efcfe4e67584805c2b96..6eab03cf281c95fcba87f89c33eccea18dc3e7c4 100755 (executable)
@@ -4,7 +4,9 @@
 </head>
 <body>
 <hr style="width: 100%; height: 2px;">
-<div style="text-align: center;">Copyright &copy; 2003-2007 CEA, EDF<br>
+<div style="text-align: center;">
+Copyright &copy; 2007-2008  CEA/DEN, EDF R&amp;D, OPEN CASCADE<br>
+Copyright &copy; 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&amp;D, LEG, PRINCIPIA R&amp;D, BUREAU VERITAS<br>
 </div>
 </body>
 </html>
index b06306d1edac3bd34bcc510f840c922d01a00d54..bddfbcb90d5cabb929c08b305bf44357e0d1a7fe 100644 (file)
 include $(top_srcdir)/salome_adm/unix/make_common_starter.am
 
 dev_docs:
-       echo "DOXYGEN SUPPORT PYTHON - $(DOXYGEN_WITH_PYTHON)"; \
-       if( test "x$(DOXYGEN_WITH_PYTHON)" = "xyes"); then \
-         sed 's|python_extension_must_be_here|*.py|' ./doxyfile > ./doxyfile1; \
-         $(DOXYGEN) -u ./doxyfile1; \
-       else \
-         sed 's|python_extension_must_be_here||' ./doxyfile > ./doxyfile1; \
-       fi; \
-       echo "DOXYGEN SUPPORT STL - $(DOXYGEN_WITH_STL)"; \
-       if( test "x$(DOXYGEN_WITH_STL)" = "xyes"); then \
-         sed -e 's|BUILTIN_STL_SUPPORT    = NO|BUILTIN_STL_SUPPORT    = YES|' ./doxyfile1 > ./doxyfile2; \
-         mv -f doxyfile2 doxyfile1; \
-       fi; \
-       $(DOXYGEN) ./doxyfile1
+       $(DOXYGEN) -u doxyfile; \
+       $(DOXYGEN) doxyfile
 
 clean-local:
-       -rm -fr KERNEL log.txt doxyfile1.bak doxyfile1
+       -rm -fr KERNEL log.txt doxyfile.bak
 
 install-data-local:
        if test -d KERNEL; then \
@@ -53,9 +42,4 @@ install-data-local:
 uninstall-local:
        rm -rf $(DESTDIR)$(docdir)/tui/KERNEL
 
-EXTRA_DIST=static KERNEL/exemple
-
-dist-hook:
-       rm -rf $(distdir)/static/CVS ; \
-       rm -rf $(distdir)/KERNEL/exemple/CVS
-
+EXTRA_DIST = static
index 544dd2015e5456e33db5cc68845c732a97d8ae11..30541d87280ef0c70c0d00f7ab707f1e2d26d354 100644 (file)
@@ -27,7 +27,7 @@ TAB_SIZE               = 5
 ALIASES                = 
 OPTIMIZE_OUTPUT_FOR_C  = YES
 OPTIMIZE_OUTPUT_JAVA   = NO
-BUILTIN_STL_SUPPORT    = NO
+BUILTIN_STL_SUPPORT    = @DOXYGEN_SUPPORT_STL@
 DISTRIBUTE_GROUP_DOC   = NO
 SUBGROUPING            = YES
 
@@ -77,7 +77,7 @@ WARN_LOGFILE           = log.txt
 #---------------------------------------------------------------------------
 INPUT                  = \
                       @top_srcdir@/src/DSC
-FILE_PATTERNS          = *.idl *.cxx *.hxx *.h *.hh *.i *c *.cc python_extension_must_be_here
+FILE_PATTERNS          = *.idl *.cxx *.hxx *.h *.hh *.i *c *.cc @DOXYGEN_PYTHON_EXTENSION@
 RECURSIVE              = YES
 EXCLUDE                = 
 EXCLUDE_SYMLINKS       = NO
index 56d52a61ad5a331e8853efcfe4e67584805c2b96..6eab03cf281c95fcba87f89c33eccea18dc3e7c4 100755 (executable)
@@ -4,7 +4,9 @@
 </head>
 <body>
 <hr style="width: 100%; height: 2px;">
-<div style="text-align: center;">Copyright &copy; 2003-2007 CEA, EDF<br>
+<div style="text-align: center;">
+Copyright &copy; 2007-2008  CEA/DEN, EDF R&amp;D, OPEN CASCADE<br>
+Copyright &copy; 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&amp;D, LEG, PRINCIPIA R&amp;D, BUREAU VERITAS<br>
 </div>
 </body>
 </html>
index 71a0c4c12fced993a50a64ebaff41001b795d340..d1e43efc65c53d96a1ab358910e7d7e794e107ca 100644 (file)
@@ -271,9 +271,9 @@ if WITH_PACO_PARALLEL
 %.hxx: %.idl
        $(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) -Wbh=.hxx -Wbs=.cxx $<
 
-$(DESTDIR)$(salomepythondir)/%_idl.py : %.idl
-       $(MKDIR_P) $(DESTDIR)$(salomepythondir)
-       $(OMNIORB_IDL) $(IDLPYFLAGS) -I$(top_srcdir)/idl -I@PACOPATH@/idl -C$(DESTDIR)$(salomepythondir) $<
+#$(DESTDIR)$(salomepythondir)/%_idl.py : %.idl
+#      $(MKDIR_P) $(DESTDIR)$(salomepythondir)
+#      $(OMNIORB_IDL) $(IDLPYFLAGS) -I$(top_srcdir)/idl -I@PACOPATH@/idl -C$(DESTDIR)$(salomepythondir) $<
 
 endif
 
@@ -282,6 +282,11 @@ install-exec-local: $(IDL_FILES:%=$(top_srcdir)/idl/%)
        ls $^ | while read file; do \
          $(OMNIORB_IDL) $(IDLPYFLAGS) -C$(DESTDIR)$(salomepythondir) $$file ; \
        done
+if WITH_PACO_PARALLEL
+       ls $(top_builddir)/idl/*.idl | while read file; do \
+         $(OMNIORB_IDL) $(IDLPYFLAGS) -I$(top_srcdir)/idl -I@PACOPATH@/idl -C$(DESTDIR)$(salomepythondir) $$file ; \
+       done
+endif
 
 # uninstall-local removes too much, but it works in distcheck
 uninstall-local:
index 878d2e6cdfed75a4f866e0646728958886360924..db817c063dcec465700820fe481314e6d5a1ee47 100644 (file)
@@ -179,6 +179,13 @@ module Engines
     */
     fileTransfer getFileTransfer();
 
+    //! Copy a file from a remote host (container) to a local file
+    /*!
+      \param contai the remote container
+      \param remoteFile the file on the remote host to copy
+      \param localFile the local file to create by copy
+     */
+    void copyFile(in Container contai, in string remoteFile, in string localFile);
   };
 
   /*! \brief Interface of the %component.
@@ -426,6 +433,12 @@ module Engines
       File.
     */
     long open(in string fileName);
+    //! Open the file transfer in write mode for file fileName
+    /*!
+      \param fileName the file to copy into with putBlock
+      \return the id to use with putBlock
+    */
+    long openW(in string fileName);
 
     //! Close the file transfer
     /*!
@@ -440,6 +453,14 @@ module Engines
       The last block is empty, and identifies the end of file.
     */
     fileBlock getBlock(in long fileId);
+
+    //! Put a file data block
+    /*!
+       \param fileId identification of the file obtained by openW
+       \param block a data block to copy into the file identified by fileId
+    */
+    void putBlock(in long fileId, in fileBlock block);
+
   };
 
   //!  A file managed by a Salome_file. 
index 13b0d64fc9a43b79d5a4e73b46f13db5d112933f..16ffacd19b2c856c86d547c5f37d40486bda76d2 100644 (file)
@@ -40,45 +40,79 @@ module Engines
 //! modules list
   typedef sequence<string> ModulesList;
 
-//!  Type to describe properties of a resource.
+//!  Type to describe required properties of a container.
 struct MachineParameters
 {
+  //! container name if given else automatic
   string container_name;
+  //! host name if given else automatic
   string hostname;
+  //! if given list of components that could be loaded on the container
+  CompoList componentList;
+  //! if given restricted list of machines to search in
+  MachineList computerList;
+  //! required operating system 
+  string OS;
+  //! required memory size
+  long mem_mb;
+  //! required frequency
+  long cpu_clock;
+  //! required number of proc per node
+  long nb_proc_per_node;
+  //! required number of node
+  long nb_node;
+  //! if true start a MPI container
+  boolean isMPI;
+  //! container working directory 
+  string workingdir;
+  //! creation mode for GiveContainer. 
+  /*!start creates a new container
+   * get  try to find an existing container
+   * getorstart   use an existing container if it exists or creates a new one
+   */
+  string mode;
+  //! resource management policy : first, cycl, altcycl or best (can be extended)
+  string policy;
+
+  //! PaCO specific informations
+  string parallelLib;
+  long nb_component_nodes;
+};
+
+//!  Type to describe properties of a resource.
+struct MachineDefinition
+{
+  //! host name 
+  string hostname;
+  //! alias name 
   string alias;
+  //! protocol to use to start a remote container (ssh or rsh)
   string protocol;
+  //! login name to use to start a remote container
   string username;
+  //! salome application to use to start a remote container
   string applipath;
-  ModulesList modList;
+  //! list of available components 
+  CompoList componentList;
+  //! operating system 
   string OS;
+  //! memory size
   long mem_mb;
+  //! frequency
   long cpu_clock;
+  //! number of proc per node
   long nb_proc_per_node;
+  //! number of node
   long nb_node;
-  boolean isMPI;
+  //! MPI implementation
   string mpiImpl;
+  //! batch system
   string batch;
-  string workingdir;
-
-  // PaCO specific informations
-  string parallelLib;
   long nb_component_nodes;
 };
-
 //! exception thrown if a computer is not found in the catalog
   exception NotFound {};
 
-//! enumeration to set a resource management policy
-  enum policy {
-  //! first machine in the list of admissible computers
-  P_FIRST,
-  //! next machine in the list of admissible computers
-  P_CYCL,
-  //! best machine in the list of admissible computers
-  P_BEST};
-//! resource management policy
-  typedef policy ResPolicy;
-
 //!  Structure used for Salome Batch Job parameters
 struct BatchParameters
 {
@@ -124,36 +158,27 @@ struct BatchParameters
   interface ContainerManager
   {
     //!  Find an existing container satisfying the constraints given by input parameters or start a new one.
-    Container FindOrStartContainer( in MachineParameters params,
-                                   in MachineList possibleComputers);
+    Container FindOrStartContainer( in MachineParameters params);
 
     //!  This operation launches a PaCO++ container.
     /*!  
-
       \param Description of the container resquested.
       \param List of computers ressources.
 
       \return Container's CORBA reference.
     */
-    Container StartParallelContainer(in MachineParameters params,
-                                    in ResPolicy policy,
-                                    in MachineList possibleComputers);
+    Container StartParallelContainer( in MachineParameters params);
 
     //!  Start a new container satisfying the constraints given by input parameters.
-    Container StartContainer( in MachineParameters params,
-                             in ResPolicy policy,
-                             in CompoList componentList );
+    Container StartContainer( in MachineParameters params);
 
     //!  Same as StartContainer except that in batch all containers have already been launched
     /*! 
-
          We are in batch if environment variable SALOME_BATCH is 1.
          In this case, containers have been launched at the beginning of the Salome session and 
          the container manager picks one in the pool of existing containers.
     */
-    Container GiveContainer( in MachineParameters params,
-                            in ResPolicy policy,
-                            in CompoList componentList );
+    Container GiveContainer( in MachineParameters params);
 
     //!  Shutdown all containers that have been launched by the container manager
     void ShutdownContainers();
@@ -169,17 +194,18 @@ struct BatchParameters
     //!  Find first available computer in a computers list
     string FindFirst(in MachineList possibleComputers);
 
+    //!  Find best available computer according to policy in a computers list
+    string Find(in string policy, in MachineList possibleComputers);
+
     //!  Get a list of computers that are best suited to launch a container given constraints 
     /*! 
-
          The constraints are resource constraints (params) and components constraints (componentList)
     */
-    MachineList GetFittingResources( in MachineParameters params,
-                                    in CompoList componentList )
-      raises (SALOME::SALOME_Exception);
+    MachineList GetFittingResources( in MachineParameters params)
+                                    raises (SALOME::SALOME_Exception);
 
     //!  Get the current machine parameters of a computer
-    MachineParameters GetMachineParameters( in string hostname );
+    MachineDefinition GetMachineParameters( in string hostname );
 
   } ;
 };
index 2c469754312423368efe14f0272e0ee493d62a8c..e82c416d5fda4d377c376e30c3bcc1b7df8a4454 100644 (file)
@@ -39,12 +39,6 @@ module Engines
 
   interface MPIContainer:Container,MPIObject
   {
-    // asynchronous version to load and remove parallel component in parallel
-    oneway void Asload_component_Library(in string componentName);
-    oneway void Ascreate_component_instance(in string componentName,in long studyId);
-    oneway void Asload_impl(in string nameToRegister, in string componentName);
-    oneway void Asremove_impl(in Component component_i);
-    oneway void Asfinalize_removal();
   };
 } ;
 
index e7e318c36bbc8a91ac7dceb46db3f6e5adbef175..917418b5259f3c5e0000730c7123011f22d3ebba 100644 (file)
@@ -34,6 +34,9 @@
   <objref name="BASIC_short" id="IDL:Ports/Data_Short_Port:1.0"/>
   <objref name="Study" id="IDL:SALOMEDS/Study:1.0"/>
   <objref name="SObject" id="IDL:SALOMEDS/SObject:1.0"/>
+  <objref name="SALOME/SenderDouble"/>
+  <objref name="SALOME/SenderInt"/>
+  <objref name="SALOME/Matrix"/>
 </type-list>
 
 <!-- Component list -->
index 0c4517cf6e01d2e13e4ade8b53703562c2a39670..581560ef74850ffbbb9e4aa989bd9247cba153ff 100644 (file)
 #
 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
-SET(BOOST_ROOT $ENV{BOOST_ROOT})
-IF(BOOST_ROOT)
-  FIND_PATH(BOOST_INCLUDES boost/shared_ptr.hpp ${BOOST_ROOT})
-  FIND_LIBRARY(BOOST_LIB_THREAD libboost_thread-vc90-mt-gd-1_35 ${BOOST_ROOT}/lib)
-  FIND_LIBRARY(BOOST_LIB_DATE_TIME libboost_date_time-vc90-mt-gd-1_35 ${BOOST_ROOT}/lib)
-  SET(BOOST_LIBS ${BOOST_LIB_THREAD} ${BOOST_LIB_DATE_TIME})
-  SET(BOOST_CPPFLAGS -I${BOOST_INCLUDES} -DBOOST_DISABLE_ASSERTS)
-ELSE(BOOST_ROOT)
-  SET(boost_thread -lboost_thread)
-ENDIF(BOOST_ROOT)
+# ------
+
+MESSAGE(STATUS "Check for boost ...")
+
+# ------
+
+IF(BOOST_IS_MANDATORY STREQUAL 0)
+  SET(BOOST_IS_MANDATORY 0)
+  SET(BOOST_IS_OPTIONAL 1)
+ENDIF(BOOST_IS_MANDATORY STREQUAL 0)
+IF(BOOST_IS_OPTIONAL STREQUAL 0)
+  SET(BOOST_IS_MANDATORY 1)
+  SET(BOOST_IS_OPTIONAL 0)
+ENDIF(BOOST_IS_OPTIONAL STREQUAL 0)
+IF(NOT BOOST_IS_MANDATORY AND NOT BOOST_IS_OPTIONAL)
+  SET(BOOST_IS_MANDATORY 1)
+  SET(BOOST_IS_OPTIONAL 0)
+ENDIF(NOT BOOST_IS_MANDATORY AND NOT BOOST_IS_OPTIONAL)
+
+# ------
+
+SET(BOOST_STATUS 1)
+IF(WITHOUT_BOOST OR WITH_BOOST STREQUAL 0)
+  SET(BOOST_STATUS 0)
+  MESSAGE(STATUS "boost disabled from command line.")
+ENDIF(WITHOUT_BOOST OR WITH_BOOST STREQUAL 0)
+
+# ------
+
+IF(BOOST_STATUS)
+  IF(WITH_BOOST)
+    SET(BOOST_ROOT_USER ${WITH_BOOST})
+  ELSE(WITH_BOOST)
+    SET(BOOST_ROOT_USER $ENV{BOOST_ROOT})
+  ENDIF(WITH_BOOST)
+ENDIF(BOOST_STATUS)
+
+# -----
+
+IF(BOOST_STATUS)
+  IF(BOOST_ROOT_USER)
+    SET(BOOST_FIND_PATHS_OPTION NO_DEFAULT_PATH)
+  ELSE(BOOST_ROOT_USER)
+    SET(BOOST_FIND_PATHS_OPTION)
+  ENDIF(BOOST_ROOT_USER)
+ENDIF(BOOST_STATUS)
+
+# -----
+
+IF(BOOST_STATUS)
+  IF(BOOST_ROOT_USER)
+    SET(BOOST_INCLUDE_PATHS ${BOOST_ROOT_USER} ${BOOST_ROOT_USER}/include)
+  ELSE(BOOST_ROOT_USER)
+    SET(BOOST_INCLUDE_PATHS)
+  ENDIF(BOOST_ROOT_USER)
+  SET(BOOST_INCLUDE_TO_FIND boost/shared_ptr.hpp)
+  FIND_PATH(BOOST_INCLUDE_DIR ${BOOST_INCLUDE_TO_FIND} PATHS ${BOOST_INCLUDE_PATHS} ${BOOST_FIND_PATHS_OPTION})
+  IF(BOOST_INCLUDE_DIR)
+    IF(BOOST_ROOT_USER)
+      SET(BOOST_CPPFLAGS -I${BOOST_INCLUDE_DIR})
+    ENDIF(BOOST_ROOT_USER)
+    MESSAGE(STATUS "${BOOST_INCLUDE_TO_FIND} found in ${BOOST_INCLUDE_DIR}")
+  ELSE(BOOST_INCLUDE_DIR)
+    SET(BOOST_STATUS 0)
+    IF(BOOST_ROOT_USER)
+      MESSAGE(STATUS "${BOOST_INCLUDE_TO_FIND} not found in ${BOOST_INCLUDE_PATHS}, check your BOOST installation.")
+    ELSE(BOOST_ROOT_USER)
+      MESSAGE(STATUS "${BOOST_INCLUDE_TO_FIND} not found on system, try to use WITH_BOOST option or BOOST_ROOT environment variable.")
+    ENDIF(BOOST_ROOT_USER)
+  ENDIF(BOOST_INCLUDE_DIR)
+ENDIF(BOOST_STATUS)
+
+# ----
+
+IF(BOOST_STATUS)
+  IF(BOOST_ROOT_USER)
+    SET(BOOST_LIB_PATHS ${BOOST_ROOT_USER}/lib)
+  ELSE(BOOST_ROOT_USER)
+    SET(BOOST_LIB_PATHS)
+  ENDIF(BOOST_ROOT_USER)
+ENDIF(BOOST_STATUS)
+
+IF(BOOST_STATUS)
+  IF(WINDOWS)
+    IF(CMAKE_BUILD_TYPE STREQUAL Debug)
+      SET(EXTENSION -gd)
+    ELSE(CMAKE_BUILD_TYPE STREQUAL Debug)
+      SET(EXTENSION)
+    ENDIF(CMAKE_BUILD_TYPE STREQUAL Debug)
+    FIND_LIBRARY(BOOST_LIB_THREAD libboost_thread-vc90-mt${EXTENSION}-1_35 ${BOOST_LIB_PATHS})
+    FIND_LIBRARY(BOOST_LIB_DATE_TIME libboost_date_time-vc90-mt${EXTENSION}-1_35 ${BOOST_LIB_PATHS})
+    FIND_LIBRARY(BOOST_LIB_SIGNALS libboost_signals-vc90-mt${EXTENSION}-1_35 ${BOOST_LIB_PATHS})
+    FIND_LIBRARY(BOOST_LIB_FILESYSTEM libboost_filesystem-vc90-mt${EXTENSION}-1_35 ${BOOST_LIB_PATHS})
+    FIND_LIBRARY(BOOST_LIB_SYSTEM libboost_system-vc90-mt${EXTENSION}-1_35 ${BOOST_LIB_PATHS})
+  ELSE(WINDOWS)
+    FIND_LIBRARY(BOOST_LIB_THREAD boost_thread ${BOOST_LIB_PATHS})
+  ENDIF(WINDOWS)
+  SET(BOOST_LIBS)
+  SET(BOOST_LIBS ${BOOST_LIBS} ${BOOST_LIB_THREAD})
+  SET(BOOST_LIBS ${BOOST_LIBS} ${BOOST_LIB_DATE_TIME})
+  SET(BOOST_LIBS ${BOOST_LIBS} ${BOOST_LIB_SIGNALS})
+  SET(BOOST_LIBS ${BOOST_LIBS} ${BOOST_LIB_FILESYSTEM})
+  SET(BOOST_LIBS ${BOOST_LIBS} ${BOOST_LIB_SYSTEM})
+ENDIF(BOOST_STATUS)
+
+# ------
+
+IF(BOOST_STATUS)
+  IF(WINDOWS)
+    SET(BOOST_CPPFLAGS ${BOOST_CPPFLAGS} -DBOOST_DISABLE_ASSERTS)
+  ENDIF(WINDOWS)
+ELSE(BOOST_STATUS)
+  IF(BOOST_IS_MANDATORY)
+    MESSAGE(FATAL_ERROR "boost not found ... mandatory ... abort")
+  ELSE(BOOST_IS_MANDATORY)
+    MESSAGE(STATUS "boost not found ... optional ... disabled")
+  ENDIF(BOOST_IS_MANDATORY)
+ENDIF(BOOST_STATUS)
+
+# ------
index 5add4eeb3c95cb779750a33a2573c300439df0f8..7e8263eac16dfc27e6ee49ace535295636a65606 100644 (file)
 #
 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
-FIND_LIBRARY(CPPUNIT_LIBS cppunit /usr/lib)
-IF(CPPUNIT_LIBS)
+# ------
+
+MESSAGE(STATUS "Check for cppunit ...")
+
+# ------
+
+IF(CPPUNIT_IS_MANDATORY STREQUAL 0)
+  SET(CPPUNIT_IS_MANDATORY 0)
+  SET(CPPUNIT_IS_OPTIONAL 1)
+ENDIF(CPPUNIT_IS_MANDATORY STREQUAL 0)
+IF(CPPUNIT_IS_OPTIONAL STREQUAL 0)
+  SET(CPPUNIT_IS_MANDATORY 1)
+  SET(CPPUNIT_IS_OPTIONAL 0)
+ENDIF(CPPUNIT_IS_OPTIONAL STREQUAL 0)
+IF(NOT CPPUNIT_IS_MANDATORY AND NOT CPPUNIT_IS_OPTIONAL)
+  SET(CPPUNIT_IS_MANDATORY 0)
+  SET(CPPUNIT_IS_OPTIONAL 1)
+ENDIF(NOT CPPUNIT_IS_MANDATORY AND NOT CPPUNIT_IS_OPTIONAL)
+
+# ------
+
+SET(CPPUNIT_STATUS 1)
+IF(WITHOUT_CPPUNIT OR WITH_CPPUNIT STREQUAL 0)
+  SET(CPPUNIT_STATUS 0)
+  MESSAGE(STATUS "cppunit disabled from command line.")
+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)
+ENDIF(CPPUNIT_STATUS)
+
+# -----
+
+IF(CPPUNIT_STATUS)
+  IF(CPPUNIT_ROOT_USER)
+    SET(CPPUNIT_FIND_PATHS_OPTION NO_DEFAULT_PATH)
+  ELSE(CPPUNIT_ROOT_USER)
+    SET(CPPUNIT_FIND_PATHS_OPTION)
+  ENDIF(CPPUNIT_ROOT_USER)
+ENDIF(CPPUNIT_STATUS)
+
+# -----
+
+IF(CPPUNIT_STATUS)
+  IF(CPPUNIT_ROOT_USER)
+    SET(CPPUNIT_INCLUDE_PATHS ${CPPUNIT_ROOT_USER} ${CPPUNIT_ROOT_USER}/include)
+  ELSE(CPPUNIT_ROOT_USER)
+    SET(CPPUNIT_INCLUDE_PATHS)
+  ENDIF(CPPUNIT_ROOT_USER)
+  SET(CPPUNIT_INCLUDE_TO_FIND cppunit/extensions/HelperMacros.h)
+  FIND_PATH(CPPUNIT_INCLUDE_DIR ${CPPUNIT_INCLUDE_TO_FIND} PATHS ${CPPUNIT_INCLUDE_PATHS} ${CPPUNIT_FIND_PATHS_OPTION})
+  IF(CPPUNIT_INCLUDE_DIR)
+    IF(CPPUNIT_ROOT_USER)
+      SET(CPPUNIT_INCLUDES -I${CPPUNIT_INCLUDE_DIR})
+    ENDIF(CPPUNIT_ROOT_USER)
+    MESSAGE(STATUS "${CPPUNIT_INCLUDE_TO_FIND} found in ${CPPUNIT_INCLUDE_DIR}")
+  ELSE(CPPUNIT_INCLUDE_DIR)
+    SET(CPPUNIT_STATUS 0)
+    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.")
+    ENDIF(CPPUNIT_ROOT_USER)
+  ENDIF(CPPUNIT_INCLUDE_DIR)
+ENDIF(CPPUNIT_STATUS)
+
+# ----
+
+IF(CPPUNIT_STATUS)
+  IF(CPPUNIT_ROOT_USER)
+    SET(CPPUNIT_LIB_PATHS ${CPPUNIT_ROOT_USER}/lib)
+  ELSE(CPPUNIT_ROOT_USER)
+    SET(CPPUNIT_LIB_PATHS)
+  ENDIF(CPPUNIT_ROOT_USER)
+ENDIF(CPPUNIT_STATUS)
+
+IF(CPPUNIT_STATUS)
+  IF(WINDOWS)
+    FIND_LIBRARY(CPPUNIT_LIB cppunitd_dll PATHS ${CPPUNIT_LIB_PATHS} ${CPPUNIT_FIND_PATHS_OPTION})
+  ELSE(WINDOWS)
+    FIND_LIBRARY(CPPUNIT_LIB cppunit PATHS ${CPPUNIT_LIB_PATHS} ${CPPUNIT_FIND_PATHS_OPTION})
+  ENDIF(WINDOWS)
+  SET(CPPUNIT_LIBS)
+  IF(CPPUNIT_LIB)
+    SET(CPPUNIT_LIBS ${CPPUNIT_LIBS} ${CPPUNIT_LIB})
+    MESSAGE(STATUS "cppunit lib found: ${CPPUNIT_LIB}")
+  ELSE(CPPUNIT_LIB)
+    SET(CPPUNIT_STATUS 0)
+    IF(CPPUNIT_ROOT_USER)
+      MESSAGE(STATUS "cppunit lib not found in ${CPPUNIT_LIB_PATHS}, check your CPPUNIT installation.")
+    ELSE(CPPUNIT_ROOT_USER)
+      MESSAGE(STATUS "cppunit lib not found on system, try to use WITH_CPPUNIT option or CPPUNIT_ROOT environment variable.")
+    ENDIF(CPPUNIT_ROOT_USER)
+  ENDIF(CPPUNIT_LIB)
+ENDIF(CPPUNIT_STATUS)
+
+# ----
+
+IF(CPPUNIT_STATUS)
   SET(CPPUNIT_IS_OK 1)
-ENDIF(CPPUNIT_LIBS)
+  IF(WINDOWS)
+    SET(CPPUNIT_INCLUDES ${CPPUNIT_INCLUDES} -DCPPUNIT_DLL)
+  ENDIF(WINDOWS)
+ELSE(CPPUNIT_STATUS)
+  IF(CPPUNIT_IS_MANDATORY)
+    MESSAGE(FATAL_ERROR "cppunit not found ... mandatory ... abort")
+  ELSE(CPPUNIT_IS_MANDATORY)
+    MESSAGE(STATUS "cppunit not found ... optional ... disabled")
+  ENDIF(CPPUNIT_IS_MANDATORY)
+ENDIF(CPPUNIT_STATUS)
+
+# ------
index c0f0a60c1b38d5bd249c2ab8bf5fd3185bf3df6b..fe54d590a2a8b6201f2c1b7f8818efd6db9c6aba 100644 (file)
 #
 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
-FIND_PROGRAM(HDF5_DUMP h5dump)
+# ------
 
-SET(HDF5_ROOT ${HDF5_DUMP})
-GET_FILENAME_COMPONENT(HDF5_ROOT ${HDF5_ROOT} PATH)
-GET_FILENAME_COMPONENT(HDF5_ROOT ${HDF5_ROOT} PATH)
+MESSAGE(STATUS "Check for hdf5 ...")
 
-FIND_PATH(HDF5_INCLUDES H5public.h ${HDF5_ROOT}/include)
-SET(HDF5_INCLUDES -I${HDF5_INCLUDES})
+# ------
 
-IF(WINDOWS)
-  FIND_LIBRARY(HDF5_LIBS hdf5d ${HDF5_ROOT}/lib)
-ELSE(WINDOWS)
-  FIND_LIBRARY(HDF5_LIBS hdf5 ${HDF5_ROOT}/lib)
-ENDIF(WINDOWS)
+IF(HDF5_IS_MANDATORY STREQUAL 0)
+  SET(HDF5_IS_MANDATORY 0)
+  SET(HDF5_IS_OPTIONAL 1)
+ENDIF(HDF5_IS_MANDATORY STREQUAL 0)
+IF(HDF5_IS_OPTIONAL STREQUAL 0)
+  SET(HDF5_IS_MANDATORY 1)
+  SET(HDF5_IS_OPTIONAL 0)
+ENDIF(HDF5_IS_OPTIONAL STREQUAL 0)
+IF(NOT HDF5_IS_MANDATORY AND NOT HDF5_IS_OPTIONAL)
+  SET(HDF5_IS_MANDATORY 1)
+  SET(HDF5_IS_OPTIONAL 0)
+ENDIF(NOT HDF5_IS_MANDATORY AND NOT HDF5_IS_OPTIONAL)
+
+# ------
+
+SET(HDF5_STATUS 1)
+IF(WITHOUT_HDF5 OR WITH_HDF5 STREQUAL 0)
+  SET(HDF5_STATUS 0)
+  MESSAGE(STATUS "hdf5 disabled from command line.")
+ENDIF(WITHOUT_HDF5 OR WITH_HDF5 STREQUAL 0)
+
+# ------
+
+IF(HDF5_STATUS)
+  IF(WITH_HDF5)
+    SET(HDF5_ROOT_USER ${WITH_HDF5})
+  ENDIF(WITH_HDF5)
+  IF(NOT HDF5_ROOT_USER)
+    SET(HDF5_ROOT_USER $ENV{HDF5_ROOT})
+  ENDIF(NOT HDF5_ROOT_USER)
+  IF(NOT HDF5_ROOT_USER)
+    SET(HDF5_ROOT_USER $ENV{HDF5HOME})
+  ENDIF(NOT HDF5_ROOT_USER)
+ENDIF(HDF5_STATUS)
+
+# ------
+
+IF(HDF5_STATUS)
+  IF(NOT HDF5_ROOT_USER)
+    FIND_PROGRAM(HDF5_DUMP h5dump)
+    IF(HDF5_DUMP)
+      MESSAGE(STATUS "h5dump found: ${HDF5_DUMP}")
+      IF(HDF5_DUMP STREQUAL /usr/bin/h5dump)
+      ELSE(HDF5_DUMP STREQUAL /usr/bin/h5dump)
+       SET(HDF5_ROOT_USER ${HDF5_DUMP})
+       GET_FILENAME_COMPONENT(HDF5_ROOT_USER ${HDF5_ROOT_USER} PATH)
+       GET_FILENAME_COMPONENT(HDF5_ROOT_USER ${HDF5_ROOT_USER} PATH)
+      ENDIF(HDF5_DUMP STREQUAL /usr/bin/h5dump)
+    ELSE(HDF5_DUMP)
+      MESSAGE(STATUS "h5dump not found, try to use WITH_HDF5 option or HDF5_ROOT (or HDF5HOME) environment variable")
+      SET(HDF5_STATUS 0)
+    ENDIF(HDF5_DUMP)
+  ENDIF(NOT HDF5_ROOT_USER)
+ENDIF(HDF5_STATUS)
+
+# ------
+
+IF(HDF5_STATUS)
+  IF(HDF5_ROOT_USER)
+    SET(HDF5_FIND_PATHS_OPTION NO_DEFAULT_PATH)
+  ELSE(HDF5_ROOT_USER)
+    SET(HDF5_FIND_PATHS_OPTION)
+  ENDIF(HDF5_ROOT_USER)
+ENDIF(HDF5_STATUS)
+
+# ------
+
+IF(HDF5_STATUS)
+  IF(HDF5_ROOT_USER)
+    SET(HDF5_INCLUDE_PATHS ${HDF5_ROOT_USER}/include)
+  ELSE(HDF5_ROOT_USER)
+    SET(HDF5_INCLUDE_PATHS)
+  ENDIF(HDF5_ROOT_USER)
+  SET(HDF5_INCLUDE_TO_FIND H5public.h)
+  FIND_PATH(HDF5_INCLUDE_DIR ${HDF5_INCLUDE_TO_FIND} PATHS ${HDF5_INCLUDE_PATHS} ${HDF5_FIND_PATHS_OPTION})
+  IF(HDF5_INCLUDE_DIR)
+    IF(HDF5_ROOT_USER)
+      SET(HDF5_INCLUDES -I${HDF5_INCLUDE_DIR})
+    ENDIF(HDF5_ROOT_USER)
+    SET(HDF5_INCLUDES -D_HDF5USEDLL_ ${HDF5_INCLUDES})
+    MESSAGE(STATUS "${HDF5_INCLUDE_TO_FIND} found in ${HDF5_INCLUDE_DIR}")
+  ELSE(HDF5_INCLUDE_DIR)
+    SET(HDF5_STATUS 0)
+    IF(HDF5_ROOT_USER)
+      MESSAGE(STATUS "${HDF5_INCLUDE_TO_FIND} not found in ${HDF5_INCLUDE_PATHS}, check your HDF5 installation.")
+    ELSE(HDF5_ROOT_USER)
+      MESSAGE(STATUS "${HDF5_INCLUDE_TO_FIND} not found on system, try to use WITH_HDF5 option or HDF5_ROOT (or HDF5HOME) environment variable.")
+    ENDIF(HDF5_ROOT_USER)
+  ENDIF(HDF5_INCLUDE_DIR)
+ENDIF(HDF5_STATUS)
+
+# ----
+
+IF(HDF5_STATUS)
+  IF(HDF5_ROOT_USER)
+    IF(WINDOWS)
+      SET(HDF5_LIB_PATHS ${HDF5_ROOT_USER}/dll)
+    ELSE(WINDOWS)
+      SET(HDF5_LIB_PATHS ${HDF5_ROOT_USER}/lib)
+    ENDIF(WINDOWS)
+  ELSE(HDF5_ROOT_USER)
+    SET(HDF5_LIB_PATHS)
+  ENDIF(HDF5_ROOT_USER)
+  IF(WINDOWS)
+    IF(CMAKE_BUILD_TYPE STREQUAL Release)
+      FIND_LIBRARY(HDF5_LIB hdf5dll PATHS ${HDF5_LIB_PATHS} ${HDF5_FIND_PATHS_OPTION})
+    ELSE(CMAKE_BUILD_TYPE STREQUAL Release)
+      FIND_LIBRARY(HDF5_LIB hdf5ddll PATHS ${HDF5_LIB_PATHS} ${HDF5_FIND_PATHS_OPTION})
+    ENDIF(CMAKE_BUILD_TYPE STREQUAL Release)
+  ELSE(WINDOWS)
+    FIND_LIBRARY(HDF5_LIB hdf5 PATHS ${HDF5_LIB_PATHS} ${HDF5_FIND_PATHS_OPTION})
+  ENDIF(WINDOWS)
+  SET(HDF5_LIBS)
+  IF(HDF5_LIB)
+    SET(HDF5_LIBS ${HDF5_LIBS} ${HDF5_LIB})
+    MESSAGE(STATUS "hdf5 lib found: ${HDF5_LIB}")
+  ELSE(HDF5_LIB)
+    SET(HDF5_STATUS 0)
+    IF(HDF5_ROOT_USER)
+      MESSAGE(STATUS "hdf5 lib not found in ${HDF5_LIB_PATHS}, check your HDF5 installation.")
+    ELSE(HDF5_ROOT_USER)
+      MESSAGE(STATUS "hdf5 lib not found on system, try to use WITH_HDF5 option or HDF5_ROOT (or HDF5HOME) environment variable.")
+    ENDIF(HDF5_ROOT_USER)
+  ENDIF(HDF5_LIB)
+ENDIF(HDF5_STATUS)
+
+# ----
+
+IF(HDF5_STATUS)
+ELSE(HDF5_STATUS)
+  IF(HDF5_IS_MANDATORY)
+    MESSAGE(FATAL_ERROR "hdf5 not found ... mandatory ... abort")
+  ELSE(HDF5_IS_MANDATORY)
+    MESSAGE(STATUS "hdf5 not found ... optional ... disabled")
+  ENDIF(HDF5_IS_MANDATORY)
+ENDIF(HDF5_STATUS)
+
+# ------
 
 #SET(ZLIB_ROOT $ENV{ZLIB_ROOT})
 #STRING(LENGTH "${ZLIB_ROOT}" NB)
@@ -47,3 +177,5 @@ ENDIF(WINDOWS)
 #  FIND_LIBRARY(SZIP_LIBS szlib ${SZIP_ROOT}/lib)
 #  SET(HDF5_LIBS ${HDF5_LIBS} ${SZIP_LIBS})
 #ENDIF(${NB} GREATER 0)
+
+# ------
index cd0b454698c703245c2bb6294d9bd47f6c38b031..7d87abcc468d5826a87001cebe4e7daac6f6b1ff 100644 (file)
 #
 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
-SET(LIBXML2_ROOT $ENV{LIBXML2_ROOT})
-IF(LIBXML2_ROOT)
-  FIND_PATH(LIBXML2_INCLUDE_DIR libxml/parser.h ${LIBXML2_ROOT}/include)
-  FIND_LIBRARY(LIBXML2_LIBS libxml2 ${LIBXML2_ROOT}/lib)
-ELSE(LIBXML2_ROOT)
-  FIND_PATH(LIBXML2_INCLUDE_DIR libxml/parser.h /usr/include/libxml2)
-  FIND_LIBRARY(LIBXML2_LIBS xml2 /usr/lib)
-ENDIF(LIBXML2_ROOT)
-
-SET(LIBXML2_INCLUDES -I${LIBXML2_INCLUDE_DIR})
-
-SET(ICONV_ROOT $ENV{ICONV_ROOT})
-IF(ICONV_ROOT)
-  FIND_PATH(ICONV_INCLUDE_DIR iconv.h ${ICONV_ROOT}/include)
-  FIND_LIBRARY(ICONV_LIBS iconv ${ICONV_ROOT}/lib)
-  SET(LIBXML2_INCLUDES ${LIBXML2_INCLUDES} -I${ICONV_INCLUDE_DIR})
-  SET(LIBXML2_LIBS ${LIBXML2_LIBS} ${ICONV_LIBS})
-ENDIF(ICONV_ROOT)
-
-SET(LIBXML_INCLUDES ${LIBXML2_INCLUDES})
-SET(LIBXML_CPPFLAGS ${LIBXML2_INCLUDES})
-SET(LIBXML_LIBS ${LIBXML2_LIBS})
+# ------
+
+MESSAGE(STATUS "Check for libxml2 ...")
+
+# ------
+
+IF(LIBXML2_IS_MANDATORY STREQUAL 0)
+  SET(LIBXML2_IS_MANDATORY 0)
+  SET(LIBXML2_IS_OPTIONAL 1)
+ENDIF(LIBXML2_IS_MANDATORY STREQUAL 0)
+IF(LIBXML2_IS_OPTIONAL STREQUAL 0)
+  SET(LIBXML2_IS_MANDATORY 1)
+  SET(LIBXML2_IS_OPTIONAL 0)
+ENDIF(LIBXML2_IS_OPTIONAL STREQUAL 0)
+IF(NOT LIBXML2_IS_MANDATORY AND NOT LIBXML2_IS_OPTIONAL)
+  SET(LIBXML2_IS_MANDATORY 1)
+  SET(LIBXML2_IS_OPTIONAL 0)
+ENDIF(NOT LIBXML2_IS_MANDATORY AND NOT LIBXML2_IS_OPTIONAL)
+
+# ------
+
+SET(LIBXML2_STATUS 1)
+IF(WITHOUT_LIBXML2 OR WITH_LIBXML2 STREQUAL 0)
+  SET(LIBXML2_STATUS 0)
+  MESSAGE(STATUS "libxml2 disabled from command line.")
+ENDIF(WITHOUT_LIBXML2 OR WITH_LIBXML2 STREQUAL 0)
+
+# ------
+
+IF(LIBXML2_STATUS)
+  IF(WITH_LIBXML2)
+    SET(LIBXML2_ROOT_USER ${WITH_LIBXML2})
+  ELSE(WITH_LIBXML2)
+    SET(LIBXML2_ROOT_USER $ENV{LIBXML2_ROOT})
+  ENDIF(WITH_LIBXML2)
+ENDIF(LIBXML2_STATUS)
+
+# -----
+
+IF(LIBXML2_STATUS)
+  IF(LIBXML2_ROOT_USER)
+    SET(LIBXML2_FIND_PATHS_OPTION NO_DEFAULT_PATH)
+  ELSE(LIBXML2_ROOT_USER)
+    SET(LIBXML2_FIND_PATHS_OPTION)
+  ENDIF(LIBXML2_ROOT_USER)
+ENDIF(LIBXML2_STATUS)
+
+# -----
+
+IF(LIBXML2_STATUS)
+  IF(LIBXML2_ROOT_USER)
+    SET(LIBXML2_INCLUDE_PATHS ${LIBXML2_ROOT_USER}/include)
+  ELSE(LIBXML2_ROOT_USER)
+    SET(LIBXML2_INCLUDE_PATHS /usr/include/libxml2)
+  ENDIF(LIBXML2_ROOT_USER)
+  SET(LIBXML2_INCLUDE_TO_FIND libxml/parser.h)
+  FIND_PATH(LIBXML2_INCLUDE_DIR ${LIBXML2_INCLUDE_TO_FIND} PATHS ${LIBXML2_INCLUDE_PATHS} ${LIBXML2_FIND_PATHS_OPTION})
+  IF(LIBXML2_INCLUDE_DIR)
+    SET(LIBXML2_INCLUDES -I${LIBXML2_INCLUDE_DIR})
+    MESSAGE(STATUS "${LIBXML2_INCLUDE_TO_FIND} found in ${LIBXML2_INCLUDE_DIR}")
+  ELSE(LIBXML2_INCLUDE_DIR)
+    SET(LIBXML2_STATUS 0)
+    IF(LIBXML2_ROOT_USER)
+      MESSAGE(STATUS "${LIBXML2_INCLUDE_TO_FIND} not found in ${LIBXML2_INCLUDE_PATHS}, check your LIBXML2 installation.")
+    ELSE(LIBXML2_ROOT_USER)
+      MESSAGE(STATUS "${LIBXML2_INCLUDE_TO_FIND} not found on system, try to use WITH_LIBXML2 option or LIBXML2_ROOT environment variable.")
+    ENDIF(LIBXML2_ROOT_USER)
+  ENDIF(LIBXML2_INCLUDE_DIR)
+ENDIF(LIBXML2_STATUS)
+
+# ----
+
+IF(LIBXML2_STATUS)
+  IF(LIBXML2_ROOT_USER)
+    SET(LIBXML2_LIB_PATHS ${LIBXML2_ROOT_USER}/lib)
+  ELSE(LIBXML2_ROOT_USER)
+    SET(LIBXML2_LIB_PATHS)
+  ENDIF(LIBXML2_ROOT_USER)
+ENDIF(LIBXML2_STATUS)
+
+IF(LIBXML2_STATUS)
+  IF(WINDOWS)
+    FIND_LIBRARY(LIBXML2_LIB libxml2 PATHS ${LIBXML2_LIB_PATHS} ${LIBXML2_FIND_PATHS_OPTION})
+  ELSE(WINDOWS)
+    FIND_LIBRARY(LIBXML2_LIB xml2 PATHS ${LIBXML2_LIB_PATHS} ${LIBXML2_FIND_PATHS_OPTION})
+  ENDIF(WINDOWS)
+  SET(LIBXML2_LIBS)
+  IF(LIBXML2_LIB)
+    SET(LIBXML2_LIBS ${LIBXML2_LIBS} ${LIBXML2_LIB})
+    MESSAGE(STATUS "libxml2 lib found: ${LIBXML2_LIB}")
+  ELSE(LIBXML2_LIB)
+    SET(LIBXML2_STATUS 0)
+    IF(LIBXML2_ROOT_USER)
+      MESSAGE(STATUS "libxml2 lib not found in ${LIBXML2_LIB_PATHS}, check your LIBXML2 installation.")
+    ELSE(LIBXML2_ROOT_USER)
+      MESSAGE(STATUS "libxml2 lib not found on system, try to use WITH_LIBXML2 option or LIBXML2_ROOT environment variable.")
+    ENDIF(LIBXML2_ROOT_USER)
+  ENDIF(LIBXML2_LIB)
+ENDIF(LIBXML2_STATUS)
+
+# ----
+
+IF(WINDOWS)
+  SET(ICONV_ROOT $ENV{ICONV_ROOT})
+  IF(ICONV_ROOT)
+    FIND_PATH(ICONV_INCLUDE_DIR iconv.h ${ICONV_ROOT}/include)
+    FIND_LIBRARY(ICONV_LIBS iconv ${ICONV_ROOT}/lib)
+    SET(LIBXML2_INCLUDES ${LIBXML2_INCLUDES} -I${ICONV_INCLUDE_DIR})
+    SET(LIBXML2_LIBS ${LIBXML2_LIBS} ${ICONV_LIBS})
+  ENDIF(ICONV_ROOT)
+ENDIF(WINDOWS)
+
+# ------
+IF(LIBXML2_STATUS)
+  SET(LIBXML_INCLUDES ${LIBXML2_INCLUDES})
+  SET(LIBXML_CPPFLAGS ${LIBXML2_INCLUDES})
+  SET(LIBXML_LIBS ${LIBXML2_LIBS})
+ELSE(LIBXML2_STATUS)
+  IF(LIBXML2_IS_MANDATORY)
+    MESSAGE(FATAL_ERROR "libxml2 not found ... mandatory ... abort")
+  ELSE(LIBXML2_IS_MANDATORY)
+    MESSAGE(STATUS "libxml2 not found ... optional ... disabled")
+  ENDIF(LIBXML2_IS_MANDATORY)
+ENDIF(LIBXML2_STATUS)
+
+# ------
index f9cd2d6185e1ad61ad0b0ece2bb599802df1b19a..e8a1c70fcd853fbfea7752c2ccfd6571bf6158f8 100644 (file)
 #
 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
-# -----
-
-FIND_PROGRAM(OMNIORB_IDL omniidl)
-
-# -----
-
-IF(OMNIORB_IDL)
-  SET(CORBA_GEN 1)
-ELSE(OMNIORB_IDL)
-  SET(CORBA_GEN 0)
-ENDIF(OMNIORB_IDL)
-
-# -----
-
-SET(OMNIORB_ROOT ${OMNIORB_IDL})
-GET_FILENAME_COMPONENT(OMNIORB_ROOT ${OMNIORB_ROOT} PATH)
-IF(WINDOWS)
-  GET_FILENAME_COMPONENT(OMNIORB_ROOT ${OMNIORB_ROOT} PATH)
-ENDIF(WINDOWS)
-GET_FILENAME_COMPONENT(OMNIORB_ROOT ${OMNIORB_ROOT} PATH)
-
-# ----
-
-FIND_PATH(OMNIORB_INC1
-  NAMES omniORB4/CORBA.h
-  PATHS ${OMNIORB_ROOT}/include
-  )
-FIND_PATH(OMNIORB_INC2
-  NAMES CORBA.h
-  PATHS ${OMNIORB_ROOT}/include/omniORB4
-  )
-
-SET(OMNIORB_INCLUDES -I${OMNIORB_INC1} -I${OMNIORB_INC2})
-SET(CORBA_INCLUDES ${OMNIORB_INCLUDES})
+# ------
+
+MESSAGE(STATUS "Check for omniorb ...")
+
+# ------
+
+IF(OMNIORB_IS_MANDATORY STREQUAL 0)
+  SET(OMNIORB_IS_MANDATORY 0)
+  SET(OMNIORB_IS_OPTIONAL 1)
+ENDIF(OMNIORB_IS_MANDATORY STREQUAL 0)
+IF(OMNIORB_IS_OPTIONAL STREQUAL 0)
+  SET(OMNIORB_IS_MANDATORY 1)
+  SET(OMNIORB_IS_OPTIONAL 0)
+ENDIF(OMNIORB_IS_OPTIONAL STREQUAL 0)
+IF(NOT OMNIORB_IS_MANDATORY AND NOT OMNIORB_IS_OPTIONAL)
+  SET(OMNIORB_IS_MANDATORY 1)
+  SET(OMNIORB_IS_OPTIONAL 0)
+ENDIF(NOT OMNIORB_IS_MANDATORY AND NOT OMNIORB_IS_OPTIONAL)
+
+# ------
+
+SET(OMNIORB_STATUS 1)
+IF(WITHOUT_OMNIORB OR WITH_OMNIORB STREQUAL 0)
+  SET(OMNIORB_STATUS 0)
+  MESSAGE(STATUS "omniorb disabled from command line.")
+ENDIF(WITHOUT_OMNIORB OR WITH_OMNIORB STREQUAL 0)
+
+# ------
+
+IF(OMNIORB_STATUS)
+  IF(WITH_OMNIORB)
+    SET(OMNIORB_ROOT_USER ${WITH_OMNIORB})
+  ENDIF(WITH_OMNIORB)
+  IF(NOT OMNIORB_ROOT_USER)
+    SET(OMNIORB_ROOT_USER $ENV{OMNIORB_ROOT})
+  ENDIF(NOT OMNIORB_ROOT_USER)
+  IF(NOT OMNIORB_ROOT_USER)
+    SET(OMNIORB_ROOT_USER $ENV{OMNIORBHOME})
+  ENDIF(NOT OMNIORB_ROOT_USER)
+ENDIF(OMNIORB_STATUS)
+
+# ------
+
+IF(OMNIORB_STATUS)
+  SET(OMNIIDL_EXECUTABLE_TO_FIND omniidl)
+  IF(OMNIORB_ROOT_USER)
+    FIND_PROGRAM(OMNIIDL_EXECUTABLE ${OMNIIDL_EXECUTABLE_TO_FIND} PATHS ${OMNIORB_ROOT_USER}/bin)
+  ELSE(OMNIORB_ROOT_USER)
+    FIND_PROGRAM(OMNIIDL_EXECUTABLE ${OMNIIDL_EXECUTABLE_TO_FIND})
+  ENDIF(OMNIORB_ROOT_USER)
+  IF(OMNIIDL_EXECUTABLE)
+    MESSAGE(STATUS "${OMNIIDL_EXECUTABLE_TO_FIND} found: ${OMNIIDL_EXECUTABLE}")
+    IF(OMNIORB_EXECUTABLE STREQUAL /usr/bin/${OMNIIDL_EXECUTABLE_TO_FIND})
+    ELSE(OMNIORB_EXECUTABLE STREQUAL /usr/bin/${OMNIIDL_EXECUTABLE_TO_FIND})
+      SET(OMNIORB_ROOT_USER ${OMNIIDL_EXECUTABLE})
+      GET_FILENAME_COMPONENT(OMNIORB_ROOT_USER ${OMNIORB_ROOT_USER} PATH)
+      IF(WINDOWS)
+       GET_FILENAME_COMPONENT(OMNIORB_ROOT_USER ${OMNIORB_ROOT_USER} PATH)
+      ENDIF(WINDOWS)
+      GET_FILENAME_COMPONENT(OMNIORB_ROOT_USER ${OMNIORB_ROOT_USER} PATH)
+    ENDIF(OMNIORB_EXECUTABLE STREQUAL /usr/bin/${OMNIIDL_EXECUTABLE_TO_FIND})
+  ELSE(OMNIIDL_EXECUTABLE)
+    MESSAGE(STATUS "${OMNIIDL_EXECUTABLE_TO_FIND} not found, try to use WITH_OMNIORB option or OMNIORBHOME environment variable")
+    SET(OMNIORB_STATUS 0)
+  ENDIF(OMNIIDL_EXECUTABLE)
+ENDIF(OMNIORB_STATUS)
+
+# ------
+
+IF(OMNIORB_STATUS)
+  IF(OMNIORB_ROOT_USER)
+    SET(OMNIORB_FIND_PATHS_OPTION NO_DEFAULT_PATH)
+  ELSE(OMNIORB_ROOT_USER)
+    SET(OMNIORB_FIND_PATHS_OPTION)
+  ENDIF(OMNIORB_ROOT_USER)
+ENDIF(OMNIORB_STATUS)
+
+# ------
+
+IF(OMNIORB_STATUS)
+  SET(OMNIORB_INCLUDES)
+ENDIF(OMNIORB_STATUS)
+IF(OMNIORB_STATUS)
+  IF(OMNIORB_ROOT_USER)
+    SET(OMNIORB_INCLUDE_PATHS ${OMNIORB_ROOT_USER}/include)
+  ELSE(OMNIORB_ROOT_USER)
+    SET(OMNIORB_INCLUDE_PATHS)
+  ENDIF(OMNIORB_ROOT_USER)
+  SET(OMNIORB_INCLUDE_TO_FIND omniORB4/CORBA.h)
+  FIND_PATH(OMNIORB_INCLUDE_DIR1 ${OMNIORB_INCLUDE_TO_FIND} PATHS ${OMNIORB_INCLUDE_PATHS} ${OMNIORB_FIND_PATHS_OPTION})
+  IF(OMNIORB_INCLUDE_DIR1)
+    SET(OMNIORB_INCLUDES ${OMNIORB_INCLUDES} -I${OMNIORB_INCLUDE_DIR1})
+    MESSAGE(STATUS "${OMNIORB_INCLUDE_TO_FIND} found in ${OMNIORB_INCLUDE_DIR1}")
+  ELSE(OMNIORB_INCLUDE_DIR1)
+    SET(OMNIORB_STATUS 0)
+    IF(OMNIORB_ROOT_USER)
+      MESSAGE(STATUS "${OMNIORB_INCLUDE_TO_FIND} not found in ${OMNIORB_INCLUDE_PATHS}, check your OMNIORB installation.")
+    ELSE(OMNIORB_ROOT_USER)
+      MESSAGE(STATUS "${OMNIORB_INCLUDE_TO_FIND} not found on system, try to use WITH_OMNIORB option or OMNIORB_ROOT environment variable.")
+    ENDIF(OMNIORB_ROOT_USER)
+  ENDIF(OMNIORB_INCLUDE_DIR1)
+ENDIF(OMNIORB_STATUS)
+IF(OMNIORB_STATUS)
+  IF(OMNIORB_ROOT_USER)
+    SET(OMNIORB_INCLUDE_PATHS ${OMNIORB_ROOT_USER}/include/omniORB4)
+  ELSE(OMNIORB_ROOT_USER)
+    SET(OMNIORB_INCLUDE_PATHS /usr/include/omniORB4)
+  ENDIF(OMNIORB_ROOT_USER)
+  SET(OMNIORB_INCLUDE_TO_FIND CORBA.h)
+  FIND_PATH(OMNIORB_INCLUDE_DIR2 ${OMNIORB_INCLUDE_TO_FIND} PATHS ${OMNIORB_INCLUDE_PATHS} ${OMNIORB_FIND_PATHS_OPTION})
+  IF(OMNIORB_INCLUDE_DIR2)
+    SET(OMNIORB_INCLUDES ${OMNIORB_INCLUDES} -I${OMNIORB_INCLUDE_DIR2})
+    MESSAGE(STATUS "${OMNIORB_INCLUDE_TO_FIND} found in ${OMNIORB_INCLUDE_DIR2}")
+  ELSE(OMNIORB_INCLUDE_DIR2)
+    SET(OMNIORB_STATUS 0)
+    MESSAGE(STATUS "${OMNIORB_INCLUDE_TO_FIND} not found in ${OMNIORB_INCLUDE_PATHS}, check your OMNIORB installation.")
+  ENDIF(OMNIORB_INCLUDE_DIR2)
+ENDIF(OMNIORB_STATUS)
+
+# ------
+
+IF(OMNIORB_STATUS)
+  SET(OMNIORB_CXXFLAGS)
+  # SET(OMNIORB_CXXFLAGS ${OMNIORB_CXXFLAGS} -DOMNIORB_VERSION=4)
+  SET(OMNIORB_CXXFLAGS ${OMNIORB_CXXFLAGS} -D__x86__)
+  SET(OMNIORB_CXXFLAGS ${OMNIORB_CXXFLAGS} -DCOMP_CORBA_DOUBLE)
+  SET(OMNIORB_CXXFLAGS ${OMNIORB_CXXFLAGS} -DCOMP_CORBA_LONG)
+  IF(WINDOWS)
+    SET(OMNIORB_CXXFLAGS ${OMNIORB_CXXFLAGS} -D__WIN32__)
+    #    #  #  # SET(OMNIORB_CXXFLAGS ${OMNIORB_CXXFLAGS} -D_WIN32_WINNT=0x0400)
+    #    SET(OMNIORB_CXXFLAGS ${OMNIORB_CXXFLAGS} -D__NT__)
+    #    SET(OMNIORB_CXXFLAGS ${OMNIORB_CXXFLAGS} -D__OSVERSION__=4)
+    #  ELSE(WINDOWS)
+    #    SET(OMNIORB_CXXFLAGS ${OMNIORB_CXXFLAGS} -D__linux__)
+  ENDIF(WINDOWS)
+  #  IF(WINDOWS)
+  #    SET(OMNIORB_LIBS ws2_32.lib mswsock.lib advapi32.lib ${OMNIORB_LIBS})
+  #  ENDIF(WINDOWS)
+ENDIF(OMNIORB_STATUS)
 
 # ----
 
-SET(OMNIORB_CXXFLAGS)
-SET(OMNIORB_CXXFLAGS ${OMNIORB_CXXFLAGS} -DOMNIORB_VERSION=4)
-SET(OMNIORB_CXXFLAGS ${OMNIORB_CXXFLAGS} -D__x86__)
-
-IF(WINDOWS)
-  SET(OMNIORB_CXXFLAGS ${OMNIORB_CXXFLAGS} -D__WIN32__)
-  #  #  # SET(OMNIORB_CXXFLAGS ${OMNIORB_CXXFLAGS} -D_WIN32_WINNT=0x0400)
-  SET(OMNIORB_CXXFLAGS ${OMNIORB_CXXFLAGS} -D__NT__)
-  SET(OMNIORB_CXXFLAGS ${OMNIORB_CXXFLAGS} -D__OSVERSION__=4)
-ELSE(WINDOWS)
-  SET(OMNIORB_CXXFLAGS ${OMNIORB_CXXFLAGS} -D__linux__)
-ENDIF(WINDOWS)
-
-SET(CORBA_CXXFLAGS ${OMNIORB_CXXFLAGS})
-
-# ----
-
-IF(WINDOWS)
-  FIND_LIBRARY(lib_omniORB4       omniORB4_rtd        ${OMNIORB_ROOT}/lib/x86_win32)
-  FIND_LIBRARY(lib_omniDynamic4   omniDynamic4_rtd    ${OMNIORB_ROOT}/lib/x86_win32)
-  FIND_LIBRARY(lib_COS4           COS4_rtd            ${OMNIORB_ROOT}/lib/x86_win32)
-  FIND_LIBRARY(lib_COSDynamic4    COSDynamic4_rtd     ${OMNIORB_ROOT}/lib/x86_win32)
-  FIND_LIBRARY(lib_omnithread     omnithread_rtd      ${OMNIORB_ROOT}/lib/x86_win32)
-ELSE(WINDOWS)
-  FIND_LIBRARY(lib_omniORB4       omniORB4           ${OMNIORB_ROOT}/lib)
-  FIND_LIBRARY(lib_omniDynamic4   omniDynamic4       ${OMNIORB_ROOT}/lib)
-  FIND_LIBRARY(lib_COS4           COS4               ${OMNIORB_ROOT}/lib)
-  FIND_LIBRARY(lib_COSDynamic4    COSDynamic4        ${OMNIORB_ROOT}/lib)
-  FIND_LIBRARY(lib_omnithread     omnithread         ${OMNIORB_ROOT}/lib)
-ENDIF(WINDOWS)
-
-SET(OMNIORB_LIBS ${lib_omniORB4} ${lib_omniDynamic4} ${lib_COS4} ${lib_COSDynamic4} ${lib_omnithread})
-IF(WINDOWS)
-  SET(OMNIORB_LIBS ws2_32.lib mswsock.lib advapi32.lib ${OMNIORB_LIBS})
-ENDIF(WINDOWS)
-
-SET(CORBA_LIBS ${OMNIORB_LIBS})
+IF(OMNIORB_STATUS)
+  IF(OMNIORB_ROOT_USER)
+    IF(WINDOWS)
+      SET(OMNIORB_LIB_PATHS ${OMNIORB_ROOT_USER}/lib/x86_win32)
+    ELSE(WINDOWS)
+      SET(OMNIORB_LIB_PATHS ${OMNIORB_ROOT_USER}/lib)
+    ENDIF(WINDOWS)
+  ELSE(OMNIORB_ROOT_USER)
+    SET(OMNIORB_LIB_PATHS)
+  ENDIF(OMNIORB_ROOT_USER)
+ENDIF(OMNIORB_STATUS)
+
+IF(OMNIORB_STATUS)
+  IF(WINDOWS)
+    IF(CMAKE_BUILD_TYPE STREQUAL Release)
+      SET(OMNIORB_LIB_SUFFIX _rt)
+    ELSE(CMAKE_BUILD_TYPE STREQUAL Release)
+      SET(OMNIORB_LIB_SUFFIX _rtd)
+    ENDIF(CMAKE_BUILD_TYPE STREQUAL Release)
+  ELSE(WINDOWS)
+    SET(OMNIORB_LIB_SUFFIX)
+  ENDIF(WINDOWS)
+ENDIF(OMNIORB_STATUS)
+
+SET(OMNIORB_LIBS)
+FOREACH(lib omniORB4 omniDynamic4 COS4 COSDynamic4 omnithread)
+  IF(OMNIORB_STATUS)
+    FIND_LIBRARY(${lib}${OMNIORB_LIB_SUFFIX} ${lib}${OMNIORB_LIB_SUFFIX} PATHS ${OMNIORB_LIB_PATHS} ${OMNIORB_FIND_PATHS_OPTION})
+    IF(${lib}${OMNIORB_LIB_SUFFIX})
+      SET(OMNIORB_LIBS ${OMNIORB_LIBS} ${${lib}${OMNIORB_LIB_SUFFIX}})
+      MESSAGE(STATUS "${lib}${OMNIORB_LIB_SUFFIX} lib found: ${${lib}${OMNIORB_LIB_SUFFIX}}")
+    ELSE(${lib}${OMNIORB_LIB_SUFFIX})
+      SET(OMNIORB_STATUS 0)
+      IF(OMNIORB_ROOT_USER)
+       MESSAGE(STATUS "${lib}${OMNIORB_LIB_SUFFIX} lib not found in ${OMNIORB_LIB_PATHS}, check your OMNIORB installation.")
+      ELSE(OMNIORB_ROOT_USER)
+       MESSAGE(STATUS "${lib}${OMNIORB_LIB_SUFFIX} lib not found on system, try to use WITH_OMNIORB option or OMNIORB_ROOT environment variable.")
+      ENDIF(OMNIORB_ROOT_USER)
+    ENDIF(${lib}${OMNIORB_LIB_SUFFIX})
+  ENDIF(OMNIORB_STATUS)
+ENDFOREACH(lib omniORB4 omniDynamic4 COS4 COSDynamic4 omnithread)
 
 # ----------------
 
-SET(OMNIORB_IDL_PYTHON $ENV{OMNIIDL_PYTHON})
-IF(NOT OMNIORB_IDL_PYTHON)
-  SET(OMNIORB_IDL_PYTHON ${OMNIORB_IDL})
-ENDIF(NOT OMNIORB_IDL_PYTHON)
+IF(OMNIORB_STATUS)
+  SET(OMNIORB_IDL_PYTHON $ENV{OMNIIDL_PYTHON})
+  IF(NOT OMNIORB_IDL_PYTHON)
+    SET(OMNIORB_IDL_PYTHON ${OMNIIDL_EXECUTABLE})
+  ENDIF(NOT OMNIORB_IDL_PYTHON)
+ENDIF(OMNIORB_STATUS)
 
-# ----------------
+# ----
 
-SET(IDL_CLN_H .hh)
-SET(IDL_SRV_H .hh)
+IF(OMNIORB_STATUS)
+  SET(CORBA_GEN 1)
+  SET(OMNIORB_IDL ${OMNIIDL_EXECUTABLE})
+  SET(CORBA_INCLUDES ${OMNIORB_INCLUDES})
+  SET(CORBA_CXXFLAGS ${OMNIORB_CXXFLAGS})
+  SET(CORBA_LIBS ${OMNIORB_LIBS})
+  SET(OMNIORB_IDLCXXFLAGS -Wba -nf)
+  SET(OMNIORB_IDLPYFLAGS -bpython)
+  SET(IDLCXXFLAGS ${OMNIORB_IDLCXXFLAGS})
+  SET(IDLPYFLAGS ${OMNIORB_IDLPYFLAGS})
+  SET(IDL_CLN_H .hh)
+  SET(IDL_SRV_H .hh)
+ELSE(OMNIORB_STATUS)
+  SET(CORBA_GEN 0)
+  IF(OMNIORB_IS_MANDATORY)
+    MESSAGE(FATAL_ERROR "omniorb not found ... mandatory ... abort")
+  ELSE(OMNIORB_IS_MANDATORY)
+    MESSAGE(STATUS "omniorb not found ... optional ... disabled")
+  ENDIF(OMNIORB_IS_MANDATORY)
+ENDIF(OMNIORB_STATUS)
 
-# SET(OMNIORB_IDLCXXFLAGS -Wba -nf)
-# SET(OMNIORB_IDLPYFLAGS -bpython)
-SET(IDLCXXFLAGS -Wba -nf)
-SET(IDLPYFLAGS -bpython)
+# ----
index 068623d19f7c70fc2c0162304fcde180ebecc949..a753fb63ad0c21d30811171e21cc9e9812cda730 100644 (file)
@@ -19,6 +19,7 @@
 #
 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
+
 MARK_AS_ADVANCED(ISSUE)
 FIND_FILE(ISSUE issue /etc)
 IF(ISSUE)
@@ -29,21 +30,57 @@ ENDIF(ISSUE)
 
 IF(WINDOWS)
   SET(MACHINE WINDOWS)
-  SET(PLATFORM_CPPFLAGS)
-  SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -DWNT)
-  SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -DPPRO_NT)
-  SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} /W0)
-  #  #  SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -DWNT -D_CRT_SECURE_NO_WARNINGS)
-  #  #  SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -D_WIN32_WINNT=0x0500)
-  #  SET(RM del)
 ELSE(WINDOWS)
   SET(MACHINE PCLINUX)
-  SET(PLATFORM_CPPFLAGS)
-  #  SET(RM /bin/rm)
 ENDIF(WINDOWS)
 
-## SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -D_DEBUG_)
+SET(CMAKE_INSTALL_PREFIX_ENV $ENV{CMAKE_INSTALL_PREFIX})
+IF(CMAKE_INSTALL_PREFIX_ENV)
+  SET(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX_ENV} CACHE PATH "installation prefix" FORCE)
+ENDIF(CMAKE_INSTALL_PREFIX_ENV)
+
+IF(NOT CMAKE_BUILD_TYPE)
+  SET(CMAKE_BUILD_TYPE $ENV{CMAKE_BUILD_TYPE})
+ENDIF(NOT CMAKE_BUILD_TYPE)
+
+IF(CMAKE_BUILD_TYPE)
+  IF(WINDOWS)
+    MARK_AS_ADVANCED(CLEAR CMAKE_CONFIGURATION_TYPES)
+    SET(CMAKE_CONFIGURATION_TYPES ${CMAKE_BUILD_TYPE} CACHE STRING "compilation types" FORCE)
+  ELSE(WINDOWS)
+    IF(CMAKE_BUILD_TYPE STREQUAL Release)
+      SET(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG")
+      SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
+    ENDIF(CMAKE_BUILD_TYPE STREQUAL Release)
+  ENDIF(WINDOWS)
+ENDIF(CMAKE_BUILD_TYPE)
+
+SET(PLATFORM_CPPFLAGS)
+SET(PLATFORM_LDFLAGS)
+SET(PLATFORM_LIBADD)
+IF(WINDOWS)
+  SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} /W0)
+  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_LIBADD ${PLATFORM_LIBADD} Ws2_32.lib)
+  SET(PLATFORM_LIBADD ${PLATFORM_LIBADD} Userenv.lib) # At least for GEOM suit
+ELSE(WINDOWS)
+  SET(PLATFORM_LIBADD ${PLATFORM_LIBADD} -ldl)
+ENDIF(WINDOWS)
+
+#  SET(PLATFORM_CPPFLAGS)
+#  #  #  SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -DWNT -D_CRT_SECURE_NO_WARNINGS)
+#  #  #  SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -D_WIN32_WINNT=0x0500)
+#  #  SET(RM del)
+#ELSE(WINDOWS)
+#  #  SET(RM /bin/rm)
+#ENDIF(WINDOWS)
+
+### SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -D_DEBUG_)
+
+##SET(RCP rcp)
+##SET(RSH rsh)
+##SET(RCP rcp)
 
-#SET(RCP rcp)
-#SET(RSH rsh)
-#SET(RCP rcp)
+## MESSAGE(FATAL_ERROR "ZZZZZZZ")
index 0fe504c3fa2600f3d2d7f06ca4da2f6ff3bcd309..68e180a0dc5f471fc1b87c2dd31185ec956e57d4 100644 (file)
 #
 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
-SET(PTHREADS_ROOT $ENV{PTHREADS_ROOT})
-IF(PTHREADS_ROOT)
-  FIND_PATH(PTHREADS_INCLUDE_DIR pthread.h ${PTHREADS_ROOT}/include)
+# ------
+
+MESSAGE(STATUS "Check for pthreads ...")
+
+# ------
+
+IF(PTHREADS_IS_MANDATORY STREQUAL 0)
+  SET(PTHREADS_IS_MANDATORY 0)
+  SET(PTHREADS_IS_OPTIONAL 1)
+ENDIF(PTHREADS_IS_MANDATORY STREQUAL 0)
+IF(PTHREADS_IS_OPTIONAL STREQUAL 0)
+  SET(PTHREADS_IS_MANDATORY 1)
+  SET(PTHREADS_IS_OPTIONAL 0)
+ENDIF(PTHREADS_IS_OPTIONAL STREQUAL 0)
+IF(NOT PTHREADS_IS_MANDATORY AND NOT PTHREADS_IS_OPTIONAL)
+  SET(PTHREADS_IS_MANDATORY 1)
+  SET(PTHREADS_IS_OPTIONAL 0)
+ENDIF(NOT PTHREADS_IS_MANDATORY AND NOT PTHREADS_IS_OPTIONAL)
+
+# ------
+
+SET(PTHREADS_STATUS 1)
+IF(WITHOUT_PTHREADS OR WITH_PTHREADS STREQUAL 0)
+  SET(PTHREADS_STATUS 0)
+  MESSAGE(STATUS "pthreads disabled from command line.")
+ENDIF(WITHOUT_PTHREADS OR WITH_PTHREADS STREQUAL 0)
+
+# ------
+
+IF(PTHREADS_STATUS)
+  IF(WITH_PTHREADS)
+    SET(PTHREADS_ROOT_USER ${WITH_PTHREADS})
+  ELSE(WITH_PTHREADS)
+    SET(PTHREADS_ROOT_USER $ENV{PTHREADS_ROOT})
+  ENDIF(WITH_PTHREADS)
+ENDIF(PTHREADS_STATUS)
+
+# -----
+
+IF(PTHREADS_STATUS)
+  IF(PTHREADS_ROOT_USER)
+    SET(PTHREADS_FIND_PATHS_OPTION NO_DEFAULT_PATH)
+  ELSE(PTHREADS_ROOT_USER)
+    SET(PTHREADS_FIND_PATHS_OPTION)
+  ENDIF(PTHREADS_ROOT_USER)
+ENDIF(PTHREADS_STATUS)
+
+# -----
+
+IF(PTHREADS_STATUS)
+  IF(PTHREADS_ROOT_USER)
+    SET(PTHREADS_INCLUDE_PATHS ${PTHREADS_ROOT_USER}/include)
+  ELSE(PTHREADS_ROOT_USER)
+    SET(PTHREADS_INCLUDE_PATHS)
+  ENDIF(PTHREADS_ROOT_USER)
+  SET(PTHREADS_INCLUDE_TO_FIND pthread.h)
+  FIND_PATH(PTHREADS_INCLUDE_DIR ${PTHREADS_INCLUDE_TO_FIND} PATHS ${PTHREADS_INCLUDE_PATHS} ${PTHREADS_FIND_PATHS_OPTION})
   IF(PTHREADS_INCLUDE_DIR)
-    SET(PTHREADS_INCLUDES -I${PTHREADS_INCLUDE_DIR})
+    IF(PTHREADS_ROOT_USER)
+      SET(PTHREAD_CFLAGS -I${PTHREADS_INCLUDE_DIR})
+    ENDIF(PTHREADS_ROOT_USER)
+    MESSAGE(STATUS "${PTHREADS_INCLUDE_TO_FIND} found in ${PTHREADS_INCLUDE_DIR}")
+  ELSE(PTHREADS_INCLUDE_DIR)
+    SET(PTHREADS_STATUS 0)
+    IF(PTHREADS_ROOT_USER)
+      MESSAGE(STATUS "${PTHREADS_INCLUDE_TO_FIND} not found in ${PTHREADS_INCLUDE_PATHS}, check your PTHREADS installation.")
+    ELSE(PTHREADS_ROOT_USER)
+      MESSAGE(STATUS "${PTHREADS_INCLUDE_TO_FIND} not found on system, try to use WITH_PTHREADS option or PTHREADS_ROOT environment variable.")
+    ENDIF(PTHREADS_ROOT_USER)
   ENDIF(PTHREADS_INCLUDE_DIR)
-  FIND_LIBRARY(PTHREADS_LIBRARY pthreadVSE2d ${PTHREADS_ROOT}/lib)
-ENDIF(PTHREADS_ROOT)
+ENDIF(PTHREADS_STATUS)
+
+# ----
+
+IF(PTHREADS_STATUS)
+  IF(PTHREADS_ROOT_USER)
+    SET(PTHREADS_LIB_PATHS ${PTHREADS_ROOT_USER}/lib)
+  ELSE(PTHREADS_ROOT_USER)
+    SET(PTHREADS_LIB_PATHS)
+  ENDIF(PTHREADS_ROOT_USER)
+ENDIF(PTHREADS_STATUS)
+
+IF(PTHREADS_STATUS)
+  IF(WINDOWS)
+    IF(CMAKE_BUILD_TYPE STREQUAL Release)
+      FIND_LIBRARY(PTHREAD_LIB pthreadVSE2 pthreadVC2 PATHS ${PTHREADS_LIB_PATHS} ${PTHREADS_FIND_PATHS_OPTION})
+    ELSE(CMAKE_BUILD_TYPE STREQUAL Release)
+      FIND_LIBRARY(PTHREAD_LIB pthreadVSE2d pthreadVC2d PATHS ${PTHREADS_LIB_PATHS} ${PTHREADS_FIND_PATHS_OPTION})
+    ENDIF(CMAKE_BUILD_TYPE STREQUAL Release)
+  ELSE(WINDOWS)
+    FIND_LIBRARY(PTHREAD_LIB pthread PATHS ${PTHREADS_LIB_PATHS} ${PTHREADS_FIND_PATHS_OPTION})
+  ENDIF(WINDOWS)
+  SET(PTHREAD_LIBS)
+  IF(PTHREAD_LIB)
+    SET(PTHREAD_LIBS ${PTHREAD_LIBS} ${PTHREAD_LIB})
+    MESSAGE(STATUS "pthread lib found: ${PTHREAD_LIB}")
+  ELSE(PTHREAD_LIB)
+    SET(PTHREADS_STATUS 0)
+    IF(PTHREADS_ROOT_USER)
+      MESSAGE(STATUS "pthread lib not found in ${PTHREADS_LIB_PATHS}, check your PTHREADS installation.")
+    ELSE(PTHREADS_ROOT_USER)
+      MESSAGE(STATUS "pthread lib not found on system, try to use WITH_PTHREADS option or PTHREADS_ROOT environment variable.")
+    ENDIF(PTHREADS_ROOT_USER)
+  ENDIF(PTHREAD_LIB)
+ENDIF(PTHREADS_STATUS)
+
+# ----
+
+IF(PTHREADS_STATUS)
+ELSE(PTHREADS_STATUS)
+  IF(PTHREADS_IS_MANDATORY)
+    MESSAGE(FATAL_ERROR "pthreads not found ... mandatory ... abort")
+  ELSE(PTHREADS_IS_MANDATORY)
+    MESSAGE(STATUS "pthreads not found ... optional ... disabled")
+  ENDIF(PTHREADS_IS_MANDATORY)
+ENDIF(PTHREADS_STATUS)
index 4b84d7c58db65f88d500b219004fcc33fb1708a2..a03b563a4d731fcefac56d691fdacf8c74568d92 100644 (file)
 #
 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
-IF(WINDOWS)
-  FIND_PROGRAM(PYTHON_EXECUTABLE python_d)
-ELSE(WINDOWS)
-  FIND_PROGRAM(PYTHON_EXECUTABLE python)
-ENDIF(WINDOWS)
-
-EXECUTE_PROCESS(
-  COMMAND ${PYTHON_EXECUTABLE} -c "import sys; sys.stdout.write(sys.version[:3])"
-  OUTPUT_VARIABLE PYTHON_VERSION
-  )
-
-SET(PYTHON_ROOT ${PYTHON_EXECUTABLE})
-GET_FILENAME_COMPONENT(PYTHON_ROOT ${PYTHON_ROOT} PATH)
-GET_FILENAME_COMPONENT(PYTHON_ROOT ${PYTHON_ROOT} PATH)
-
-FIND_PATH(PYTHON_INCLUDE_PATH Python.h PATHS ${PYTHON_ROOT}/include ${PYTHON_ROOT}/include/python${PYTHON_VERSION})
-
-IF(WINDOWS)
-  STRING(REPLACE "." "" PYTHON_VERSION_WITHOUT_DOT ${PYTHON_VERSION})
-  FIND_LIBRARY(PYTHON_LIBRARIES python${PYTHON_VERSION_WITHOUT_DOT}_d ${PYTHON_ROOT}/libs)
-ELSE(WINDOWS)
-  FIND_LIBRARY(PYTHON_LIBRARIES python${PYTHON_VERSION} ${PYTHON_ROOT}/lib)
-ENDIF(WINDOWS)
-
-SET(PYTHON_INCLUDES -I${PYTHON_INCLUDE_PATH})
-SET(PYTHON_LIBS ${PYTHON_LIBRARIES})
-
-IF(WINDOWS)
-  SET(PYTHON_INCLUDES ${PYTHON_INCLUDES} -DHAVE_DEBUG_PYTHON)
-ENDIF(WINDOWS)
+# ------
+
+MESSAGE(STATUS "Check for python ...")
+
+# ------
+
+IF(PYTHON_IS_MANDATORY STREQUAL 0)
+  SET(PYTHON_IS_MANDATORY 0)
+  SET(PYTHON_IS_OPTIONAL 1)
+ENDIF(PYTHON_IS_MANDATORY STREQUAL 0)
+IF(PYTHON_IS_OPTIONAL STREQUAL 0)
+  SET(PYTHON_IS_MANDATORY 1)
+  SET(PYTHON_IS_OPTIONAL 0)
+ENDIF(PYTHON_IS_OPTIONAL STREQUAL 0)
+IF(NOT PYTHON_IS_MANDATORY AND NOT PYTHON_IS_OPTIONAL)
+  SET(PYTHON_IS_MANDATORY 1)
+  SET(PYTHON_IS_OPTIONAL 0)
+ENDIF(NOT PYTHON_IS_MANDATORY AND NOT PYTHON_IS_OPTIONAL)
+
+# ------
+
+SET(PYTHON_STATUS 1)
+IF(WITHOUT_PYTHON OR WITH_PYTHON STREQUAL 0)
+  SET(PYTHON_STATUS 0)
+  MESSAGE(STATUS "python disabled from command line.")
+ENDIF(WITHOUT_PYTHON OR WITH_PYTHON STREQUAL 0)
+
+# ------
+
+IF(PYTHON_STATUS)
+  IF(WITH_PYTHON)
+    SET(PYTHON_ROOT_USER ${WITH_PYTHON})
+  ENDIF(WITH_PYTHON)
+  IF(NOT PYTHON_ROOT_USER)
+    SET(PYTHON_ROOT_USER $ENV{PYTHON_ROOT})
+  ENDIF(NOT PYTHON_ROOT_USER)
+  IF(NOT PYTHON_ROOT_USER)
+    SET(PYTHON_ROOT_USER $ENV{PYTHONHOME})
+  ENDIF(NOT PYTHON_ROOT_USER)
+ENDIF(PYTHON_STATUS)
+
+# ------
+
+IF(PYTHON_STATUS)
+  IF(PYTHON_ROOT_USER)
+    SET(PYTHON_FIND_PATHS_OPTION NO_DEFAULT_PATH)
+  ELSE(PYTHON_ROOT_USER)
+    SET(PYTHON_FIND_PATHS_OPTION)
+  ENDIF(PYTHON_ROOT_USER)
+ENDIF(PYTHON_STATUS)
+
+# ------
+
+IF(PYTHON_STATUS)
+  IF(WINDOWS)
+    IF(CMAKE_BUILD_TYPE STREQUAL Release)
+      SET(PYTHON_EXECUTABLE_TO_FIND python)
+    ELSE(CMAKE_BUILD_TYPE STREQUAL Release)
+      SET(PYTHON_EXECUTABLE_TO_FIND python_d)
+    ENDIF(CMAKE_BUILD_TYPE STREQUAL Release)
+  ELSE(WINDOWS)
+    SET(PYTHON_EXECUTABLE_TO_FIND python)
+  ENDIF(WINDOWS)
+  IF(NOT PYTHON_ROOT_USER)
+    SET(PYTHON_EXECUTABLE_PATHS)
+  ELSE(NOT PYTHON_ROOT_USER)
+    IF(WINDOWS)
+      SET(PYTHON_EXECUTABLE_PATHS ${PYTHON_ROOT_USER})
+    ELSE(WINDOWS)
+      SET(PYTHON_EXECUTABLE_PATHS ${PYTHON_ROOT_USER}/bin)
+    ENDIF(WINDOWS)
+  ENDIF(NOT PYTHON_ROOT_USER)
+  FIND_PROGRAM(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE_TO_FIND} PATHS ${PYTHON_EXECUTABLE_PATHS} ${PYTHON_FIND_PATHS_OPTION})
+  IF(PYTHON_EXECUTABLE)
+    MESSAGE(STATUS "python found: ${PYTHON_EXECUTABLE}")
+    IF(PYTHON_EXECUTABLE STREQUAL /usr/bin/python)
+    ELSE(PYTHON_EXECUTABLE STREQUAL /usr/bin/python)
+      SET(PYTHON_ROOT_USER ${PYTHON_EXECUTABLE})
+      GET_FILENAME_COMPONENT(PYTHON_ROOT_USER ${PYTHON_ROOT_USER} PATH)
+      IF(NOT WINDOWS)
+       GET_FILENAME_COMPONENT(PYTHON_ROOT_USER ${PYTHON_ROOT_USER} PATH)
+      ENDIF(NOT WINDOWS)
+    ENDIF(PYTHON_EXECUTABLE STREQUAL /usr/bin/python)
+  ELSE(PYTHON_EXECUTABLE)
+    IF(PYTHON_ROOT_USER)
+      MESSAGE(STATUS "${PYTHON_EXECUTABLE_TO_FIND} not found in ${PYTHON_EXECUTABLE_PATHS}, check your PYTHON installation.")
+    ELSE(PYTHON_ROOT_USER)
+      MESSAGE(STATUS "${PYTHON_EXECUTABLE_TO_FIND} not found on system, try to use WITH_PYTHON option or PYTHON_ROOT environment variable.")
+    ENDIF(PYTHON_ROOT_USER)
+    SET(PYTHON_STATUS 0)
+  ENDIF(PYTHON_EXECUTABLE)
+ENDIF(PYTHON_STATUS)
+
+# ------
+
+IF(PYTHON_STATUS)
+  EXECUTE_PROCESS(
+    COMMAND ${PYTHON_EXECUTABLE} -c "import sys; sys.stdout.write(sys.version[:3])"
+    OUTPUT_VARIABLE PYTHON_VERSION
+    )
+ENDIF(PYTHON_STATUS)
+
+# ------
+
+IF(PYTHON_STATUS)
+  IF(PYTHON_ROOT_USER)
+    SET(PYTHON_FIND_PATHS_OPTION NO_DEFAULT_PATH)
+  ELSE(PYTHON_ROOT_USER)
+    SET(PYTHON_FIND_PATHS_OPTION)
+  ENDIF(PYTHON_ROOT_USER)
+ENDIF(PYTHON_STATUS)
+
+# ------
+
+IF(PYTHON_STATUS)
+  IF(PYTHON_ROOT_USER)
+    SET(PYTHON_INCLUDE_PATHS ${PYTHON_ROOT_USER}/include ${PYTHON_ROOT_USER}/include/python${PYTHON_VERSION})
+  ELSE(PYTHON_ROOT_USER)
+    SET(PYTHON_INCLUDE_PATHS /usr/include/python${PYTHON_VERSION})
+  ENDIF(PYTHON_ROOT_USER)
+  SET(PYTHON_INCLUDE_TO_FIND Python.h)
+  FIND_PATH(PYTHON_INCLUDE_DIR ${PYTHON_INCLUDE_TO_FIND} PATHS ${PYTHON_INCLUDE_PATHS} ${PYTHON_FIND_PATHS_OPTION})
+  IF(PYTHON_INCLUDE_DIR)
+    SET(PYTHON_INCLUDES -I${PYTHON_INCLUDE_DIR})
+    IF(WINDOWS)
+      IF(CMAKE_BUILD_TYPE STREQUAL Release)
+      ELSE(CMAKE_BUILD_TYPE STREQUAL Release)
+       SET(PYTHON_INCLUDES ${PYTHON_INCLUDES} -DHAVE_DEBUG_PYTHON)
+      ENDIF(CMAKE_BUILD_TYPE STREQUAL Release)
+    ENDIF(WINDOWS)
+    MESSAGE(STATUS "${PYTHON_INCLUDE_TO_FIND} found in ${PYTHON_INCLUDE_DIR}")
+  ELSE(PYTHON_INCLUDE_DIR)
+    SET(PYTHON_STATUS 0)
+    IF(PYTHON_ROOT_USER)
+      MESSAGE(STATUS "${PYTHON_INCLUDE_TO_FIND} not found in ${PYTHON_INCLUDE_PATHS}, check your PYTHON installation.")
+    ELSE(PYTHON_ROOT_USER)
+      MESSAGE(STATUS "${PYTHON_INCLUDE_TO_FIND} not found on system, try to use WITH_PYTHON option or PYTHON_ROOT environment variable.")
+    ENDIF(PYTHON_ROOT_USER)
+  ENDIF(PYTHON_INCLUDE_DIR)
+ENDIF(PYTHON_STATUS)
+
+# ----
+
+IF(PYTHON_STATUS)
+  IF(PYTHON_ROOT_USER)
+    IF(WINDOWS)
+      SET(PYTHON_LIB_PATHS ${PYTHON_ROOT_USER}/libs)
+    ELSE(WINDOWS)
+      SET(PYTHON_LIB_PATHS ${PYTHON_ROOT_USER}/lib ${PYTHON_ROOT_USER}/lib/python${PYTHON_VERSION}/config)
+    ENDIF(WINDOWS)
+  ELSE(PYTHON_ROOT_USER)
+    SET(PYTHON_LIB_PATHS)
+  ENDIF(PYTHON_ROOT_USER)
+  IF(WINDOWS)
+    STRING(REPLACE "." "" PYTHON_VERSION_WITHOUT_DOT ${PYTHON_VERSION})
+    IF(CMAKE_BUILD_TYPE STREQUAL Release)
+      FIND_LIBRARY(PYTHON_LIB python${PYTHON_VERSION_WITHOUT_DOT} PATHS ${PYTHON_LIB_PATHS} ${PYTHON_FIND_PATHS_OPTION})
+    ELSE(CMAKE_BUILD_TYPE STREQUAL Release)
+      FIND_LIBRARY(PYTHON_LIB python${PYTHON_VERSION_WITHOUT_DOT}_d PATHS ${PYTHON_LIB_PATHS} ${PYTHON_FIND_PATHS_OPTION})
+    ENDIF(CMAKE_BUILD_TYPE STREQUAL Release)
+  ELSE(WINDOWS)
+    FIND_LIBRARY(PYTHON_LIB python${PYTHON_VERSION} PATHS ${PYTHON_LIB_PATHS} ${PYTHON_FIND_PATHS_OPTION})
+  ENDIF(WINDOWS)
+  SET(PYTHON_LIBS)
+  IF(PYTHON_LIB)
+    SET(PYTHON_LIBS ${PYTHON_LIBS} ${PYTHON_LIB})
+    MESSAGE(STATUS "python lib found: ${PYTHON_LIB}")
+  ELSE(PYTHON_LIB)
+    SET(PYTHON_STATUS 0)
+    IF(PYTHON_ROOT_USER)
+      MESSAGE(STATUS "python lib not found in ${PYTHON_LIB_PATHS}, check your PYTHON installation.")
+    ELSE(PYTHON_ROOT_USER)
+      MESSAGE(STATUS "python lib not found on system, try to use WITH_PYTHON option or PYTHON_ROOT environment variable.")
+    ENDIF(PYTHON_ROOT_USER)
+  ENDIF(PYTHON_LIB)
+ENDIF(PYTHON_STATUS)
+
+# ----
+
+IF(PYTHON_STATUS)
+ELSE(PYTHON_STATUS)
+  IF(PYTHON_IS_MANDATORY)
+    MESSAGE(FATAL_ERROR "python not found ... mandatory ... abort")
+  ELSE(PYTHON_IS_MANDATORY)
+    MESSAGE(STATUS "python not found ... optional ... disabled")
+  ENDIF(PYTHON_IS_MANDATORY)
+ENDIF(PYTHON_STATUS)
index c6a9a4356184710fe1d71f9ee209253f1515e5b5..0545cfaa6eb1450dae0e7b61872f7573a2fcc080 100644 (file)
 #
 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
-FIND_PROGRAM(SWIG_EXECUTABLE swig)
-SET(SWIG_FLAGS -c++ -python -shadow)
+# ------
+
+MESSAGE(STATUS "Check for swig ...")
+
+# ------
+
+IF(SWIG_IS_MANDATORY STREQUAL 0)
+  SET(SWIG_IS_MANDATORY 0)
+  SET(SWIG_IS_OPTIONAL 1)
+ENDIF(SWIG_IS_MANDATORY STREQUAL 0)
+IF(SWIG_IS_OPTIONAL STREQUAL 0)
+  SET(SWIG_IS_MANDATORY 1)
+  SET(SWIG_IS_OPTIONAL 0)
+ENDIF(SWIG_IS_OPTIONAL STREQUAL 0)
+IF(NOT SWIG_IS_MANDATORY AND NOT SWIG_IS_OPTIONAL)
+  SET(SWIG_IS_MANDATORY 1)
+  SET(SWIG_IS_OPTIONAL 0)
+ENDIF(NOT SWIG_IS_MANDATORY AND NOT SWIG_IS_OPTIONAL)
+
+# ------
+
+SET(SWIG_STATUS 1)
+IF(WITHOUT_SWIG OR WITH_SWIG STREQUAL 0)
+  SET(SWIG_STATUS 0)
+  MESSAGE(STATUS "swig disabled from command line.")
+ENDIF(WITHOUT_SWIG OR WITH_SWIG STREQUAL 0)
+
+# ------
+
+IF(SWIG_STATUS)
+  IF(WITH_SWIG)
+    SET(SWIG_ROOT_USER ${WITH_SWIG})
+  ENDIF(WITH_SWIG)
+  IF(NOT SWIG_ROOT_USER)
+    SET(SWIG_ROOT_USER $ENV{SWIG_ROOT})
+  ENDIF(NOT SWIG_ROOT_USER)
+  IF(NOT SWIG_ROOT_USER)
+    SET(SWIG_ROOT_USER $ENV{SWIGHOME})
+  ENDIF(NOT SWIG_ROOT_USER)
+ENDIF(SWIG_STATUS)
+
+# ------
+
+IF(SWIG_STATUS)
+  SET(SWIG_EXECUTABLE_TO_FIND swig)
+  IF(SWIG_ROOT_USER)
+    FIND_PROGRAM(SWIG_EXECUTABLE ${SWIG_EXECUTABLE_TO_FIND} PATHS ${SWIG_ROOT_USER}/bin NO_DEFAULT_PATH)
+  ELSE(SWIG_ROOT_USER)
+    FIND_PROGRAM(SWIG_EXECUTABLE ${SWIG_EXECUTABLE_TO_FIND})
+  ENDIF(SWIG_ROOT_USER)
+  IF(SWIG_EXECUTABLE)
+    MESSAGE(STATUS "${SWIG_EXECUTABLE_TO_FIND} found: ${SWIG_EXECUTABLE}")
+  ELSE(SWIG_EXECUTABLE)
+    MESSAGE(STATUS "${SWIG_EXECUTABLE_TO_FIND} not found, try to use WITH_SWIG option or SWIG_ROOT (or SWIGHOME) environment variable")
+    SET(SWIG_STATUS 0)
+  ENDIF(SWIG_EXECUTABLE)
+ENDIF(SWIG_STATUS)
+
+# ----
+
+IF(SWIG_STATUS)
+  SET(SWIG_FLAGS -c++ -python -shadow)
+ELSE(SWIG_STATUS)
+  IF(SWIG_IS_MANDATORY)
+    MESSAGE(FATAL_ERROR "swig not found ... mandatory ... abort")
+  ELSE(SWIG_IS_MANDATORY)
+    MESSAGE(STATUS "swig not found ... optional ... disabled")
+  ENDIF(SWIG_IS_MANDATORY)
+ENDIF(SWIG_STATUS)
+
+# ----
index 6da6dc21338e6af09d54ba35abe824999c29000c..740e93a23ae7a8e66916cd9f390fb2e1da259f2b 100644 (file)
@@ -33,4 +33,5 @@ FindPLATFORM.cmake \
 FindPTHREADS.cmake \
 FindPYTHON.cmake \
 FindSWIG.cmake \
-install_python_from_idl.cmake
+install_python_from_idl.cmake \
+install_and_compile_python_file.cmake
index 39218dbd99694ba0fc0c838ff0edd5a835129b96..b0624ab0918a340083f03fb36f7be57fd0c1cf27 100644 (file)
@@ -124,16 +124,6 @@ class CMakeFile(object):
         # --
         content = p_multiline.sub(r' ', content)
         
-        # --
-        content = content.replace("-no-undefined -version-info=0:0:0", "")
-        content = content.replace("-include SALOMEconfig.h", "")
-
-        # --
-        # Compatibility medfile
-        # --
-        content = content.replace("-no-undefined -version-info 0:0:0", "")
-        content = content.replace("-no-undefined -version-info 2:5:1", "")
-        
         # --
         # Compatibility netgen plugin
         # --
@@ -312,10 +302,15 @@ class CMakeFile(object):
             "TransformationGUI",
             ]
         med_list = [
+            "InterpGeometric2DAlg",
+            "interpkernelbases",
             "interpkernel",
-            "InterpKernelTest",
-            "MEDMEMCppTest",
+            "MEDClientcmodule",
+            "medcoupling",
+            "MEDEngine",
+            "MEDMEMImpl",
             "medmem",
+            "MED",
             "med_V2_1",
             "MEDWrapperBase",
             "MEDWrapper",
@@ -347,10 +342,6 @@ class CMakeFile(object):
         full_list = cas_list + kernel_list + gui_list
         full_list += geom_list + med_list + smesh_list
         # --
-        full_list += [
-            "boost_thread",
-            ]
-        # --
         # E.A. : sort by len before substitution ...
         # Why ? Thing to "-lMEDWrapper" then "-lMEDWrapper_V2_1" substition
         # And you understand ...
@@ -400,15 +391,20 @@ class CMakeFile(object):
         self.finalize(newlines)
         
         # --
-        # Add a last CR at the end of the file
+        # Concatenate newlines into content
         # --
-        newlines.append('\n')
+        content = '\n'.join(newlines)
         
         # --
-        # Concatenate newlines into content
+        # Add a CR at end if necessary
         # --
-        content = '\n'.join(newlines)
-
+        lines = content.split('\n')
+        # lines = [ l.strip() for l in lines ]
+        if len(lines[-1]) != 0:
+            lines.append('')
+            pass
+        content = '\n'.join(lines)
+        
         # --
         self.content = content
         
@@ -419,7 +415,7 @@ class CMakeFile(object):
         if self.root == self.the_root:
             # --
             newlines.append("""
-            CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
+            CMAKE_MINIMUM_REQUIRED(VERSION 2.4.7 FATAL_ERROR)
             IF(COMMAND cmake_policy)
             cmake_policy(SET CMP0003 NEW)
             ENDIF(COMMAND cmake_policy)
@@ -497,6 +493,23 @@ class CMakeFile(object):
                         INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindNETGEN.cmake)
                         """)
                         pass
+                    if self.module == "blsurfplugin":
+                        newlines.append("""
+                        SET(GEOM_ROOT_DIR $ENV{GEOM_ROOT_DIR})
+                        SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR})
+                        SET(SMESH_ROOT_DIR $ENV{SMESH_ROOT_DIR})
+                        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)
+                        """)
+                        pass
+                    if self.module == "visu":
+                        newlines.append("""
+                        SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR})
+                        INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMED.cmake)
+                        """)
+                        pass
                     pass
                 pass
             # --
@@ -504,8 +517,8 @@ class CMakeFile(object):
                 newlines.append("""
                 SET(WITH_LOCAL 1)
                 SET(WITH_BATCH 1)
-                set(VERSION 4.1.3)
-                set(XVERSION 0x040103)
+                set(VERSION 5.1.2)
+                set(XVERSION 0x050102)
                 """)
             elif self.module == "gui":
                 newlines.append("""
@@ -518,6 +531,8 @@ class CMakeFile(object):
                 SET(ENABLE_PYCONSOLE ON)
                 SET(ENABLE_SUPERVGRAPHVIEWER ON)
                 # SET(ENABLE_QXGRAPHVIEWER ON)
+                set(VERSION 5.1.2)
+                set(XVERSION 0x050102)
                 """)
                 pass
             elif self.module == "geom":
@@ -552,10 +567,17 @@ class CMakeFile(object):
                 SET(NETGENPLUGIN_ENABLE_GUI ON)
                 """)
                 pass
+            elif self.module == "blsurfplugin":
+                newlines.append("""
+                SET(BLSURFPLUGIN_ENABLE_GUI ON)
+                """)
+                pass
             # --
             pass
         # --
         newlines.append("""
+        SET(VERSION_INFO 0.0.0)
+        SET(SOVERSION_INFO 0)
         SET(SUBDIRS)
         SET(AM_CPPFLAGS)
         SET(AM_CXXFLAGS)
@@ -600,7 +622,7 @@ class CMakeFile(object):
             return
         
         # --
-        # A particuliar case
+        # A particuliar case where there are two ":" on the same line
         # --
         if line.find('install-exec-local:') == 0:
             newlines.append("# " + line)
@@ -613,6 +635,25 @@ class CMakeFile(object):
             newlines.append("# " + line)
             return
         
+        # --
+        # --
+        key = "-version-info"
+        if line.find(key) >= 0:
+            # --
+            before = line.split(key)[0]
+            after = line[len(before)+len(key):]
+            sep = after[0]
+            after = after[1:]
+            version_info = after.split()[0]
+            line = line.replace(key+sep+version_info, "")
+            # --
+            version_info = version_info.replace(':', '.')
+            soversion_info = version_info.split('.')[0]
+            newlines.append("SET(VERSION_INFO " + version_info + ")")
+            newlines.append("SET(SOVERSION_INFO " + soversion_info + ")")
+            # --
+            pass
+        
         # --
         # Replace the $(TOTO) by ${TOTO}
         # Replace the @TOTO@  by ${TOTO}
@@ -736,6 +777,12 @@ class CMakeFile(object):
             if f[-3:] == ".in":
                 if f == "sstream.in":
                     continue
+                if f in ["runContainer.in", "stopContainer.in"]:
+                    if self.module == "med":
+                        if self.root[-3:] == "csh":
+                            continue
+                        pass
+                    pass
                 if f == "SALOMEconfig.ref.in":
                     out = "SALOMEconfig.h"
                 else:
@@ -997,14 +1044,6 @@ class CMakeFile(object):
         # --
         newlines.append(r'''
         IF(WINDOWS)
-        SET(libadd ${libadd} Userenv.lib Ws2_32.lib)
-        ELSE(WINDOWS)
-        SET(libadd ${libadd} -ldl -lpthread)
-        ENDIF(WINDOWS)
-        ''')
-        # --
-        newlines.append(r'''
-        IF(WINDOWS)
         SET(targets)
         SET(targets ${targets} MEFISTO2D)
         FOREACH(target ${targets})
@@ -1019,7 +1058,10 @@ class CMakeFile(object):
         ''')
         # --
         newlines.append(r'''
-        SET(libs ${${amname}_LIBADD} ${${amname}_LDADD} ${${amname}_LDFLAGS})
+        SET(libs ${PLATFORM_LIBADD} ${PLATFORM_LDFLAGS} ${${amname}_LIBADD} ${${amname}_LDADD} ${${amname}_LDFLAGS})
+        IF(name STREQUAL SALOMEBasics)
+        SET(libs ${libs} ${PTHREAD_LIBS})
+        ENDIF(name STREQUAL SALOMEBasics)
         ''')
         if key == "bin_PROGRAMS":
             newlines.append(r'''
@@ -1034,50 +1076,42 @@ class CMakeFile(object):
         GET_FILENAME_COMPONENT(lib ${lib} NAME_WE)
         STRING(REPLACE "lib" "" lib ${lib})
         ENDIF(ext STREQUAL .la)
+        SET(vars)
+        SET(vars ${vars} -no-undefined)
         IF(WINDOWS)
-        SET(vars -Xlinker -export-dynamic -module -Wl,-E)
-        SET(vars ${vars} -lutil -lm)
+        SET(vars ${vars} -module)
+        SET(vars ${vars} -Wl,-E)
+        SET(vars ${vars} -Xlinker)
+        SET(vars ${vars} -export-dynamic)
+        SET(vars ${vars} -lm)
+        SET(vars ${vars} -lboost_thread)
+        SET(vars ${vars} -lboost_signals)
+        SET(vars ${vars} -lvtkWidgets)
+        ENDIF(WINDOWS)
         FOREACH(v ${vars})
         IF(lib STREQUAL v)
         SET(lib)
         ENDIF(lib STREQUAL v)
         ENDFOREACH(v ${vars})
-        ENDIF(WINDOWS)
         SET(libadd ${libadd} ${lib})
         ENDFOREACH(lib ${libs})
-        TARGET_LINK_LIBRARIES(${name} ${PTHREADS_LIBRARY} ${libadd})
+        TARGET_LINK_LIBRARIES(${name} ${libadd})
         ''')
         # --
         newlines.append(r'''
         IF(WINDOWS)
         SET(targets)
-        SET(targets ${targets} SalomeHDFPersist)
-        SET(targets ${targets} medC)
-        SET(targets ${targets} medimport)
-        SET(targets ${targets} medimportcxx)
-        FOREACH(target ${targets})
-        IF(name STREQUAL ${target})
-        SET_TARGET_PROPERTIES(${name} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:LIBCMTD")
-        ENDIF(name STREQUAL ${target})
-        ENDFOREACH(target ${targets})
-        SET(targets)
         SET(targets ${targets} MEFISTO2D)
         FOREACH(target ${targets})
         IF(name STREQUAL ${target})
+        IF(CMAKE_BUILD_TYPE STREQUAL Debug)
         SET_TARGET_PROPERTIES(${name} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:MSVCRT")
+        ENDIF(CMAKE_BUILD_TYPE STREQUAL Debug)
         ENDIF(name STREQUAL ${target})
         ENDFOREACH(target ${targets})
         ENDIF(WINDOWS)
         ''')
         # --
-        if self.module == "med":
-            newlines.append(r'''
-            IF(WINDOWS)
-            SET_TARGET_PROPERTIES(${name} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:LIBCMTD")
-            ENDIF(WINDOWS)
-            ''')
-            pass
-        # --
         return
     
     def setCompilationFlags(self, key, newlines):
@@ -1087,6 +1121,7 @@ class CMakeFile(object):
         SET(targets)
         SET(targets ${targets} SalomeIDLKernel)
         SET(targets ${targets} SalomeDS)
+        SET(targets ${targets} SALOMEDSTest)
         SET(targets ${targets} SALOMEDS_Client_exe)
         SET(targets ${targets} SalomeIDLGEOM)
         SET(targets ${targets} GEOMEngine)
@@ -1115,12 +1150,6 @@ class CMakeFile(object):
         ENDIF(WINDOWS)
         ''')
         # --
-        newlines.append(r'''
-        IF(WINDOWS)
-        SET(var ${var} -D_USE_MATH_DEFINES)
-        ENDIF(WINDOWS)
-        ''')
-        # --
         if self.module in ["geom", "med"]:
             newlines.append(r'''
             SET(var ${var} -I${CMAKE_CURRENT_SOURCE_DIR})
@@ -1135,12 +1164,22 @@ class CMakeFile(object):
             pass
         newlines.append(r'''
        SET(var ${var} ${PLATFORM_CPPFLAGS})
-       SET(var ${var} ${PTHREADS_INCLUDES})
+       SET(var ${var} ${PTHREAD_CFLAGS})
        SET(var ${var} ${${amname}_CPPFLAGS})
        SET(var ${var} ${${amname}_CXXFLAGS})
        SET(var ${var} ${${amname}_CFLAGS})
+        SET(vars)
+        IF(WINDOWS)
+        SET(vars ${vars} -include SALOMEconfig.h)
+        SET(vars ${vars} -ftemplate-depth-32)
+        ENDIF(WINDOWS)
         SET(flags)
         FOREACH(f ${var})
+        FOREACH(v ${vars})
+        IF(f STREQUAL v)
+        SET(f)
+        ENDIF(f STREQUAL v)
+        ENDFOREACH(v ${vars})
         SET(flags "${flags} ${f}")
         ENDFOREACH(f ${var})
         SET_TARGET_PROPERTIES(${name} PROPERTIES COMPILE_FLAGS "${flags}")
@@ -1234,14 +1273,21 @@ class CMakeFile(object):
         ENDIF(ext STREQUAL .f)
         SET(srcs ${srcs} ${src})
         ENDFOREACH(src ${${amname}_SOURCES} ${dist_${amname}_SOURCES})
+        ''')
+        newlines.append(r'''
         SET(build_srcs)
-        FOREACH(f ${nodist_${amname}_SOURCES} ${BUILT_SOURCES})
+        ''')
+        newlines.append(r'''
+        SET(l ${nodist_${amname}_SOURCES} ${BUILT_SOURCES})
+        ''')
+        newlines.append(r'''
+        FOREACH(f ${l})
         GET_FILENAME_COMPONENT(ext ${f} EXT)
         IF(ext STREQUAL .py)
         ELSE(ext STREQUAL .py)
         SET(build_srcs ${build_srcs} ${CMAKE_CURRENT_BINARY_DIR}/${f})
         ENDIF(ext STREQUAL .py)
-        ENDFOREACH(f ${nodist_${amname}_SOURCES})
+        ENDFOREACH(f ${l})
         SET(srcs ${build_srcs} ${srcs})
         ''')
         # --
@@ -1256,139 +1302,7 @@ class CMakeFile(object):
         self.setCompilationFlags(key, newlines)
         # --
         newlines.append(r'''
-        SET_TARGET_PROPERTIES(${name} PROPERTIES VERSION 0.0.0 SOVERSION 0)
-        FOREACH(lib medC med)
-        IF(lib STREQUAL ${name})
-        SET_TARGET_PROPERTIES(${name} PROPERTIES VERSION 1.1.5 SOVERSION 1)
-        ENDIF(lib STREQUAL ${name})
-        ENDFOREACH(lib medC med)
-        ''')
-        # --
-        from os.path import basename
-        upper_name = basename(self.root).upper()
-        # --
-        if upper_name in ["2.1.X", "2.3.1"]:
-            upper_name = "D_" + upper_name
-            pass
-        # --
-        newlines.append(r'''
-        SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL %s_EXPORTS)
-        '''%(upper_name))
-        # --
-        newlines.append(r'''
-        IF(name STREQUAL SalomeLauncher)
-        SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL SALOME%s_EXPORTS)
-        ENDIF(name STREQUAL SalomeLauncher)
-        '''%(upper_name))
-        newlines.append(r'''
-        IF(name STREQUAL SalomeResourcesManager)
-        SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL SALOME%s_EXPORTS)
-        ENDIF(name STREQUAL SalomeResourcesManager)
-        '''%(upper_name))
-        newlines.append(r'''
-        IF(name STREQUAL GEOMObject)
-        SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL GEOM_%s_EXPORTS)
-        ENDIF(name STREQUAL GEOMObject)
-        '''%(upper_name))
-        newlines.append(r'''
-        IF(name STREQUAL medC)
-        SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL MEDC_DLL_EXPORTS)
-        ENDIF(name STREQUAL medC)
-        ''')
-        newlines.append(r'''
-        IF(name STREQUAL med)
-        SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL MED_DLL_EXPORTS)
-        ENDIF(name STREQUAL med)
-        ''')
-        newlines.append(r'''
-        IF(name STREQUAL medimport)
-        SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL MEDIMPORT_DLL_EXPORTS)
-        ENDIF(name STREQUAL medimport)
-        ''')
-        newlines.append(r'''
-        IF(name STREQUAL medimportcxx)
-        SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL MEDIMPORTCXX_DLL_EXPORTS)
-        ENDIF(name STREQUAL medimportcxx)
-        ''')
-        newlines.append(r'''
-        IF(name STREQUAL MEDWrapperBase)
-        SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL MEDWRAPPER_BASE_EXPORTS)
-        ENDIF(name STREQUAL MEDWrapperBase)
-        ''')
-        newlines.append(r'''
-        IF(name STREQUAL MEDWrapper_V2_1)
-        SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL MEDWRAPPER_V2_1_EXPORTS)
-        ENDIF(name STREQUAL MEDWrapper_V2_1)
-        ''')
-        newlines.append(r'''
-        IF(name STREQUAL med_V2_1)
-        SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL MEDWRAPPER_V2_1_CORE_EXPORTS)
-        ENDIF(name STREQUAL med_V2_1)
-        ''')
-        newlines.append(r'''
-        IF(name STREQUAL MEDWrapper_V2_2)
-        SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL MEDWRAPPER_V2_2_EXPORTS)
-        ENDIF(name STREQUAL MEDWrapper_V2_2)
-        ''')
-        newlines.append(r'''
-        IF(name STREQUAL MEDWrapper)
-        SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL MEDWRAPPER_FACTORY_EXPORTS)
-        ENDIF(name STREQUAL MEDWrapper)
-        ''')
-        newlines.append(r'''
-        IF(name STREQUAL interpkernel)
-        SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL INTERPKERNEL_EXPORTS)
-        ENDIF(name STREQUAL interpkernel)
-        ''')
-        newlines.append(r'''
-        IF(name STREQUAL SMESHControls)
-        SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL SMESHCONTROLS_EXPORTS)
-        ENDIF(name STREQUAL SMESHControls)
-        ''')
-        newlines.append(r'''
-        IF(name STREQUAL MeshDriver)
-        SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL MESHDRIVER_EXPORTS)
-        ENDIF(name STREQUAL MeshDriver)
-        ''')
-        newlines.append(r'''
-        IF(name STREQUAL MeshDriverMED)
-        SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL MESHDRIVERMED_EXPORTS)
-        ENDIF(name STREQUAL MeshDriverMED)
-        ''')
-        newlines.append(r'''
-        IF(name STREQUAL MeshDriverDAT)
-        SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL MESHDRIVERDAT_EXPORTS)
-        ENDIF(name STREQUAL MeshDriverDAT)
-        ''')
-        newlines.append(r'''
-        IF(name STREQUAL MeshDriverUNV)
-        SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL MESHDRIVERUNV_EXPORTS)
-        ENDIF(name STREQUAL MeshDriverUNV)
-        ''')
-        newlines.append(r'''
-        IF(name STREQUAL MeshDriverSTL)
-        SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL MESHDRIVERSTL_EXPORTS)
-        ENDIF(name STREQUAL MeshDriverSTL)
-        ''')
-        newlines.append(r'''
-        IF(name STREQUAL MEFISTO2D)
-        SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL MEFISTO2D_EXPORTS)
-        ENDIF(name STREQUAL MEFISTO2D)
-        ''')
-        newlines.append(r'''
-        IF(name STREQUAL SMESHObject)
-        SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL SMESHOBJECT_EXPORTS)
-        ENDIF(name STREQUAL SMESHObject)
-        ''')
-        newlines.append(r'''
-        IF(name STREQUAL _libSMESH_Swig)
-        SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL SMESH_SWIG_EXPORTS)
-        ENDIF(name STREQUAL _libSMESH_Swig)
-        ''')
-        newlines.append(r'''
-        IF(name STREQUAL NETGENPluginGUI)
-        SET_TARGET_PROPERTIES(${name} PROPERTIES DEFINE_SYMBOL NETGENPLUGIN_GUI_EXPORTS)
-        ENDIF(name STREQUAL NETGENPluginGUI)
+        SET_TARGET_PROPERTIES(${name} PROPERTIES VERSION ${VERSION_INFO} SOVERSION ${SOVERSION_INFO})
         ''')
         # --
         self.setLibAdd(key, newlines)
@@ -1422,13 +1336,21 @@ class CMakeFile(object):
                 ''')
                 pass
             newlines.append(r'''
-            IF(name STREQUAL SalomePyQt)
-            INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${name}.so DESTINATION ${DEST} RENAME ${name}.so)
-            ENDIF(name STREQUAL SalomePyQt)
+            # IF(name STREQUAL SalomePyQt)
+            # INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${name}.so DESTINATION ${DEST} RENAME ${name}.so)
+            # ENDIF(name STREQUAL SalomePyQt)
+            ''')
+            newlines.append(r'''
             ELSE(BEGIN_WITH_lib)
+            ''')
+            newlines.append(r'''
             IF(WINDOWS)
             INSTALL(TARGETS ${name} DESTINATION lib/python${PYTHON_VERSION}/site-packages/salome)
+            IF(CMAKE_BUILD_TYPE STREQUAL Release)
+            INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/lib/python${PYTHON_VERSION}/site-packages/salome/${name}.dll DESTINATION lib/python${PYTHON_VERSION}/site-packages/salome RENAME ${name}.pyd)
+            ELSE(CMAKE_BUILD_TYPE STREQUAL Release)
             INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/lib/python${PYTHON_VERSION}/site-packages/salome/${name}.dll DESTINATION lib/python${PYTHON_VERSION}/site-packages/salome RENAME ${name}_d.pyd)
+            ENDIF(CMAKE_BUILD_TYPE STREQUAL Release)
             ELSE(WINDOWS)
             GET_TARGET_PROPERTY(version ${name} VERSION)
             GET_TARGET_PROPERTY(soversion ${name} SOVERSION)
@@ -1436,6 +1358,8 @@ class CMakeFile(object):
             INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${name}.so.${version} DESTINATION lib/python${PYTHON_VERSION}/site-packages/salome RENAME ${name}.so.${soversion})
             INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${name}.so.${version} DESTINATION lib/python${PYTHON_VERSION}/site-packages/salome RENAME ${name}.so)
             ENDIF(WINDOWS)
+            ''')
+            newlines.append(r'''
             ENDIF(BEGIN_WITH_lib)
             ''')
             pass
@@ -1555,6 +1479,33 @@ class CMakeFile(object):
         ENDIF(dummy)
         ENDIF(test_SALOMEconfig.h.in)
         ''')
+        newlines.append(r'''
+        GET_FILENAME_COMPONENT(ext ${f} EXT)
+        IF(ext STREQUAL .py)
+        INSTALL(CODE "SET(PYTHON_FILE ${f})")
+        INSTALL(CODE "SET(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})")
+        INSTALL(CODE "SET(DEST ${DEST})")
+        INSTALL(CODE "SET(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE})")
+        ''')
+        if self.module == "kernel":
+            newlines.append('''
+            IF(f STREQUAL SALOME_ContainerPy.py)
+            ELSE(f STREQUAL SALOME_ContainerPy.py)
+            IF(f STREQUAL am2cmake.py)
+            ELSE(f STREQUAL am2cmake.py)
+            INSTALL(SCRIPT ${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/install_and_compile_python_file.cmake)
+            ENDIF(f STREQUAL am2cmake.py)
+            ENDIF(f STREQUAL SALOME_ContainerPy.py)
+            ''')
+        else:
+            newlines.append('''
+            STRING(REPLACE "\\\\" "/" KERNEL_ROOT_DIR ${KERNEL_ROOT_DIR})
+            INSTALL(SCRIPT ${KERNEL_ROOT_DIR}/salome_adm/cmake_files/install_and_compile_python_file.cmake)
+            ''')
+            pass
+        newlines.append(r'''
+        ENDIF(ext STREQUAL .py)
+        ''') 
         newlines.append(r"ENDFOREACH(f ${%s})"%(key))
         return
     
@@ -1599,11 +1550,18 @@ if __name__ == "__main__":
     #
     from os import walk
     for root, dirs, files in walk(the_root):
-        from os.path import basename
-        if basename(root) == "CVS": continue
+        # --
+        # E.A. : Remove 'CVS' in dirs
+        # E.A. : It allows to not recurse in CVS dirs
+        # E.A. : See os module python documentation
+        # --
+        try:
+            dirs.remove('CVS')
+        except ValueError:
+            pass
+        # --
         for f in files:
-            from os.path import basename
-            if basename(f) == "Makefile.am":
+            if f == "Makefile.am":
                 convertAmFile(the_root, root, dirs, files, f, module)
                 pass
             pass
diff --git a/salome_adm/cmake_files/install_and_compile_python_file.cmake b/salome_adm/cmake_files/install_and_compile_python_file.cmake
new file mode 100644 (file)
index 0000000..396d782
--- /dev/null
@@ -0,0 +1,27 @@
+#  Copyright (C) 2007-2008  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
+#
+SET(FULLDIR ${CMAKE_INSTALL_PREFIX}/${DEST})
+MESSAGE(STATUS "py compiling ${FULLDIR}/${PYTHON_FILE}")
+SET(CMD "import py_compile ; py_compile.compile('${FULLDIR}/${PYTHON_FILE}')")
+EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "${CMD}")
+SET(CMD "import py_compile ; py_compile.compile('${FULLDIR}/${PYTHON_FILE}')")
+EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -O -c "${CMD}")
index b6e704b4fef2aedcaf72c563bed9230354f02e00..3473cf26eb913a3dd510ac0b30f34bf6e550cbc5 100644 (file)
@@ -121,7 +121,7 @@ dnl sur CCRT/osf pas d'equivalent de l'option -MG de gcc avec compilo natif
 dnl on utilise donc gnu pour generer les dependances.
      DEPCC=gcc
      DEPCXX=g++
-     DEPCXXFLAGS="-Wno-deprecated"
+     DEPCXXFLAGS=
      DIFFFLAGS="-w"
 dnl  MACHINE="OSF1"
      ;;
index 14d2cafa841029ccd96b78cd3ee1bb9e8c05766e..e9889795cb9fff313e31aaaa1882bedd8ef55972 100644 (file)
@@ -23,7 +23,6 @@ dnl @synopsis AC_CXX_WARNINGS
 dnl Check warning flags for C++ compiler to control warning messages
 dnl
 AC_DEFUN([AC_CXX_WARNINGS],[
-  AC_CXX_OPTION(-Wno-deprecated,CXXFLAGS)
   AC_CXX_OPTION(-Wparentheses,CXXFLAGS)
   AC_CXX_OPTION(-Wreturn-type,CXXFLAGS)
   AC_CXX_OPTION(-Wmissing-declarations,CXXFLAGS)
index 5a57f165f01d726057087d302aff726c87da3ba6..a954190d79ccb9fb536115f94010dbfc1df2029f 100644 (file)
@@ -33,7 +33,11 @@ if test "$WITHOPENMPI" = yes; then
   OPENMPI_HOME=$withval
 
   if test "$OPENMPI_HOME"; then
-    MPI_INCLUDES=`$OPENMPI_HOME/bin/mpicxx --showme:compile`
+    if test -f "${OPENMPI_HOME}/include/mpi.h"; then
+      MPI_INCLUDES="-I${OPENMPI_HOME}/include"
+    else  
+      MPI_INCLUDES=`$OPENMPI_HOME/bin/mpicxx --showme:compile`
+    fi
     MPI_LIBS=`$OPENMPI_HOME/bin/mpicxx --showme:link`
   fi
 
index 6b61d9207ffac22028eb50db184d5fe3a7c2c9f0..4113f28feae112419ee9785551897d7976ae550c 100644 (file)
@@ -38,7 +38,6 @@ AC_ARG_ENABLE([production],
     ],
     [enable_production=]AC_ENABLE_PRODUCTION_DEFAULT)
 
-AC_CXX_OPTION(-Wno-deprecated,CXXFLAGS)
 AC_CXX_OPTION(-Wparentheses,CXXFLAGS)
 AC_CXX_OPTION(-Wreturn-type,CXXFLAGS)
 AC_CXX_OPTION(-Wmissing-declarations,CXXFLAGS)
index 35defec9fa9963a54461a08ad2598af74c25bc59..cd0690952c83014058d3253f4107c6e28dad44a2 100644 (file)
@@ -30,7 +30,7 @@
 
 
 #ifdef WIN32
-# ifdef BASICS_EXPORTS
+# if defined BASICS_EXPORTS || defined SALOMEBasics_EXPORTS
 #  define BASICS_EXPORT __declspec( dllexport )
 # else
 #  define BASICS_EXPORT __declspec( dllimport )
index e61d83c1e6de4ce52d327303acb014a23f0440a5..84548ad428f7acdebff28b389ff7d8ec60c292e8 100755 (executable)
@@ -27,7 +27,7 @@
 #define _BATCH_Defines_HXX_
 
 #ifdef WIN32
-# ifdef BATCH_EXPORTS
+# if defined BATCH_EXPORTS || defined SalomeBatch_EXPORTS
 #  define BATCH_EXPORT __declspec( dllexport )
 # else
 #  define BATCH_EXPORT __declspec( dllimport )
index e52954fd05c86455181ccf905c01c4c24141f0d3..8e21bb57710e8fad2667a22eaceea86f0e01c43c 100644 (file)
 //#include "utilities.h"
 
 namespace Batch {
-  
-  static FactBatchManager_Local_RSH* instanceOfFBM_eLSF()
-  {
-    static FactBatchManager_Local_RSH* sFBM_Local_RSH = 0;
-    if ( !sFBM_Local_RSH )
-      sFBM_Local_RSH = new FactBatchManager_Local_RSH();
-
-    return sFBM_Local_RSH;
-  }
 
   // Constructeur
   FactBatchManager_Local_RSH::FactBatchManager_Local_RSH() : FactBatchManager("RSH")
index b21c36598316964f5614f2184a6f476268c174df..e46b355bd7bda239dbc13ab7525f7df9b6d2d516 100644 (file)
 
 namespace Batch {
 
-static FactBatchManager_eLSF* instanceOfFBM_eLSF()
-{
-  static FactBatchManager_eLSF* sFBM_eLSF = 0;
-  if ( !sFBM_eLSF )
-    sFBM_eLSF = new FactBatchManager_eLSF();
-
-  return sFBM_eLSF;
-}
-  
-
   // Constructeur
   FactBatchManager_eLSF::FactBatchManager_eLSF() : FactBatchManager_eClient("eLSF")
   {
index e5745b2fc5fe4d52874d5dfd2008dc3bf8482f6e..863ed5212f376339f6aa43f348b391a9656c1ace 100644 (file)
 
 namespace Batch {
 
-  static FactBatchManager_ePBS* instanceOfFBM_eLSF()
-  {
-    static FactBatchManager_ePBS* sFBM_ePBS = 0;
-    if ( !sFBM_ePBS )
-      sFBM_ePBS = new FactBatchManager_ePBS();
-
-    return sFBM_ePBS;
-  }
-
   // Constructeur
   FactBatchManager_ePBS::FactBatchManager_ePBS() : FactBatchManager_eClient("ePBS")
   {
index 3f4539a2b5d2bff1da3cb03dd815c7900b36ab26..2d18ed2e05bf59c9536983e3b273a19faca2d575 100644 (file)
@@ -80,7 +80,12 @@ EXTRA_DIST = $(SWIGSOURCES)
 #
 
 # Scripts to be installed.
-dist_salomescript_SCRIPTS = Batch_test.py
+dist_salomescript_PYTHON = Batch_test.py
 
 # You don't need to specify libBatch_Swig.py. It is automatically
 # installed by means of the swig target salomepython_PYTHON.
+
+install-data-hook:
+       @for f in $(dist_salomescript_PYTHON) ; do \
+          chmod -f a+x $(DESTDIR)$(salomescriptdir)/$$f ; \
+        done
index 42a7392b3c107ff9491661c8ff395ce8769ce62c..c0c8eba5b9c1d6dca86b4a4fcce695fd48446e5d 100755 (executable)
@@ -27,7 +27,7 @@
 #define _SALOME_COMMIUNICATION_HXX_
 
 #ifdef WIN32
-# ifdef COMMUNICATION_EXPORTS
+# if defined COMMUNICATION_EXPORTS || defined SalomeCommunication_EXPORTS
 #  define COMMUNICATION_EXPORT __declspec( dllexport )
 # else
 #  define COMMUNICATION_EXPORT __declspec( dllimport )
index 7558ef37ef32624f1a4ed17d5ae87959dbac7d0e..065c5b4b55165398d5c8d36bbdc9f8766fad92c7 100644 (file)
@@ -1371,3 +1371,47 @@ void SigIntHandler( int what )
   }
 }
 #endif
+
+/*! \brief copy a file from a remote host (container) to the local host
+ * \param container the remote container
+ * \param remoteFile the file to copy locally from the remote host into localFile
+ * \param localFile the local file
+ */
+void Engines_Container_i::copyFile(Engines::Container_ptr container, const char* remoteFile, const char* localFile)
+{
+  Engines::fileTransfer_var fileTransfer = container->getFileTransfer();
+
+  FILE* fp;
+  if ((fp = fopen(localFile,"wb")) == NULL)
+    {
+      INFOS("file " << localFile << " cannot be open for writing");
+      return;
+    }
+
+  CORBA::Long fileId = fileTransfer->open(remoteFile);
+  if (fileId > 0)
+    {
+      Engines::fileBlock* aBlock;
+      int toFollow = 1;
+      int ctr=0;
+      while (toFollow)
+        {
+          ctr++;
+          SCRUTE(ctr);
+          aBlock = fileTransfer->getBlock(fileId);
+          toFollow = aBlock->length();
+          SCRUTE(toFollow);
+          CORBA::Octet *buf = aBlock->get_buffer();
+          fwrite(buf, sizeof(CORBA::Octet), toFollow, fp);
+          delete aBlock;
+        }
+      fclose(fp);
+      MESSAGE("end of transfer");
+      fileTransfer->close(fileId);
+    }
+  else
+    {
+      INFOS("open reference file for copy impossible");
+    }
+}
+
index 394ea10358b0604eaad5e324201f2e6dfcd1258a..9c6bffe17beb3542e9ecb2e70f8c07455927c4bc 100644 (file)
@@ -44,7 +44,7 @@ salomeinclude_HEADERS = \
        Salome_file_i.hxx
 
 # Scripts to be installed
-dist_salomescript_DATA =\
+dist_salomescript_PYTHON =\
        SALOME_ComponentPy.py \
        SALOME_Container.py
 
@@ -168,3 +168,7 @@ TestSalome_file_LDADD =\
        $(CORBA_LIBS) \
        $(PYTHON_LIBS)
 
+install-data-hook:
+       @for f in $(dist_salomescript_PYTHON) ; do \
+          chmod -f a+x $(DESTDIR)$(salomescriptdir)/$$f ; \
+        done
index 361b87eb3e599e7b539aff7733c4031b55fec3f8..2285e5f4d64feaaab4435a6ff1274a7155dee370 100644 (file)
@@ -113,7 +113,7 @@ public:
 
   // Object information
   virtual bool hasObjectInfo() { return false; }
-  virtual char* getObjectInfo(CORBA::Long studyId, const char* entry) { return ""; }
+  virtual char* getObjectInfo(CORBA::Long studyId, const char* entry) { return CORBA::string_dup(""); }
   
   // --- local C++ methods
 
index fe1959ff04f2a6210ea0b50e2599e884df51fc44..cdcfc64a9a8a6a23991c25892453144f51623e02 100644 (file)
@@ -32,7 +32,7 @@
 #endif
 
 #include <iostream>
-#include <strstream>
+#include <sstream>
 #include <string>
 #include <stdio.h>
 #include <time.h>
index c1e1e24df09a9b9d0f7ab4054b30f8d8f5441194..b24bd4ea247e38b58cb48e5715d6544d4e755d80 100755 (executable)
@@ -27,7 +27,7 @@
 #define _SALOME_Container_HXX_
 
 #ifdef WIN32
-# ifdef CONTAINER_EXPORTS
+# if defined CONTAINER_EXPORTS || defined SalomeContainer_EXPORTS
 #  define CONTAINER_EXPORT __declspec( dllexport )
 # else
 #  define CONTAINER_EXPORT __declspec( dllimport )
index 94f6a604d006641df342b5c90d05dff9b4b89383..0ac18204f78932783d6bde25da5e71c6d204d9f8 100644 (file)
@@ -96,8 +96,8 @@ SALOME_ContainerManager::~SALOME_ContainerManager()
 }
 
 //=============================================================================
+//! shutdown all the containers, then the ContainerManager servant
 /*! CORBA method:
- *  shutdown all the containers, then the ContainerManager servant
  */
 //=============================================================================
 
@@ -108,13 +108,11 @@ void SALOME_ContainerManager::Shutdown()
   _NS->Destroy_Name(_ContainerManagerNameInNS);
   PortableServer::ObjectId_var oid = _poa->servant_to_id(this);
   _poa->deactivate_object(oid);
-  //_remove_ref() has already been done at creation
-  //_remove_ref();
 }
 
 //=============================================================================
+//! Loop on all the containers listed in naming service, ask shutdown on each
 /*! CORBA Method:
- *  Loop on all the containers listed in naming service, ask shutdown on each
  */
 //=============================================================================
 
@@ -134,7 +132,7 @@ void SALOME_ContainerManager::ShutdownContainers()
           {
             Engines::Container_var cont=Engines::Container::_narrow(obj);
             if(!CORBA::is_nil(cont))
-             lstCont.push_back((*iter));
+              lstCont.push_back((*iter));
           }
         catch(const CORBA::Exception& e)
           {
@@ -177,101 +175,105 @@ void SALOME_ContainerManager::ShutdownContainers()
 }
 
 //=============================================================================
-//!  Find a suitable Container in a list of machines, or start one
+//! Give a suitable Container given constraints
 /*! CORBA Method:
  *  \param params            Machine Parameters required for the container
- *  \param possibleComputers list of machines usable for find or start
+ *  \return the container or nil
  */
 //=============================================================================
 
 Engines::Container_ptr
-SALOME_ContainerManager::
-FindOrStartContainer(const Engines::MachineParameters& params,
-                    const Engines::MachineList& possibleComputers)
+SALOME_ContainerManager::GiveContainer(const Engines::MachineParameters& params)
 {
-  Engines::Container_ptr ret = FindContainer(params,possibleComputers);
-  if(!CORBA::is_nil(ret))
-    return ret;
-  MESSAGE("Container doesn't exist try to launch it ...");
+  char *valenv=getenv("SALOME_BATCH");
+  if(valenv)
+    if (strcmp(valenv,"1")==0)
+      {
+        if(_batchLaunchedContainers.empty())
+          fillBatchLaunchedContainers();
 
-  return StartContainer(params,possibleComputers,Engines::P_FIRST);
+        if (_batchLaunchedContainersIter == _batchLaunchedContainers.end())
+          _batchLaunchedContainersIter = _batchLaunchedContainers.begin();
 
+        Engines::Container_ptr rtn = Engines::Container::_duplicate(*_batchLaunchedContainersIter);
+        _batchLaunchedContainersIter++;
+        return rtn;
+      }
+  return StartContainer(params);
 }
 
 //=============================================================================
-//! Start a suitable Container in a list of machines with constraints and a policy
+//! Start a suitable Container in a list of machines with constraints 
 /*! C++ Method:
  * Constraints are given by a machine parameters struct
  *  \param params            Machine Parameters required for the container
  *  \param possibleComputers list of machines usable for start
- *  \param policy        policy to use (first,cycl or best)
  *  \param container_exe specific container executable (default=SALOME_Container)
  */
 //=============================================================================
 
 Engines::Container_ptr
-SALOME_ContainerManager::
-StartContainer(const Engines::MachineParameters& params,
-              const Engines::MachineList& possibleComputers,
-              Engines::ResPolicy policy,const std::string& container_exe)
+SALOME_ContainerManager::StartContainer(const Engines::MachineParameters& params,
+               const Engines::MachineList& possibleComputers,
+               const std::string& container_exe)
 {
 #ifdef WITH_PACO_PARALLEL
   std::string parallelLib(params.parallelLib);
   if (parallelLib != "")
-    return StartParallelContainer(params, policy, possibleComputers);
+  {
+    Engines::MachineParameters myparams(params);
+    myparams.computerList=possibleComputers;
+    return StartParallelContainer(myparams);
+  }
 #endif
   string containerNameInNS;
   Engines::Container_ptr ret = Engines::Container::_nil();
 
-  MESSAGE("SALOME_ContainerManager::StartContainer " <<
-         possibleComputers.length());
+  MESSAGE("SALOME_ContainerManager::StartContainer " << possibleComputers.length());
 
   vector<string> lm;
-  for(unsigned int i=0;i<possibleComputers.length();i++)
-    lm.push_back(string(possibleComputers[i]));
+// if mode is "get" keep only machines with existing containers 
+  if(std::string(params.mode.in())=="get")
+    {
+      for(unsigned int i=0;i<possibleComputers.length();i++)
+        {
+          Engines::Container_ptr cont = FindContainer(params,possibleComputers[i]);
+          try
+            {
+              if(!cont->_non_existent())
+                lm.push_back(string(possibleComputers[i]));
+            }
+          catch(CORBA::Exception&)
+            {
+              // CORBA::Exception ignored.
+            }
+        }
+    }
+  else
+    {
+      for(unsigned int i=0;i<possibleComputers.length();i++)
+        lm.push_back(string(possibleComputers[i]));
+    }
 
   string theMachine;
-  try{
-    switch(policy){
-    case Engines::P_FIRST:
-      theMachine=_ResManager->GetImpl()->FindFirst(lm);
-      break;
-    case Engines::P_CYCL:
-      theMachine=_ResManager->GetImpl()->FindNext(lm);
-      break;
-    case Engines::P_BEST:
-      theMachine=_ResManager->GetImpl()->FindBest(lm);
-      break;
+  try
+    {
+      theMachine=_ResManager->GetImpl()->Find(params.policy.in(),lm);
+    }
+  catch( const SALOME_Exception &ex )
+    {
+      MESSAGE(ex.what());
+      return Engines::Container::_nil();
     }
-  }
-  catch( const SALOME_Exception &ex ){
-    MESSAGE(ex.what());
-    return Engines::Container::_nil();
-  }
 
   //If the machine name is localhost use the real name
   if(theMachine == "localhost")
     theMachine=Kernel_Utils::GetHostname();
 
-  MESSAGE("try to launch it on " << theMachine);
-
-  string command;
-  if(theMachine==""){
-    MESSAGE("SALOME_ContainerManager::StartContainer : " <<
-           "no possible computer");
-    return Engines::Container::_nil();
-  }
-  else if(theMachine==Kernel_Utils::GetHostname())
-    command = BuildCommandToLaunchLocalContainer(params,container_exe);
-  else
-    command = BuildCommandToLaunchRemoteContainer(theMachine,params,container_exe);
-
   //check if an entry exists in Naming service
-  if(params.isMPI)
-    // A parallel container register on zero node in NS
-    containerNameInNS = _NS->BuildContainerNameForNS(params,GetMPIZeroNode(theMachine).c_str());
-  else
-    containerNameInNS = _NS->BuildContainerNameForNS(params,theMachine.c_str());
+  //if params.mode == "start" or "" shutdown the existing container before launching a new one with that name
+  //if params.mode == "getorstart" or "get" use the existing container
+  containerNameInNS = _NS->BuildContainerNameForNS(params,theMachine.c_str());
 
   SCRUTE(containerNameInNS);
   CORBA::Object_var obj = _NS->Resolve(containerNameInNS.c_str());
@@ -279,10 +281,14 @@ StartContainer(const Engines::MachineParameters& params,
     {
       try
         {
-          // shutdown the registered container if it exists
           Engines::Container_var cont=Engines::Container::_narrow(obj);
-          if(!CORBA::is_nil(cont))
-            cont->Shutdown();
+          if(!cont->_non_existent())
+            {
+              if(std::string(params.mode.in())=="getorstart"||std::string(params.mode.in())=="get")
+                return cont._retn(); /* the container exists and params.mode is getorstart or get use it*/
+              else
+                cont->Shutdown(); // shutdown the registered container if it exists
+            }
         }
       catch(CORBA::Exception&)
         {
@@ -290,6 +296,19 @@ StartContainer(const Engines::MachineParameters& params,
         }
     }
 
+  //try to launch a new container
+  MESSAGE("try to launch it on " << theMachine);
+
+  string command;
+  if(theMachine==""){
+    MESSAGE("SALOME_ContainerManager::StartContainer : no possible computer");
+    return Engines::Container::_nil();
+  }
+  else if(theMachine==Kernel_Utils::GetHostname())
+    command = BuildCommandToLaunchLocalContainer(params,container_exe);
+  else
+    command = BuildCommandToLaunchRemoteContainer(theMachine,params,container_exe);
+
   //redirect stdout and stderr in a file
   string logFilename="/tmp/"+_NS->ContainerName(params)+"_"+ theMachine +"_"+getenv( "USER" )+".log" ;
   command += " > " + logFilename + " 2>&1 &";
@@ -297,16 +316,13 @@ StartContainer(const Engines::MachineParameters& params,
   // launch container with a system call
   int status=system(command.c_str());
 
-
   if (status == -1){
-    MESSAGE("SALOME_LifeCycleCORBA::StartOrFindContainer rsh failed " <<
-           "(system command status -1)");
+    MESSAGE("SALOME_ContainerManager::StartContainer rsh failed (system command status -1)");
     RmTmpFile(_TmpFileName); // command file can be removed here
     return Engines::Container::_nil();
   }
   else if (status == 217){
-    MESSAGE("SALOME_LifeCycleCORBA::StartOrFindContainer rsh failed " <<
-           "(system command status 217)");
+    MESSAGE("SALOME_ContainerManager::StartContainer rsh failed (system command status 217)");
     RmTmpFile(_TmpFileName); // command file can be removed here
     return Engines::Container::_nil();
   }
@@ -321,7 +337,7 @@ StartContainer(const Engines::MachineParameters& params,
 #endif
       count-- ;
       if ( count != 10 )
-       MESSAGE( count << ". Waiting for container on " << theMachine);
+        MESSAGE( count << ". Waiting for container on " << theMachine);
 
       CORBA::Object_var obj = _NS->Resolve(containerNameInNS.c_str());
       ret=Engines::Container::_narrow(obj);
@@ -329,7 +345,7 @@ StartContainer(const Engines::MachineParameters& params,
     
     if ( CORBA::is_nil(ret) )
       {
-        MESSAGE("SALOME_LifeCycleCORBA::StartOrFindContainer rsh failed");
+        MESSAGE("SALOME_ContainerManager::StartContainer rsh failed");
       }
     else
       {
@@ -345,21 +361,16 @@ StartContainer(const Engines::MachineParameters& params,
 }
 
 //=============================================================================
-//! Start a suitable Container for a list of components with constraints and a policy
+//! Start a suitable Container given constraints 
 /*! CORBA Method:
  *  \param params            Machine Parameters required for the container
- *  \param policy        policy to use (first,cycl or best)
- *  \param componentList list of component to be loaded on this container
  */
 //=============================================================================
 
 Engines::Container_ptr
-SALOME_ContainerManager::
-StartContainer(const Engines::MachineParameters& params,
-              Engines::ResPolicy policy,
-              const Engines::CompoList& componentList)
+SALOME_ContainerManager::StartContainer(const Engines::MachineParameters& params)
 {
-  Engines::MachineList_var possibleComputers = _ResManager->GetFittingResources(params,componentList);
+  Engines::MachineList_var possibleComputers = _ResManager->GetFittingResources(params);
 
   // Look into ModulCatalog if a specific container must be launched
   CORBA::String_var container_exe;
@@ -371,9 +382,9 @@ StartContainer(const Engines::MachineParameters& params,
       if (CORBA::is_nil (Catalog))
         return Engines::Container::_nil();
       // Loop through component list
-      for(unsigned int i=0;i<componentList.length();i++)
+      for(unsigned int i=0;i<params.componentList.length();i++)
         {
-          const char* compoi = componentList[i];
+          const char* compoi = params.componentList[i];
           SALOME_ModuleCatalog::Acomponent_var compoInfo = Catalog->GetComponent(compoi);
           if (CORBA::is_nil (compoInfo))
             {
@@ -404,9 +415,77 @@ StartContainer(const Engines::MachineParameters& params,
     }
 
   if(found)
-    return StartContainer(params,possibleComputers,policy,container_exe.in());
+    return StartContainer(params,possibleComputers,container_exe.in());
   else
-    return StartContainer(params,possibleComputers,policy);
+    return StartContainer(params,possibleComputers);
+}
+
+//=============================================================================
+//!  Find or start a suitable Container given some constraints
+/*! CORBA Method:
+ *  \param params            Machine Parameters required for the container
+ *  \return the container or nil
+ */
+//=============================================================================
+
+Engines::Container_ptr
+SALOME_ContainerManager::FindOrStartContainer(const Engines::MachineParameters& params)
+{
+  Engines::Container_ptr ret = FindContainer(params,params.computerList);
+  if(!CORBA::is_nil(ret))
+    return ret;
+  MESSAGE("Container doesn't exist try to launch it ...");
+
+  return StartContainer(params);
+}
+
+//=============================================================================
+//! Find a container given constraints (params) on a list of machines (possibleComputers)
+/*!
+ *
+ */
+//=============================================================================
+
+Engines::Container_ptr
+SALOME_ContainerManager::FindContainer(const Engines::MachineParameters& params,
+                                       const Engines::MachineList& possibleComputers)
+{
+  MESSAGE("FindContainer "<<possibleComputers.length());
+  for(unsigned int i=0;i<possibleComputers.length();i++)
+    {
+      MESSAGE("FindContainer possible " << possibleComputers[i]);
+      Engines::Container_ptr cont = FindContainer(params,possibleComputers[i]);
+      if( !CORBA::is_nil(cont) )
+        return cont;
+    }
+  MESSAGE("FindContainer: not found");
+  return Engines::Container::_nil();
+}
+
+//=============================================================================
+//! Find a container given constraints (params) on a machine (theMachine)
+/*!
+ *
+ */
+//=============================================================================
+
+Engines::Container_ptr
+SALOME_ContainerManager::FindContainer(const Engines::MachineParameters& params,
+                                       const char *theMachine)
+{
+  string containerNameInNS(_NS->BuildContainerNameForNS(params,theMachine));
+  CORBA::Object_var obj = _NS->Resolve(containerNameInNS.c_str());
+  try
+    {
+      if(obj->_non_existent())
+        return Engines::Container::_nil();
+      else
+        return Engines::Container::_narrow(obj);
+    }
+  catch(const CORBA::Exception& e)
+    {
+      return Engines::Container::_nil();
+    }
 }
 
 #ifdef WITH_PACO_PARALLEL
@@ -414,16 +493,11 @@ StartContainer(const Engines::MachineParameters& params,
 /*! CORBA Method:
  *  Find or Start a suitable PaCO++ Parallel Container in a list of machines.
  *  \param params            Machine Parameters required for the container
- *  \param possibleComputers list of machines usable for find or start
- *
  *  \return CORBA container reference.
  */
 //=============================================================================
 Engines::Container_ptr
-SALOME_ContainerManager::
-StartParallelContainer(const Engines::MachineParameters& params_const,
-                            Engines::ResPolicy policy,
-                            const Engines::MachineList& possibleComputers)
+SALOME_ContainerManager::StartParallelContainer(const Engines::MachineParameters& params_const)
 {
   CORBA::Object_var obj;
   PaCO::InterfaceManager_var container_proxy;
@@ -434,13 +508,13 @@ StartParallelContainer(const Engines::MachineParameters& params_const,
   // Currently not as good as could be since
   // we have to verified the number of nodes of the container
   // if a user tell that.
-  ret = FindContainer(params, possibleComputers);
+  ret = FindContainer(params, params.computerList);
   if(CORBA::is_nil(ret)) {
     // Step 2 : Starting a new parallel container !
     INFOS("[StartParallelContainer] Starting a PaCO++ parallel container");
 
     // Step 3 : Choose a computer
-    std::string theMachine = _ResManager->FindFirst(possibleComputers);
+    std::string theMachine = _ResManager->FindFirst(params.computerList);
     //If the machine name is localhost use the real name
     if(theMachine == "localhost")
       theMachine=Kernel_Utils::GetHostname();
@@ -615,16 +689,11 @@ StartParallelContainer(const Engines::MachineParameters& params_const,
 /*! CORBA Method:
  *  Find or Start a suitable PaCO++ Parallel Container in a list of machines.
  *  \param params            Machine Parameters required for the container
- *  \param possibleComputers list of machines usable for find or start
- *
  *  \return CORBA container reference.
  */
 //=============================================================================
 Engines::Container_ptr
-SALOME_ContainerManager::
-StartParallelContainer(const Engines::MachineParameters& params,
-                      Engines::ResPolicy policy,
-                      const Engines::MachineList& possibleComputers)
+SALOME_ContainerManager::StartParallelContainer(const Engines::MachineParameters& params)
 {
   Engines::Container_ptr ret = Engines::Container::_nil();
   INFOS("[StartParallelContainer] is disabled !");
@@ -633,80 +702,6 @@ StartParallelContainer(const Engines::MachineParameters& params,
 }
 #endif
 
-//=============================================================================
-//! Give a suitable Container for a list of components with constraints and a policy
-/*! CORBA Method:
- *  \param params            Machine Parameters required for the container
- *  \param policy        policy to use (first,cycl or best)
- *  \param componentList list of component to be loaded on this container
- */
-//=============================================================================
-
-Engines::Container_ptr
-SALOME_ContainerManager::
-GiveContainer(const Engines::MachineParameters& params,
-              Engines::ResPolicy policy,
-              const Engines::CompoList& componentList)
-{
-  char *valenv=getenv("SALOME_BATCH");
-  if(valenv)
-    if (strcmp(valenv,"1")==0)
-      {
-       if(_batchLaunchedContainers.empty())
-         fillBatchLaunchedContainers();
-
-       if (_batchLaunchedContainersIter == _batchLaunchedContainers.end())
-         _batchLaunchedContainersIter = _batchLaunchedContainers.begin();
-
-       Engines::Container_ptr rtn = Engines::Container::_duplicate(*_batchLaunchedContainersIter);
-       _batchLaunchedContainersIter++;
-        return rtn;
-      }
-  return StartContainer(params,policy,componentList);
-}
-
-//=============================================================================
-/*! 
- * 
- */
-//=============================================================================
-
-Engines::Container_ptr
-SALOME_ContainerManager::
-FindContainer(const Engines::MachineParameters& params,
-             const char *theMachine)
-{
-  string containerNameInNS(_NS->BuildContainerNameForNS(params,theMachine));
-  CORBA::Object_var obj = _NS->Resolve(containerNameInNS.c_str());
-  if( !CORBA::is_nil(obj) )
-    return Engines::Container::_narrow(obj);
-  else
-    return Engines::Container::_nil();
-}
-
-//=============================================================================
-/*! 
- * 
- */
-//=============================================================================
-
-Engines::Container_ptr
-SALOME_ContainerManager::
-FindContainer(const Engines::MachineParameters& params,
-             const Engines::MachineList& possibleComputers)
-{
-  MESSAGE("FindContainer "<<possibleComputers.length());
-  for(unsigned int i=0;i<possibleComputers.length();i++)
-    {
-      MESSAGE("FindContainer possible " << possibleComputers[i]);
-      Engines::Container_ptr cont = FindContainer(params,possibleComputers[i]);
-      if( !CORBA::is_nil(cont) )
-       return cont;
-    }
-  MESSAGE("FindContainer: not found");
-  return Engines::Container::_nil();
-}
-
 //=============================================================================
 /*! This method launches the parallel container.
  *  It will may be placed on the ressources manager.
@@ -762,6 +757,7 @@ SALOME_ContainerManager::LaunchParallelContainer(const std::string& command,
     // We are waiting all the nodes
     for (int i = 0; i < params.nb_component_nodes; i++) 
     {
+      obj = CORBA::Object::_nil();
       std::string theMachine(vect_machine[i]);
       // Name of the node
       std::ostringstream tmp;
index e4340dcc58dc580c0ff173bca42a783a037a5391..d5f4b2b2d3f3a6a6b23ec34013e48e563f20637d 100644 (file)
@@ -42,44 +42,37 @@ public:
   SALOME_ContainerManager(CORBA::ORB_ptr orb, PortableServer::POA_var poa, SALOME_ResourcesManager *rm, SALOME_NamingService *ns);
   ~SALOME_ContainerManager();
 
-  Engines::Container_ptr
-  FindOrStartContainer(const Engines::MachineParameters& params,
-                      const Engines::MachineList& possibleComputer);
+  void Shutdown();
+  void ShutdownContainers();
 
   Engines::Container_ptr
   StartContainer(const Engines::MachineParameters& params,
-                const Engines::MachineList& possibleComputer,
-                Engines::ResPolicy policy,
+                 const Engines::MachineList& possibleComputer,
                  const std::string& container_exe="SALOME_Container");
 
   Engines::Container_ptr
-  StartContainer(const Engines::MachineParameters& params,
-                 Engines::ResPolicy policy,
-                 const Engines::CompoList& componentList);
+  StartContainer(const Engines::MachineParameters& params);
 
   Engines::Container_ptr
-  GiveContainer(const Engines::MachineParameters& params,
-               Engines::ResPolicy policy,
-               const Engines::CompoList& componentList);
+  GiveContainer(const Engines::MachineParameters& params);
 
-  void Shutdown();
-  void ShutdownContainers();
+  Engines::Container_ptr
+  FindOrStartContainer(const Engines::MachineParameters& params);
 
   static const char *_ContainerManagerNameInNS;
 
   // PaCO++ Parallel extension
   Engines::Container_ptr
-  StartParallelContainer(const Engines::MachineParameters& params,
-                        Engines::ResPolicy policy,
-                        const Engines::MachineList& possibleComputer);
+  StartParallelContainer(const Engines::MachineParameters& params);
+
 protected:
   Engines::Container_ptr
   FindContainer(const Engines::MachineParameters& params,
-               const Engines::MachineList& possibleComputers);
+                const Engines::MachineList& possibleComputers);
 
   Engines::Container_ptr
   FindContainer(const Engines::MachineParameters& params,
-               const char *theMachine);
+                const char *theMachine);
 
   void fillBatchLaunchedContainers();
 
index 08afa42af91766f239ebf24f3d780e192580b59f..9dae83fb6f4146eb7b878ed3de5c22878ae93e80 100644 (file)
@@ -96,6 +96,7 @@ public:
   Engines::fileTransfer_ptr getFileTransfer();
 
   virtual Engines::Salome_file_ptr createSalome_file(const char* origFileName);
+  void copyFile(Engines::Container_ptr container, const char* remoteFile, const char* localFile);
   // --- local C++ methods
 
   Engines::Component_ptr
index b1195972647c15a2ea2b4827737cfb35ec5b09ca..fd54215240d28b81d6eba6dc5a74813fdb43f89b 100644 (file)
@@ -97,7 +97,11 @@ void fileTransfer_i::close(CORBA::Long fileId)
     {
       INFOS(" no FILE structure associated to fileId " <<fileId);
     }
-  else fclose(fp);
+  else 
+    {
+      fclose(fp);
+      _fileAccess.erase(fileId);
+    }
 }
 
 #define FILEBLOCK_SIZE 256*1024
@@ -135,3 +139,48 @@ Engines::fileBlock* fileTransfer_i::getBlock(CORBA::Long fileId)
   return aBlock;
 }
 
+/*! \brief open the given file in write mode (for copy)
+ *
+ *  CORBA method: try to open the file. If the file is writable, 
+ *  return a positive integer else return 0;
+ *  \param  fileName path to the file to be transfered
+ *  \return fileId = positive integer > 0 if open OK.
+ */
+CORBA::Long fileTransfer_i::openW(const char* fileName)
+{
+  MESSAGE(" fileTransfer_i::openW " << fileName);
+  int aKey = _fileKey++;
+  _ctr=0;
+  FILE* fp;
+  if ((fp = fopen(fileName,"wb")) == NULL)
+    {
+      INFOS("file " << fileName << " is not writable");
+      return 0;
+    }
+  _fileAccess[aKey] = fp;
+  return aKey;
+}
+
+/*! \brief put a data block for copy into a file
+ * 
+ *  CORBA method: put a block of data into the file associated to the fileId
+ *  given at openW.
+ *  \param fileId got in return from openW method
+ *  \param block an octet sequence to copy into opened file
+ */
+void fileTransfer_i::putBlock(CORBA::Long fileId, const Engines::fileBlock& block)
+{
+  MESSAGE("fileTransfer_i::putBlock");
+  FILE* fp;
+  if (! (fp = _fileAccess[fileId]) )
+    {
+      INFOS(" no FILE structure associated to fileId " <<fileId);
+      return ;
+    }
+  int toFollow = block.length();
+  SCRUTE(toFollow);
+  const CORBA::Octet *buf = block.get_buffer();
+  fwrite(buf, sizeof(CORBA::Octet), toFollow, fp);
+}
+
+
index 5114bf7cedf0d5553bd65eb1555428cc2d58245e..dd96d400990c6f23a9795d74c03ee438599cb454 100644 (file)
@@ -47,10 +47,12 @@ public:
   void close(CORBA::Long fileId);
 
   Engines::fileBlock* getBlock(CORBA::Long fileId);
+  CORBA::Long openW(const char* fileName);
+  void putBlock(CORBA::Long fileId, const Engines::fileBlock& block);
 
 protected:
   int _fileKey;
-  std::map<int, FILE*> _fileAccess;
+  std::map<int, FILE* > _fileAccess;
   int _ctr;
 };
 
index ac72586e73e7d73629b1887144d1d8ecf54cb47e..d92ab4f4cf7b07aae60dfe93399603b5484e746e 100644 (file)
 #include CORBA_SERVER_HEADER(SALOME_Exception)
 
 #include "SALOME_Container.hxx"
+#include "SALOME_FileTransfer_i.hxx"
+
 #include <map>
 #include <cstdio>
 #include <string>
 
 class CONTAINER_EXPORT Salome_file_i:
-  public virtual POA_Engines::Salome_file
+  public virtual POA_Engines::Salome_file,public virtual fileTransfer_i
 {
   public:
     Salome_file_i();
index 12e3f6de9257f8d304a801b054e3ac3d4a08daf7..de5d65e6dd2f88312cfa557c4c108a1d111b489f 100644 (file)
@@ -23,7 +23,7 @@
 #define  DF_DEF_HXX
 
 #ifdef WIN32
-# ifdef DF_EXPORTS
+# if defined DF_EXPORTS
 #  define DF_EXPORT __declspec( dllexport )
 # else
 #  define DF_EXPORT __declspec( dllimport )
index 3e0b4922da208bd5922e8517daa09906cff91d4b..0fec8e5285b5d9909486894c5d306c80b01decb3 100755 (executable)
@@ -27,7 +27,7 @@
 #define _DSC_Basic_HXX_
 
 #ifdef WIN32
-# ifdef DSC_BASIC_EXPORTS
+# if defined DSC_BASIC_EXPORTS || defined SalomeDSCContainer_EXPORTS
 #  define DSC_BASIC_EXPORT __declspec( dllexport )
 # else
 #  define DSC_BASIC_EXPORT __declspec( dllimport )
index 5a87b6b309a63666c8b7b5d13abd12444d268905..e5d9bf04a22b0cee4ef0ba8caa2529f3782d7a43 100644 (file)
@@ -30,6 +30,8 @@ include $(top_srcdir)/salome_adm/unix/make_common_starter.am
 # ===============================================================
 #
 
+BUILT_SOURCES = calcium_wrap.cpp calcium.py
+
 # This local variable defines the list of CPPFLAGS common to all target in this package.
 COMMON_CPPFLAGS= -I$(top_srcdir)/src/DSC/DSC_User \
                 -I$(top_srcdir)/src/DSC/DSC_User/Datastream \
index bbf7f06a76ab981590c72baa1506efd4ad19b65c..4ebb051fb0ba92f398d178a295ad7cae91ccae82 100644 (file)
@@ -21,8 +21,8 @@
 //
 #include <string.h>
 #include <stdlib.h>
-#include <fortoc.h>
-#include <calcium.h>
+#include "fortoc.h"
+#include "calcium.h"
 #include <stdio.h>
 
 static void* COMPO=0;
index 59c31faac88a40f282b5f9cd67873764a7493bed..a7f03c893d117ec829aa03865fa7cb7f1e6c13fc 100644 (file)
@@ -32,7 +32,7 @@
 #include CORBA_SERVER_HEADER(SALOME_GenericObj)
 
 #ifdef WIN32
-# ifdef GENERICOBJ_EXPORTS
+# if defined GENERICOBJ_EXPORTS || defined SalomeGenericObj_EXPORTS
 #  define GENERICOBJ_EXPORT __declspec( dllexport )
 # else
 #  define GENERICOBJ_EXPORT __declspec( dllimport )
index 2b0402a6d2cbf080457cf0259f27066d1262cb99..3c969d33f5ae2788cf6ffae4863e2acd681d5288 100644 (file)
@@ -27,7 +27,7 @@
 #define _HDF_export_HXX_
 
 #ifdef WIN32
-# ifdef HDFPERSIST_EXPORTS
+# if defined HDFPERSIST_EXPORTS || defined SalomeHDFPersist_EXPORTS
 #  define HDFPERSIST_EXPORT __declspec( dllexport )
 # else
 #  define HDFPERSIST_EXPORT __declspec( dllimport )
index 8ac181d983a01111e988e9f8f57f394ae5d186c2..869e2f9137af27ad3b6f6063c178b64dd5ca98d4 100755 (executable)
@@ -27,21 +27,27 @@ include $(top_srcdir)/salome_adm/unix/make_common_starter.am
 
 # Scripts to be installed (salomepython is an automake keyword for python targets)
 salomepython_PYTHON = \
-       Help.py \
-       PyInterp.py \
-       salome.py \
        salome_shared_modules.py \
-       batchmode_salome.py \
        import_hook.py \
-       salome_test.py \
-       salome_kernel.py \
-       salome_study.py \
-       salome_iapp.py \
-       salome_ComponentGUI.py \
-       omnipatch.py \
-       iparameters.py \
-       salome_version.py \
-       salome_notebook.py
+       omnipatch.py
 
-sharedpkgpython_PYTHON = kernel_shared_modules.py
+if CORBA_GEN
+  salomepython_PYTHON += \
+               Help.py \
+               PyInterp.py \
+               salome.py \
+               salome_shared_modules.py \
+               batchmode_salome.py \
+               import_hook.py \
+               salome_test.py \
+               salome_kernel.py \
+               salome_study.py \
+               salome_iapp.py \
+               salome_ComponentGUI.py \
+               omnipatch.py \
+               iparameters.py \
+               salome_version.py \
+               salome_notebook.py
+endif
 
+sharedpkgpython_PYTHON = kernel_shared_modules.py
index 23d7d4a1adcdac429cdf8697debc4b0e299c2bc9..a62cbafe9c399a16986b52e28a2f209f63bbe625 100755 (executable)
@@ -253,14 +253,16 @@ print ret
 smesh.Compute(mesh, box)
 sg.updateObjBrowser(1);
 
+#####################################################################
 # SUPERVISOR module is not available since SALOME 5.0 version
-defineSuperV = 0
-
-if (defineSuperV != 0) & (sys.platform != "win32"):
-       print
-       print "=============  Test      Supervisor      ============================="
-       print
-
+#####################################################################
+print
+print "=============  Test     Supervisor      ============================="
+print
+import salome_version
+versions = salome_version.getVersions()
+if versions[0] < 5:
+       # SUPERV module is avaiable
        comp = catalog.GetComponent("SUPERV")
        if comp is None:
                raise RuntimeError,"Component SUPERV not found in Module Catalog."
@@ -455,6 +457,10 @@ if (defineSuperV != 0) & (sys.platform != "win32"):
        sg.updateObjBrowser(1);
 
        pass
+else:
+       # SUPERV module is NOT avaiable
+       print "WARNING! Supervisor is not avaiable in this version of SALOME!"
+       pass
 
 print
 print "=============  Test  VISU  and MED ============================="
index 2c95b42196acd1e32dd77186a8726fb6b535dc09..696cd48db3ee25d86436f5e61928c6d5cf3f7b0f 100644 (file)
@@ -84,3 +84,26 @@ def getVersionRelease( mod = "KERNEL" ):
     except:
         pass
     return None
+
+def getVersions( mod = "KERNEL" ):
+    """
+    Get SALOME module version as list of [major, minor, release] numbers
+    Returns: version numbers list
+    """
+    try:
+        major = int( getVersionMajor( mod ) )
+    except:
+        major = 0
+        pass
+    try:
+        minor = int( getVersionMinor( mod ) )
+    except:
+        minor = 0
+        pass
+    try:
+        rel = int( getVersionRelease( mod ) )
+    except:
+        rel = 0
+        pass
+    return [ major, minor, rel ]
+    
index a320ecedc6b75b03475ca1bbc91402a0c66c8236..727cedc5f5fc4a034818da8dc2b6cef0895a1e0e 100644 (file)
@@ -31,7 +31,7 @@
 #ifdef WIN32
 # include <io.h>
 #endif
-BatchTest::BatchTest(const Engines::MachineParameters& batch_descr) 
+BatchTest::BatchTest(const Engines::MachineDefinition& batch_descr) 
 {
   _batch_descr = batch_descr;
 
index 8ccd5a5503ce0b45633ca3d7b791b552d26329d4..8fdf3736c6eec1a50267f0b521dbe3a5986ef0d2 100644 (file)
@@ -32,7 +32,7 @@
 class SALOMELAUNCHER_EXPORT BatchTest 
 {
   public:
-    BatchTest(const Engines::MachineParameters& batch_descr);
+    BatchTest(const Engines::MachineDefinition& batch_descr);
     virtual ~BatchTest();
 
     bool test();
@@ -48,7 +48,7 @@ class SALOMELAUNCHER_EXPORT BatchTest
     std::string get_home(std::string * home);
   
   private:
-    Engines::MachineParameters _batch_descr;
+    Engines::MachineDefinition _batch_descr;
     std::string _test_filename;
     std::string _base_filename;
     std::string _date;
index 6dd80e1899b89a35467142675bdf75a713f847ed..b6a6ea2caf065a473ce9ea1c4a31ef60f4ee516a 100644 (file)
@@ -92,9 +92,8 @@ long Launcher_cpp::submitJob( const std::string xmlExecuteFile,
   // verify if cluster is in resources catalog
   machineParams params;
   params.hostname = clusterName;
-  vector<string> aCompoList ;
   try{
-    aMachineList = _ResManager->GetFittingResources(params, aCompoList);
+    aMachineList = _ResManager->GetFittingResources(params);
   }
   catch(const ResourcesException &ex){
     throw LauncherException(ex.msg.c_str());
@@ -207,9 +206,8 @@ long Launcher_cpp::submitSalomeJob( const string fileToExecute ,
     throw LauncherException("Batch parameters are bad (see informations above)");
 
   // find a cluster matching the structure params
-  vector<string> aCompoList ;
   try{
-    aMachineList = _ResManager->GetFittingResources(params, aCompoList);
+    aMachineList = _ResManager->GetFittingResources(params);
   }
   catch(const ResourcesException &ex){
     throw LauncherException(ex.msg.c_str());
@@ -298,8 +296,7 @@ string Launcher_cpp::queryJob( long id,
     throw LauncherException("You must set Resources Manager to Launcher!!");
 
   // find a cluster matching params structure
-  vector<string> aCompoList ;
-  vector<string> aMachineList = _ResManager->GetFittingResources( params , aCompoList ) ;
+  vector<string> aMachineList = _ResManager->GetFittingResources( params ) ;
   ParserResourcesType p = _ResManager->GetResourcesList(aMachineList[0]);
   string clustername(p.Alias);
     
@@ -346,8 +343,7 @@ void Launcher_cpp::deleteJob( const long id,
     throw LauncherException("You must set Resources Manager to Launcher!!");
 
   // find a cluster matching params structure
-  vector<string> aCompoList ;
-  vector<string> aMachineList = _ResManager->GetFittingResources( params , aCompoList ) ;
+  vector<string> aMachineList = _ResManager->GetFittingResources( params ) ;
   ParserResourcesType p = _ResManager->GetResourcesList(aMachineList[0]);
   string clustername(p.Alias);
     
@@ -385,8 +381,7 @@ void Launcher_cpp::getResultsJob( const string directory,
   if(!_ResManager)
     throw LauncherException("You must set Resources Manager to Launcher!!");
 
-  vector<string> aCompoList ;
-  vector<string> aMachineList = _ResManager->GetFittingResources( params , aCompoList ) ;
+  vector<string> aMachineList = _ResManager->GetFittingResources( params ) ;
   ParserResourcesType p = _ResManager->GetResourcesList(aMachineList[0]);
   string clustername(p.Alias);
     
index d9153543e9b2b59f1854128b5523b12d82ddca4f..33e7fd76c238ce0d9835c3e6dceef564f4037ce0 100644 (file)
@@ -23,7 +23,7 @@
 #define __LAUNCHER_HXX__
 
 #ifdef WIN32
-# ifdef LAUNCHER_EXPORTS
+# if defined LAUNCHER_EXPORTS || defined Launcher_EXPORTS
 #  define LAUNCHER_EXPORT __declspec(dllexport)
 # else
 #  define LAUNCHER_EXPORT __declspec(dllimport)
index 00869eec808cdc3db817b4e4b4f40ffe88027695..9ec5bf1f992d6e5c4aae804b00f70d803bf6ed8d 100644 (file)
@@ -92,7 +92,6 @@ void SALOME_Launcher::Shutdown()
   _ResManager->Shutdown();
   PortableServer::ObjectId_var oid = _poa->servant_to_id(this);
   _poa->deactivate_object(oid);
-  //_remove_ref();
   if(!CORBA::is_nil(_orb))
     _orb->shutdown(0);
 }
@@ -199,12 +198,11 @@ SALOME_Launcher::testBatch(const Engines::MachineParameters& params)
   try
   {
     // find a cluster matching the structure params
-    Engines::CompoList aCompoList ;
-    Engines::MachineList *aMachineList = _ResManager->GetFittingResources(params, aCompoList);
+    Engines::MachineList *aMachineList = _ResManager->GetFittingResources(params);
     if (aMachineList->length() == 0)
       throw SALOME_Exception("No resources have been found with your parameters");
 
-    const Engines::MachineParameters* p = _ResManager->GetMachineParameters((*aMachineList)[0]);
+    const Engines::MachineDefinition* p = _ResManager->GetMachineParameters((*aMachineList)[0]);
     string clustername(p->alias);
     INFOS("Choose cluster" <<  clustername);
     
index 31b4e7ce1c0beec25eb2fb3f8b05c1f3ad814834..c9861c4e93b20dae63c7a1da3cc56188668d6b97 100755 (executable)
 
 using namespace std;
 
-#ifdef _DEBUG_
-static int MYDEBUG = 1;
-#else
-static int MYDEBUG = 0;
-#endif
-
 //=============================================================================
 /*!
  *  Constructor
index a321beadf7d6a59637bd3f026249c0cd37586352..6cd96d7fa69092d6016d5db95f10c3ac2c75df8d 100755 (executable)
@@ -23,7 +23,7 @@
 #define __SALOME_LAUNCHER_DEFS_HXX__
 
 #ifdef WIN32
-# ifdef SALOMELAUNCHER_EXPORTS
+# if defined SALOMELAUNCHER_EXPORTS || defined SalomeLauncher_EXPORTS
 #  define SALOMELAUNCHER_EXPORT __declspec(dllexport)
 # else
 #  define SALOMELAUNCHER_EXPORT __declspec(dllimport)
index 3f80d74531fff880a450a6a0dd9e0083419cab8c..26e08da5640e655d01c75e6852ec5820c0e8ccab 100644 (file)
@@ -130,12 +130,7 @@ string SALOME_FileTransferCORBA::getLocalFile(string localFile)
       params.container_name = _containerName.c_str();
       params.hostname = _refMachine.c_str();
 
-      Engines::CompoList clist;
-      Engines::MachineList_var listOfMachines =
-       resManager->GetFittingResources(params, clist);
-
-      container = contManager->FindOrStartContainer(params,
-                                                   listOfMachines);
+      container = contManager->FindOrStartContainer(params);
       if (CORBA::is_nil(container))
        {
          INFOS("machine " << _refMachine << " unreachable");
@@ -145,7 +140,7 @@ string SALOME_FileTransferCORBA::getLocalFile(string localFile)
       _theFileRef = container->createFileRef(_origFileName.c_str());
       if (CORBA::is_nil(_theFileRef))
        {
-         INFOS("imposssible to create fileRef on " << _refMachine);
+         INFOS("impossible to create fileRef on " << _refMachine);
          return "";
        }
     }
index 522ca0faabb5daa3ccc99b30b106a2f440b36f61..223a71511accb17fe759ec580ba1ceb507b5a9b3 100644 (file)
@@ -36,7 +36,7 @@
 #include <string>
 
 #ifdef WIN32
-# if defined LIFECYCLECORBA_EXPORTS
+# if defined LIFECYCLECORBA_EXPORTS || defined SalomeLifeCycleCORBA_EXPORTS
 #  define LIFECYCLECORBA_EXPORT __declspec( dllexport )
 # else
 #  define LIFECYCLECORBA_EXPORT __declspec( dllimport )
index 0d7e8b0f22943d9453024d4b4c416ac17800867e..2ad58629a526d88c5c5da3cc4f07683ba51f5f10 100644 (file)
@@ -51,6 +51,7 @@
 #include "SALOME_ContainerManager.hxx"
 #include "SALOME_Component_i.hxx"
 #include "SALOME_NamingService.hxx"
+#include "SALOME_FileTransferCORBA.hxx"
 
 using namespace std;
 
@@ -133,13 +134,12 @@ SALOME_LifeCycleCORBA::FindComponent(const Engines::MachineParameters& params,
   if (! isKnownComponentClass(componentName))
     return Engines::Component::_nil();
 
-  Engines::CompoList clist;
-  clist.length(1);
-  clist[0] = componentName;
-  Engines::MachineList_var listOfMachines =
-    _ResManager->GetFittingResources(params, clist);
+  Engines::MachineParameters parms(params);
+  parms.componentList.length(1);
+  parms.componentList[0] = componentName;
+  Engines::MachineList_var listOfMachines = _ResManager->GetFittingResources(parms);
 
-  Engines::Component_var compo = _FindComponent(params,
+  Engines::Component_var compo = _FindComponent(parms,
                                                componentName,
                                                studyId,
                                                listOfMachines);
@@ -167,16 +167,13 @@ SALOME_LifeCycleCORBA::LoadComponent(const Engines::MachineParameters& params,
   if (! isKnownComponentClass(componentName))
     return Engines::Component::_nil();
 
-  Engines::CompoList clist;
-  clist.length(1);
-  clist[0] = componentName;
-  Engines::MachineList_var listOfMachines =
-    _ResManager->GetFittingResources(params, clist);
+  Engines::MachineParameters parms(params);
+  parms.componentList.length(1);
+  parms.componentList[0] = componentName;
 
-  Engines::Component_var compo = _LoadComponent(params,
+  Engines::Component_var compo = _LoadComponent(parms,
                                                componentName,
-                                               studyId,
-                                               listOfMachines);
+                                               studyId);
 
   return compo._retn();
 }
@@ -203,22 +200,20 @@ FindOrLoad_Component(const Engines::MachineParameters& params,
   if (! isKnownComponentClass(componentName))
     return Engines::Component::_nil();
 
-  Engines::CompoList clist;
-  clist.length(1);
-  clist[0] = componentName;
-  Engines::MachineList_var listOfMachines =
-    _ResManager->GetFittingResources(params,clist);
+  Engines::MachineParameters parms(params);
+  parms.componentList.length(1);
+  parms.componentList[0] = componentName;
+  Engines::MachineList_var listOfMachines = _ResManager->GetFittingResources(parms);
 
-  Engines::Component_var compo = _FindComponent(params,
+  Engines::Component_var compo = _FindComponent(parms,
                                                componentName,
                                                studyId,
                                                listOfMachines);
 
   if(CORBA::is_nil(compo))
-    compo = _LoadComponent(params,
+    compo = _LoadComponent(parms,
                           componentName,
-                          studyId,
-                          listOfMachines);
+                          studyId);
 
   return compo._retn();
 }
@@ -368,13 +363,17 @@ void SALOME_LifeCycleCORBA::preSet( Engines::MachineParameters& params)
 {
   params.container_name = "";
   params.hostname = "";
+  //param.componentList = 0;
+  //param.computerList = 0;
   params.OS = "";
   params.mem_mb = 0;
   params.cpu_clock = 0;
   params.nb_proc_per_node = 0;
   params.nb_node = 0;
   params.isMPI = false;
-
+  params.workingdir = "";
+  params.mode = "";
+  params.policy = "";
   params.parallelLib = "";
   params.nb_component_nodes = 0;
 }
@@ -623,7 +622,6 @@ _FindComponent(const Engines::MachineParameters& params,
  *  \param params         machine parameters like type or name...
  *  \param componentName  the name of component class
  *  \param studyId        default = 0  : multistudy instance
- *  \param listOfMachines list of machine address
  *  \return a CORBA reference of the component instance, or _nil if problem
  */
 //=============================================================================
@@ -632,15 +630,12 @@ Engines::Component_ptr
 SALOME_LifeCycleCORBA::
 _LoadComponent(const Engines::MachineParameters& params, 
              const char *componentName,
-             int studyId,
-             const Engines::MachineList& listOfMachines)
+             int studyId)
 {
   MESSAGE("_LoadComponent, required " << params.container_name <<
          " " << componentName << " " << NbProc(params));
 
-  Engines::Container_var cont =
-    _ContManager->FindOrStartContainer(params,
-                                      listOfMachines);
+  Engines::Container_var cont = _ContManager->FindOrStartContainer(params);
   if (CORBA::is_nil(cont)) return Engines::Component::_nil();
 
   bool isLoadable = cont->load_component_Library(componentName);
@@ -672,19 +667,12 @@ SALOME_LifeCycleCORBA::Load_ParallelComponent(const Engines::MachineParameters&
   MESSAGE("Number of component nodes : " << params.nb_component_nodes);
   MESSAGE("Component Name : " << componentName);*/
 
-  Engines::CompoList clist;
-  clist.length(1);
-  clist[0] = componentName;
-  MESSAGE("Building a list of machines");
-  Engines::MachineList_var listOfMachines = _ResManager->GetFittingResources(params, clist);
-  if (listOfMachines->length() == 0)
-  {
-    INFOS("No matching machines founded !");
-    return Engines::Component::_nil();
-  }
+  Engines::MachineParameters parms(params);
+  parms.componentList.length(1);
+  parms.componentList[0] = componentName;
 
   MESSAGE("Starting Parallel Container");
-  Engines::Container_var cont = _ContManager->StartParallelContainer(params, Engines::P_FIRST, listOfMachines);
+  Engines::Container_var cont = _ContManager->StartParallelContainer(parms);
   if (CORBA::is_nil(cont)) {
     INFOS("FindOrStartParallelContainer() returns a NULL container !");
     return Engines::Component::_nil();
@@ -707,3 +695,33 @@ SALOME_LifeCycleCORBA::Load_ParallelComponent(const Engines::MachineParameters&
   return myInstance._retn();
 }
 
+/*! \brief copy a file from a source host to a destination host
+ * \param hostSrc the source host
+ * \param fileSrc the file to copy from the source host to the destination host
+ * \param hostDest the destination host
+ * \param fileDest the destination file
+ */
+void SALOME_LifeCycleCORBA::copyFile(const char* hostSrc, const char* fileSrc, const char* hostDest, const char* fileDest)
+{
+  if(strcmp(hostDest,"localhost") == 0)
+    {
+      //if localhost use a shortcut
+      SALOME_FileTransferCORBA transfer(hostSrc,fileSrc);
+      transfer.getLocalFile(fileDest);
+      return;
+    }
+
+  Engines::ContainerManager_var contManager = getContainerManager();
+
+  Engines::MachineParameters params;
+  preSet(params);
+
+  params.hostname = hostDest;
+  Engines::Container_var containerDest = contManager->FindOrStartContainer(params);
+
+  params.hostname = hostSrc;
+  Engines::Container_var containerSrc = contManager->FindOrStartContainer(params);
+
+  containerDest->copyFile(containerSrc,fileSrc,fileDest);
+}
+
index 3c73ad3f98b496e79b3980f046999bbd3a78a5c5..4083c428b6919d0bfe50a5f9ea5fb282839f0b33 100644 (file)
@@ -41,7 +41,7 @@
 #include <iostream>
 
 #ifdef WIN32
-# if defined LIFECYCLECORBA_EXPORTS
+# if defined LIFECYCLECORBA_EXPORTS || defined SalomeLifeCycleCORBA_EXPORTS
 #  define LIFECYCLECORBA_EXPORT __declspec( dllexport )
 # else
 #  define LIFECYCLECORBA_EXPORT __declspec( dllimport )
@@ -98,10 +98,11 @@ public:
 
   int NbProc(const Engines::MachineParameters& params);
 
-  void preSet(Engines::MachineParameters& params);
+  static void preSet(Engines::MachineParameters& outparams);
 
   Engines::ContainerManager_ptr getContainerManager();
   Engines::ResourcesManager_ptr getResourcesManager();
+  void copyFile(const char* hostSrc, const char* fileSrc, const char* hostDest, const char* fileDest);
 
   void shutdownServers();
   static void killOmniNames();
@@ -122,8 +123,7 @@ protected:
   Engines::Component_ptr
   _LoadComponent(const Engines::MachineParameters& params,
                 const char *componentName,
-                int studyId,
-                const Engines::MachineList& listOfMachines);
+                int studyId);
   
   SALOME_NamingService *_NS;
   Engines::ContainerManager_var _ContManager;
index 9629055e62fcc1684396b29625fb3b6f0eb760e1..fa4fc4777d6fd991563605c716baf80b0e33905a 100644 (file)
@@ -681,12 +681,10 @@ string LifeCycleCORBATest::GetRemoteHost()
 
   Engines::MachineParameters params;
   _LCC.preSet(params);               // empty params to get all the machines
+  params.componentList.length(1);
+  params.componentList[0]="SalomeTestComponent";
 
-  Engines::CompoList clist;
-  clist.length(1);
-  clist[0] = "SalomeTestComponent";
-  Engines::MachineList_var hostList =
-    resourcesManager->GetFittingResources(params,clist);
+  Engines::MachineList_var hostList = resourcesManager->GetFittingResources(params);
   CPPUNIT_ASSERT(hostList->length() > 1);
 
   string localHost = Kernel_Utils::GetHostname();
index fc09b92e657e55daae701af9224f2b3f7e142d77..aaa52b195c3cdc00ceb06f1a0cde02ff1cbbfcd5 100644 (file)
@@ -66,10 +66,9 @@ int main (int argc, char * argv[])
   Engines::ResourcesManager_var _ResManager=Engines::ResourcesManager::_narrow(obj);
 
   Engines::MachineParameters p;
-  Engines::CompoList clist;
-  clist.length(2);
-  clist[0] = "MED";
-  clist[1] = "GEOM";
+  p.componentList.length(2);
+  p.componentList[0] = "MED";
+  p.componentList[1] = "GEOM";
 
   p.hostname = "";
   p.OS = "LINUX";
@@ -83,19 +82,22 @@ int main (int argc, char * argv[])
   for(int i=0;i<10;i++){
     sprintf(st,"cycl_%d",i);
     p.container_name = CORBA::string_dup(st);
-    cont = _ContManager->GiveContainer(p,Engines::P_CYCL,clist);
+    p.policy="cycl";
+    cont = _ContManager->GiveContainer(p);
     if(CORBA::is_nil(cont)) error = true;
   }
 
   for(int i=0;i<10;i++){
     sprintf(st,"first_%d",i);
     p.container_name = CORBA::string_dup(st);
-    cont = _ContManager->GiveContainer(p,Engines::P_FIRST,clist);
+    p.policy="best";
+    cont = _ContManager->GiveContainer(p);
     if(CORBA::is_nil(cont)) error = true;
   }
 
   p.container_name = CORBA::string_dup("best");
-  cont = _ContManager->GiveContainer(p,Engines::P_BEST,clist);
+  p.policy="best";
+  cont = _ContManager->GiveContainer(p);
   if(CORBA::is_nil(cont)) bestImplemented = false;
   else bestImplemented = true;
 
@@ -139,7 +141,7 @@ int main (int argc, char * argv[])
   int nbpmax;
   for(std::map<std::string,int>::iterator iter=cycle.begin();iter!=cycle.end();iter++){
     if(strcmp((*iter).first.c_str(),"localhost")!=0){
-      Engines::MachineParameters *p = _ResManager->GetMachineParameters((*iter).first.c_str());
+      Engines::MachineDefinition *p = _ResManager->GetMachineParameters((*iter).first.c_str());
       int nbproc = p->nb_node * p->nb_proc_per_node;
       if(cycle[(*iter).first]/nbproc<cmin) cmin=cycle[(*iter).first]/nbproc;
       if(cycle[(*iter).first]/nbproc>cmax) cmax=cycle[(*iter).first]/nbproc;
index 2b5670b71093cac6c89785ea4c9bf714094e8a42..7946e1d54ca12b625cf7ba11758d2bc80a9a4dac 100644 (file)
@@ -37,3 +37,12 @@ class LifeCycleCORBA (SALOME_LifeCycleCORBA):
         return SALOME_LifeCycleCORBA.FindOrLoad_Component(self,
                                                           containerName,
                                                           componentName)
+
+class MachineParameters (Engines.MachineParameters):
+          def __init__(self, container_name='', hostname='', componentList=[], computerList=[], OS='', 
+                             mem_mb=0, cpu_clock=0, nb_proc_per_node=0, nb_node=0, isMPI=False, workingdir='', 
+                             mode='start', policy='altcycl', parallelLib='', nb_component_nodes=0):
+            Engines.MachineParameters.__init__(self,container_name, hostname, componentList, computerList, OS, 
+                                                    mem_mb, cpu_clock, nb_proc_per_node, nb_node, isMPI, workingdir, 
+                                                    mode, policy, parallelLib, nb_component_nodes)
+
index b0cd8a4995651a53290e6621cf09bd47a460258e..0b5126cbe2019a2d252c768bab992dffa7f9d6f4 100644 (file)
@@ -88,7 +88,7 @@ EXTRA_DIST = $(SWIGSOURCES)
 #
 
 # Scripts to be installed.
-dist_salomescript_DATA =\
+dist_salomescript_PYTHON =\
        LifeCycleCORBA.py \
        TestLifeCycleCORBA.py
 
index d74b615377bacbf4f9e17814b673d136406325e3..ba9331b2f9eddc0f24d3a0d46bb680452da44698 100644 (file)
@@ -178,7 +178,7 @@ class LifeCycleCORBA_SWIGTest(unittest.TestCase):
         try:
             cp1=self.lcc.FindOrLoad_Component(containerName,"SalomeTestComponent")
         except RuntimeError,ex :
-            self.assertEqual(ex.args[0],'Salome Exception : unknown host')
+            self.assertEqual(ex.args[0],'unknown host')
         pass
        
     
index d9614245ef0d00e5c32d63e3737d313eff745c72..4191c3d5e0edc4b1b27d5f08d991c195529e0641 100644 (file)
@@ -36,8 +36,10 @@ include $(top_srcdir)/salome_adm/unix/make_common_starter.am
 salomeinclude_HEADERS=
 
 # Scripts to be installed
-dist_salomescript_SCRIPTS = \
+dist_salomescript_PYTHON = \
        LifeCycleCORBA_SWIGTest.py \
+       testresourcemanager.py \
+       testcontainermanager.py \
        TestLifeCycleCORBA_SWIG.py
 
 #
@@ -67,3 +69,8 @@ lib_LTLIBRARIES =
 # ===============================================================
 #
 bin_PROGRAMS =
+
+install-data-hook:
+       @for f in $(dist_salomescript_PYTHON) ; do \
+          chmod -f a+x $(DESTDIR)$(salomescriptdir)/$$f ; \
+        done
diff --git a/src/LifeCycleCORBA_SWIG/Test/testcontainermanager.py b/src/LifeCycleCORBA_SWIG/Test/testcontainermanager.py
new file mode 100644 (file)
index 0000000..256d337
--- /dev/null
@@ -0,0 +1,56 @@
+import unittest
+import salome
+import Engines
+import LifeCycleCORBA
+salome.salome_init()
+cm= salome.lcc.getContainerManager()
+rm= salome.lcc.getResourcesManager()
+
+class TestContainerManager(unittest.TestCase):
+  """
+Test with catalog :
+<!DOCTYPE ResourcesCatalog>
+<resources>
+   <machine hostname="claui2c6" >
+   </machine>
+   <machine hostname="clt10br" >
+   </machine>
+</resources>
+"""
+  def setUp(self):
+    pass
+
+  def test0(self):
+    """"""
+    p=LifeCycleCORBA.MachineParameters(container_name="MyContainer",mode="start",
+                                       policy="best",componentList=["PYHELLO"])
+    co=cm.StartContainer( p )
+    print "Container:",co,co.getHostName(), co.getPID(),co._get_name()
+    self.assertEqual(co._get_name(), "/Containers/claui2c6/MyContainer")
+    co=cm.StartContainer( p )
+    self.assertEqual(co._get_name(), "/Containers/clt10br/MyContainer")
+
+  def test1(self):
+    """"""
+    p=LifeCycleCORBA.MachineParameters(container_name="MyContainer",mode="get",
+                                       policy="best",componentList=["PYHELLO"])
+    co=cm.StartContainer( p )
+    print "Container:",co,co.getHostName(), co.getPID(),co._get_name()
+    self.assertEqual(co._get_name(), "/Containers/claui2c6/MyContainer")
+    co=cm.StartContainer( p )
+    self.assertEqual(co._get_name(), "/Containers/clt10br/MyContainer")
+
+  def test2(self):
+    """"""
+    p=LifeCycleCORBA.MachineParameters(container_name="MyContainer",mode="getorstart",
+                                       policy="best",componentList=["PYHELLO"])
+    co=cm.StartContainer( p )
+    print "Container:",co,co.getHostName(), co.getPID(),co._get_name()
+    self.assertEqual(co._get_name(), "/Containers/claui2c6/MyContainer")
+    co=cm.StartContainer( p )
+    self.assertEqual(co._get_name(), "/Containers/clt10br/MyContainer")
+
+
+if __name__ == '__main__':
+  unittest.main()
+
diff --git a/src/LifeCycleCORBA_SWIG/Test/testresourcemanager.py b/src/LifeCycleCORBA_SWIG/Test/testresourcemanager.py
new file mode 100644 (file)
index 0000000..aba6295
--- /dev/null
@@ -0,0 +1,116 @@
+import unittest
+import salome
+import LifeCycleCORBA
+salome.salome_init()
+cm= salome.lcc.getContainerManager()
+rm= salome.lcc.getResourcesManager()
+
+class TestResourceManager(unittest.TestCase):
+  """
+Test with CatalogResources.xml:
+<!DOCTYPE ResourcesCatalog>
+<resources>
+   <machine hostname="m1" />
+   <machine hostname="m2" />
+   <machine hostname="m3" >
+     <modules moduleName="tutu" />
+   </machine>
+   <machine hostname="m4" >
+     <component name="sub" moduleName="tata" />
+   </machine>
+   <machine hostname="claui2c6" >
+     <modules moduleName="toto" />
+     <component name="add" moduleName="titi" />
+   </machine>
+</resources>
+"""
+  def setUp(self):
+    pass
+
+  def test0(self):
+    """host required"""
+    params=LifeCycleCORBA.MachineParameters(hostname="m3")
+    machineList=rm.GetFittingResources(params)
+    self.assertEqual(machineList, ["m3"])
+
+  def test1(self):
+    """OS required"""
+    params=LifeCycleCORBA.MachineParameters(OS="Linux")
+    machineList=rm.GetFittingResources(params)
+    self.assertEqual(machineList, [])
+
+  def test2(self):
+    """component add required"""
+    params=LifeCycleCORBA.MachineParameters(componentList=["add"])
+    machineList=rm.GetFittingResources(params)
+    self.assertEqual(machineList, ['claui2c6', 'm1', 'm2'])
+
+  def test3(self):
+    """component tutu required"""
+    machineList=rm.GetFittingResources(LifeCycleCORBA.MachineParameters(componentList=["tutu"]))
+    self.assertEqual(machineList, ['m1', 'm2', 'm3'])
+
+  def test4(self):
+    """component tata required"""
+    machineList=rm.GetFittingResources(LifeCycleCORBA.MachineParameters(componentList=["tata"]))
+    self.assertEqual(machineList, ['m1', 'm2'])
+
+  def test5(self):
+    """component titi required"""
+    machineList=rm.GetFittingResources(LifeCycleCORBA.MachineParameters(componentList=["titi"]))
+    self.assertEqual(machineList, ['m1', 'm2'])
+
+  def test6(self):
+    """component toto required"""
+    machineList=rm.GetFittingResources(LifeCycleCORBA.MachineParameters(componentList=["toto"]))
+    self.assertEqual(machineList, ['claui2c6', 'm1', 'm2'])
+
+  def test7(self):
+    """components add and toto required"""
+    machineList=rm.GetFittingResources(LifeCycleCORBA.MachineParameters(componentList=["add","toto"]))
+    self.assertEqual(machineList, ['claui2c6', 'm1', 'm2'])
+
+  def test8(self):
+    """components add and toto required"""
+    machineDef=rm.GetMachineParameters('claui2c6')
+    self.assertEqual(machineDef.componentList, ['toto', 'add'])
+
+  def test10(self):
+    """policy altcycl"""
+    machineList=rm.GetFittingResources(LifeCycleCORBA.MachineParameters(componentList=["add","toto"]))
+    self.assertEqual(rm.Find('altcycl',machineList), "claui2c6")
+    self.assertEqual(rm.Find('altcycl',machineList), "m1")
+    self.assertEqual(rm.Find('altcycl',machineList), "m2")
+    self.assertEqual(rm.Find('altcycl',machineList), "claui2c6")
+    self.assertEqual(rm.Find('altcycl',machineList), "m1")
+    self.assertEqual(rm.Find('altcycl',machineList), "m2")
+
+  def test11(self):
+    """policy cycl"""
+    machineList=rm.GetFittingResources(LifeCycleCORBA.MachineParameters(componentList=["add","toto"]))
+    self.assertEqual(rm.Find('cycl',machineList), "claui2c6")
+    self.assertEqual(rm.Find('cycl',machineList), "m1")
+    self.assertEqual(rm.Find('cycl',machineList), "m2")
+    self.assertEqual(rm.Find('cycl',machineList), "claui2c6")
+    self.assertEqual(rm.Find('cycl',machineList), "m1")
+    self.assertEqual(rm.Find('cycl',machineList), "m2")
+
+  def test12(self):
+    """policy first"""
+    machineList=rm.GetFittingResources(LifeCycleCORBA.MachineParameters(componentList=["add","toto"]))
+    self.assertEqual(rm.Find('first',machineList), "claui2c6")
+    self.assertEqual(rm.Find('first',machineList), "claui2c6")
+
+  def test13(self):
+    """policy best"""
+    machineList=rm.GetFittingResources(LifeCycleCORBA.MachineParameters(componentList=["add","toto"]))
+    self.assertEqual(rm.Find('best',machineList), "claui2c6")
+    self.assertEqual(rm.Find('best',machineList), "m1")
+    self.assertEqual(rm.Find('best',machineList), "m2")
+    self.assertEqual(rm.Find('best',machineList), "claui2c6")
+    self.assertEqual(rm.Find('best',machineList), "m1")
+    self.assertEqual(rm.Find('best',machineList), "m2")
+
+if __name__ == '__main__':
+  unittest.main()
+
index d2d5fe26866fac3e40e762b5bf3724032d206e1f..22da974baf643569d1685f9570c3a81c87c72693 100644 (file)
@@ -26,6 +26,7 @@
 %feature("autodoc", "1");
 
 %include <std_except.i>
+%include "std_string.i"
 
 
 // ----------------------------------------------------------------------------
@@ -43,19 +44,19 @@ typedef int Py_ssize_t;
 #define PY_SSIZE_T_MIN INT_MIN
 #endif
 
-  using namespace std;
+using namespace std;
 
 //--- from omniORBpy.h (not present on Debian Sarge packages)
 
 struct omniORBpyAPI {
 
   PyObject* (*cxxObjRefToPyObjRef)(const CORBA::Object_ptr cxx_obj,
-                                  CORBA::Boolean hold_lock);
+                                   CORBA::Boolean hold_lock);
   // Convert a C++ object reference to a Python object reference.
   // If <hold_lock> is true, caller holds the Python interpreter lock.
 
   CORBA::Object_ptr (*pyObjRefToCxxObjRef)(PyObject* py_obj,
-                                          CORBA::Boolean hold_lock);
+                                           CORBA::Boolean hold_lock);
   // Convert a Python object reference to a C++ object reference.
   // Raises BAD_PARAM if the Python object is not an object reference.
   // If <hold_lock> is true, caller holds the Python interpreter lock.
@@ -65,7 +66,7 @@ struct omniORBpyAPI {
   // Constructor for the singleton. Sets up the function pointers.
 };
 
-  omniORBpyAPI* api;
+omniORBpyAPI* api;
 
 %}
 
@@ -80,8 +81,7 @@ struct omniORBpyAPI {
   PyObject* omnipy = PyImport_ImportModule((char*)"_omnipy");
   if (!omnipy)
   {
-    PyErr_SetString(PyExc_ImportError,
-                   (char*)"Cannot import _omnipy");
+    PyErr_SetString(PyExc_ImportError, (char*)"Cannot import _omnipy");
     return;
   }
   PyObject* pyapi = PyObject_GetAttrString(omnipy, (char*)"API");
@@ -92,8 +92,11 @@ struct omniORBpyAPI {
 
 
 // ----------------------------------------------------------------------------
+using namespace std;
 
-%typemap(python,out) Engines::Container_ptr, Engines::Component_ptr, Engines::fileRef_ptr
+
+%typemap(out) Engines::Container_ptr, Engines::Component_ptr, Engines::fileRef_ptr,
+              Engines::ContainerManager_ptr, Engines::ResourcesManager_ptr 
 {
   MESSAGE("typemap out on CORBA object ptr");
   SCRUTE($1);
@@ -101,7 +104,12 @@ struct omniORBpyAPI {
   SCRUTE($result);
 }
 
-%typemap(python,in) Engines::fileRef_ptr aFileRef
+%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER) Engines::fileRef_ptr
+{
+  $1=PyObject_HasAttrString($input, "__omni_obj");
+}
+
+%typemap(in) Engines::fileRef_ptr aFileRef
 {
   MESSAGE("typemap in on CORBA object ptr");
   try {
@@ -114,114 +122,72 @@ struct omniORBpyAPI {
   }
 }
 
-
-%typemap(python,out) std::string, 
-                   string
-{
-  MESSAGE("typemap out on std::string");
-  SCRUTE($1);
-  $result = PyString_FromString($1.c_str());
-}
-
-%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER) Engines::MachineParameters const &
-{
-  $1 = PyDict_Check($input)? 1 : 0;
-}
 %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER) const Engines::MachineParameters &
 {
   $1 = PyDict_Check($input)? 1 : 0;
 }
 
-%typemap(typecheck) std::string, 
-                   string
-{
-  $1 = PyString_Check($input);
-}
-
-%typemap(python,in) std::string, 
-                   string
-{
-  MESSAGE("typemap in on std::string");
-  std::string str;
-  if (PyString_Check($input) == 1)
-    {
-      char* value = PyString_AsString($input);
-      str = value;
-      $1 = str;
-    }
-  else 
-    {
-       MESSAGE("Not a string");
-       PyErr_SetString(PyExc_TypeError,"Must Be a Python string");
-       return NULL;
-    }
-}
-
-
-%typemap(python,in) const Engines::MachineParameters &
+%typemap(in) const Engines::MachineParameters &
 {
   //printf("typemap in on Engines::MachineParameters\n");
   MESSAGE("typemap in on Engines::MachineParameters");
   if (PyDict_Check($input) == 1)
     {
       Engines::MachineParameters *param = new Engines::MachineParameters ;
-      param->container_name = CORBA::string_dup("");
-      param->hostname = CORBA::string_dup("");
-      param->OS = CORBA::string_dup("");
-      param->mem_mb = 0;
-      param->cpu_clock = 0;
-      param->nb_proc_per_node = 0;
-      param->nb_node = 0;
-      param->isMPI = false;
-      param->parallelLib = CORBA::string_dup("");
-      param->nb_component_nodes = 0;
+      SALOME_LifeCycleCORBA::preSet(*param);
+
       PyObject *key, *value;
       Py_ssize_t pos = 0;
       while (PyDict_Next($input, &pos, &key, &value))
-       {
-         char* keystr = PyString_AsString(key);
-         printf("key: %s\n", keystr);
-         if (strcmp(keystr,"container_name")==0)
-           {
-             param->container_name = CORBA::string_dup(PyString_AsString(value));
-           }
-         else if (strcmp(keystr,"hostname")==0)
-           {
-             param->hostname = CORBA::string_dup(PyString_AsString(value));
-           }
-         else if (strcmp(keystr,"OS")==0)
-           {
-             param->OS = CORBA::string_dup(PyString_AsString(value));
-           }
-         else if (strcmp(keystr,"mem_mb")==0)
-           {
-             param->mem_mb = PyLong_AsLong(value);
-           }
-         else if (strcmp(keystr,"cpu_clock")==0)
-           {
-             param->cpu_clock = PyLong_AsLong(value);
-           }
-         else if (strcmp(keystr,"nb_proc_per_node")==0)
-           {
-             param->nb_proc_per_node = PyLong_AsLong(value);
-           }
-         else if (strcmp(keystr,"nb_node")==0)
-           {
-             param->nb_node = PyLong_AsLong(value);
-           }
-         else if (strcmp(keystr,"isMPI")==0)
-           {
-             param->isMPI = PyLong_AsLong(value);
-           }
-         else if (strcmp(keystr,"parallelLib")==0)
-           {
-             param->parallelLib = CORBA::string_dup(PyString_AsString(value));
-           }
-         else if (strcmp(keystr,"nb_component_nodes")==0)
-           {
-             param->nb_component_nodes = PyLong_AsLong(value);
-           }
-       }
+       {
+         char* keystr = PyString_AsString(key);
+         if (strcmp(keystr,"container_name")==0)
+           {
+             param->container_name = CORBA::string_dup(PyString_AsString(value));
+           }
+         else if (strcmp(keystr,"hostname")==0)
+           {
+             param->hostname = CORBA::string_dup(PyString_AsString(value));
+           }
+         else if (strcmp(keystr,"OS")==0)
+           {
+             param->OS = CORBA::string_dup(PyString_AsString(value));
+           }
+         else if (strcmp(keystr,"mem_mb")==0)
+           {
+             param->mem_mb = PyLong_AsLong(value);
+           }
+         else if (strcmp(keystr,"cpu_clock")==0)
+           {
+             param->cpu_clock = PyLong_AsLong(value);
+           }
+         else if (strcmp(keystr,"nb_proc_per_node")==0)
+           {
+             param->nb_proc_per_node = PyLong_AsLong(value);
+           }
+         else if (strcmp(keystr,"nb_node")==0)
+           {
+             param->nb_node = PyLong_AsLong(value);
+           }
+         else if (strcmp(keystr,"isMPI")==0)
+           {
+             param->isMPI = PyLong_AsLong(value);
+           }
+         else if (strcmp(keystr,"workingdir")==0)
+             param->workingdir = CORBA::string_dup(PyString_AsString(value));
+         else if (strcmp(keystr,"mode")==0)
+             param->mode = CORBA::string_dup(PyString_AsString(value));
+         else if (strcmp(keystr,"policy")==0)
+             param->policy = CORBA::string_dup(PyString_AsString(value));
+         else if (strcmp(keystr,"parallelLib")==0)
+           {
+             param->parallelLib = CORBA::string_dup(PyString_AsString(value));
+           }
+         else if (strcmp(keystr,"nb_component_nodes")==0)
+           {
+             param->nb_component_nodes = PyLong_AsLong(value);
+           }
+       }
       $1 = param;
     }
   else 
@@ -233,7 +199,7 @@ struct omniORBpyAPI {
 }
 
 
-%typemap(python,freearg) const Engines::MachineParameters &
+%typemap(freearg) const Engines::MachineParameters &
 {
   MESSAGE("delete $1");
   delete $1;
index db56c6be81faefcbac5fdc46d03f883995166d71..e763aa4f69353ceb22555b0f3c02da9cfb8c0985 100644 (file)
@@ -68,4 +68,4 @@ libSalomeLoggerServer_la_LIBADD  = \
        @CORBA_LIBS@
 
 # Scripts target
-dist_salomescript_DATA = SALOME_Trace.py
+dist_salomescript_PYTHON = SALOME_Trace.py
index a206328578990dac120877775a2a92badd600dbf..b7f0b913f91e78ff07062d0ad82ee92178c647fd 100644 (file)
@@ -37,7 +37,7 @@
 #include "Logger.hh"
 
 #ifdef WIN32
-# if defined LOGGER_EXPORTS
+# if defined LOGGER_EXPORTS || defined SalomeLoggerServer_EXPORTS
 #  define LOGGER_EXPORT __declspec( dllexport )
 # else
 #  define LOGGER_EXPORT __declspec( dllimport )
index ce73c7f6d22d0449b20e18e730ff83677a4e8ef0..3617c6c4b6c4c4c5df4c89bf82743f0d324cb83a 100644 (file)
@@ -144,9 +144,9 @@ void SALOME_Trace::putMessage(ostream& msg)
 
   //   CORBA::String_var LogMsg = CORBA::string_dup( str() );
   //Allow automatic deletion of ostrstream content 
-  char* adt = str();
+  const char* adt = str().c_str();
   CORBA::String_var LogMsg = CORBA::string_dup( adt );
-  rdbuf()->freeze(false);
+  //rdbuf()->freeze(false);
   //rdbuf()->sync(); // problem with gcc3.2
   seekp(0);
 
index a9d2ebd7f0cc39edc2667ba6505a962e8288adee..261d270059b2312e7bd3389893b9a1ed36cf481e 100644 (file)
@@ -27,7 +27,7 @@
 #if !defined(AFX_LOGGER_H__96F2A3AB_F6F8_11D6_BFA6_000476A0958C__INCLUDED_)
 #define AFX_LOGGER_H__96F2A3AB_F6F8_11D6_BFA6_000476A0958C__INCLUDED_
 
-#include <strstream>
+#include <sstream>
 #include <SALOMEconfig.h>
 #include "Logger.hh"
 
@@ -62,7 +62,7 @@
 
 # endif  /* WIN32 */
 
-class SALOME_Trace : public std::ostrstream  
+class SALOME_Trace : public std::ostringstream  
 {
 public:
        virtual ~SALOME_Trace();
index 074eb6039ac285ae66ff1a7b0aacf976bcd462cf..d24a8db43d2379656c57de652a15eb2580a3cc05 100644 (file)
@@ -34,4 +34,4 @@ include $(top_srcdir)/salome_adm/unix/make_common_starter.am
 #
 
 # Executable scripts to be installed
-dist_salomescript_SCRIPTS = TestKiller.py 
+dist_salomescript_PYTHON = TestKiller.py 
index e7bd42494f6fe62349ce13e3f9429d07a4c3ddd4..943238344b4eba90beb58664b8d38fb9e24f4694 100644 (file)
@@ -116,18 +116,26 @@ void Engines_MPIContainer_i::Shutdown()
 // Load a component library
 bool Engines_MPIContainer_i::load_component_Library(const char* componentName)
 {
-  if( _numproc == 0 ){
-    // Invocation du chargement du composant dans les autres process
-    for(int ip= 1;ip<_nbproc;ip++)
-      (Engines::MPIContainer::_narrow((*_tior)[ip]))->Asload_component_Library(componentName);
+  pthread_t *th;
+  if(_numproc == 0){
+    th = new pthread_t[_nbproc];
+    for(int ip=1;ip<_nbproc;ip++){
+      thread_st *st = new thread_st;
+      st->ip = ip;
+      st->tior = _tior;
+      st->compoName = componentName;
+      pthread_create(&(th[ip]),NULL,th_loadcomponentlibrary,(void*)st);
+    }
   }
 
-  return Lload_component_Library(componentName);
-}
+  bool ret = Lload_component_Library(componentName);
 
-void Engines_MPIContainer_i::Asload_component_Library(const char* componentName)
-{
-  Lload_component_Library(componentName);
+  if(_numproc == 0){
+    for(int ip=1;ip<_nbproc;ip++)
+      pthread_join(th[ip],NULL);
+    delete th;
+  }
+  return ret;
 }
 
 bool Engines_MPIContainer_i::Lload_component_Library(const char* componentName)
@@ -155,14 +163,12 @@ bool Engines_MPIContainer_i::Lload_component_Library(const char* componentName)
       _library_map[impl_name] = handle;
       _numInstanceMutex.unlock();
       MESSAGE("[" << _numproc << "] Library " << impl_name << " loaded");
-      MPI_Barrier(MPI_COMM_WORLD);
       return true;
     }
   else
     {
       MESSAGE("[" << _numproc << "] Can't load shared library : " << impl_name);
       MESSAGE("[" << _numproc << "] error dlopen: " << dlerror());
-      MPI_Barrier(MPI_COMM_WORLD);
     }
   _numInstanceMutex.unlock();
 
@@ -206,19 +212,28 @@ Engines::Component_ptr
 Engines_MPIContainer_i::create_component_instance( const char* componentName,
                                                   CORBA::Long studyId)
 {
-  if( _numproc == 0 ){
-    // Invocation du chargement du composant dans les autres process
-    for(int ip= 1;ip<_nbproc;ip++)
-      (Engines::MPIContainer::_narrow((*_tior)[ip]))->Ascreate_component_instance(componentName,studyId);
+  pthread_t *th;
+  if(_numproc == 0){
+    th = new pthread_t[_nbproc];
+    for(int ip=1;ip<_nbproc;ip++){
+      thread_st *st = new thread_st;
+      st->ip = ip;
+      st->tior = _tior;
+      st->compoName = componentName;
+      st->studyId = studyId;
+      pthread_create(&(th[ip]),NULL,th_createcomponentinstance,(void*)st);
+    }
   }
 
-  return Lcreate_component_instance(componentName,studyId);
-}
+  Engines::Component_ptr cptr = Lcreate_component_instance(componentName,studyId);
 
-void Engines_MPIContainer_i::Ascreate_component_instance( const char* componentName,
-                                                         CORBA::Long studyId)
-{
-  Lcreate_component_instance(componentName,studyId);
+  if(_numproc == 0){
+    for(int ip=1;ip<_nbproc;ip++)
+      pthread_join(th[ip],NULL);
+    delete th;
+  }
+
+  return cptr;
 }
 
 Engines::Component_ptr
@@ -387,24 +402,31 @@ Engines_MPIContainer_i::createMPIInstance(string genericRegisterName,
 Engines::Component_ptr Engines_MPIContainer_i::load_impl(const char* nameToRegister,
                                                 const char* componentName)
 {
-  if( _numproc == 0 ){
-    // Invocation du chargement du composant dans les autres process
-    for(int ip= 1;ip<_nbproc;ip++)
-      (Engines::MPIContainer::_narrow((*_tior)[ip]))->Asload_impl(nameToRegister,
-                                                               componentName);
+  pthread_t *th;
+  if(_numproc == 0){
+    th = new pthread_t[_nbproc];
+    for(int ip=1;ip<_nbproc;ip++){
+      thread_st *st = new thread_st;
+      st->ip = ip;
+      st->tior = _tior;
+      st->nameToRegister = nameToRegister;
+      st->compoName = componentName;
+      pthread_create(&(th[ip]),NULL,th_loadimpl,(void*)st);
+    }
   }
 
-  return Lload_impl(nameToRegister,componentName);
+  Engines::Component_ptr cptr =  Lload_impl(nameToRegister,componentName);
 
-}
+  if(_numproc == 0){
+    for(int ip=1;ip<_nbproc;ip++)
+      pthread_join(th[ip],NULL);
+    delete th;
+  }
 
-// Load component
-void Engines_MPIContainer_i::Asload_impl(const char* nameToRegister,
-                                        const char* componentName)
-{
-  Lload_impl(nameToRegister,componentName);
+  return cptr;
 }
 
+// Load component
 Engines::Component_ptr Engines_MPIContainer_i::Lload_impl(
                                   const char* nameToRegister,
                                   const char* componentName)
@@ -492,83 +514,106 @@ Engines::Component_ptr Engines_MPIContainer_i::Lload_impl(
 
 void Engines_MPIContainer_i::remove_impl(Engines::Component_ptr component_i)
 {
-  int ip;
-  Engines::Component_ptr cptr;
   Engines::MPIObject_ptr pcptr;
   Engines::MPIObject_ptr spcptr;
 
-  ASSERT(! CORBA::is_nil(component_i));
-
-  if( _numproc == 0 ){
-    // Invocation de la destruction du composant dans les autres process
+  pthread_t *th;
+  if(_numproc == 0){
     pcptr = (Engines::MPIObject_ptr)component_i;
-    for(ip= 1;ip<_nbproc;ip++){
+    th = new pthread_t[_nbproc];
+    for(int ip=1;ip<_nbproc;ip++){
+      thread_st *st = new thread_st;
+      st->ip = ip;
+      st->tior = _tior;
       spcptr = Engines::MPIObject::_narrow((*(pcptr->tior()))[ip]);
-      cptr = (Engines::Component_ptr)spcptr;
-      (Engines::MPIContainer::_narrow((*_tior)[ip]))->Asremove_impl(cptr);
+      st->cptr = (Engines::Component_ptr)spcptr;
+      pthread_create(&(th[ip]),NULL,th_removeimpl,(void*)st);
     }
   }
 
-  Lremove_impl(component_i);
-}
-
-void Engines_MPIContainer_i::Asremove_impl(Engines::Component_ptr component_i)
-{
-  Lremove_impl(component_i);
-}
-
-void Engines_MPIContainer_i::Lremove_impl(Engines::Component_ptr component_i)
-{
-  BEGIN_OF("[" << _numproc << "] MPIContainer_i::Lremove_impl");
-
   ASSERT(! CORBA::is_nil(component_i));
-
   string instanceName = component_i->instanceName() ;
   MESSAGE("[" << _numproc << "] unload component " << instanceName);
-  component_i->destroy() ;
-  MESSAGE("[" << _numproc << "] test key handle_map");
   _numInstanceMutex.lock() ; // lock on the remove on handle_map
+  _listInstances_map.erase(instanceName);
   _numInstanceMutex.unlock() ;
-  MESSAGE("[" << _numproc << "] list handle_map");
+  component_i->destroy() ;
+  if(_numproc == 0)
+    _NS->Destroy_Name(instanceName.c_str());
 
-  END_OF("[" << _numproc << "] MPIContainer_i::Lremove_impl");
+  if(_numproc == 0){
+    for(int ip=1;ip<_nbproc;ip++)
+      pthread_join(th[ip],NULL);
+    delete th;
+  }
 
 }
 
 void Engines_MPIContainer_i::finalize_removal()
 {
-  int ip;
+  pthread_t *th;
+  if(_numproc == 0){
+    th = new pthread_t[_nbproc];
+    for(int ip=1;ip<_nbproc;ip++){
+      thread_st *st = new thread_st;
+      st->ip = ip;
+      st->tior = _tior;
+      pthread_create(&(th[ip]),NULL,th_finalizeremoval,(void*)st);
+    }
+  }
 
-  if( _numproc == 0 ){
-    // Invocation de la destruction du composant dans les autres process
-    for(ip= 1;ip<_nbproc;ip++)
-      (Engines::MPIContainer::_narrow((*_tior)[ip]))->Asfinalize_removal();
+  _numInstanceMutex.lock(); // lock to be alone
+  // (see decInstanceCnt, load_component_Library)
+  map<string, void *>::iterator ith;
+  for (ith = _toRemove_map.begin(); ith != _toRemove_map.end(); ith++)
+  {
+    void *handle = (*ith).second;
+    string impl_name= (*ith).first;
+    if (handle)
+    {
+      SCRUTE(handle);
+      SCRUTE(impl_name);
+      //        dlclose(handle);                // SALOME unstable after ...
+      //        _library_map.erase(impl_name);
+    }
   }
+  _toRemove_map.clear();
+  _numInstanceMutex.unlock();
 
-  Lfinalize_removal();
+  if(_numproc == 0){
+    for(int ip=1;ip<_nbproc;ip++)
+      pthread_join(th[ip],NULL);
+    delete th;
+  }
 }
 
-void Engines_MPIContainer_i::Asfinalize_removal()
+void *th_loadcomponentlibrary(void *s)
 {
-  Lfinalize_removal();
+  thread_st *st = (thread_st*)s;
+  (Engines::MPIContainer::_narrow((*(st->tior))[st->ip]))->load_component_Library(st->compoName.c_str());
 }
 
-void Engines_MPIContainer_i::Lfinalize_removal()
+void *th_createcomponentinstance(void *s)
 {
-  BEGIN_OF("[" << _numproc << "] MPIContainer_i::Lfinalize_removal");
-
-//   map<string, void *>::iterator im ;
-//   // lock on the explore remove_map & dlclose
-//   _numInstanceMutex.lock() ; 
-//   for (im = remove_map.begin() ; im != remove_map.end() ; im ++)
-//     {
-//       void * handle = (*im).second ;
-//       MESSAGE("[" << _numproc << "] dlclose " << (*im).first);
-//       dlclose(handle) ;
-//     }
-//   MESSAGE("[" << _numproc << "] remove_map.clear()");
-//   remove_map.clear() ;  
-//   _numInstanceMutex.unlock() ;
-
-  END_OF("[" << _numproc << "] MPIContainer_i::Lfinalize_removal");
+  thread_st *st = (thread_st*)s;
+  (Engines::MPIContainer::_narrow((*(st->tior))[st->ip]))->create_component_instance(st->compoName.c_str(),st->studyId);
 }
+
+void *th_loadimpl(void *s)
+{
+  thread_st *st = (thread_st*)s;
+  (Engines::MPIContainer::_narrow((*(st->tior))[st->ip]))->load_impl(st->nameToRegister.c_str(),st->compoName.c_str());
+}
+
+void *th_removeimpl(void *s)
+{
+  thread_st *st = (thread_st*)s;
+  (Engines::MPIContainer::_narrow((*(st->tior))[st->ip]))->remove_impl(st->cptr);
+}
+
+void *th_finalizeremoval(void *s)
+{
+  thread_st *st = (thread_st*)s;
+  (Engines::MPIContainer::_narrow((*(st->tior))[st->ip]))->finalize_removal();
+}
+
index a654485406c39fd41d493dffb406f22d8dfcdfa6..58f92aa3ee7f7e6703b0aed98b456d1f580b3405 100644 (file)
 #include "SALOME_Container_i.hxx"
 #include "MPIObject_i.hxx"
 
+void * th_loadcomponentlibrary(void *st);
+void * th_createcomponentinstance(void *st);
+void * th_loadimpl(void *st);
+void * th_removeimpl(void *st);
+void * th_finalizeremoval(void *st);
+
+typedef struct {
+  int ip;
+  Engines::IORTab* tior;
+  std::string compoName;
+  std::string nameToRegister;
+  long studyId;
+  Engines::Component_ptr cptr;
+} thread_st;
+
 class Engines_MPIContainer_i : public POA_Engines::MPIContainer,
                               public Engines_Container_i,
                               public MPIObject_i
@@ -53,47 +68,32 @@ class Engines_MPIContainer_i : public POA_Engines::MPIContainer,
   // Load a component library
   // synchronous version for process 0
   bool load_component_Library(const char* componentName);
-  // asynchronous version for other process
-  void Asload_component_Library(const char* componentName);
 
   // Create an instance of component
   // synchronous version for process 0
   Engines::Component_ptr
   create_component_instance( const char* componentName,
                             CORBA::Long studyId); // 0 for multiStudy
-  // asynchronous version for other process
-  void Ascreate_component_instance( const char* componentName,
-                                 CORBA::Long studyId); // 0 for multiStudy
 
   // Load a component in current MPI container
   // synchronous version for process 0
   Engines::Component_ptr load_impl(const char* nameToRegister,
                                   const char* componentName);
-  // asynchronous version for other process
-  void Asload_impl(const char* nameToRegister, const char* componentName);
 
   // Unload a component from current MPI container
   // synchronous version for process 0
   void remove_impl(Engines::Component_ptr component_i);
-  // asynchronous version for other process
-  void Asremove_impl(Engines::Component_ptr component_i);
 
   // synchronous version for process 0
   void finalize_removal();
-  // asynchronous version for other process
-  void Asfinalize_removal();
 
  private:
-  // local version to not duplicate code 
-  // called by synchronous and asynchronous version
   bool Lload_component_Library(const char* componentName);
   Engines::Component_ptr
   Lcreate_component_instance( const char* componentName,
                              CORBA::Long studyId); // 0 for multiStudy
   Engines::Component_ptr Lload_impl(const char* nameToRegister,
                                    const char* componentName);
-  void Lremove_impl(Engines::Component_ptr component_i);
-  void Lfinalize_removal();
 
   Engines::Component_ptr
   createMPIInstance(std::string genericRegisterName,
index ff45f5e5ea3d6f9330707abda3a782451af94fb2..af78c0f2c39e1e70a9161751fbcfcd2ae2141421 100644 (file)
@@ -64,8 +64,7 @@ void MPIObject_i::tior(const Engines::IORTab& ior)
     (*_tior)[ip] = ior[ip];
 }
 
-void MPIObject_i::BCastIOR(CORBA::ORB_ptr orb, Engines::MPIObject_ptr pobj, 
-                          bool amiCont) throw(POException)
+void MPIObject_i::BCastIOR(CORBA::ORB_ptr orb, Engines::MPIObject_ptr pobj, bool amiCont)
 {
   int err, ip, n;
   char *ior;
@@ -125,33 +124,43 @@ void MPIObject_i::BCastIOR(CORBA::ORB_ptr orb, Engines::MPIObject_ptr pobj,
 }
 
 #ifdef HAVE_MPI2
-MPI_Comm MPIObject_i::remoteMPI2Connect(string service) throw(POException)
+void MPIObject_i::remoteMPI2Connect(bool high, string service)
 {
   int i;
-  MPI_Comm gcom;
+  char port_name[MPI_MAX_PORT_NAME];
   char port_name_clt[MPI_MAX_PORT_NAME];
 
-  _srv = 0;
-  _service = service;
+  if( service.size() == 0 ){
+    MESSAGE("[" << _numproc << "] You have to give a service name !");
+    throw POException(_numproc,"You have to give a service name !");
+  }
+
+  if( _srv.find(service) != _srv.end() ){
+    MESSAGE("[" << _numproc << "] service " << service << " already exist !");
+    throw POException(_numproc,"service " + service + " already exist !");
+  }
+
+  _srv[service] = false;
 
   MPI_Barrier(MPI_COMM_WORLD);
 
   MPI_Errhandler_set(MPI_COMM_WORLD, MPI_ERRORS_RETURN);
   if( _numproc == 0 ){ 
     /* rank 0 try to be a server. If service is already published, try to be a cient */
-    MPI_Open_port(MPI_INFO_NULL, _port_name); 
-    if ( MPI_Publish_name((char*)_service.c_str(), MPI_INFO_NULL, _port_name) == MPI_SUCCESS )  {
-      _srv = 1;
-      MESSAGE("[" << _numproc << "] service " << _service << " available at " << _port_name << "\n");
+    MPI_Open_port(MPI_INFO_NULL, port_name); 
+    if ( MPI_Publish_name((char*)service.c_str(), MPI_INFO_NULL, port_name) == MPI_SUCCESS )  {
+      _srv[service] = true;
+      _port_name[service] = port_name;
+      MESSAGE("[" << _numproc << "] service " << service << " available at " << port_name << endl);
     }      
-    else if ( MPI_Lookup_name((char*)_service.c_str(), MPI_INFO_NULL, port_name_clt) == MPI_SUCCESS ){
-      MESSAGE("[" << _numproc << "] I get the connection with " << _service << " at " << port_name_clt << "!\n");
-      MPI_Close_port( _port_name );
+    else if ( MPI_Lookup_name((char*)service.c_str(), MPI_INFO_NULL, port_name_clt) == MPI_SUCCESS ){
+      MESSAGE("[" << _numproc << "] I get the connection with " << service << " at " << port_name_clt << endl);
+      MPI_Close_port( port_name );
     }
     else{
       /* Throw exception */
-      MESSAGE("[" << _numproc << "] Error on connection with " << _service << " at " << port_name_clt << "!\n");
-      throw POException(_numproc,"Error on connection with " + _service + " at " + port_name_clt);
+      MESSAGE("[" << _numproc << "] Error on connection with " << service << " at " << port_name_clt << endl);
+      throw POException(_numproc,"Error on connection with " + service + " at " + port_name_clt);
     }
   }
   else{
@@ -159,43 +168,67 @@ MPI_Comm MPIObject_i::remoteMPI2Connect(string service) throw(POException)
     /* Waiting rank 0 publish name and try to be a client */
     while ( i != TIMEOUT  ) {
       sleep(1);
-      if ( MPI_Lookup_name((char*)_service.c_str(), MPI_INFO_NULL, port_name_clt) == MPI_SUCCESS ){
-       MESSAGE("[" << _numproc << "] I get the connection with " << _service << " at " << port_name_clt << "!\n");
+      if ( MPI_Lookup_name((char*)service.c_str(), MPI_INFO_NULL, port_name_clt) == MPI_SUCCESS ){
+       MESSAGE("[" << _numproc << "] I get the connection with " << service << " at " << port_name_clt << endl);
        break;
       }
       i++;
     }
     if(i==TIMEOUT){
       /* Throw exception */
-      MESSAGE("[" << _numproc << "] Error on connection with " << _service << " at " << port_name_clt << "!\n");
-      throw POException(_numproc,"Error on connection with " + _service + " at " + port_name_clt);
+      MESSAGE("[" << _numproc << "] Error on connection with " << service << " at " << port_name_clt << endl);
+      throw POException(_numproc,"Error on connection with " + service + " at " + port_name_clt);
     }
   }
   MPI_Errhandler_set(MPI_COMM_WORLD, MPI_ERRORS_ARE_FATAL);
   
   /* If rank 0 is server, all processes call MPI_Comm_accept */
   /* If rank 0 is not server, all processes call MPI_Comm_connect */
-  MPI_Bcast(&_srv,1,MPI_INT,0,MPI_COMM_WORLD);
-  if ( _srv )
-    MPI_Comm_accept( _port_name, MPI_INFO_NULL, 0, MPI_COMM_WORLD, &gcom );
+  int srv = (int)_srv[service];
+  MPI_Bcast(&srv,1,MPI_INT,0,MPI_COMM_WORLD);
+  _srv[service] = (bool)srv;
+  if ( _srv[service] )
+    MPI_Comm_accept( port_name, MPI_INFO_NULL, 0, MPI_COMM_WORLD, &(_icom[service]) );
   else
-    MPI_Comm_connect(port_name_clt, MPI_INFO_NULL, 0, MPI_COMM_WORLD, &gcom );
+    MPI_Comm_connect(port_name_clt, MPI_INFO_NULL, 0, MPI_COMM_WORLD, &(_icom[service]) );
 
-  /* only rank 0 can be server for unpublish name */
-  if(_numproc != 0) _srv = 0;
+  /* create global communicator */
+  MPI_Intercomm_merge(_icom[service],high,&(_gcom[service]));
 
-  return gcom;
+  /* only rank 0 can be server for unpublish name */
+  if(_numproc != 0) _srv[service] = false;
 
 }
 
-void MPIObject_i::remoteMPI2Disconnect(MPI_Comm gcom)
+void MPIObject_i::remoteMPI2Disconnect(std::string service)
 {
-  MPI_Comm_disconnect( &gcom ); 
-  if ( _srv ) {
-    MPI_Unpublish_name((char*)_service.c_str(), MPI_INFO_NULL, _port_name); 
-    MESSAGE("[" << _numproc << "] " << _service << ": close port " << _port_name << "\n");
-    MPI_Close_port( _port_name ); 
+
+  if( service.size() == 0 ){
+    MESSAGE("[" << _numproc << "] You have to give a service name !");
+    throw POException(_numproc,"You have to give a service name !");
   }
+
+  if( _srv.find(service) == _srv.end() ){
+    MESSAGE("[" << _numproc << "] service " << service << " don't exist !");
+    throw POException(_numproc,"service " + service + " don't exist !");
+  }
+
+  MPI_Comm_disconnect( &(_gcom[service]) ); 
+  if ( _srv[service] ) {
+
+    char port_name[MPI_MAX_PORT_NAME];
+    strcpy(port_name,_port_name[service].c_str());
+
+    MPI_Unpublish_name((char*)service.c_str(), MPI_INFO_NULL, port_name); 
+    MESSAGE("[" << _numproc << "] " << service << ": close port " << _port_name[service] << endl);
+    MPI_Close_port( port_name ); 
+    _port_name.erase(service);
+  }
+
+  _gcom.erase(service);
+  _icom.erase(service);
+  _srv.erase(service);
+
 }
 #endif
 
index 641cb113895059aabfa7356cae93d9b6b2d99030..66d24f58d43592195457339114d579e85edab84a 100644 (file)
@@ -30,7 +30,6 @@
 #include <string>
 #include <SALOMEconfig.h>
 #include CORBA_SERVER_HEADER(SALOME_MPIObject)
-#define defaultService "SERVER"
 
 class POException
 {
@@ -58,18 +57,21 @@ class MPIObject_i: public POA_Engines::MPIObject
   // IOR des objets paralleles sur tous les process mpi
   Engines::IORTab* _tior;
   // Echange des IOR de l'objet entre process
-  void BCastIOR(CORBA::ORB_ptr orb,Engines::MPIObject_ptr pobj,bool amiCont) throw(POException);
+  void BCastIOR(CORBA::ORB_ptr orb,Engines::MPIObject_ptr pobj,bool amiCont);
 #ifdef HAVE_MPI2
   // MPI2 connection
-  MPI_Comm remoteMPI2Connect(std::string service=defaultService) throw(POException);
+  void remoteMPI2Connect(bool high, std::string service);
   // MPI2 disconnection
-  void remoteMPI2Disconnect(MPI_Comm gcom);
+  void remoteMPI2Disconnect(std::string service);
 #endif
 
+protected:
+  std::map<std::string, MPI_Comm> _gcom;
+
 private:
-  int _srv;
-  char _port_name[MPI_MAX_PORT_NAME];
-  std::string _service;
+  std::map<std::string, MPI_Comm> _icom;
+  std::map<std::string, bool> _srv;
+  std::map<std::string, std::string> _port_name;
 
 } ;
 
index 2d202204b768bdee6d1cf41531aa01c2773fbbdb..52b42f6c22c0e713c9a3b28f7bb88dadb24e5457 100644 (file)
@@ -27,7 +27,8 @@
 SUBDIR_BASE = \
   Basics \
   SALOMELocalTrace \
-  HDFPersist
+  HDFPersist\
+  KERNEL_PY
 
 SUBDIR_CORBA = \
   DF \
@@ -50,7 +51,6 @@ SUBDIR_CORBA = \
   TOOLSDS \
   SALOMEDSImpl \
   SALOMEDS \
-  KERNEL_PY \
   ModuleGenerator \
   Communication \
   Communication_SWIG \
index 7cdd4073a25a6b77a0d19f23c4ab1d707b0e04b3..99160e72e961bdd7e147cb5d9861c8fd1dbe4d1c 100644 (file)
@@ -43,7 +43,7 @@ salomeinclude_HEADERS = \
                SALOME_ModuleCatalog.hxx
 
 # Scripts to be installed
-dist_salomescript_DATA = TestModuleCatalog.py
+dist_salomescript_PYTHON = TestModuleCatalog.py
 
 
 #
index bb8a2320afb0e5114cdf8d56c0dae324e764e87c..d70e2aa775ffe09692a478746dd4ea5e5b5678e9 100755 (executable)
@@ -27,7 +27,7 @@
 #define _SALOME_ModuleCatalog_HXX_
 
 #ifdef WIN32
-# ifdef MODULECATALOG_EXPORTS
+# if defined MODULECATALOG_EXPORTS || defined SalomeCatalog_EXPORTS
 #  define MODULECATALOG_EXPORT __declspec( dllexport )
 # else
 #  define MODULECATALOG_EXPORT __declspec( dllimport )
index 453e87b5a3729e45b5d500300f57ee28c29b7e4f..2f74b5ba1ee2b68804602586c06bc6067b159c9e 100644 (file)
 #
 include $(top_srcdir)/salome_adm/unix/make_common_starter.am
 
-dist_salomescript_DATA = IDLparser.py
+dist_salomescript_PYTHON = IDLparser.py
 
 EXTRA_DIST = tests
+
+install-data-hook:
+       @for f in $(dist_salomescript_PYTHON) ; do \
+          chmod -f a+x $(DESTDIR)$(salomescriptdir)/$$f ; \
+        done
index cc18e0448dc89767db0207acfb1223a03a683d55..710c575f42778c8d509b0b032fcb23ed4ebc2712 100755 (executable)
@@ -27,7 +27,7 @@
 #define _SALOME_NOTIFICATION_SWIG_HXX_
 
 #ifdef WIN32
-# ifdef NOTIFICATION_SWIG_EXPORTS
+# if defined NOTIFICATION_SWIG_EXPORTS || defined _libNOTIFICATION_EXPORTS
 #  define NOTIFICATION_SWIG_EXPORT __declspec( dllexport )
 # else
 #  define NOTIFICATION_SWIG_EXPORT __declspec( dllimport )
index 8b65147555dfafa0edd477289f031b4dcf6509b2..474f5f02e5ce51e3230b1c6193728f513d217b12 100644 (file)
@@ -35,7 +35,7 @@ salomeinclude_HEADERS =\
        SALOME_NamingService_defs.hxx
 
 # Scripts to be exported
-dist_salomescript_DATA =\
+dist_salomescript_PYTHON =\
        SALOME_NamingServicePy.py
 
 
index 061d2f9ce785dc1d175422456f24fd77715f6ec7..81dbae46e79696e3a94a48262d82013fc565e7a4 100644 (file)
@@ -29,7 +29,7 @@
 #define SALOME_NAMINGSERVICE_DEFS_HXX
 
 #ifdef WIN32
-# ifdef NAMINGSERVICE_EXPORTS
+# if defined NAMINGSERVICE_EXPORTS || defined SalomeNS_EXPORTS
 #  define NAMINGSERVICE_EXPORT __declspec( dllexport )
 # else
 #  define NAMINGSERVICE_EXPORT __declspec( dllimport )
index 1de5e46d567b90adbaff09051fe833307d313ccd..166fd338840551bb04a26d104e12623ed3e45501 100644 (file)
@@ -36,7 +36,7 @@ include $(top_srcdir)/salome_adm/unix/make_common_starter.am
 salomeinclude_HEADERS= NamingServiceTest.hxx
 
 # Scripts to be installed
-dist_salomescript_SCRIPTS = TestNamingService.py
+dist_salomescript_PYTHON = TestNamingService.py
 
 
 #
@@ -58,6 +58,11 @@ COMMON_CPPFLAGS=\
        -I$(top_builddir)/idl \
        @CORBA_CXXFLAGS@ @CORBA_INCLUDES@
 
+# This local variable defines the list of dependant libraries common to all target in this package.
+COMMON_LIBS =\
+       @CPPUNIT_LIBS@ \
+       ../libSalomeNS.la
+
 #
 # ===============================================================
 # Libraries targets
@@ -67,7 +72,7 @@ lib_LTLIBRARIES = libNamingServiceTest.la
 libNamingServiceTest_la_SOURCES = NamingServiceTest.cxx
 libNamingServiceTest_la_CPPFLAGS = $(COMMON_CPPFLAGS)
 libNamingServiceTest_la_LDFLAGS  = -no-undefined -version-info=0:0:0
-libNamingServiceTest_la_LIBADD   = @CPPUNIT_LIBS@
+libNamingServiceTest_la_LIBADD   = $(COMMON_LIBS)
 
 
 #
index 8dad9d8ccf4d67970ec54c154d7ab00ad9683bb9..faa40bfbf4615da20b683f114ac15063aef9901d 100755 (executable)
@@ -27,7 +27,7 @@
 #define _SALOME_NOTIFICATION_HXX_
 
 #ifdef WIN32
-# ifdef NOTIFICATION_EXPORTS
+# if defined NOTIFICATION_EXPORTS || defined SalomeNotification_EXPORTS
 #  define NOTIFICATION_EXPORT __declspec( dllexport )
 # else
 #  define NOTIFICATION_EXPORT __declspec( dllimport )
index b146908aca2880a2adfc4d5810e76ad0e0add5a4..530a66d881555bb9215aa75269d497efbba51f0b 100644 (file)
@@ -47,7 +47,7 @@
 class Engines_Parallel_Container_i;
 
 #ifdef WIN32
-# ifdef CONTAINER_EXPORTS
+# if defined CONTAINER_EXPORTS || defined SalomeParallelContainer_EXPORTS
 #  define CONTAINER_EXPORT __declspec( dllexport )
 # else
 #  define CONTAINER_EXPORT __declspec( dllimport )
index a80d51f08e3decb7f834e56f3cab7173f00717b5..ec268dc0192590ab2e80f30b7f0ec8843358ecca 100644 (file)
@@ -126,6 +126,8 @@ Container_proxy_impl_final::Shutdown()
   }
 
   INFOS("Shutdown Parallel Proxy");
+  _NS->Destroy_FullDirectory(_containerName.c_str());
+  _NS->Destroy_Name(_containerName.c_str());
   if(!CORBA::is_nil(_orb))
     _orb->shutdown(0);
 }
index 65cea7871ebcdbc3b41827b1889d5df6d5f2f76a..1213347d2aa049811e81375639d9b78ac1d2f7c7 100644 (file)
@@ -1037,6 +1037,51 @@ Engines_Parallel_Container_i::updateInstanceNumber()
     _numInstanceMutex.unlock();
   }
 }
+
+/*! \brief copy a file from a remote host (container) to the local host
+ * \param container the remote container
+ * \param remoteFile the file to copy locally from the remote host into localFile
+ * \param localFile the local file
+ */
+void 
+Engines_Parallel_Container_i::copyFile(Engines::Container_ptr container, const char* remoteFile, const char* localFile)
+{
+  Engines::fileTransfer_var fileTransfer = container->getFileTransfer();
+
+  FILE* fp;
+  if ((fp = fopen(localFile,"wb")) == NULL)
+    {
+      INFOS("file " << localFile << " cannot be open for writing");
+      return;
+    }
+
+  CORBA::Long fileId = fileTransfer->open(remoteFile);
+  if (fileId > 0)
+    {
+      Engines::fileBlock* aBlock;
+      int toFollow = 1;
+      int ctr=0;
+      while (toFollow)
+        {
+          ctr++;
+          SCRUTE(ctr);
+          aBlock = fileTransfer->getBlock(fileId);
+          toFollow = aBlock->length();
+          SCRUTE(toFollow);
+          CORBA::Octet *buf = aBlock->get_buffer();
+          fwrite(buf, sizeof(CORBA::Octet), toFollow, fp);
+          delete aBlock;
+        }
+      fclose(fp);
+      MESSAGE("end of transfer");
+      fileTransfer->close(fileId);
+    }
+  else
+    {
+      INFOS("open reference file for copy impossible");
+    }
+}
+
 //=============================================================================
 /*! 
  *  
index a3a8083bf18317d6cfe21b205e6a647394e94cfd..ba014d4582f4618f5ab47373271739ac6b531c8f 100644 (file)
@@ -45,7 +45,7 @@
 class SALOME_NamingService;
 
 #ifdef WIN32
-# ifdef CONTAINER_EXPORTS
+# if defined CONTAINER_EXPORTS || defined SalomeParallelContainer_EXPORTS
 #  define CONTAINER_EXPORT __declspec( dllexport )
 # else
 #  define CONTAINER_EXPORT __declspec( dllimport )
@@ -131,6 +131,7 @@ public:
   Engines::fileTransfer_ptr getFileTransfer();
 
   virtual Engines::Salome_file_ptr createSalome_file(const char* origFileName);
+  void copyFile(Engines::Container_ptr container, const char* remoteFile, const char* localFile);
 
 protected:
 
index a4c234a29aa46182706379cfb66abc0f4279d7f3..6652204578766ce471163e625b64242e89957353 100755 (executable)
@@ -27,7 +27,7 @@
 #define _SALOME_Registry_HXX_
 
 #ifdef WIN32
-# ifdef REGISTRY_EXPORTS
+# if defined REGISTRY_EXPORTS || defined Registry_EXPORTS
 #  define REGISTRY_EXPORT __declspec( dllexport )
 # else
 #  define REGISTRY_EXPORT __declspec( dllimport )
index 062ea9124f3fc0c7da602a04c52cf58aa62f13b9..6dfdb367c9e903cd39a62e6819de0d9a3c7b9f52 100644 (file)
@@ -28,8 +28,6 @@
 #include <map>
 #include <list>
 
-#include <sys/types.h>
-#include <sys/stat.h>
 #include <libxml/parser.h>
 
 #include <algorithm>
@@ -38,6 +36,9 @@
 
 using namespace std;
 
+static LoadRateManagerFirst first;
+static LoadRateManagerCycl cycl;
+static LoadRateManagerAltCycl altcycl;
 //=============================================================================
 /*!
  * just for test
@@ -51,6 +52,11 @@ ResourcesManager_cpp(const char *xmlFilePath)
 #if defined(_DEBUG_) || defined(_DEBUG)
   cerr << "ResourcesManager_cpp constructor" << endl;
 #endif
+  _resourceManagerMap["first"]=&first;
+  _resourceManagerMap["cycl"]=&cycl;
+  _resourceManagerMap["altcycl"]=&altcycl;
+  _resourceManagerMap["best"]=&altcycl;
+  _resourceManagerMap[""]=&altcycl;
 }
 
 //=============================================================================
@@ -69,6 +75,11 @@ ResourcesManager_cpp::ResourcesManager_cpp() throw(ResourcesException)
 #if defined(_DEBUG_) || defined(_DEBUG)
   cerr << "ResourcesManager_cpp constructor" << endl;
 #endif
+  _resourceManagerMap["first"]=&first;
+  _resourceManagerMap["cycl"]=&cycl;
+  _resourceManagerMap["altcycl"]=&altcycl;
+  _resourceManagerMap["best"]=&altcycl;
+  _resourceManagerMap[""]=&altcycl;
 
   std::string default_file("");
   if (getenv("APPLI") != 0)
@@ -95,6 +106,8 @@ ResourcesManager_cpp::ResourcesManager_cpp() throw(ResourcesException)
     _path_resources.push_back(user_file);
   }
 
+  _lasttime=0;
+
   ParseXmlFiles();
 #if defined(_DEBUG_) || defined(_DEBUG)
   cerr << "ResourcesManager_cpp constructor end";
@@ -115,22 +128,21 @@ ResourcesManager_cpp::~ResourcesManager_cpp()
 }
 
 //=============================================================================
+//! get the list of resource names fitting constraints given by params
 /*!
- *  get the list of name of ressources fitting for the specified module.
- *  If hostname specified, check it is local or known in resources catalog.
+ *  If hostname is specified, check if it is local or known in resources catalog.
  *
  *  Else
  *  - select first machines with corresponding OS (all machines if
  *    parameter OS empty),
- *  - then select the sublist of machines on witch the module is known
+ *  - then select the sublist of machines on which the component is known
  *    (if the result is empty, that probably means that the inventory of
- *    modules is probably not done, so give complete list from previous step)
+ *    components is probably not done, so give complete list from previous step)
  */ 
 //=============================================================================
 
 std::vector<std::string> 
-ResourcesManager_cpp::GetFittingResources(const machineParams& params,
-                                         const std::vector<std::string>& componentList) throw(ResourcesException)
+ResourcesManager_cpp::GetFittingResources(const machineParams& params) throw(ResourcesException)
 {
   vector <std::string> vec;
 
@@ -223,10 +235,13 @@ ResourcesManager_cpp::GetFittingResources(const machineParams& params,
     
   else{
     // --- Search for available resources sorted by priority
+    vec=params.computerList;
+
     SelectOnlyResourcesWithOS(vec, params.OS.c_str());
       
-    KeepOnlyResourcesWithModule(vec, componentList);
-       
+    KeepOnlyResourcesWithComponent(vec, params.componentList);
+
+    //if hosts list (vec) is empty, ignore componentList constraint and use only OS constraint
     if (vec.size() == 0)
       SelectOnlyResourcesWithOS(vec, params.OS.c_str());
     
@@ -265,25 +280,25 @@ ResourcesManager_cpp::GetFittingResources(const machineParams& params,
 //=============================================================================
 /*!
  *  add an entry in the ressources catalog  xml file.
- *  Return 0 if OK (KERNEL found in new resources modules) else throw exception
+ *  Return 0 if OK (KERNEL found in new resources components) else throw exception
  */ 
 //=============================================================================
 
 int
 ResourcesManager_cpp::
 AddResourceInCatalog(const machineParams& paramsOfNewResources,
-                     const vector<string>& modulesOnNewResources,
+                     const vector<string>& componentsOnNewResources,
                      const char *alias,
                      const char *userName,
                      AccessModeType mode,
                      AccessProtocolType prot)
 throw(ResourcesException)
 {
-  vector<string>::const_iterator iter = find(modulesOnNewResources.begin(),
-                                            modulesOnNewResources.end(),
+  vector<string>::const_iterator iter = find(componentsOnNewResources.begin(),
+                                            componentsOnNewResources.end(),
                                             "KERNEL");
 
-  if (iter != modulesOnNewResources.end())
+  if (iter != componentsOnNewResources.end())
     {
       ParserResourcesType newElt;
       newElt.DataForSort._hostName = paramsOfNewResources.hostname;
@@ -291,7 +306,7 @@ throw(ResourcesException)
       newElt.Protocol = prot;
       newElt.Mode = mode;
       newElt.UserName = userName;
-      newElt.ModulesList = modulesOnNewResources;
+      newElt.ComponentsList = componentsOnNewResources;
       newElt.OS = paramsOfNewResources.OS;
       newElt.DataForSort._memInMB = paramsOfNewResources.mem_mb;
       newElt.DataForSort._CPUFreqMHz = paramsOfNewResources.cpu_clock;
@@ -365,63 +380,83 @@ void ResourcesManager_cpp::WriteInXmlFile(std::string & xml_file)
 
 const MapOfParserResourcesType& ResourcesManager_cpp::ParseXmlFiles()
 {
-  // Nettoyage des variables (est-ce vraiment utile ?)
-  _resourcesList.clear();
-  _resourcesBatchList.clear();
-
-  // On parse tous les fichiers
+  // Parse file only if its modification time is greater than lasttime (last registered modification time)
+  bool to_parse = false;
   for(_path_resources_it = _path_resources.begin(); _path_resources_it != _path_resources.end(); ++_path_resources_it)
   {
-    MapOfParserResourcesType _resourcesList_tmp;
-    MapOfParserResourcesType _resourcesBatchList_tmp;
-    SALOME_ResourcesCatalog_Handler* handler =
-      new SALOME_ResourcesCatalog_Handler(_resourcesList_tmp, _resourcesBatchList_tmp);
-    const char* aFilePath = (*_path_resources_it).c_str();
-    FILE* aFile = fopen(aFilePath, "r");
-    if (aFile != NULL)
+    struct stat statinfo;
+    int result = stat((*_path_resources_it).c_str(), &statinfo);
+    if (result < 0)
     {
-      xmlDocPtr aDoc = xmlReadFile(aFilePath, NULL, 0);
-      if (aDoc != NULL)
-      {
-       handler->ProcessXmlDocument(aDoc);
+      std::cerr << "Error in method stat for file : " << (*_path_resources_it).c_str() << " no new xml file is parsed" << std::endl;
+      return _resourcesList;
+    }
 
-       // adding new resources to the file
-       for (MapOfParserResourcesType_it i = _resourcesList_tmp.begin(); i != _resourcesList_tmp.end(); ++i)
-       {
-         MapOfParserResourcesType_it j = _resourcesList.find(i->first);
-         if (j == _resourcesList.end())
-         {
-           _resourcesList[i->first] = i->second;
-         }
-         else
-         {
-           std::cerr << "ParseXmlFiles Warning, to resource with the same name was found, taking the first declaration : " << i->first << std::endl;
-         }
-       }
-       for (MapOfParserResourcesType_it i = _resourcesBatchList_tmp.begin(); i != _resourcesBatchList_tmp.end(); ++i)
+    if(statinfo.st_mtime > _lasttime)
+    {
+      to_parse = true;
+      _lasttime = statinfo.st_mtime;
+    }
+  }
+
+  if (to_parse)
+  {
+    _resourcesList.clear();
+    _resourcesBatchList.clear();
+    // On parse tous les fichiers
+    for(_path_resources_it = _path_resources.begin(); _path_resources_it != _path_resources.end(); ++_path_resources_it)
+    {
+      MapOfParserResourcesType _resourcesList_tmp;
+      MapOfParserResourcesType _resourcesBatchList_tmp;
+      SALOME_ResourcesCatalog_Handler* handler =
+       new SALOME_ResourcesCatalog_Handler(_resourcesList_tmp, _resourcesBatchList_tmp);
+      const char* aFilePath = (*_path_resources_it).c_str();
+      FILE* aFile = fopen(aFilePath, "r");
+
+      if (aFile != NULL)
+      {
+       xmlDocPtr aDoc = xmlReadFile(aFilePath, NULL, 0);
+       if (aDoc != NULL)
        {
-         MapOfParserResourcesType_it j = _resourcesBatchList.find(i->first);
-         if (j == _resourcesBatchList.end())
+         handler->ProcessXmlDocument(aDoc);
+
+         // adding new resources to the file
+         for (MapOfParserResourcesType_it i = _resourcesList_tmp.begin(); i != _resourcesList_tmp.end(); ++i)
          {
-           _resourcesBatchList[i->first] = i->second;
+           MapOfParserResourcesType_it j = _resourcesList.find(i->first);
+           if (j == _resourcesList.end())
+           {
+             _resourcesList[i->first] = i->second;
+           }
+           else
+           {
+             std::cerr << "ParseXmlFiles Warning, to resource with the same name was found, taking the first declaration : " << i->first << std::endl;
+           }
          }
-         else
+         for (MapOfParserResourcesType_it i = _resourcesBatchList_tmp.begin(); i != _resourcesBatchList_tmp.end(); ++i)
          {
-           std::cerr << "ParseXmlFiles Warning, to resource with the same name was found, taking the first declaration : " << i->first << std::endl;
+           MapOfParserResourcesType_it j = _resourcesBatchList.find(i->first);
+           if (j == _resourcesBatchList.end())
+           {
+             _resourcesBatchList[i->first] = i->second;
+           }
+           else
+           {
+             std::cerr << "ParseXmlFiles Warning, to resource with the same name was found, taking the first declaration : " << i->first << std::endl;
+           }
          }
        }
+       else
+         std::cerr << "ResourcesManager_cpp: could not parse file " << aFilePath << std::endl;
+       // Free the document
+       xmlFreeDoc(aDoc);
+       fclose(aFile);
       }
       else
-       std::cerr << "ResourcesManager_cpp: could not parse file " << aFilePath << std::endl;
-      // Free the document
-      xmlFreeDoc(aDoc);
-      fclose(aFile);
-    }
-    else
-      std::cerr << "ResourcesManager_cpp: file " << aFilePath << " is not readable." << std::endl;
+       std::cerr << "ResourcesManager_cpp: file " << aFilePath << " is not readable." << std::endl;
 
-    delete handler;
+      delete handler;
+    }
   }
   return _resourcesList;
 }
@@ -433,41 +468,15 @@ const MapOfParserResourcesType& ResourcesManager_cpp::ParseXmlFiles()
 //=============================================================================
 
 const MapOfParserResourcesType& ResourcesManager_cpp::GetList() const
-  {
-    return _resourcesList;
-  }
-
-
-//=============================================================================
-/*!
- *  dynamically obtains the first machines
- */ 
-//=============================================================================
-
-string ResourcesManager_cpp::FindFirst(const std::vector<std::string>& listOfMachines)
 {
-  return _dynamicResourcesSelecter.FindFirst(listOfMachines);
-}
-
-//=============================================================================
-/*!
- *  dynamically obtains the best machines
- */ 
-//=============================================================================
-
-string ResourcesManager_cpp::FindNext(const std::vector<std::string>& listOfMachines)
-{
-  return _dynamicResourcesSelecter.FindNext(listOfMachines,_resourcesList);
+  return _resourcesList;
 }
-//=============================================================================
-/*!
- *  dynamically obtains the best machines
- */ 
-//=============================================================================
 
-string ResourcesManager_cpp::FindBest(const std::vector<std::string>& listOfMachines)
+string ResourcesManager_cpp::Find(const std::string& policy, const std::vector<std::string>& listOfMachines)
 {
-  return _dynamicResourcesSelecter.FindBest(listOfMachines);
+  if(_resourceManagerMap.count(policy)==0)
+    return _resourceManagerMap[""]->Find(listOfMachines,_resourcesList);
+  return _resourceManagerMap[policy]->Find(listOfMachines,_resourcesList);
 }
 
 //=============================================================================
@@ -483,41 +492,56 @@ throw(ResourcesException)
 {
   string base(OS);
 
-  for (map<string, ParserResourcesType>::const_iterator iter =
-         _resourcesList.begin();
-       iter != _resourcesList.end();
-       iter++)
+  if(hosts.size()==0)
+    {
+      //No constraint on computer list : take all known resources with OS
+      map<string, ParserResourcesType>::const_iterator iter;
+      for (iter = _resourcesList.begin(); iter != _resourcesList.end(); iter++)
+        {
+          if ( (*iter).second.OS == base || base.size() == 0)
+            hosts.push_back((*iter).first);
+        }
+    }
+  else
     {
-      if ( (*iter).second.OS == base || base.size() == 0)
-        hosts.push_back((*iter).first);
+      //a computer list is given : take only resources with OS on those computers
+      vector<string> vec=hosts;
+      hosts.clear();
+      vector<string>::iterator iter;
+      for (iter = vec.begin(); iter != vec.end(); iter++)
+        {
+          MapOfParserResourcesType::const_iterator it = _resourcesList.find(*iter);
+          if(it != _resourcesList.end())
+            if ( (*it).second.OS == base || base.size() == 0 )
+              hosts.push_back(*iter);
+        }
     }
 }
 
 
 //=============================================================================
 /*!
- *  Gives a sublist of machines on which the module is known.
+ *  Gives a sublist of machines on which the component is known.
  */ 
 //=============================================================================
 
 //Warning need an updated parsed list : _resourcesList
-void ResourcesManager_cpp::KeepOnlyResourcesWithModule( vector<string>& hosts, const vector<string>& componentList) const
+void ResourcesManager_cpp::KeepOnlyResourcesWithComponent( vector<string>& hosts, const vector<string>& componentList) const
 throw(ResourcesException)
 {
   for (vector<string>::iterator iter = hosts.begin(); iter != hosts.end();)
     {
       MapOfParserResourcesType::const_iterator it = _resourcesList.find(*iter);
-      const vector<string>& mapOfModulesOfCurrentHost = (((*it).second).ModulesList);
+      const vector<string>& mapOfComponentsOfCurrentHost = (((*it).second).ComponentsList);
 
       bool erasedHost = false;
-      if( mapOfModulesOfCurrentHost.size() > 0 ){
+      if( mapOfComponentsOfCurrentHost.size() > 0 ){
        for(unsigned int i=0;i<componentList.size();i++){
           const char* compoi = componentList[i].c_str();
-         vector<string>::const_iterator itt = find(mapOfModulesOfCurrentHost.begin(),
-                                             mapOfModulesOfCurrentHost.end(),
+         vector<string>::const_iterator itt = find(mapOfComponentsOfCurrentHost.begin(),
+                                             mapOfComponentsOfCurrentHost.end(),
                                              compoi);
-//                                           componentList[i]);
-         if (itt == mapOfModulesOfCurrentHost.end()){
+         if (itt == mapOfComponentsOfCurrentHost.end()){
            erasedHost = true;
            break;
          }
index ecd1db6c3d38c74535eb4bd90657d442ecf6ebb6..1287d99b30ecbe8216caeeeadf9ff9013d3f5df5 100644 (file)
@@ -31,6 +31,9 @@
 #include "SALOME_ResourcesCatalog_Parser.hxx"
 #include "SALOME_ResourcesCatalog_Handler.hxx"
 #include "SALOME_LoadRateManager.hxx"
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
 
 // --- WARNING ---
 // The call of BuildTempFileToLaunchRemoteContainer and RmTmpFile must be done
@@ -47,6 +50,8 @@ struct machineParams{
   unsigned int cpu_clock;
   unsigned int mem_mb;
   unsigned int nb_component_nodes;
+  std::vector<std::string> componentList;
+  std::vector<std::string> computerList;
 };
 
 class RESOURCESMANAGER_EXPORT ResourcesException
@@ -68,16 +73,13 @@ class RESOURCESMANAGER_EXPORT ResourcesManager_cpp
     ~ResourcesManager_cpp();
 
     std::vector<std::string> 
-    GetFittingResources(const machineParams& params,
-                        const std::vector<std::string>& componentList) throw(ResourcesException);
+    GetFittingResources(const machineParams& params) throw(ResourcesException);
 
-    std::string FindFirst(const std::vector<std::string>& listOfMachines);
-    std::string FindNext(const std::vector<std::string>& listOfMachines);
-    std::string FindBest(const std::vector<std::string>& listOfMachines);
+    std::string Find(const std::string& policy, const std::vector<std::string>& listOfMachines);
 
     int AddResourceInCatalog
     (const machineParams& paramsOfNewResources,
-     const std::vector<std::string>& modulesOnNewResources,
+     const std::vector<std::string>& componentsOnNewResources,
      const char *alias,
      const char *userName,
      AccessModeType mode,
@@ -99,7 +101,7 @@ class RESOURCESMANAGER_EXPORT ResourcesManager_cpp
                                   const char *OS) const
       throw(ResourcesException);
 
-    void KeepOnlyResourcesWithModule(std::vector<std::string>& hosts,
+    void KeepOnlyResourcesWithComponent(std::vector<std::string>& hosts,
                                     const std::vector<std::string>& componentList) const
       throw(ResourcesException);
 
@@ -113,10 +115,11 @@ class RESOURCESMANAGER_EXPORT ResourcesManager_cpp
     //! will contain the informations on the data type catalog(after parsing)
     MapOfParserResourcesType _resourcesBatchList;
 
-    SALOME_LoadRateManager _dynamicResourcesSelecter;
+    //! a map that contains all the available load rate managers (the key is the name)
+    std::map<std::string , LoadRateManager*> _resourceManagerMap;
 
-    //! different behaviour if $APPLI exists (SALOME Application) 
-    bool _isAppliSalomeDefined;    
+    //! contain the time where resourcesList was created
+    time_t _lasttime;
   };
 
 #endif // __RESOURCESMANAGER_HXX__
index 8613c4b9d8b153e7c455f77a28798e0a00286819..c6d0c25e9cadcb338ba1e0d2c2f284a4ddcc01ca 100755 (executable)
@@ -23,7 +23,7 @@
 #define __RESOURCESMANAGER_DEFS_HXX__
 
 #ifdef WIN32
-# ifdef RESOURCESMANAGER_EXPORTS
+# if defined RESOURCESMANAGER_EXPORTS || defined ResourcesManager_EXPORTS
 #  define RESOURCESMANAGER_EXPORT __declspec( dllexport )
 # else
 #  define RESOURCESMANAGER_EXPORT __declspec( dllimport )
index 5865483a6b278625700e410b5bb73afeb4bdb613..c422a3fd0efe8ea41ad13e0d3b582b21a667b11f 100644 (file)
@@ -25,7 +25,8 @@
 
 using namespace std;
 
-string SALOME_LoadRateManager::FindFirst(const vector<string>& hosts)
+string LoadRateManagerFirst::Find(const vector<string>& hosts,
+                                  MapOfParserResourcesType& resList)
 {
   if (hosts.size() == 0)
     return string("");
@@ -33,7 +34,8 @@ string SALOME_LoadRateManager::FindFirst(const vector<string>& hosts)
   return string(hosts[0]);
 }
 
-string SALOME_LoadRateManager::FindNext(const vector<string>& hosts,MapOfParserResourcesType& resList)
+string LoadRateManagerCycl::Find(const vector<string>& hosts,
+                                 MapOfParserResourcesType& resList)
 {
   static int imachine = 0;
   static int iproc = 0;
@@ -52,15 +54,40 @@ string SALOME_LoadRateManager::FindNext(const vector<string>& hosts,MapOfParserR
     else{
       iproc = 1;
       imachine++;
-      if(imachine == hosts.size())
-       imachine = 0;
+      if(imachine >= hosts.size())
+        imachine = 0;
       return string(hosts[imachine]);
     }
   }
 }
 
-string SALOME_LoadRateManager::FindBest(const vector<string>& hosts)
+string LoadRateManagerAltCycl::Find(const vector<string>& hosts,
+                                    MapOfParserResourcesType& resList)
 {
-  // for the moment then "maui" will be used for dynamic selection ...
-  return FindFirst(hosts);
+  if (hosts.size() == 0)
+    return string("");
+
+  std::string selected=hosts[0];
+  int uses=0;
+  if(_numberOfUses.count(selected) != 0)
+    uses=_numberOfUses[selected];
+  else
+    uses=0;
+
+  for (std::vector<std::string>::const_iterator iter = hosts.begin(); iter != hosts.end(); iter++)
+    {
+      std::string machine=*iter;
+      if(_numberOfUses.count(machine) == 0)
+        _numberOfUses[machine]=0;
+      if(_numberOfUses[machine] < uses)
+        {
+          selected=machine;
+          uses=_numberOfUses[machine];
+        }
+    }
+
+  _numberOfUses[selected]=_numberOfUses[selected]+1;
+  std::cerr << "selected: " << selected << " " << _numberOfUses[selected] << std::endl;
+  return selected;
 }
+
index 4a43bd7e313748fe7b7b2df9011243bc2e621841..af167bef808c72b3999f63a412d044a0a46d5838 100644 (file)
 
 #include "ResourcesManager_Defs.hxx"
 #include <string>
+#include <map>
 #include "SALOME_ResourcesCatalog_Parser.hxx"
 
-class RESOURCESMANAGER_EXPORT SALOME_LoadRateManager
-  {
+class RESOURCESMANAGER_EXPORT LoadRateManager
+{
+  public:
+    virtual std::string Find(const std::vector<std::string>& hosts,
+                             MapOfParserResourcesType& resList){return "";};
+};
+
+class RESOURCESMANAGER_EXPORT LoadRateManagerFirst:public LoadRateManager
+{
+  public:
+    virtual std::string Find(const std::vector<std::string>& hosts,
+                             MapOfParserResourcesType& resList);
+};
+
+class RESOURCESMANAGER_EXPORT LoadRateManagerCycl :public LoadRateManager
+{
+  public:
+    virtual std::string Find(const std::vector<std::string>& hosts,
+                             MapOfParserResourcesType& resList);
+};
 
+class RESOURCESMANAGER_EXPORT LoadRateManagerAltCycl :public LoadRateManager
+{
   public:
-    std::string FindFirst(const std::vector<std::string>& hosts);
-    std::string FindNext(const std::vector<std::string>& hosts,MapOfParserResourcesType& resList);
-    std::string FindBest(const std::vector<std::string>& hosts);
-  };
+    virtual std::string Find(const std::vector<std::string>& hosts,
+                             MapOfParserResourcesType& resList);
+  protected:
+    std::map<std::string,int> _numberOfUses;
+};
 
 #endif
index b51969141f69294fcb89476a12ecefc0d7ecff07..9c2ec5fea509ebc9574e6a03137f925a5e4f7fb1 100755 (executable)
@@ -58,6 +58,8 @@ SALOME_ResourcesCatalog_Handler(MapOfParserResourcesType& resources_list,
   test_appli_path = "appliPath";
   test_modules = "modules";
   test_module_name = "moduleName";
+  test_components = "component";
+  test_component_name = "name";
   test_os = "OS";
   test_mem_in_mb = "memInMB";
   test_cpu_freq_mhz = "CPUFreqMHz";
@@ -552,6 +554,27 @@ SALOME_ResourcesCatalog_Handler::ProcessMachine(xmlNodePtr machine_descr, Parser
   xmlNodePtr aCurSubNode = machine_descr->xmlChildrenNode;
   while(aCurSubNode != NULL)
   {
+    if ( !xmlStrcmp(aCurSubNode->name, (const xmlChar*)test_components) )
+    {
+      //If a component is given, it is in a module with the same name
+      //except if the module name is given
+      if (xmlHasProp(aCurSubNode, (const xmlChar*)test_component_name)) 
+      {
+       xmlChar* component_name = xmlGetProp(aCurSubNode, (const xmlChar*)test_component_name);
+       std::string aComponentName = (const char*)component_name;
+       _resource.ComponentsList.push_back(aComponentName);
+       if (xmlHasProp(aCurSubNode, (const xmlChar*)test_module_name)) 
+       {
+         xmlChar* module_name = xmlGetProp(aCurSubNode, (const xmlChar*)test_module_name);
+         std::string aModuleName = (const char*)module_name;
+         _resource.ModulesList.push_back(aModuleName);
+         xmlFree(module_name);
+       }
+       else
+         _resource.ModulesList.push_back(aComponentName);
+       xmlFree(component_name);
+      }
+    }
     // Process modules
     if ( !xmlStrcmp(aCurSubNode->name, (const xmlChar*)test_modules) )
     {
@@ -661,12 +684,12 @@ void SALOME_ResourcesCatalog_Handler::PrepareDocToXmlFile(xmlDocPtr theDoc)
       xmlNewProp(node, BAD_CAST test_user_name, BAD_CAST (*iter).second.UserName.c_str());
 
      for (vector<string>::const_iterator iter2 =
-             (*iter).second.ModulesList.begin();
-           iter2 != (*iter).second.ModulesList.end();
+             (*iter).second.ComponentsList.begin();
+           iter2 != (*iter).second.ComponentsList.end();
            iter2++)
         {
-         node1 = xmlNewChild(node, NULL, BAD_CAST test_modules, NULL);
-         xmlNewProp(node1, BAD_CAST test_module_name, BAD_CAST (*iter2).c_str());
+         node1 = xmlNewChild(node, NULL, BAD_CAST test_components, NULL);
+         xmlNewProp(node1, BAD_CAST test_component_name, BAD_CAST (*iter2).c_str());
         }
 
       xmlNewProp(node, BAD_CAST test_os, BAD_CAST (*iter).second.OS.c_str());
@@ -750,12 +773,12 @@ void SALOME_ResourcesCatalog_Handler::PrepareDocToXmlFile(xmlDocPtr theDoc)
       xmlNewProp(node, BAD_CAST test_user_name, BAD_CAST (*iter).second.UserName.c_str());
 
      for (vector<string>::const_iterator iter2 =
-             (*iter).second.ModulesList.begin();
-           iter2 != (*iter).second.ModulesList.end();
+             (*iter).second.ComponentsList.begin();
+           iter2 != (*iter).second.ComponentsList.end();
            iter2++)
         {
-         node1 = xmlNewChild(node, NULL, BAD_CAST test_modules, NULL);
-         xmlNewProp(node1, BAD_CAST test_module_name, BAD_CAST (*iter2).c_str());
+         node1 = xmlNewChild(node, NULL, BAD_CAST test_components, NULL);
+         xmlNewProp(node1, BAD_CAST test_component_name, BAD_CAST (*iter2).c_str());
         }
 
       xmlNewProp(node, BAD_CAST test_os, BAD_CAST (*iter).second.OS.c_str());
index 8fa1ca5da022f40a630859d0457bfd28e3693596..c0445989f6ed991b53590eeb992b71c706c2c585 100755 (executable)
@@ -58,7 +58,7 @@ class RESOURCESMANAGER_EXPORT SALOME_ResourcesCatalog_Handler
     void PrepareDocToXmlFile(xmlDocPtr theDoc);
 
   private :
-    std::string previous_module_name;
+    std::string previous_component_name;
 
     ParserResourcesType _resource;
     MapOfParserResourcesType& _resources_list;
@@ -74,8 +74,11 @@ class RESOURCESMANAGER_EXPORT SALOME_ResourcesCatalog_Handler
     const char *test_mpi;
     const char *test_user_name;
     const char *test_appli_path;
+    // for compatibility
     const char *test_modules;
     const char *test_module_name;
+    const char *test_components;
+    const char *test_component_name;
     const char *test_os;
     const char *test_mem_in_mb;
     const char *test_cpu_freq_mhz;
index a09d02cb30c788f4978bed5bba5e9779ce60db9c..40870f49e2b2b5447a4680d32e8b7ae70c88c160 100644 (file)
@@ -135,10 +135,11 @@ void ParserResourcesType::Print()
     "userCommands : " << userCommands << endl <<
     "use : " << use << endl <<
     "NbOfProc : " << nbOfProc << endl <<
-    "Modules : " << endl;
+    "Modules : " << endl <<
+    "Components : " << endl;
 
-  for(int i=0;i<ModulesList.size();i++)
-    oss << "Module " << i+1 << " called : " << ModulesList[i] << endl;
+  for(int i=0;i<ComponentsList.size();i++)
+    oss << "Component " << i+1 << " called : " << ComponentsList[i] << endl;
 
   
   std::list<ParserResourcesClusterMembersType>::iterator it;
@@ -169,7 +170,7 @@ void ParserResourcesType::Clear()
   AppliPath = "";
   batchQueue = "";
   userCommands = "";
-  ModulesList.clear();
+  ComponentsList.clear();
   OS = "";
   use = "";
   ClusterMembersList.clear();
index 6a2c2aa36d1660745dae1d01c1a18e37a7868d49..e4ad2d55f1b80723e31b95667ed11e54361c0e8c 100755 (executable)
@@ -92,6 +92,7 @@ struct RESOURCESMANAGER_EXPORT ParserResourcesType
   MpiImplType mpi;
   std::string UserName;
   std::string AppliPath;
+  std::vector<std::string> ComponentsList;
   std::vector<std::string> ModulesList;
   std::string OS;
   std::string batchQueue;
index e3fb14ffc397f39254fde6c13f8b3ef5b33f68aa..91d2de5c9cdd8938f9b081f8443ff1c9febf0444 100644 (file)
@@ -67,9 +67,7 @@ SALOME_ResourcesManager(CORBA::ORB_ptr orb,
   _poa = PortableServer::POA::_duplicate(poa) ;
   PortableServer::ObjectId_var id = _poa->activate_object(this);
   CORBA::Object_var obj = _poa->id_to_reference(id);
-  Engines::SalomeLauncher_var refContMan =
-    Engines::SalomeLauncher::_narrow(obj);
-
+  Engines::ResourcesManager_var refContMan = Engines::ResourcesManager::_narrow(obj);
   _NS->Register(refContMan,_ResourcesManagerNameInNS);
   MESSAGE("SALOME_ResourcesManager constructor end");
 }
@@ -125,26 +123,24 @@ void SALOME_ResourcesManager::Shutdown()
   _NS->Destroy_Name(_ResourcesManagerNameInNS);
   PortableServer::ObjectId_var oid = _poa->servant_to_id(this);
   _poa->deactivate_object(oid);
-  //_remove_ref();
 }
 
 //=============================================================================
+//! get the name of resources fitting the specified constraints (params)
 /*!
- *  get the list of name of ressources fitting for the specified module.
  *  If hostname specified, check it is local or known in resources catalog.
  *
  *  Else
  *  - select first machines with corresponding OS (all machines if
  *    parameter OS empty),
- *  - then select the sublist of machines on witch the module is known
+ *  - then select the sublist of machines on which the component is known
  *    (if the result is empty, that probably means that the inventory of
- *    modules is probably not done, so give complete list from previous step)
+ *    components is probably not done, so give complete list from previous step)
  */ 
 //=============================================================================
 
 Engines::MachineList *
-SALOME_ResourcesManager::GetFittingResources(const Engines::MachineParameters& params,
-                                            const Engines::CompoList& componentList)
+SALOME_ResourcesManager::GetFittingResources(const Engines::MachineParameters& params)
 {
 //   MESSAGE("ResourcesManager::GetFittingResources");
   machineParams p;
@@ -157,13 +153,15 @@ SALOME_ResourcesManager::GetFittingResources(const Engines::MachineParameters& p
   p.parallelLib = params.parallelLib;
   p.nb_component_nodes = params.nb_component_nodes;
 
-  vector<string> cl;
-  for(unsigned int i=0;i<componentList.length();i++)
-    cl.push_back(string(componentList[i]));
+  for(unsigned int i=0;i<params.componentList.length();i++)
+    p.componentList.push_back(string(params.componentList[i]));
+
+  for(unsigned int i=0;i<params.computerList.length();i++)
+    p.computerList.push_back(string(params.computerList[i]));
   
   Engines::MachineList *ret=new Engines::MachineList;
   try{
-      vector <std::string> vec = _rm.GetFittingResources(p,cl);
+      vector <std::string> vec = _rm.GetFittingResources(p);
       ret->length(vec.size());
       for(unsigned int i=0;i<vec.size();i++)
        (*ret)[i] = (vec[i]).c_str();
@@ -189,14 +187,22 @@ SALOME_ResourcesManager::FindFirst(const Engines::MachineList& listOfMachines)
   for(unsigned int i=0;i<listOfMachines.length();i++)
     ml.push_back(string(listOfMachines[i]));
 
-  return CORBA::string_dup(_rm.FindFirst(ml).c_str());
+  return CORBA::string_dup(_rm.Find("first",ml).c_str());
+}
+
+char *
+SALOME_ResourcesManager::Find(const char* policy, const Engines::MachineList& listOfMachines)
+{
+  vector<string> ml;
+  for(unsigned int i=0;i<listOfMachines.length();i++)
+    ml.push_back(string(listOfMachines[i]));
+  return CORBA::string_dup(_rm.Find(policy,ml).c_str());
 }
 
-Engines::MachineParameters* SALOME_ResourcesManager::GetMachineParameters(const char *hostname)
+Engines::MachineDefinition* SALOME_ResourcesManager::GetMachineParameters(const char *hostname)
 {
   ParserResourcesType resource = _rm.GetResourcesList(string(hostname));
-  Engines::MachineParameters *p_ptr = new Engines::MachineParameters;
-  p_ptr->container_name = CORBA::string_dup("");
+  Engines::MachineDefinition *p_ptr = new Engines::MachineDefinition;
   p_ptr->hostname = CORBA::string_dup(resource.HostName.c_str());
   p_ptr->alias = CORBA::string_dup(resource.Alias.c_str());
   if( resource.Protocol == rsh )
@@ -205,9 +211,9 @@ Engines::MachineParameters* SALOME_ResourcesManager::GetMachineParameters(const
     p_ptr->protocol = "ssh";
   p_ptr->username = CORBA::string_dup(resource.UserName.c_str());
   p_ptr->applipath = CORBA::string_dup(resource.AppliPath.c_str());
-  p_ptr->modList.length(resource.ModulesList.size());
-  for(unsigned int i=0;i<resource.ModulesList.size();i++)
-    p_ptr->modList[i] = CORBA::string_dup(resource.ModulesList[i].c_str());
+  p_ptr->componentList.length(resource.ComponentsList.size());
+  for(unsigned int i=0;i<resource.ComponentsList.size();i++)
+    p_ptr->componentList[i] = CORBA::string_dup(resource.ComponentsList[i].c_str());
   p_ptr->OS = CORBA::string_dup(resource.OS.c_str());
   p_ptr->mem_mb = resource.DataForSort._memInMB;
   p_ptr->cpu_clock = resource.DataForSort._CPUFreqMHz;
index 9ad49734184808a75c7a6641ec73ac0330a63cad..be58300ac0b8b942748c42a25fd0481f8b0f3b29 100644 (file)
@@ -36,7 +36,7 @@
 
 
 #ifdef WIN32
-# ifdef SALOMERESOURCESMANAGER_EXPORTS
+# if defined SALOMERESOURCESMANAGER_EXPORTS || defined SalomeResourcesManager_EXPORTS
 #  define SALOMERESOURCESMANAGER_EXPORT __declspec( dllexport )
 # else
 #  define SALOMERESOURCESMANAGER_EXPORT __declspec( dllimport )
@@ -65,10 +65,10 @@ class SALOMERESOURCESMANAGER_EXPORT SALOME_ResourcesManager:
 
     // CORBA Methods
     Engines::MachineList *
-    GetFittingResources(const Engines::MachineParameters& params,
-                        const Engines::CompoList& componentList);
+    GetFittingResources(const Engines::MachineParameters& params);
     char* FindFirst(const Engines::MachineList& listOfMachines);
-    Engines::MachineParameters* GetMachineParameters(const char *hostname);
+    char* Find(const char *policy, const Engines::MachineList& listOfMachines);
+    Engines::MachineDefinition* GetMachineParameters(const char *hostname);
 
     // Cpp Methods
     void Shutdown();
index c56b7455311024e34f44a5c160914a62b9caf2b4..73c36db8d9d3813bcb6824430c2714c0ec2181b3 100644 (file)
@@ -47,7 +47,7 @@ salomeinclude_HEADERS= \
        SALOMEDS_Defines.hxx
 
 # Scripts to be installed
-dist_salomescript_DATA = SALOME_DriverPy.py
+dist_salomescript_PYTHON = SALOME_DriverPy.py
 
 #
 # ===============================================================
index 992bd9163c3a65fb70d2048939adef82c084892e..01a3f03bd2da6143d639dc0cff04edf21ffd5b71 100644 (file)
@@ -29,7 +29,7 @@
 #include "Utils_ExceptHandlers.hxx"
 
 #include <stdexcept>
-#include <strstream>
+#include <sstream>
 #include <string>
 #include <vector>
 
index 9a4de029d8109a0cdbe3fd9cb7d6496076373c5d..30ee7075b978b8bd5b5bc04f40c81cf4efc79eda 100644 (file)
@@ -26,7 +26,7 @@
 #include "SALOMEDS_AttributeTableOfReal_i.hxx"
 #include "SALOMEDS.hxx"
 
-#include <strstream>
+#include <sstream>
 #include <string>
 #include <vector>
 
index 56a29f66a957bc4691336b0ef61df99d78e1f419..ebc8ebd7657a416feaa58a9b1636bc3396da0f32 100644 (file)
@@ -26,7 +26,7 @@
 #include "SALOMEDS_AttributeTableOfString_i.hxx"
 #include "SALOMEDS.hxx"
 
-#include <strstream>
+#include <sstream>
 #include <string>
 #include <vector>
 
index 1c4475e4c635712239d16db4d3dfb630ce1430d4..45d2c7dd3bd6368c2bd0fb2d7702477031561fa3 100755 (executable)
@@ -27,7 +27,7 @@
 #define _SALOMEDS_Defines_HXX_
 
 #ifdef WIN32
-# ifdef SALOMEDS_EXPORTS
+# if defined SALOMEDS_EXPORTS || defined SalomeDS_EXPORTS
 #  define SALOMEDS_EXPORT __declspec( dllexport )
 # else
 #  define SALOMEDS_EXPORT __declspec( dllimport )
index 63bd4acd853bb80cf5007416f9f35709d56df7ab..c579fa47fa0f371998e9e80836beb31846dc0cce 100644 (file)
@@ -41,7 +41,7 @@
 #include "Basics_Utils.hxx"
 #include "SALOME_GenericObj_i.hh"
 
-#include <strstream>
+#include <sstream>
 #include <vector>
 #include <map>
 
index 43ce2d59b7fb3d8b43f5ef630bb558c371149bcb..3ec35db2baa21a109202a585ec622b539ed92820 100644 (file)
@@ -667,16 +667,23 @@ void SALOMEDS_Study_i::Close()
     if (sco->ComponentIOR(IOREngine)) {
       // we have found the associated engine to write the data 
       MESSAGE ( "We have found an engine for data type :"<< sco->ComponentDataType());
-      CORBA::Object_var obj = _orb->string_to_object(IOREngine);
-      if (!CORBA::is_nil(obj)) {
-       SALOMEDS::Driver_var anEngine = SALOMEDS::Driver::_narrow(obj) ;
-
-       if (!anEngine->_is_nil()) { 
-         SALOMEDS::unlock();
-         anEngine->Close(sco);
-         SALOMEDS::lock();
-       }
-      }
+      //_narrow can throw a corba exception
+      try
+        {
+          CORBA::Object_var obj = _orb->string_to_object(IOREngine);
+          if (!CORBA::is_nil(obj)) 
+            {
+              SALOMEDS::Driver_var anEngine = SALOMEDS::Driver::_narrow(obj) ;
+              if (!anEngine->_is_nil()) 
+                { 
+                  SALOMEDS::unlock();
+                  anEngine->Close(sco);
+                  SALOMEDS::lock();
+                }
+            }
+        } 
+      catch (CORBA::Exception&) 
+        {/*pass*/ }
     }
   }
 
index c052e3b705c7703eca0b4c3ce902716f558fdf3b..f1c35770767b7a3573920fc464bf52109f0db1d5 100644 (file)
@@ -35,7 +35,7 @@ include $(top_srcdir)/salome_adm/unix/make_common_starter.am
 salomeinclude_HEADERS= SALOMEDSTest.hxx
 
 # Scripts to be installed
-dist_salomescript_SCRIPTS = TestSALOMEDS.py
+dist_salomescript_PYTHON = TestSALOMEDS.py
 
 #
 # ===============================================================
index b9942098a86a8c09999c514f2af993dd32aaee3c..2d63937ba262983730dace527710bf04ec300905 100644 (file)
@@ -23,7 +23,7 @@
 #define  SALOMEDSCLIENT_DEF_HXX
 
 #ifdef WIN32
-# ifdef SALOMEDSCLIENT_EXPORTS
+# if defined SALOMEDSCLIENT_EXPORTS || defined SalomeDSClient_EXPORTS
 #  define SALOMEDSCLIENT_EXPORT __declspec( dllexport )
 # else
 #  define SALOMEDSCLIENT_EXPORT __declspec( dllimport )
index 441e578a1062d5a19b027ca3a65be904c9ccf87d..9f012789c0557940da12add7ac06aa09d56d61e8 100644 (file)
@@ -27,7 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <strstream>
+#include <sstream>
 #include <sstream>
 
 using namespace std;
@@ -710,7 +710,7 @@ void SALOMEDSImpl_AttributeParameter::Load(const string& theValue)
   _realarrays.clear();
   _intarrays.clear();
 
-  istrstream buffer(theValue.c_str(), theValue.size());
+  istringstream buffer(theValue.c_str());
 
   int size, val, ival;
   double val2;
index da906393ca33cea158fb7de9103858e8edd5a0e8..24a21d7726d8f78144f9ea0bdbd02b87df52d788 100644 (file)
@@ -24,7 +24,7 @@
 //  Module : SALOME
 //
 #include "SALOMEDSImpl_AttributeTableOfInteger.hxx"
-#include <strstream>
+#include <sstream>
 
 using namespace std;
 
index 1b9dd68c608bac945778a75ac2982f7a048ba75d..af1baaacd911abeec1b7b027590f4c909a316ea6 100644 (file)
@@ -25,7 +25,7 @@
 //
 #include "SALOMEDSImpl_AttributeTableOfReal.hxx"
 #include <stdio.h>
-#include <strstream>
+#include <sstream>
 
 using namespace std;
 
index f5872c4ad0570488885c81548dc0faf3dbdbbb2a..c73f7c730bfbb17c0f7e4b7e7f7b4cffeef13ea1 100644 (file)
@@ -26,7 +26,7 @@
 #include "SALOMEDSImpl_AttributeTableOfString.hxx"
 #include <stdio.h>
 #include <stdlib.h>
-#include <strstream>
+#include <sstream>
 
 using namespace std;
 
index 5b6ee955d77e488a1dbff7ec3ab7de39c2ec6775..65905c915576231b2ed24f0a54105ebadc39638f 100755 (executable)
@@ -27,7 +27,7 @@
 #define _SALOMEDSImpl_Defines_HXX_
 
 #ifdef WIN32
-# if defined SALOMEDSIMPL_EXPORTS
+# if defined SALOMEDSIMPL_EXPORTS || defined SalomeDSImpl_EXPORTS
 #  define SALOMEDSIMPL_EXPORT __declspec( dllexport )
 # else
 #  define SALOMEDSIMPL_EXPORT __declspec( dllimport )
index 063562ae304ecf23228cfda72607fdf8f79acb2d..2fa36c294f3201e642ab01d1ecc2e7efd070ad9b 100644 (file)
@@ -1210,13 +1210,24 @@ bool SALOMEDSImpl_Study::DumpStudy(const string& thePath,
   //set sys.path and add a creation of the study.
   fp << GetDumpStudyComment() << endl << endl;
   fp << "import sys" << endl;
+  fp << "import os.path" << endl;
   fp << "import " << aBatchModeScript << endl << endl;
 
   fp << aBatchModeScript << ".salome_init()" << endl << endl;
 
-  fp << _GetNoteBookAccess();
-
-  fp << "sys.path.insert( 0, \'" << thePath << "\')" << endl << endl;
+  fp << _GetNoteBookAccess() << endl;
+
+  // IPAL21005 (Dump/load python script works only with absolute path)
+  // try to use '__file__' to get an absolute path to the generated scripts
+  // or use the path passed to this method (case of using execfile() command)
+  fp << "#Get absolute path to generated scripts:" << endl;
+  fp << "try:"                                     << endl;
+  fp << "    absPath = os.path.dirname(__file__)"  << endl;
+  fp << "except NameError:"                        << endl;
+  fp << "    absPath = \'" << thePath << "\'"      << endl;
+  fp << "    pass"                                 << endl;
+  fp << "sys.path.insert( 0, absPath )"            << endl << endl;
+  //fp << "sys.path.insert( 0, \'" << thePath << "\')" << endl << endl;
 
   //Dump NoteBook Variables
   fp << _GetStudyVariablesScript();
index 4a0b2ef77e8bdad1bb60c719c65b5568200a6ee0..b98a47364e31ce2f053d2c23b2b79e11f483268c 100644 (file)
@@ -29,7 +29,7 @@
 #include "SALOMEDSImpl_Defines.hxx"
 
 // std C++ headers
-#include <strstream>
+#include <sstream>
 #include <string>
 #include <vector>
 
index 3b02fb3c491871a2224fd1ff971cc666081751b6..3ac0c73a5bb96c7c3f50eb4778400df828aadc87 100644 (file)
@@ -35,7 +35,7 @@ include $(top_srcdir)/salome_adm/unix/make_common_starter.am
 salomeinclude_HEADERS= SALOMEDSImplTest.hxx
 
 # Scripts to be installed
-dist_salomescript_SCRIPTS = TestSALOMEDSImpl.py
+dist_salomescript_PYTHON = TestSALOMEDSImpl.py
 
 #
 # ===============================================================
index 663bdb57f7fd5710b43a5e359a12e3a45ce18dcf..568bd2d3640f96a7a3429ca5f832221e94a50a65 100755 (executable)
@@ -27,7 +27,7 @@
 #define _SALOME_LOCALTRACE_HXX_
 
 #ifdef WIN32
-# ifdef SALOMELOCALTRACE_EXPORTS
+# if defined SALOMELOCALTRACE_EXPORTS || defined SALOMELocalTrace_EXPORTS
 #  define SALOMELOCALTRACE_EXPORT __declspec( dllexport )
 # else
 #  define SALOMELOCALTRACE_EXPORT __declspec( dllimport )
index e97bbb260b58d1ccccfac210d1cc6695eb6b259f..e5a8fd956cc2f207ebcbabedfc621df9e81e1ca0 100644 (file)
@@ -39,7 +39,7 @@ SRCROOT=$(srcdir)/../..
 salomeinclude_HEADERS = SALOMELocalTraceTest.hxx
 
 # Executable scripts to be installed
-dist_salomescript_SCRIPTS = TestSALOMELocalTrace.py
+dist_salomescript_PYTHON = TestSALOMELocalTrace.py
 
 #
 # ===============================================================
index 5b32f44800c2a5ac98cb5c82fa8158f229de0830..3fa09fabf6e6cb66f1fc8e54141d3870972bb858 100644 (file)
@@ -36,7 +36,7 @@
 //! for usage without CORBA
 
 #ifdef WIN32
-# ifdef SALOMETRACECOLLECTOR_EXPORTS
+# if defined SALOMETRACECOLLECTOR_EXPORTS || defined with_loggerTraceCollector_EXPORTS
 #  define SALOMETRACECOLLECTOR_EXPORT __declspec( dllexport )
 # else
 #  define SALOMETRACECOLLECTOR_EXPORT
index 9ef92294df21e8022b16706e30e781b37cbd7374..fbe2bd53d6ff84ed9c2fc78360e52f7baeab108a 100644 (file)
@@ -38,7 +38,7 @@ include $(top_srcdir)/salome_adm/unix/make_common_starter.am
 salomeinclude_HEADERS= SALOMETraceCollectorTest.hxx
 
 # Scripts to be installed
-dist_salomescript_SCRIPTS = TestSALOMETraceCollector.py
+dist_salomescript_PYTHON = TestSALOMETraceCollector.py
 
 
 #
index 2184143e947aecc7009a3d8d0a07e8f5ab3c8d0c..427762d6dbbeb3123a31559079c54eb2ef1b1f36 100644 (file)
@@ -37,7 +37,7 @@
 #include CORBA_SERVER_HEADER(SALOMEDS)
 
 #ifdef WIN32
-# ifdef TOOLSDS_EXPORTS
+# if defined TOOLSDS_EXPORTS
 #  define TOOLSDS_EXPORT __declspec( dllexport )
 # else
 #  define TOOLSDS_EXPORT __declspec( dllimport )
index 144cbe3898526cb5ff5f342f8b177986b79cabe9..f69747c1c2555e67f1acad8122dc1ad8cb1d6516 100644 (file)
@@ -34,7 +34,7 @@ include $(top_srcdir)/salome_adm/unix/make_common_starter.am
 #
 # header files  
 # Scripts to be installed
-dist_salomescript_DATA = \
+dist_salomescript_PYTHON = \
        SALOME_TestComponentPy.py \
        TestComponentPy.py \
        TestLogger.py
index fc0f0bb29e8de5e3012121f3a3b563b2e89521a9..8246ffe04cb7a8b1bd26ddc327bac25befa4de17 100644 (file)
@@ -27,7 +27,7 @@
 #define SALOME_TESTCOMPONENT_HXX
 
 #ifdef WIN32
-# if defined TESTCONTAINER_EXPORTS
+# if defined TESTCONTAINER_EXPORTS || defined SalomeTestComponentEngine_EXPORTS
 #  define TESTCONTAINER_EXPORT __declspec( dllexport )
 # else
 #  define TESTCONTAINER_EXPORT __declspec( dllimport )
index 3e64bf5650716696b835650114d1370261317670..5a9efeced85df4cd392ec24ddebee9e87f9a3cb8 100644 (file)
@@ -33,7 +33,7 @@ include $(top_srcdir)/salome_adm/unix/make_common_starter.am
 #
 
 # Executable scripts to be installed
-dist_salomescript_SCRIPTS = UnitTests.py
+dist_salomescript_PYTHON = UnitTests.py
 
 #
 # ===============================================================
index 7ef2a59e2a709c66cfc0b14af9e1e32afc05d215..7b73b10667479dde058f6b4baf4b1ac5e824df08 100644 (file)
@@ -43,7 +43,7 @@ salomeinclude_HEADERS =\
        SALOME_Utils.hxx
 
 # Scripts to be exported
-dist_salomescript_DATA =\
+dist_salomescript_PYTHON =\
        Utils_Identity.py \
        SALOME_utilities.py
 
index d3d3184b7ce7fc4beed53228b7b45ae13092ce0a..805a8e830157fada3badcc3ef5d61db741ad70fa 100755 (executable)
@@ -27,7 +27,7 @@
 #define _SALOME_UTILS_HXX_
 
 #ifdef WIN32
-# if defined UTILS_EXPORTS
+# if defined UTILS_EXPORTS || defined OpUtil_EXPORTS
 #  define UTILS_EXPORT __declspec( dllexport )
 # else
 #  define UTILS_EXPORT __declspec( dllimport )
index befa572ae8abf92efdd97cf4d541f590bca2da88..fe50c050135a714ee61debd8ec87611532970a78 100644 (file)
@@ -37,7 +37,7 @@ include $(top_srcdir)/salome_adm/unix/make_common_starter.am
 salomeinclude_HEADERS= UtilsTest.hxx
 
 # Scripts to be installed
-dist_salomescript_SCRIPTS = TestUtils.py
+dist_salomescript_PYTHON = TestUtils.py
 
 
 #
index c093e05c5caacd4134bab7ded4e26529b3792387..30d378266cd45dcbe8b44319f8c848f8085e6752 100644 (file)
@@ -46,7 +46,7 @@
 //therefore (temporary solution) defines are placed below
 
 #ifdef WIN32
-# ifdef UTILS_EXPORTS
+# if defined UTILS_EXPORTS || defined OpUtil_EXPORTS
 #  define UTILS_EXPORT __declspec( dllexport )
 # else
 #  define UTILS_EXPORT __declspec( dllimport )