Salome HOME
bos #26458 Versioning of sources via git commit id (sha1)
[modules/yacs.git] / doc / yacsgen.rst
index cda4c320581bff3d41d9e53543e19166e1131887..b9ea4d296d24bd062de7826fc6a0b373edc5b017 100644 (file)
@@ -37,6 +37,7 @@ The first action to be done is to import these definitions::
 
      from module_generator import Generator,Module,PYComponent
      from module_generator import CPPComponent,Service,F77Component
+     from module_generator import Library
 
 If you want to import all definitions, you can do that::
 
@@ -198,10 +199,13 @@ For example, we can have::
                                         body="outputport=myfunc(inputport);",
                                        ),
                                ],
-                      libs="-L/usr/local/mysoft -lmybib",
-                      rlibs="-Wl,--rpath -Wl,/usr/local/mysoft"
+                      libs=[Library(name="mybib", path="/usr/local/mysoft")],
+                      rlibs="/usr/local/mysoft"
                       )
 
+**libs** contains a list of **Library** objects. On linux, if the name of the file is "libmybib.so",
+the **name** of the library will be "mybib". The *path* shows where the library is installed.
+
 The **rlibs** attribute is not compulsory but it can be used to indicate a search path for dynamic libraries in execution.  
 **libs** is used during the link phase.  **rlibs** is only used during execution, it avoids the need to set the LD_LIBRARY_PATH 
 environment variable to find the dynamic library.
@@ -212,7 +216,7 @@ Includes will be added using the **defs** attribute.  For example::
 
    defs="""#include "myinclude.h" """
 
-The includes path will be specified in the **includes** attribute of the component in the following form::
+The include paths will be specified in the **includes** attribute of the component in the following form::
 
 
    defs="""#include "myinclude.h"
@@ -227,11 +231,13 @@ The includes path will be specified in the **includes** attribute of the compone
                                      body="outputport=myfunc(inputport);",
                                     ),
                             ],
-                   libs="-L/usr/local/mysoft -lmybib",
-                   rlibs="-Wl,--rpath -Wl,/usr/local/mysoft",
-                   includes="-I/usr/local/mysoft/include",
+                   libs=[Library(name="mybib", path="/usr/local/mysoft")],
+                   rlibs="/usr/local/mysoft",
+                   includes="/usr/local/mysoft/include",
                   )
 
+Multiple include paths should be separated by spaces or end of line character (\\n).
+
 Adding sources
 """"""""""""""""""""""""""""""""""""""""""""""""""""
 It is possible to add some source files with the **sources** attribute (a list of source files will be given).
@@ -252,7 +258,7 @@ named myfunc.cpp. The description will be::
                                     ),
                             ],
                    sources=["myfunc.cpp"],
-                   includes="-I/usr/local/mysoft/include",
+                   includes="/usr/local/mysoft/include",
                   )
 
 
@@ -379,8 +385,8 @@ The following example will be used to specify these final concepts::
                                        body="chdir(c);"
                                       ),
                               ],
-                     libs="-L/usr/local/fcompo -lfcompo",
-                     rlibs="-Wl,--rpath -Wl,/usr/local/fcompo"
+                     libs=[Library(name="fcompo", path="/usr/local/fcompo")],
+                     rlibs="/usr/local/fcompo"
                     )
 
 The Fortran “compo3” component has dataflow and datastream ports like the C++ component.  The Fortran dynamic library 
@@ -671,8 +677,7 @@ Example creation of generator::
 Once this generator has been created, simply call its commands to perform the necessary operations.
 
 - SALOME module generation:  ``g.generate()``
-- initialise automake:  ``g.bootstrap()``
-- execute the configure script:  ``g.configure()``
+- build configuration:  ``g.configure()``
 - compilation:  ``g.make()``
 - installation in the directory <prefix>:  ``g.install()``
 - create a SALOME application in the directory **appli_dir**::
@@ -724,13 +729,12 @@ This gives something like the following for a module with a single Fortran compo
                                     body="chdir(c);"
                                    ),
                            ],
-                  libs="-L/local/chris/modulegen/YACSGEN/fcompo -lfcompo",
-                  rlibs="-Wl,--rpath -Wl,/local/chris/modulegen/YACSGEN/fcompo")
+                  libs=[Library(name="fcompo", path="/local/chris/modulegen/YACSGEN/fcompo")],
+                  rlibs="/local/chris/modulegen/YACSGEN/fcompo")
 
   m=Module("mymodule",components=[c1],prefix="Install")
   g=Generator(m,context)
   g.generate()
-  g.bootstrap()
   g.configure()
   g.make()
   g.install()
@@ -1228,7 +1232,6 @@ written as follows::
 
   g=Generator(Module("astmod",components=[c1,c2],prefix=install_prefix),context)
   g.generate()
