Make open62541 and opcua

发布于 2019-06-18  88 次阅读



最近在看OPC UA的相关知识,就去Qt上查了一下,发现他们在开发OPCUA模块,准备在2018年5月的Qt5.11版本里发布。虽然还没有发布,但是可以提前试用下。参考这篇文章:Want to give Qt OpcUa a try?

Two things are needed: Qt OpcUa itself and an OPC UA library. In this
article, we use open62541 as it has very little dependencies (and is
the more complete implementation anyway).

The following recipes assume that you have cmake, python/pip, perl,
git and other essential build tools installed. Paths used with the
examples need to be adjusted to reflect your local situation.

写这篇文章主要是想看下cmake,qmake,make的过程,原理可以参考知乎这个提问make makefile cmake qmake都是什么,有什么区别?


我用的是MinGW因此脚本选择Installation on Windows (MinGW as shipped with Qt 5.10)

pip install six
git clone https://github.com/open62541/open62541.git
cd open62541
git checkout 302003d
mkdir build
cd build
cmake.exe -G "MinGW Makefiles" -DUA_ENABLE_AMALGAMATION=ON ..
mingw32-make.exe

git clone http://code.qt.io/qt/qtopcua.git
cd qtopcua
mkdir build
cd build
set CPLUS_INCLUDE_PATH=c:\path\to\open62541\build
set LIBRARY_PATH=c:\path\to\open62541\build\bin
qmake.exe ..
mingw32-make.exe
mingw32-make.exe install

前提软件都准备好以后,运行下这个脚本就可以了。


    pip install six
    git clone https://github.com/open62541/open62541.git
    cd open62541
    git checkout 302003d
    mkdir build
    cd build
    cmake.exe -G "MinGW Makefiles" -DUA_ENABLE_AMALGAMATION=ON ..
    mingw32-make.exe
  1. 先执行cmake生成makefile
  2. 然后执行make,可以根据makefile生成目标文件

    git clone http://code.qt.io/qt/qtopcua.git
    cd qtopcua
    mkdir build
    cd build
    set CPLUS_INCLUDE_PATH=c:\path\to\open62541\build
    set LIBRARY_PATH=c:\path\to\open62541\build\bin
    qmake.exe ..
    mingw32-make.exe
    mingw32-make.exe install

这一段
1. 先执行qmake生成makefile
2. 然后执行make,根据makefile生成目标文件
3. 最后执行make install,将编译好的目标文件以及文档copy到对应的系统目录(Qt目录)


一沙一世界,一花一天堂。君掌盛无边,刹那成永恒。