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
- Make sure that the C++ API for WinCC OA is installed, as it includes the necessary components for the NGA API .
- Set the environment variable API_ROOT as follows:
set "API_ROOT=C:\Program Files\Siemens\WinCC_OA\3.21\api" - On Linux, install the OpenSSL development library if not available:
sudo apt-get install libssl-dev -
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.4Then run the command following command to check if the build environment is setup correctly - see chapter Getting Started :
<API_ROOT>\checkAPIenv.cmd Run the newNextGenArchBackend[.sh/cmd] script and pass the name that should be used for the backend:
%API_ROOT%/newNextGenArchBackend.cmdThe 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- Navigate to the now created backend directory, e.g. myBackendName. Within the folder the necessary project files are created to implement all necessary interfaces.
- 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:
- onWriteRequest (see Write handler)
- onReadRequest (see Read handler)
- setOnDataReceivedHandler (see DataReceivedHandler handler)
- Implement database connection status notification (see DatabaseActivityMonitor handlers)
- 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
- 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
-
- 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
- Create a WinCC OA project with the UseNGA option - see chapter Create project.
- Import the NGABackendNameBackend.dpl to the project - see chapter ASCII Panel.
- Set up the parameters that your backend expects to receive in the database-specific configuration.
- 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.
-
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
-