-  g.bootstrap()
   g.configure()
   g.make()
   g.install()
@@ -1268,7 +1271,7 @@ Here is an excerpt from cppgui1 example that shows how to add a C++ GUI to a mod
 The C++ GUI is very similar to the python GUI except that the cppcomposGUI.h file is processed by the moc and the demo.ui
 is processed by the uic qt tool.
 
-By default, a Makefile.am and a SalomeApp.xml files are generated but you can put your own Makefile.am or SalomeApp.xml
+By default, a CMakeLists.txt and a SalomeApp.xml files are generated but you can put your own CMakeLists.txt or SalomeApp.xml
 in the list to override this default.
 
 Add an online documentation
@@ -1279,7 +1282,7 @@ To add a documentation use the *doc* parameter of the module. It must be a list
 (name with extension .rst) in the reStructured format (see http://docutils.sourceforge.net/) and image files (\*.png, ...).
 The main file must be named index.rst.
 
-By default, a sphinx configuration file conf.py and a Makefile.am are generated but you can put your own Makefile.am or conf.py
+By default, a sphinx configuration file conf.py and a CMakeLists.txt are generated but you can put your own CMakeLists.txt or conf.py
 in the list to override this default.
 
 Here is an excerpt from pygui1 example that shows how to add a documentation to a module::
@@ -1305,10 +1308,10 @@ Here is an excerpt from pygui1 example that shows how to add a method named crea
 
   compodefs=r"""
   class A:
-    def createObject( self, study, name ):
+    def createObject( self, name ):
       "Create object.  "
-      builder = study.NewBuilder()
-      father = study.FindComponent( "pycompos" )
+      builder = salome.myStudy.NewBuilder()
+      father = salome.myStudy.FindComponent( "pycompos" )
       if father is None:
         father = builder.NewComponent( "pycompos" )
       attr = builder.FindOrCreateAttribute( father, "AttributeName" )
@@ -1339,20 +1342,15 @@ fragment that will be included in the component class to effectively redefine th
 Here is an excerpt from cppgui1 example that shows how to redefine the DumpPython method in a C++ component::
 
   compomethods=r"""
-  Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy, CORBA::Boolean isPublished,
+  Engines::TMPFile* DumpPython(CORBA::Boolean isPublished,
                                CORBA::Boolean& isValidScript)
   {
-    SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow(theStudy);
-    if(CORBA::is_nil(aStudy))
-      return new Engines::TMPFile(0);
-    SALOMEDS::SObject_var aSO = aStudy->FindComponent("cppcompos");
+    SALOMEDS::SObject_var aSO = KERNEL::getStudy()->FindComponent("cppcompos");
     if(CORBA::is_nil(aSO))
        return new Engines::TMPFile(0);
     std::string Script = "import cppcompos_ORB\n";
     Script += "import salome\n";
     Script += "compo = salome.lcc.FindOrLoadComponent('FactoryServer','cppcompos')\n";
-    Script += "def RebuildData(theStudy):\n";
-    Script += "  compo.SetCurrentStudy(theStudy)\n";
     const char* aScript=Script.c_str();
     char* aBuffer = new char[strlen(aScript)+1];
     strcpy(aBuffer, aScript);
@@ -1397,10 +1395,10 @@ implementation from SALOME KERNEL) and an extra method (createObject) to a pytho
       SALOME_DriverPy.SALOME_DriverPy_i.__init__(self,"pycompos")
       return
 
-    def createObject( self, study, name ):
+    def createObject( self, name ):
       "Create object.  "
-      builder = study.NewBuilder()
-      father = study.FindComponent( "pycompos" )
+      builder = salome.myStudy.NewBuilder()
+      father = salome.myStudy.FindComponent( "pycompos" )
       if father is None:
         father = builder.NewComponent( "pycompos" )
         attr = builder.FindOrCreateAttribute( father, "AttributeName" )
@@ -1431,7 +1429,7 @@ one file (myinterface.idl) that contains the definition of interface Idl_A::
 
   interface Idl_A : SALOMEDS::Driver
   {
-    void createObject(in SALOMEDS::Study theStudy, in string name) raises (SALOME::SALOME_Exception);
+    void createObject(in string name) raises (SALOME::SALOME_Exception);
   };
 
 In this simple case, it is also possible to include directly the content of the file with the *interfacedefs* parameter.
@@ -1508,7 +1506,7 @@ The module provides the following classes:
 .. autoclass:: Module
 
 .. autoclass:: Generator
-    :members: generate, bootstrap, configure, make, install, make_appli
+    :members: generate, configure, make, install, make_appli
 
 .. autofunction:: add_type