Migrate project created with templates provided with WinCC OA 3.21.4 or older
Due to significant refactoring in WinCC OA 3.21.5, existing Backend projects require manual migration. This involves updating CMake library links, adding the MSVC runtime policy, adjusting subdirectory calls, and rebuilding after cleaning external libraries.
In WinCC OA 3.21.5 the template for Backend project was significantly refactored. It is necessary to migrate Backend projects to remain compatible with new WinCC OA release. Automatic migration procedure is not provided, because the affected files could contain adaptations introduced during Backend project development. What follows is a list of necessary project changes.
- Adapt
call intarget_link_libraries
change zeromq to libzmq - add libcppzmq - change protobuf to libprotobufLib/CMakeLists.txtExample, before:target_link_libraries(${TARGET} ${WCCOA_LIB_PREFIX}Basics${WCCOA_LIB_INFIX} CommonBackend ${SSL_LIB} Importer NgaProtobufFiles CommonMultiplexer DpeNameMapper zeromq protobuf )After:target_link_libraries(${TARGET} ${WCCOA_LIB_PREFIX}Basics${WCCOA_LIB_INFIX} CommonBackend ${SSL_LIB} Importer NgaProtobufFiles CommonMultiplexer DpeNameMapper libzmq libcppzmq libprotobuf ) - Adapt
CMakeLists.txtfile in the root of the project directory by adding this snippet just aftercmake_minimum_requiredcall at the beginning:if ( WIN32 ) # MSVC runtime library flags are selected by an abstraction. cmake_policy(SET CMP0091 NEW) set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreadedDLL" CACHE STRING "" FORCE) ## on Windows always use the non-debug runtime libs (-MD) endif() - Additionally, near the end of the file change
add_subdirectory(ExternLibs)intoadd_subdirectory(${API_ROOT}/TemplateNextGenArchBackend/ExternLibs ${CMAKE_CURRENT_BINARY_DIR}/ExternLibs)The
orupdateNextGenArchExternLibs.cmd
script can be removed, it is no longer necessary. Updates to external dependencies are now managed by the cmake build process and will be available automatically after WinCC OA upgrade.updateNextGenArchExternLibs.shThe
subdirectory together with its contents is no longer used by the project and can be removed.ExternLibs - Remove the old `build` subdirectory and regenerate it:
cd build cmake -G "Visual Studio 17 2022" -A "x64" -T "v143" -D CMAKE_BUILD_TYPE=RelWithDebInfo -D CMAKE_CONFIGURATION_TYPES=RelWithDebInfo ..or on Linux:
cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo .. - Now the project can be built:
cmake --build . --config RelWithDebInfo
