Salome HOME
64d2d03687a0d3c2d5ccd3329f629980d208bce7
[modules/yacs.git] / src / wrappergen / bin / HXX2SALOME_GENERIC_CLASS_NAME_SRC / doc / dev_guide.txt
1 Code Wrapping into SALOME with hxx2salome
2 =========================================
3
4
5 1 Context
6 ---------
7
8 Assuming you want to integrate the component "COMP" into SALOME, you may use the hxx2salome command.
9
10 If you are able to read this document, it is assumed that you succeeded running hxx2salome command.
11 The command you typed looks like:
12
13     hxx2salome -g -s sh ${COMP_CPP_ROOT_DIR} COMP.hxx libCOMPCXX.so ${COMP_ROOT_DIR}
14     
15     where:
16     ${COMP_CPP_ROOT_DIR}   : is the directory (absolute path) where the component to be integrated lies
17                              something as /export/home/john/COMP/COMP_CPP_INSTALL
18     
19     COMP.hxx               : is the header file describing the methods to be wrapped (must lie in one 
20                              unique occurence in ${COMP_CPP_ROOT_DIR} tree)  
21   
22     libCOMPCXX.so          : is the library file containing the implemented methods of the component 
23                              (must lie in one unique occurence in ${COMP_CPP_ROOT_DIR} tree)  
24
25     ${COMP_BUILD_ROOT_DIR} : is the directory (absolute path) where the component building tree has to  
26                              be installed something as /usr/local/salome_3.x.x/COMPONENTS
27                           
28     -g                     : is an hxx2salome option asking for the GUI part of the component
29                           
30     -s sh                  : is an hxx2salome option asking to use a sh-style environment file
31
32 The present file is ${COMP_ROOT_DIR}/COMP/COMP_SRC/doc/dev_guide.txt
33
34
35 2 Implementing your wrapper
36 ---------------------------
37
38 In the ${COMP_BUILD_ROOT_DIR}/COMP/COMP_SRC/src/COMP directory you will find a COMP_i.hxx file describing
39 all wrapped methods from your component.
40
41 2.1 Implementation for testing component from console
42
43 In the same ${COMP_BUILD_ROOT_DIR}/COMP/COMP_SRC/src/COMP directory you will find a COMP_test.py file. Edit it
44 to add (at bottom part) some calls to your component methods. They will look like: my_COMP.method(...).
45
46 2.2 Implementation for testing component from SALOME GUI
47
48 If you used option -g, you will find another directory named ${COMP_BUILD_ROOT_DIR}/COMP/COMP_SRC/src/COMPGUI.
49 You have to edit the following files:
50
51 COMPGUI.h     : Mainly changing the class fields that are only preferences-oriented in the template
52 COMPGUI.cxx   : - Constructor to fit your needs, 
53                 - initialize to define your menus, toolbars, dialogs and preferences as shown in template
54                 - OnMyNewItem, OnCallAction and equivalent own call-back routine names (template includes
55                   examples in OnCallAction to retrieve user preferences values). Here are included the
56                   calls to component library. They will look like: COMPgen->method( arg1, arg2, ... );
57                 - createPreferences to define your own user preferences data entries
58                 - preferencesChanged to get prepared for automatic SALOME call-back
59 COMP_msg_en.po: Resources file with all English text strings used in the source code COMPGUI.cxx
60 COMP_msg_xx.po: Resources file with all strings translated in language xx (for instance fr)
61
62
63 3 Building your component
64 -------------------------
65
66 When your implementation is ready, the SALOME client side of the component is built the regular way:
67
68         check definition of environment variables (COMP_SRC_DIR, COMP_BUILD_DIR, COMP_ROOT_DIR) in
69             file ${COMP_BUILD_ROOT_DIR}/COMP/COMP_SRC/env_COMP.sh and source it
70         cd ${COMP_SRC_DIR}
71         ./build_configure
72         mkdir -p ${COMP_BUILD_DIR}
73         cd ${COMP_BUILD_DIR}
74         ${COMP_SRC_DIR}/configure  --prefix=${COMP_ROOT_DIR}
75         make
76         make install
77
78 4 Using your component
79 ----------------------
80
81 To be done once:
82         edit your configuration file ~/.SalomeApprc.3.x.x:
83                 Somewhere between <document> and </document> add:
84                          <section name="COMP" >
85                            <parameter value="COMP" name="name" />
86                            <parameter value="COMP.png" name="icon" />
87                          </section>
88                          <section name="resources" >
89                            <parameter value="${COMP_ROOT_DIR}/share/salome/resources" name="COMP" />
90                          </section>
91                 In launch section add reference to COMP
92                          <section name="launch" >
93                            <parameter value="GEOM,SMESH,COMP" name="modules" />
94                          </section>
95
96 To be done at login:
97         source the Salome environment
98         source the component environment file (${COMP_BUILD_ROOT_DIR}/COMP/COMP_SRC/env_COMP.sh)
99
100 To be done at execution:
101         run Salome (runSalome command)
102         kill any still runing process if necessary (killSalome.py command)
103