diff options
author | Janne Partala <janne.partala@bitfactor.fi> | 2015-08-19 10:40:50 +0300 |
---|---|---|
committer | Alex Blasche <alexander.blasche@theqtcompany.com> | 2015-08-19 14:52:22 +0000 |
commit | 27f2ed77245df70811419ce68fde8ceb218f183b (patch) | |
tree | ea2bb0a7c2539381b790ce85d9290d7102d65b97 | |
parent | 218422886b61a6127b191768440205eb910db975 (diff) |
Check availability of libmodbus
Change-Id: I8836018eb284fa5470033f42560df2718c636a92
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
-rw-r--r-- | config.tests/libmodbus/libmodbus.pro | 6 | ||||
-rw-r--r-- | config.tests/libmodbus/main.cpp | 44 | ||||
-rw-r--r-- | qtserialbus.pro | 3 | ||||
-rw-r--r-- | src/plugins/modbus/modbus.pro | 5 | ||||
-rw-r--r-- | src/plugins/plugins.pro | 3 |
5 files changed, 58 insertions, 3 deletions
diff --git a/config.tests/libmodbus/libmodbus.pro b/config.tests/libmodbus/libmodbus.pro new file mode 100644 index 0000000..9af89b9 --- /dev/null +++ b/config.tests/libmodbus/libmodbus.pro @@ -0,0 +1,6 @@ +TEMPLATE = app + +CONFIG += link_pkgconfig +PKGCONFIG += libmodbus + +SOURCES += main.cpp diff --git a/config.tests/libmodbus/main.cpp b/config.tests/libmodbus/main.cpp new file mode 100644 index 0000000..889a9a0 --- /dev/null +++ b/config.tests/libmodbus/main.cpp @@ -0,0 +1,44 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ +#include <modbus/modbus.h> + +int main() +{ + modbus_mapping_t *mapping; + mapping = modbus_mapping_new(0,0,0,0); + modbus_mapping_free(mapping); + return 0; +} diff --git a/qtserialbus.pro b/qtserialbus.pro index 5b918c3..a5e7501 100644 --- a/qtserialbus.pro +++ b/qtserialbus.pro @@ -7,8 +7,11 @@ lessThan(QT_MAJOR_VERSION, 5) { load(configure) qtCompileTest(socketcan) qtCompileTest(socketcan_fd) +qtCompileTest(libmodbus) load(qt_parts) +!config_libmodbus:warning("Cannot build libmodbus plugin. No libmodbus found") + 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'") diff --git a/src/plugins/modbus/modbus.pro b/src/plugins/modbus/modbus.pro index cc78c8f..c29d209 100644 --- a/src/plugins/modbus/modbus.pro +++ b/src/plugins/modbus/modbus.pro @@ -1,3 +1,4 @@ TEMPLATE = subdirs - -SUBDIRS += libmodbus +config_libmodbus { + SUBDIRS += libmodbus +} diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro index 456289e..c24d657 100644 --- a/src/plugins/plugins.pro +++ b/src/plugins/plugins.pro @@ -1,3 +1,4 @@ TEMPLATE = subdirs -SUBDIRS += canbus +SUBDIRS += canbus \ + modbus |