From OpenSCADAWiki
Jump to: navigation, search

The procedure for creation a new external module based on the template is largely similar to the previous procedure and includes the following steps:

1. Get the source texts of the OpenSCADA project — for an external module as a source of the template you can use any OpenSCADA source files of version more than 0.9, because it is necessary to copy only the "=Tmpl=" directory and several files for build.
2. Copy the template directory with the "NewMod" name of the new module, for example, for the "DB" subsystem; and in that directory already create and copy the necessary files of the external module. Further, the information files of the project "COPYING", "NEWS", "README", "AUTHORS" and "ChangeLog" must be filled accordingly to the nature of the new module.
cp -r OpenSCADA/src/moduls/bd/=Tmpl= NewMod; touch NewMod/{NEWS,README,AUTHORS,ChangeLog}; cp OpenSCADA/I18N.mk NewMod/
for the "DAQ" subsystem the path is — "OpenSCADA/src/moduls/daq/=Tmpl="
for the "Archive-History" subsystem the path is — "OpenSCADA/src/moduls/arhiv/=Tmpl="
for the "Transport" subsystem the path is — "OpenSCADA/src/moduls/transport/=Tmpl="
for the "Transport protocol" subsystem the path is — "OpenSCADA/src/moduls/protocol/=Tmpl="
for the "UI" subsystem the path is — "OpenSCADA/src/moduls/ui/=Tmpl="
for the "Special" subsystem the path is — "OpenSCADA/src/moduls/special/=Tmpl="
3. Edit the module information in the "module.cpp" file similarly to the appropriate item in the previous section.
4. Edit the module building configuration in the "Makefile.am" file similarly to the appropriate item in the previous section, excepts:
  • instead "db_NewMod_la_LDFLAGS = -module -avoid-version $(top_builddir)/src/liboscada.la" write "db_NewMod_la_LDFLAGS = -module -avoid-version", that is remove "$(top_builddir)/src/liboscada.la"
  • instead "include ../../../../I18N.mk" write "include I18N.mk", that is remove the path "../../../../"
5. Edit the build system configuration file "configure.ac" for:
also can do that automatically by: sed -i "s/Tmpl/NewMod/g" configure.ac
  • "AC_INIT([Tmpl],[0.0.1],[my@email.org])" — information about the module: name, version and EMail of the project
  • "AM_CONDITIONAL([TmplIncl],[test])" — "AM_CONDITIONAL([NewModIncl],[test])"
6. Install the OpenSCADA development package "openscada-dev" or "openscada-devel" — because the module is an external one and the OpenSCADA source files are needed only at the first stage of the module creation, you need to install the OpenSCADA development package, which contains the header files and libraries.
7. Now you can build the new module, after formation of the building system
autoreconf -if; ./configure; make