Salome HOME
Merge branch 'V8_0_0_BR'
[tools/yacsgen.git] / module_generator / cppcompo.py
index 709b680da0a6aa2bb16b6a6fc4ddcd886e135e14..290277318e761f6d7e4755f2b3e00ab917b6ceed 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2009-2014  EDF R&D
+# Copyright (C) 2009-2015  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
@@ -42,11 +42,11 @@ class CPPComponent(Component):
    :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 libs: list of the additional libraries. see :class:'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"]
+         libs=[Library(name="mylib", path="/path/to/lib")]
       For more advanced features, see the documentation of cmake / FIND_LIBRARY
-   :param rlibs: semicolon-separated list specifying the rpath to use in installed targets
+   :param rlibs: space-separated list specifying the rpath to use in installed targets
    :param includes: additional include directories, separated by spaces.
    :param sources: gives all the external source files to add in the compilation step (list of paths).
    :param exe_path: is only used when kind is "exe" and gives the path to the standalone component.
@@ -59,7 +59,7 @@ class CPPComponent(Component):
    :param interfacedefs: can be used to add idl definitions (or includes of idl files) into the generated idl of the module.
    :param inheritedinterface: can be used to make the component inherit an extra idl interface that has been included through
       the *idls* and *interfacedefs* parameters. See the cppgui1 example for how to use these last parameters.
-   :param addmethods: is a C++ specific parameter that can be used to redefine a component method (DumpPython for example). This
+   :param addedmethods: is a C++ specific parameter that can be used to redefine a component method (DumpPython for example). This
       parameter is a string that must contain the definition and implementation code of the method. See the cppgui1 example
       for how to use it.
    :param calciumextendedinterface: if you want to use the Calcium extended interface for C++ as defined by the header CalciumInterface.hxx
@@ -121,9 +121,21 @@ class CPPComponent(Component):
        return a dict where key is the file name and value is the file content
     """
     (cmake_text, cmake_vars) = self.additionalLibraries()
+    # DSC_libs are needed for datastream ports only
+    DSC_libs = """${KERNEL_SalomeDSCContainer}
+  ${KERNEL_SalomeDSCSuperv}
+  ${KERNEL_SalomeDatastream}
+  ${KERNEL_SalomeDSCSupervBasic}
+  ${KERNEL_CalciumC}
+  """
+    cmake_vars = DSC_libs + cmake_vars
     cxxfile = "%s.cxx" % self.name
     hxxfile = "%s.hxx" % self.name
-    ret = { cxxfile:self.makecxx(gen),
+    if self.kind == "exe":
+      exe_opt = 1
+    else:
+      exe_opt = 0
+    ret = { cxxfile:self.makecxx(gen, exe_opt),
             hxxfile:self.makehxx(gen)
           }
     sources = " ".join(map(os.path.basename,self.sources))
@@ -146,7 +158,6 @@ class CPPComponent(Component):
     ret["CMakeLists.txt"] = cmakelist_content
     
     return ret
-    
 
   def makehxx(self, gen):
     """return a string that is the content of .hxx file