Skip to content
Martin Haefner edited this page May 24, 2018 · 6 revisions

Win32 build instructions

Following these instructions you will be able to build the freeopcua client library on Windows7 using Microsoft Visual Studio 2017 Community Editition.

Preparation

Installing boost

The boost libraries are available as precompiled installer packages at https://sourceforge.net/projects/boost/files/boost-binaries/1.67.0/ . Make sure to pick the variant that is compatible with the build environment. In our case that is boost_1_67_0-msvc-14.1-32.exe since we will build a 32 bit executable using VS 2017 (Compiler version 14.1). The default installtion directory will be c:\local.

Installing git

Get the git binary package from e.g. https://git-scm.com/download/win

Installing cmake

Get the cmake binary package from e.g. at https://cmake.org/download/

Setting up freeopcua cmake

The most troublesome work is to setup boost correctly. I needed to set the following variables: BOOST_ROOT, BOOST_INCLUDEDIR, BOOST_LIBRARYDIR, Boost_COMPILER, Boost_USE_STATIC_RUNTIME and Boost_USE_STATIC_LIBS.

Furthermore, you may switch the server part of the library off - I never tested this since I use the open62541 server. Also, I switched encrypted password login off, as well as the generation of python bindings.

The following batch file would do the job:

cmake .. -DBUILD_SERVER=OFF -DSSL_SUPPORT_MBEDTLS=OFF -DBUILD_PYTHON=OFF -DBUILD_SHARED_LIBS=OFF ^`
 `-DBOOST_ROOT=c:\local\boost_1_67_0 ^`
 `-DBOOST_INCLUDEDIR=c:\local\boost_1_67_0  ^`
 `-DBOOST_LIBRARYDIR=c:\local\boost_1_67_0\lib64-msvc-14.1 ^`
 `-DBoost_COMPILER="-vc141" ^`
 `-DBoost_USE_STATIC_RUNTIME=OFF ^`
 `-DBoost_USE_STATIC_LIBS=ON

Now, create a directory named build within the freeopcua source directory and call the batch script.

cd freeopcua
mkdir build
cd build
../build.bat

Once the cmake setup process finishes successfully, you can start the build with

cmake --build .

Good luck!

Clone this wiki locally