1 Code Wrapping into SALOME with hxx2salome
2 =========================================
8 Assuming you want to integrate the component "COMP" into SALOME, you may use the hxx2salome command.
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:
13 hxx2salome -g -s sh ${COMP_CPP_ROOT_DIR} COMP.hxx libCOMPCXX.so ${COMP_ROOT_DIR}
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
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)
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)
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
28 -g : is an hxx2salome option asking for the GUI part of the component
30 -s sh : is an hxx2salome option asking to use a sh-style environment file
32 The present file is ${COMP_ROOT_DIR}/COMP/COMP_SRC/doc/dev_guide.txt
35 2 Implementing your wrapper
36 ---------------------------
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.
41 2.1 Implementation for testing component from console
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(...).
46 2.2 Implementation for testing component from SALOME GUI
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:
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)
63 3 Building your component
64 -------------------------
66 When your implementation is ready, the SALOME client side of the component is built the regular way:
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
72 mkdir -p ${COMP_BUILD_DIR}
74 ${COMP_SRC_DIR}/configure --prefix=${COMP_ROOT_DIR}
78 4 Using your component
79 ----------------------
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" />
88 <section name="resources" >
89 <parameter value="${COMP_ROOT_DIR}/share/salome/resources" name="COMP" />
91 In launch section add reference to COMP
92 <section name="launch" >
93 <parameter value="GEOM,SMESH,COMP" name="modules" />
97 source the Salome environment
98 source the component environment file (${COMP_BUILD_ROOT_DIR}/COMP/COMP_SRC/env_COMP.sh)
100 To be done at execution:
101 run Salome (runSalome command)
102 kill any still runing process if necessary (killSalome.py command)