diff options
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | config.tests/libmodbus_systemlib/libmodbus_systemlib.pro | 6 | ||||
-rw-r--r-- | config.tests/libmodbus_systemlib/main.cpp | 40 | ||||
-rw-r--r-- | qtserialbus.pro | 10 | ||||
-rw-r--r-- | src/3rdparty/3rdparty.pro | 3 | ||||
-rw-r--r-- | src/plugins/modbus/libmodbus/libmodbus.pro | 12 |
6 files changed, 68 insertions, 5 deletions
@@ -3,6 +3,7 @@ Makefile* *.pro.user .qmake.cache *.obj +config.tests/libmodbus_systemlib/libmodbus_systemlib config.tests/libmodbus_accept4/libmodbus_accept4 config.tests/libmodbus_byteswap/libmodbus_byteswap config.tests/libmodbus_tiocmrts/libmodbus_tiocmrts @@ -12,7 +13,6 @@ config.tests/socketcan/socketcan config.tests/socketcan_fd/socketcan_fd examples/serialbus/modbus/master/modbusmaster examples/serialbus/modbus/slave/modbusslave - *.moc *.uic *.pch diff --git a/config.tests/libmodbus_systemlib/libmodbus_systemlib.pro b/config.tests/libmodbus_systemlib/libmodbus_systemlib.pro new file mode 100644 index 0000000..9af89b9 --- /dev/null +++ b/config.tests/libmodbus_systemlib/libmodbus_systemlib.pro @@ -0,0 +1,6 @@ +TEMPLATE = app + +CONFIG += link_pkgconfig +PKGCONFIG += libmodbus + +SOURCES += main.cpp diff --git a/config.tests/libmodbus_systemlib/main.cpp b/config.tests/libmodbus_systemlib/main.cpp new file mode 100644 index 0000000..2677a19 --- /dev/null +++ b/config.tests/libmodbus_systemlib/main.cpp @@ -0,0 +1,40 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtSerialBus module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +int main() +{ + return 0; +} diff --git a/qtserialbus.pro b/qtserialbus.pro index 76c3fce..24737f1 100644 --- a/qtserialbus.pro +++ b/qtserialbus.pro @@ -9,6 +9,10 @@ lessThan(QT_MAJOR_VERSION, 5) { load(configure) qtCompileTest(socketcan) qtCompileTest(socketcan_fd) + +# Check we have a platform libmodbus in case we prefer the platform version. +qtCompileTest(libmodbus_systemlib) + qtCompileTest(libmodbus_accept4) qtCompileTest(libmodbus_byteswap) qtCompileTest(libmodbus_rs485) @@ -20,3 +24,9 @@ linux { !config_socketcan:warning("You need linux/can.h and linux/can/raw.h linux headers for socketCAN support, disabling it") !config_socketcan_fd:warning("Newer kernel needed for flexible data-rate frame support 'canfd_frame'") } + +config_libmodbus_systemlib { + message("Using platform's libmodbus") +} else { + message("Using internal libmodbus") +} diff --git a/src/3rdparty/3rdparty.pro b/src/3rdparty/3rdparty.pro index ccc7388..154fbad 100644 --- a/src/3rdparty/3rdparty.pro +++ b/src/3rdparty/3rdparty.pro @@ -1,2 +1,3 @@ TEMPLATE = subdirs -SUBDIRS += libmodbus + +!config_libmodbus_systemlib:SUBDIRS += libmodbus diff --git a/src/plugins/modbus/libmodbus/libmodbus.pro b/src/plugins/modbus/libmodbus/libmodbus.pro index 7871824..9947f9f 100644 --- a/src/plugins/modbus/libmodbus/libmodbus.pro +++ b/src/plugins/modbus/libmodbus/libmodbus.pro @@ -7,9 +7,15 @@ PLUGIN_EXTENDS = serialbus PLUGIN_CLASS_NAME = LibModBusPlugin load(qt_plugin) -INCLUDEPATH += $$PWD/../../../3rdparty/libmodbus -win32:include($$PWD/../../../3rdparty/libmodbus/libmodbus_win.pri) -LIBS_PRIVATE += -L$$MODULE_BASE_OUTDIR/lib -lmodbus$$qtPlatformTargetSuffix() +# Use system lib version if available +config_libmodbus_systemlib { + CONFIG += link_pkgconfig + PKGCONFIG += libmodbus +} else { + INCLUDEPATH += $$PWD/../../../3rdparty/libmodbus + win32:include($$PWD/../../../3rdparty/libmodbus/libmodbus_win.pri) + LIBS_PRIVATE += -L$$MODULE_BASE_OUTDIR/lib -lmodbus$$qtPlatformTargetSuffix() +} HEADERS += \ libmodbusslave.h \ |