MindConnect Library – Getting started for Windows¶
Tools¶
Tools used for this guide are:
- Visual Studio 2019 IDE with Desktop Development with C++ toolset
- CMake 3.16.0
- Strawberry Perl (Perl v5.30.0)
Before Building MindConnect Library¶
MCL depends on LibCurl as an HTTP client and it depends on OpenSSL as the crypto library. LibCurl depends on OpenSSL as the TLS library. Therefore, before building MCL, developers must make sure that OpenSSL and LibCurl are installed successfully, otherwise MCL build process will not start.
Downloads¶
Download the source code :
- Download OpenSSL 1.1.1d from https://www.openssl.org/ and extract it. The extracted OpenSSL folder will be referenced as {OPENSSL_DIR} throughout this page.
- Download LibCurl 7.68.0 zip file from https://curl.haxx.se/ and extract it. The extracted LibCurl folder will be referenced as {LIBCURL_DIR} throughout this page.
- Download MindConnect Library 3.1.5.0 zip file from SIOS (Siemens Online Industry Support) page and extract it. The extracted folder will be referenced as {MCL_DIR} throughout this page.
Command Prompt¶
Open x64 Native Tools Command Prompt for VS 2019. You can find it in Start Menu, under Visual Studio 2019 folder. This will set your environment to use tools included in Visual Studio.
In x64 Native Tools Command Prompt, set variables for the paths of downloaded and extracted source code.
set OPENSSL_DIR={OPENSSL_DIR}
set LUBCURL_DIR={LIBCURL_DIR}
set MCL_DIR={MCL_DIR}
Building OpenSSL¶
In x64 Native Tools Command Prompt, build OpenSSL by running the following commands:
cd %OPENSSL_DIR%
mkdir build
perl Configure VC-WIN64A --openssldir=%OPENSSL_DIR%\build no-asm
ms\do_win64a
nmake -f ms\ntdll.mak install
You will see the build artifacts in {OPENSSL_DIR}\build
directory.
Building LibCurl¶
In x64 Native Tools Command Prompt, build LibCurl by running the following commands:
cd %LIBCURL_DIR%\winbuild
nmake /f Makefile.vc mode=dll VC=15 WITH_SSL=dll MACHINE=x64 SSL_PATH=%OPENSSL_DIR%\build
You will see the build artifacts in {LIBCURL_DIR}\builds\libcurl-vc15-x64-release-dll-ssl-dll-ipv6-sspi
directory.
Building MindConnect Library¶
In x64 Native Tools Command Prompt, build MCL by running the following commands:
cd %MCL_DIR%
mkdir build
cd build
cmake -G"Visual Studio 16 2019" -A x64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=%OPENSSL_DIR%\build;%LIBCURL_DIR%\builds\libcurl-vc15-x64-release-dll-ssl-dll-ipv6-sspi -DMCL_CREATE_DOXYGEN=OFF -DMCL_TESTING=OFF -DMCL_LOG_UTIL_LEVEL=255 %MCL_DIR%
cmake --build . --clean-first --target mc
You will see the build artifacts in {MCL_DIR}\build\build\Release
directory.
Custom Agent Application¶
When building your agent application, headers for MCL will be in {MCL_DIR}\include directory and binaries mc.lib and mc.dll will be in {MCL_DIR}\build\build\Release directory.
You will also need to link libcurl.dll located in {LIBCURL_DIR}\builds\libcurl-vc15-x64-release-dll-ssl-dll-ipv6-sspi\bin directory and libeay32.dll and ssleay32.dll located in {OPENSSL_DIR}\build\bin directory.
Except where otherwise noted, content on this site is licensed under the Development License Agreement.