Salome HOME
Merge branch 'V9_2_2_BR'
[tools/yacsgen.git] / module_generator / mpicompo.py
index 21b20ad12eb49eeca96225ca07f041175020249c..409179364a53e7002f35d30bb1735eea558482cd 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2009-2015  EDF R&D
+# Copyright (C) 2009-2019  EDF R&D
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
 """
 
 import os
-from gener import Component, Invalid
-from cpp_tmpl import initService, cxxService, hxxCompo, cxxCompo
-from cpp_tmpl import exeCPP, cmake_src_compo_cpp
-from yacstypes import corba_rtn_type, corba_in_type
-import mpi_tmpl
-from cppcompo import CPPComponent
+from module_generator.gener import Component, Invalid
+from module_generator.cpp_tmpl import initService, cxxService, hxxCompo, cxxCompo
+from module_generator.cpp_tmpl import exeCPP, cmake_src_compo_cpp
+from module_generator.yacstypes import corba_rtn_type, corba_in_type
+from module_generator import mpi_tmpl
+from module_generator.cppcompo import CPPComponent
 
 try:
   from string import Template
 except:
-  from compat import Template,set
+  from module_generator.compat import Template,set
 
 class MPIComponent(CPPComponent):
   """
@@ -42,8 +42,7 @@ class MPIComponent(CPPComponent):
    :param name: gives the name of the component.
    :type name: str
    :param services: the list of services (:class:`Service`) of the component.
-   :param kind: If it is given and has the value "exe", the component will be built as a standalone
-      component (executable or shell script). The default is to build the component as a dynamic library.
+   :param kind: For this type of component, "lib" is the unique valid option. The component is built as a dynamic library.
    :param libs: list of the additional libraries. see *Library* class.
       If you want to add "libmylib.so", installed in "/path/to/lib" you should use:
          libs=[Library(name="mylib", path="/path/to/lib")]
@@ -106,11 +105,7 @@ class MPIComponent(CPPComponent):
     cmake_vars = "${KERNEL_SalomeMPIContainer}\n  " + cmake_vars
     cxxfile = "%s.cxx" % self.name
     hxxfile = "%s.hxx" % self.name
-    if self.kind == "exe":
-      exe_opt = 1
-    else:
-      exe_opt = 0
-    ret = { cxxfile:self.makecxx(gen, exe_opt),
+    ret = { cxxfile:self.makecxx(gen),
             hxxfile:self.makehxx(gen)
           }
     sources = " ".join(map(os.path.basename,self.sources))
@@ -159,7 +154,7 @@ class MPIComponent(CPPComponent):
                                servicesdef=servicesdef, inheritedclass=inheritedclass,
                                compodefs=compodefs)
 
-  def makecxx(self, gen, exe=0):
+  def makecxx(self, gen):
     """return a string that is the content of .cxx file
     """
     services = []
@@ -209,3 +204,13 @@ class MPIComponent(CPPComponent):
     if self.interfacedefs:
       idldefs = idldefs + self.interfacedefs
     return idldefs
+  
+  def additionalLibraries(self):
+    cmake_text, cmake_vars = Component.additionalLibraries(self)
+    if "MED" in self.getDependentModules():
+      cmake_vars = cmake_vars + """
+  ${MED_paramedmemcompo}
+  ${MED_paramedcouplingcorba}  
+"""
+    return cmake_text, cmake_vars
+