Building Qt OPC UA with open62541
Qt OPC UA is not included in the Qt installer and must be built from source.
The open62541 backend is currently the most stable and feature complete open source backend in Qt OPC UA. The open62541 library has minimal external dependencies and can be built for all supported platforms (Linux, Windows (MinGW32, MSVC 2017), Android, macOS and iOS).
NEW: Starting with the 5.12 branch, Open62541 v0.3.0 has been added to Qt OPC UA as a 3rd party source. The open62541 plugin is now built by default without requiring any additional setup.
Requirements
First of all, an installation of Qt 5.12 is required. Using the Qt installer also provides the necessary tools required to build Qt OPC UA except Perl which must be installed manually.
Compiling on Linux
git clone https://code.qt.io/qt/qtopcua.git
cd qtopcua
git checkout 5.12
mkdir build && cd build
~/Qt/5.12.0/gcc_64/bin/qmake ..
make
sudo make install # sudo is not required if Qt 5.12 has been installed to a directory owned by the user
Compiling on macOS
git clone https://code.qt.io/qt/qtopcua.git
cd qtopcua
git checkout 5.12
mkdir build && cd build
~/Qt/5.12.0/clang_64/bin/qmake ..
make
sudo make install # sudo is not required if Qt 5.12 has been installed to a directory owned by the user
Compiling on Windows
MinGW32
Execute the following commands in the “Qt 5.12.0 for Desktop (MinGW 5.3.0 32 bit)” shell
git clone https://code.qt.io/qt/qtopcua.git
cd qtopcua
git checkout 5.12
mkdir build
cd build
qmake ..
mingw32-make
mingw32-make install
MSVC 2017
Execute the following commands in the “Qt 5.12.0 64-bit for Desktop (MSVC 2017)” shell
"c:\Program Files (x86)\Microsoft Visual Studio\2017\WDExpress\VC\Auxiliary\Build\vcvarsx86_amd64.bat"
git clone https://code.qt.io/qt/qtopcua.git
cd qtopcua
git checkout 5.12
mkdir build
cd build
qmake ..
nmake
nmake install
Compiling for Android
Additional requirements
The Android NDK is required to build for Android.
Compiling on Linux
git clone https://code.qt.io/qt/qtopcua.git
cd qtopcua
git checkout 5.12
mkdir build && cd build
export ANDROID_NDK_ROOT=/path/to/android-ndk-r17b
~/Qt/5.12.0/android_armv7/bin/qmake ..
# When building for android_x86 (e. g. simulator), use "~/Qt/5.12.0/android_x86/bin/qmake" instead
make
sudo make install# sudo is not required if Qt 5.12 has been installed to a directory owned by the user
Compiling on Windows
Execute the following commands in the “Qt 5.12.0 for Desktop (MinGW 5.3.0 32 bit)” shell
git clone https://code.qt.io/qt/qtopcua.git
cd qtopcua
git checkout 5.12
mkdir build
cd build
set ANDROID_NDK_ROOT=c:\path\to\android-ndk-r17b
set ANDROID_NDK_HOST=windows-x86_64 # Only set this if the windows-x86_64 Android NDK is used
c:\Qt\5.12.0\android_armv7\bin\qmake ..
# When building for android_x86 (e. g. simulator), use "c:\Qt\5.12.0\android_x86\bin\qmake" instead
mingw32-make
mingw32-make install
Compiling for iOS
Additional requirements
XCode is required to build for iOS.
Compiling on macOS
git clone https://code.qt.io/qt/qtopcua.git
cd qtopcua
git checkout 5.12
mkdir build
cd build
~/Qt/5.12.0/ios/bin/qmake ..
make
sudo make install # sudo is not required if Qt 5.12 has been installed to a directory owned by the user
Creating the documentation
Use the same shell and the platform specific make tool that has been used in building the Qt OPC UA module. Building the docs on Linux or macOS requires using sudo to execute the second step if Qt has been installed to a location not writable by the current user.
make docs
make install_docs
Compiling the examples
Use the same shell and the platform specific make tool that has been used in building the Qt OPC UA module. The examples will be created in “examples” in the build directory.
export LD_LIBRARY_PATH=/path/to/Qt/5.12.0/gcc_64/lib/:$LD_LIBRARY_PATH # Linux only
make sub-examples