# 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 \
nameserver.py \
NSparam.py \
orbmodule.py \
- runIDLparser \
runNS.py \
- runNS.sh \
- runSalome \
- runSalome.csh \
- runSalome.ksh \
runSalome.py \
salomeConsole.py \
salome_session.py \
shutdownSalome.py \
virtual_salome.py \
waitContainers.py \
- waitNS.py \
- waitNS.sh
+ waitNS.py
EXTRA_DIST = appliskel
rm -rf $(DESTDIR)$(salomescriptdir)/appliskel; \
fi;
+install-data-hook:
+ @for f in $(dist_salomescript_PYTHON) ; do \
+ chmod -f a+x $(DESTDIR)$(salomescriptdir)/$$f ; \
+ done
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
#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 , ' &']
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
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
cp -Rp $(srcdir)/static $(distdir) ; \
rm -rf $(distdir)/static/CVS
+# VSR: nullify these make targets to avoid 'make distcheck' failure
+dvi:
+pdf:
+ps:
+
</head>
<body>
<hr style="width: 100%; height: 2px;">
-<div style="text-align: center;">Copyright © 2003-2007 CEA, EDF<br>
+<div style="text-align: center;">
+Copyright © 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE<br>
+Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS<br>
</div>
</body>
</html>
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 \
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
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
#---------------------------------------------------------------------------
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
</head>
<body>
<hr style="width: 100%; height: 2px;">
-<div style="text-align: center;">Copyright © 2003-2007 CEA, EDF<br>
+<div style="text-align: center;">
+Copyright © 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE<br>
+Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS<br>
</div>
</body>
</html>
%.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
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:
*/
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.
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
/*!
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.
//! 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
{
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();
//! 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 );
} ;
};
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();
};
} ;
<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 -->
#
# 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)
+
+# ------
#
# 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)
+
+# ------
#
# 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)
# FIND_LIBRARY(SZIP_LIBS szlib ${SZIP_ROOT}/lib)
# SET(HDF5_LIBS ${HDF5_LIBS} ${SZIP_LIBS})
#ENDIF(${NB} GREATER 0)
+
+# ------
#
# 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)
+
+# ------
#
# 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)
+# ----
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
MARK_AS_ADVANCED(ISSUE)
FIND_FILE(ISSUE issue /etc)
IF(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")
#
# 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)
#
# 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)
#
# 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)
+
+# ----
FindPTHREADS.cmake \
FindPYTHON.cmake \
FindSWIG.cmake \
-install_python_from_idl.cmake
+install_python_from_idl.cmake \
+install_and_compile_python_file.cmake
# --
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
# --
"TransformationGUI",
]
med_list = [
+ "InterpGeometric2DAlg",
+ "interpkernelbases",
"interpkernel",
- "InterpKernelTest",
- "MEDMEMCppTest",
+ "MEDClientcmodule",
+ "medcoupling",
+ "MEDEngine",
+ "MEDMEMImpl",
"medmem",
+ "MED",
"med_V2_1",
"MEDWrapperBase",
"MEDWrapper",
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 ...
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
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)
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
# --
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("""
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":
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)
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)
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}
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:
# --
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})
''')
# --
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'''
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):
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)
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})
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}")
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})
''')
# --
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)
''')
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)
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
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
#
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
--- /dev/null
+# 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}")
dnl on utilise donc gnu pour generer les dependances.
DEPCC=gcc
DEPCXX=g++
- DEPCXXFLAGS="-Wno-deprecated"
+ DEPCXXFLAGS=
DIFFFLAGS="-w"
dnl MACHINE="OSF1"
;;
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)
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
],
[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)
#ifdef WIN32
-# ifdef BASICS_EXPORTS
+# if defined BASICS_EXPORTS || defined SALOMEBasics_EXPORTS
# define BASICS_EXPORT __declspec( dllexport )
# else
# define BASICS_EXPORT __declspec( dllimport )
#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 )
//#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")
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")
{
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")
{
#
# 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
#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 )
}
}
#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");
+ }
+}
+
Salome_file_i.hxx
# Scripts to be installed
-dist_salomescript_DATA =\
+dist_salomescript_PYTHON =\
SALOME_ComponentPy.py \
SALOME_Container.py
$(CORBA_LIBS) \
$(PYTHON_LIBS)
+install-data-hook:
+ @for f in $(dist_salomescript_PYTHON) ; do \
+ chmod -f a+x $(DESTDIR)$(salomescriptdir)/$$f ; \
+ done
// 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
#endif
#include <iostream>
-#include <strstream>
+#include <sstream>
#include <string>
#include <stdio.h>
#include <time.h>
#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 )
}
//=============================================================================
+//! shutdown all the containers, then the ContainerManager servant
/*! CORBA method:
- * shutdown all the containers, then the ContainerManager servant
*/
//=============================================================================
_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
*/
//=============================================================================
{
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)
{
}
//=============================================================================
-//! 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());
{
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&)
{
}
}
+ //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 &";
// 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();
}
#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);
if ( CORBA::is_nil(ret) )
{
- MESSAGE("SALOME_LifeCycleCORBA::StartOrFindContainer rsh failed");
+ MESSAGE("SALOME_ContainerManager::StartContainer rsh failed");
}
else
{
}
//=============================================================================
-//! 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;
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))
{
}
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
/*! 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;
// 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();
/*! 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 !");
}
#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.
// 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;
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();
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
{
INFOS(" no FILE structure associated to fileId " <<fileId);
}
- else fclose(fp);
+ else
+ {
+ fclose(fp);
+ _fileAccess.erase(fileId);
+ }
}
#define FILEBLOCK_SIZE 256*1024
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);
+}
+
+
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;
};
#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();
#define DF_DEF_HXX
#ifdef WIN32
-# ifdef DF_EXPORTS
+# if defined DF_EXPORTS
# define DF_EXPORT __declspec( dllexport )
# else
# define DF_EXPORT __declspec( dllimport )
#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 )
# ===============================================================
#
+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 \
//
#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;
#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 )
#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 )
# 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
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."
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 ============================="
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 ]
+
#ifdef WIN32
# include <io.h>
#endif
-BatchTest::BatchTest(const Engines::MachineParameters& batch_descr)
+BatchTest::BatchTest(const Engines::MachineDefinition& batch_descr)
{
_batch_descr = batch_descr;
class SALOMELAUNCHER_EXPORT BatchTest
{
public:
- BatchTest(const Engines::MachineParameters& batch_descr);
+ BatchTest(const Engines::MachineDefinition& batch_descr);
virtual ~BatchTest();
bool test();
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;
// 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());
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());
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);
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);
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);
#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)
_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);
}
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);
using namespace std;
-#ifdef _DEBUG_
-static int MYDEBUG = 1;
-#else
-static int MYDEBUG = 0;
-#endif
-
//=============================================================================
/*!
* Constructor
#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)
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");
_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 "";
}
}
#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 )
#include "SALOME_ContainerManager.hxx"
#include "SALOME_Component_i.hxx"
#include "SALOME_NamingService.hxx"
+#include "SALOME_FileTransferCORBA.hxx"
using namespace std;
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 (! 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();
}
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();
}
{
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;
}
* \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
*/
//=============================================================================
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);
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();
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);
+}
+
#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 )
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();
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;
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();
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";
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;
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;
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)
+
#
# Scripts to be installed.
-dist_salomescript_DATA =\
+dist_salomescript_PYTHON =\
LifeCycleCORBA.py \
TestLifeCycleCORBA.py
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
salomeinclude_HEADERS=
# Scripts to be installed
-dist_salomescript_SCRIPTS = \
+dist_salomescript_PYTHON = \
LifeCycleCORBA_SWIGTest.py \
+ testresourcemanager.py \
+ testcontainermanager.py \
TestLifeCycleCORBA_SWIG.py
#
# ===============================================================
#
bin_PROGRAMS =
+
+install-data-hook:
+ @for f in $(dist_salomescript_PYTHON) ; do \
+ chmod -f a+x $(DESTDIR)$(salomescriptdir)/$$f ; \
+ done
--- /dev/null
+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()
+
--- /dev/null
+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()
+
%feature("autodoc", "1");
%include <std_except.i>
+%include "std_string.i"
// ----------------------------------------------------------------------------
#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.
// Constructor for the singleton. Sets up the function pointers.
};
- omniORBpyAPI* api;
+omniORBpyAPI* api;
%}
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");
// ----------------------------------------------------------------------------
+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);
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 {
}
}
-
-%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
}
-%typemap(python,freearg) const Engines::MachineParameters &
+%typemap(freearg) const Engines::MachineParameters &
{
MESSAGE("delete $1");
delete $1;
@CORBA_LIBS@
# Scripts target
-dist_salomescript_DATA = SALOME_Trace.py
+dist_salomescript_PYTHON = SALOME_Trace.py
#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 )
// 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);
#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"
# endif /* WIN32 */
-class SALOME_Trace : public std::ostrstream
+class SALOME_Trace : public std::ostringstream
{
public:
virtual ~SALOME_Trace();
#
# Executable scripts to be installed
-dist_salomescript_SCRIPTS = TestKiller.py
+dist_salomescript_PYTHON = TestKiller.py
// 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)
_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();
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
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)
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();
+}
+
#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
// 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,
(*_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;
}
#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{
/* 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
#include <string>
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SALOME_MPIObject)
-#define defaultService "SERVER"
class POException
{
// 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;
} ;
SUBDIR_BASE = \
Basics \
SALOMELocalTrace \
- HDFPersist
+ HDFPersist\
+ KERNEL_PY
SUBDIR_CORBA = \
DF \
TOOLSDS \
SALOMEDSImpl \
SALOMEDS \
- KERNEL_PY \
ModuleGenerator \
Communication \
Communication_SWIG \
SALOME_ModuleCatalog.hxx
# Scripts to be installed
-dist_salomescript_DATA = TestModuleCatalog.py
+dist_salomescript_PYTHON = TestModuleCatalog.py
#
#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 )
#
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
#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 )
SALOME_NamingService_defs.hxx
# Scripts to be exported
-dist_salomescript_DATA =\
+dist_salomescript_PYTHON =\
SALOME_NamingServicePy.py
#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 )
salomeinclude_HEADERS= NamingServiceTest.hxx
# Scripts to be installed
-dist_salomescript_SCRIPTS = TestNamingService.py
+dist_salomescript_PYTHON = TestNamingService.py
#
-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
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)
#
#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 )
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 )
}
INFOS("Shutdown Parallel Proxy");
+ _NS->Destroy_FullDirectory(_containerName.c_str());
+ _NS->Destroy_Name(_containerName.c_str());
if(!CORBA::is_nil(_orb))
_orb->shutdown(0);
}
_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");
+ }
+}
+
//=============================================================================
/*!
*
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 )
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:
#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 )
#include <map>
#include <list>
-#include <sys/types.h>
-#include <sys/stat.h>
#include <libxml/parser.h>
#include <algorithm>
using namespace std;
+static LoadRateManagerFirst first;
+static LoadRateManagerCycl cycl;
+static LoadRateManagerAltCycl altcycl;
//=============================================================================
/*!
* just for test
#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;
}
//=============================================================================
#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)
_path_resources.push_back(user_file);
}
+ _lasttime=0;
+
ParseXmlFiles();
#if defined(_DEBUG_) || defined(_DEBUG)
cerr << "ResourcesManager_cpp constructor end";
}
//=============================================================================
+//! 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;
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());
//=============================================================================
/*!
* 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;
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;
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;
}
//=============================================================================
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);
}
//=============================================================================
{
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;
}
#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
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
~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,
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);
//! 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__
#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 )
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("");
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;
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;
}
+
#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
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";
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) )
{
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());
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());
void PrepareDocToXmlFile(xmlDocPtr theDoc);
private :
- std::string previous_module_name;
+ std::string previous_component_name;
ParserResourcesType _resource;
MapOfParserResourcesType& _resources_list;
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;
"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;
AppliPath = "";
batchQueue = "";
userCommands = "";
- ModulesList.clear();
+ ComponentsList.clear();
OS = "";
use = "";
ClusterMembersList.clear();
MpiImplType mpi;
std::string UserName;
std::string AppliPath;
+ std::vector<std::string> ComponentsList;
std::vector<std::string> ModulesList;
std::string OS;
std::string batchQueue;
_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");
}
_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;
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();
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 )
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;
#ifdef WIN32
-# ifdef SALOMERESOURCESMANAGER_EXPORTS
+# if defined SALOMERESOURCESMANAGER_EXPORTS || defined SalomeResourcesManager_EXPORTS
# define SALOMERESOURCESMANAGER_EXPORT __declspec( dllexport )
# else
# define SALOMERESOURCESMANAGER_EXPORT __declspec( dllimport )
// 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();
SALOMEDS_Defines.hxx
# Scripts to be installed
-dist_salomescript_DATA = SALOME_DriverPy.py
+dist_salomescript_PYTHON = SALOME_DriverPy.py
#
# ===============================================================
#include "Utils_ExceptHandlers.hxx"
#include <stdexcept>
-#include <strstream>
+#include <sstream>
#include <string>
#include <vector>
#include "SALOMEDS_AttributeTableOfReal_i.hxx"
#include "SALOMEDS.hxx"
-#include <strstream>
+#include <sstream>
#include <string>
#include <vector>
#include "SALOMEDS_AttributeTableOfString_i.hxx"
#include "SALOMEDS.hxx"
-#include <strstream>
+#include <sstream>
#include <string>
#include <vector>
#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 )
#include "Basics_Utils.hxx"
#include "SALOME_GenericObj_i.hh"
-#include <strstream>
+#include <sstream>
#include <vector>
#include <map>
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*/ }
}
}
salomeinclude_HEADERS= SALOMEDSTest.hxx
# Scripts to be installed
-dist_salomescript_SCRIPTS = TestSALOMEDS.py
+dist_salomescript_PYTHON = TestSALOMEDS.py
#
# ===============================================================
#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 )
#include <stdio.h>
#include <stdlib.h>
-#include <strstream>
+#include <sstream>
#include <sstream>
using namespace std;
_realarrays.clear();
_intarrays.clear();
- istrstream buffer(theValue.c_str(), theValue.size());
+ istringstream buffer(theValue.c_str());
int size, val, ival;
double val2;
// Module : SALOME
//
#include "SALOMEDSImpl_AttributeTableOfInteger.hxx"
-#include <strstream>
+#include <sstream>
using namespace std;
//
#include "SALOMEDSImpl_AttributeTableOfReal.hxx"
#include <stdio.h>
-#include <strstream>
+#include <sstream>
using namespace std;
#include "SALOMEDSImpl_AttributeTableOfString.hxx"
#include <stdio.h>
#include <stdlib.h>
-#include <strstream>
+#include <sstream>
using namespace std;
#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 )
//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();
#include "SALOMEDSImpl_Defines.hxx"
// std C++ headers
-#include <strstream>
+#include <sstream>
#include <string>
#include <vector>
salomeinclude_HEADERS= SALOMEDSImplTest.hxx
# Scripts to be installed
-dist_salomescript_SCRIPTS = TestSALOMEDSImpl.py
+dist_salomescript_PYTHON = TestSALOMEDSImpl.py
#
# ===============================================================
#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 )
salomeinclude_HEADERS = SALOMELocalTraceTest.hxx
# Executable scripts to be installed
-dist_salomescript_SCRIPTS = TestSALOMELocalTrace.py
+dist_salomescript_PYTHON = TestSALOMELocalTrace.py
#
# ===============================================================
//! 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
salomeinclude_HEADERS= SALOMETraceCollectorTest.hxx
# Scripts to be installed
-dist_salomescript_SCRIPTS = TestSALOMETraceCollector.py
+dist_salomescript_PYTHON = TestSALOMETraceCollector.py
#
#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 )
#
# header files
# Scripts to be installed
-dist_salomescript_DATA = \
+dist_salomescript_PYTHON = \
SALOME_TestComponentPy.py \
TestComponentPy.py \
TestLogger.py
#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 )
#
# Executable scripts to be installed
-dist_salomescript_SCRIPTS = UnitTests.py
+dist_salomescript_PYTHON = UnitTests.py
#
# ===============================================================
SALOME_Utils.hxx
# Scripts to be exported
-dist_salomescript_DATA =\
+dist_salomescript_PYTHON =\
Utils_Identity.py \
SALOME_utilities.py
#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 )
salomeinclude_HEADERS= UtilsTest.hxx
# Scripts to be installed
-dist_salomescript_SCRIPTS = TestUtils.py
+dist_salomescript_PYTHON = TestUtils.py
#
//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 )