summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config.tests/language/language.pro9
-rw-r--r--config.tests/language/main.cpp122
-rw-r--r--config.tests/socketcan/socketcan.pro2
-rw-r--r--config.tests/socketcan_fd/socketcan_fd.pro2
-rw-r--r--configure.json5
-rw-r--r--qtserialbus.pro12
-rw-r--r--src/plugins/canbus/canbus.pro4
-rw-r--r--src/serialbus/configure.json53
8 files changed, 61 insertions, 148 deletions
diff --git a/config.tests/language/language.pro b/config.tests/language/language.pro
deleted file mode 100644
index 908d781..0000000
--- a/config.tests/language/language.pro
+++ /dev/null
@@ -1,9 +0,0 @@
-TEMPLATE = app
-
-CONFIG += qt
-CONFIG += c++11
-CONFIG += console
-
-QT = core
-
-SOURCES += main.cpp
diff --git a/config.tests/language/main.cpp b/config.tests/language/main.cpp
deleted file mode 100644
index 1d6732b..0000000
--- a/config.tests/language/main.cpp
+++ /dev/null
@@ -1,122 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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 <QtCore/qglobal.h>
-
-#include <memory>
-#include <type_traits>
-
-struct Base
-{
- virtual void overrideMe() = 0;
-};
-
-struct Test : public Base
-{
- // strongly typed enums
- enum struct Enum : char {
- EnumA, EnumB
- };
-
- Test() = default; // defaulted and
- Test(const Test&) = delete; // deleted ctors
-
- explicit Test(int i)
- : Test(0, i) { }
- Test(int a, int i)
- : m_intA(a), m_intI(i) {}
-
- // std::is_same
- template <typename T, typename ... Ts> struct IsType { enum { value = false }; };
- template <typename T, typename T1, typename ... Ts> struct IsType<T, T1, Ts...> {
- enum { value = std::is_same<T, T1>::value || IsType<T, Ts...>::value };
- };
-
- // std::is_pod
- template <typename T> void test(T) const {
- static_assert(std::is_pod<T>::value, "Only POD supported.");
- static_assert(IsType<T, int>::value, "Only int supported.");
- }
-
- // variadics
- template <typename ... Args>
- void setValues(Args ... values)
- {
- const int size = sizeof...(Args);
- int tmp[size] = { (test(values), void(), '0')... };
- (void) (tmp);
- }
-
- // override keyword
- void overrideMe() override {}
-
- // const and constexpr
- Q_DECL_CONSTEXPR qint64 first() const Q_DECL_NOTHROW { return m_intA; }
- Q_DECL_RELAXED_CONSTEXPR void setFirst(int a) Q_DECL_NOTHROW { m_intA = a; }
-
- // non-static data member initializers
- int m_intA = 0;
- int m_intI = 0;
-};
-
-using func = int (*) (int, int);
-int total(int a, int i) { return a + i; }
-
-int main(int /*argc*/, char** /*argv*/)
-{
- // nullptr
- Test *t = nullptr;
- Test stackT(155);
- t = &stackT;
-
- // variadics
- t->setValues(1, 2, 3, 4, 5);
-
- // lambda and auto
- auto m = [](int a, int b) -> int {
- return a * b;
- };
-
- // decltype
- decltype(m) multiply = m;
- multiply(t->m_intA, t->m_intI);
-
- // alias templates
- func f = total;
- f(t->m_intA, t->m_intI);
-
- return 0;
-}
diff --git a/config.tests/socketcan/socketcan.pro b/config.tests/socketcan/socketcan.pro
index 104ea1e..3f6c643 100644
--- a/config.tests/socketcan/socketcan.pro
+++ b/config.tests/socketcan/socketcan.pro
@@ -1,4 +1,2 @@
-TEMPLATE = app
-
SOURCES += main.cpp
diff --git a/config.tests/socketcan_fd/socketcan_fd.pro b/config.tests/socketcan_fd/socketcan_fd.pro
index 104ea1e..3f6c643 100644
--- a/config.tests/socketcan_fd/socketcan_fd.pro
+++ b/config.tests/socketcan_fd/socketcan_fd.pro
@@ -1,4 +1,2 @@
-TEMPLATE = app
-
SOURCES += main.cpp
diff --git a/configure.json b/configure.json
new file mode 100644
index 0000000..c43610f
--- /dev/null
+++ b/configure.json
@@ -0,0 +1,5 @@
+{
+ "subconfigs": [
+ "src/serialbus"
+ ]
+}
diff --git a/qtserialbus.pro b/qtserialbus.pro
index d0e94f7..469da33 100644
--- a/qtserialbus.pro
+++ b/qtserialbus.pro
@@ -4,16 +4,4 @@ lessThan(QT_MAJOR_VERSION, 5) {
message("Cannot build current QtSerialBus sources with Qt version $${QT_VERSION}.")
}
-load(configure)
-qtCompileTest(language)
-qtCompileTest(socketcan)
-qtCompileTest(socketcan_fd)
load(qt_parts)
-
-requires(config_language) # enforce defined set of C++11
-!config_language:warning("Cannot compile the module with your compiler, missing C++11 language features.")
-
-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/canbus/canbus.pro b/src/plugins/canbus/canbus.pro
index a2e5304..0304dcc 100644
--- a/src/plugins/canbus/canbus.pro
+++ b/src/plugins/canbus/canbus.pro
@@ -1,6 +1,8 @@
TEMPLATE = subdirs
-config_socketcan {
+include($$OUT_PWD/../../serialbus/qtserialbus-config.pri)
+QT_FOR_CONFIG += serialbus-private
+qtConfig(socketcan) {
SUBDIRS += socketcan
}
diff --git a/src/serialbus/configure.json b/src/serialbus/configure.json
new file mode 100644
index 0000000..6e00230
--- /dev/null
+++ b/src/serialbus/configure.json
@@ -0,0 +1,53 @@
+{
+ "module": "serialbus",
+ "testDir": "../../config.tests",
+
+ "tests": {
+ "socketcan": {
+ "label": "Socket CAN",
+ "type": "compile",
+ "test": "socketcan"
+ },
+ "socketcan_fd": {
+ "label": "Socket CAN FD",
+ "type": "compile",
+ "test": "socketcan_fd"
+ }
+ },
+
+ "features": {
+ "socketcan": {
+ "label": "Socket CAN",
+ "condition": "config.linux && tests.socketcan",
+ "output": [ "privateFeature" ]
+ },
+ "socketcan_fd": {
+ "label": "Socket CAN FD",
+ "condition": "config.linux && features.socketcan && tests.socketcan_fd",
+ "output": [ "privateFeature"]
+ }
+ },
+
+ "report": [
+ {
+ "type": "note",
+ "condition": "!features.socketcan",
+ "message": "QtSerialBus: Cannot find linux.can.h and linux/can/raw.h Linux headers for socketCAN support."
+ },
+ {
+ "type": "note",
+ "condition": "features.socketcan && !features.socketcan_fd",
+ "message": "QtSerialBus: Newer kernel needed for flexible data-rate frame support (canfd_frame)."
+ }
+ ],
+
+ "summary": [
+ {
+ "section": "Qt SerialBus",
+ "entries": [
+ "socketcan",
+ "socketcan_fd"
+ ]
+ }
+ ]
+}