Build Steps

This chapter describes how to build a new backend and how to update the third-party libraries of an existing backend.

Create New Project

Complete the following steps to create a new project

  1. Make sure that the C++ API for WinCC OA is installed, as it includes the necessary components for the NGA API .
  2. Set the environment variable API_ROOT as follows:
    set "API_ROOT=C:\Program Files\Siemens\WinCC_OA\3.21\api"
  3. On Linux, install the OpenSSL development library if not available:
    sudo apt-get install libssl-dev
  4. On Windows, make sure to use a developer command prompt for Visual Studio (e.g. call the following command in your command prompt):

    C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Auxiliary\Build\vcvarsall.bat" amd64 -vcvars_ver=14.4

    Then run the command following command to check if the build environment is setup correctly - see chapter Getting Started :

    <API_ROOT>\checkAPIenv.cmd
  5. Run the newNextGenArchBackend[.sh/cmd] script and pass the name that should be used for the backend:

    %API_ROOT%/newNextGenArchBackend.cmd

    The stated backend name will be used to automatically replace the _TEMPLATE_ place holder in all files and files name.

    Note:
    In case of spaces in the path, pass the name as follows:
    %API_ROOT%/newNextGenArchBackend.cmd" myBackendName
  6. Navigate to the now created backend directory, e.g. myBackendName. Within the folder the necessary project files are created to implement all necessary interfaces.
  7. Implement the following basic handlers. You can find the class skeletons in the project/Lib/ directory. For example, Under Windows you can open the project solution file (Build/<project name>.sln) in Visual Studio:
  8. Implement database connection status notification (see DatabaseActivityMonitor handlers)
  9. Implement your segment management according to the NGA model - see chapter Segment States
    • autoDelete (Lib/[projectName]_Backend.cxx) - - delete segments must be implemented in accordance with the settings of the archive group
    • autoBackup (Lib/[projectName]_Backend.cxx) - - backup segments must be implemented in accordance with the settings of the archive group
  10. Build your project (Release) via the command line:
    • Navigate to the build directory.
    • Build your project by using following command:
      • Linux:

        cmake --build
      • Windows:

        cmake --build --config Release
  11. Copy executables of BackendNameExe and library of BackendNamePlugin to WinCC OA bin directory:
    • For Linux: NGABackendNameBackend and libNGABackendNamePlugin.so
    • For Windows: NGABackendNameBackend.exe and NGABackendNameBackendPlugin.dll
  12. Create a WinCC OA project with the UseNGA option - see chapter Create project.
  13. Import the NGABackendNameBackend.dpl to the project - see chapter ASCII Panel.
  14. Set up the parameters that your backend expects to receive in the database-specific configuration.
  15. Run the NextGen Archiver manager in the console of your WinCC OA project - see chapters NGA - Requirements and Installation - Windows and NGA - Requirements and Installation - Linux.

Updating third-party libraries in an existing project

To update required third-party products, proceed as follows:

If any of the third-party dependencies (ZeroMQversion and Protocol Buffers) have changed, this update is required.

This is the case, for example, in the event of a version incompatibility (the version may change due to a dependency version update), your custom backend will not start and the error message "The version of backend is not compatible with the current NGA API version. The backend will be stopped" is shown.

The template contains the updateNextGenArchExternLibs script (.cmd/.sh) to update third-party libraries (ZeroMQversion and Protocol Buffers) in an existing project.

The upgrade will remove and re-download third-party libraries. The build folder will also be deleted and regenerated. Before upgrading, make sure the project directories are not open (locked) by an editor, IDE, etc.

Important:
Do not change the libraries in the ExternLibs directory for a correct update.
  • Run the updateNextGenArchExternLibs script from within a command line / terminal in your backend project directory:

    • Linux:

      cd <API_ROOT>/<myBackendName>
      ./updateNextGenArchExternLibs.sh
    • Windows:

      cd <API_ROOT>\<myBackendName>
      .\updateNextGenArchExternLibs.cmd