Skip to content
This repository was archived by the owner on Dec 16, 2022. It is now read-only.

Commit 01aa640

Browse files
committed
Merge branch 'develop'
2 parents 80b0e78 + 979ccc1 commit 01aa640

13 files changed

+155
-66
lines changed

.travis.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
language: c
1+
language: cpp
22

33
compiler:
44
- clang
@@ -26,13 +26,13 @@ script:
2626

2727
deploy:
2828
- provider: script
29-
script: .travis/deploy.sh build/default/qtudev-artifacts.tar.gz
29+
script: .travis/deploy.sh build/artifacts/qtudev-artifacts.tar.gz
3030
skip_cleanup: true
3131
on:
3232
branch: master
3333
condition: "$CC = gcc) && ($TRAVIS_PULL_REQUEST = false"
3434
- provider: script
35-
script: .travis/deploy.sh build/default/qtudev-artifacts.tar.gz
35+
script: .travis/deploy.sh build/artifacts/qtudev-artifacts.tar.gz
3636
skip_cleanup: true
3737
on:
3838
branch: develop

.travis/build.sh

+37-18
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,52 @@ source /usr/local/share/liri-travis/functions
77
# Install dependencies
88
travis_start "install_packages"
99
msg "Install packages..."
10-
sudo apt-get install -y \
11-
libumockdev-dev
10+
dnf install -y \
11+
systemd-devel \
12+
umockdev-devel
1213
travis_end "install_packages"
1314

1415
# Install artifacts
1516
travis_start "artifacts"
1617
msg "Install artifacts..."
17-
/usr/local/bin/liri-download-artifacts $TRAVIS_BRANCH qbs-shared-artifacts.tar.gz
18+
/usr/local/bin/liri-download-artifacts $TRAVIS_BRANCH cmakeshared-artifacts.tar.gz
1819
travis_end "artifacts"
1920

20-
# Configure qbs
21-
travis_start "qbs_setup"
22-
msg "Setup qbs..."
23-
qbs setup-toolchains --detect
24-
qbs setup-qt $(which qmake) travis-qt5
25-
qbs config profiles.travis-qt5.baseProfile $CC
26-
travis_end "qbs_setup"
21+
# Configure
22+
travis_start "configure"
23+
msg "Setup CMake..."
24+
mkdir build
25+
cd build
26+
cmake .. \
27+
-DCMAKE_INSTALL_PREFIX=/usr \
28+
-DINSTALL_LIBDIR=/usr/lib64 \
29+
-DINSTALL_QMLDIR=/usr/lib64/qt5/qml \
30+
-DINSTALL_PLUGINSDIR=/usr/lib64/qt5/plugins
31+
travis_end "configure"
2732

2833
# Build
2934
travis_start "build"
3035
msg "Build..."
31-
dbus-run-session -- \
32-
xvfb-run -a -s "-screen 0 800x600x24" \
33-
qbs -d build -j $(nproc) --all-products profile:travis-qt5 \
34-
modules.lirideployment.prefix:/usr \
35-
modules.lirideployment.libDir:/usr/lib/x86_64-linux-gnu \
36-
modules.lirideployment.qmlDir:/usr/lib/x86_64-linux-gnu/qt5/qml \
37-
modules.lirideployment.pluginsDir:/usr/lib/x86_64-linux-gnu/qt5/plugins \
38-
project.autotestEnabled:false
36+
make -j $(nproc)
3937
travis_end "build"
38+
39+
# Install
40+
travis_start "install"
41+
msg "Install..."
42+
make install
43+
travis_end "install"
44+
45+
# Test
46+
#travis_start "test"
47+
#msg "Test..."
48+
#dbus-run-session -- \
49+
# xvfb-run -a -s "-screen 0 800x600x24" \
50+
# ctest -V
51+
#travis_end "test"
52+
53+
# Package
54+
travis_start "package"
55+
msg "Package..."
56+
mkdir -p artifacts
57+
tar czf artifacts/qtudev-artifacts.tar.gz -T install_manifest.txt
58+
travis_end "package"

CMakeLists.txt

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
cmake_minimum_required(VERSION 3.10.0)
2+
3+
project("QtUdev"
4+
VERSION "1.1.0"
5+
DESCRIPTION "Qt style API to use udev"
6+
LANGUAGES CXX C
7+
)
8+
9+
## Shared macros and functions:
10+
if(NOT LIRI_LOCAL_ECM)
11+
find_package(LiriCMakeShared "1.0.0" REQUIRED NO_MODULE)
12+
list(APPEND CMAKE_MODULE_PATH "${LCS_MODULE_PATH}")
13+
endif()
14+
15+
## Set minimum versions required:
16+
set(QT_MIN_VERSION "5.8.0")
17+
18+
## Add some paths to check for CMake modules:
19+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
20+
21+
## Liri specific setup common for all modules:
22+
include(LiriSetup)
23+
24+
## Find Qt 5:
25+
find_package(Qt5 "${QT_MIN_VERSION}"
26+
CONFIG REQUIRED
27+
COMPONENTS
28+
Core
29+
)
30+
31+
## Add subdirectories:
32+
add_subdirectory(src/udev)
33+
if(BUILD_TESTING)
34+
if(TARGET Qt5Udev)
35+
add_subdirectory(tests/auto/udev)
36+
endif()
37+
endif()

README.md

+9-36
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ Qt Udev
55
[![GitHub release](https://img.shields.io/github/release/lirios/qtudev.svg)](https://github.com/lirios/qtudev)
66
[![Build Status](https://travis-ci.org/lirios/qtudev.svg?branch=master)](https://travis-ci.org/lirios/qtudev)
77
[![GitHub issues](https://img.shields.io/github/issues/lirios/qtudev.svg)](https://github.com/lirios/qtudev/issues)
8-
[![Maintained](https://img.shields.io/maintenance/yes/2018.svg)](https://github.com/lirios/qtudev/commits/master)
98

109
Qt-style API to use udev.
1110

@@ -17,8 +16,8 @@ Qt >= 5.8.0 with at least the following modules is required:
1716

1817
And the following modules:
1918

20-
* [qbs](http://code.qt.io/cgit/qbs/qbs.git) >= 1.9.0
21-
* [qbs-shared](https://github.com/lirios/qbs-shared.git) >= 1.2.0
19+
* [cmake](https://gitlab.kitware.com/cmake/cmake) >= 3.10.0
20+
* [cmake-shared](https://github.com/lirios/cmake-shared.git) >= 1.0.0
2221

2322
The following modules and their dependencies are required:
2423

@@ -30,42 +29,16 @@ For autotests you need:
3029

3130
## Installation
3231

33-
Qbs is a new build system that is much easier to use compared to qmake or CMake.
34-
35-
If you want to learn more, please read the [Qbs manual](http://doc.qt.io/qbs/index.html),
36-
especially the [setup guide](http://doc.qt.io/qbs/configuring.html) and how to install artifacts
37-
from the [installation guide](http://doc.qt.io/qbs/installing-files.html).
38-
39-
From the root of the repository, run:
40-
4132
```sh
42-
qbs setup-toolchains --type gcc /usr/bin/g++ gcc
43-
qbs setup-qt /usr/bin/qmake-qt5 qt5
44-
qbs config profiles.qt5.baseProfile gcc
33+
mkdir build
34+
cd build
35+
cmake -DCMAKE_INSTALL_PREFIX=/path/to/prefix ..
36+
make
37+
make install # use sudo if necessary
4538
```
4639

47-
Then, from the root of the repository, run:
48-
49-
```sh
50-
qbs -d build -j $(nproc) profile:qt5 # use sudo if necessary
51-
```
52-
53-
To the `qbs` call above you can append additional configuration parameters:
54-
55-
* `modules.lirideployment.prefix:/path/to/prefix` where most files are installed (default: `/usr/local`)
56-
* `modules.lirideployment.dataDir:path/to/lib` where data files are installed (default: `/usr/local/share`)
57-
* `modules.lirideployment.libDir:path/to/lib` where libraries are installed (default: `/usr/local/lib`)
58-
* `modules.lirideployment.qmlDir:path/to/qml` where QML plugins are installed (default: `/usr/local/lib/qml`)
59-
* `modules.lirideployment.pluginsDir:path/to/plugins` where Qt plugins are installed (default: `/usr/local/lib/plugins`)
60-
* `modules.lirideployment.qbsModulesDir:path/to/qbs` where Qbs modules are installed (default: `/usr/local/share/qbs/modules`)
61-
62-
See [lirideployment.qbs](https://github.com/lirios/qbs-shared/blob/develop/modules/lirideployment/lirideployment.qbs)
63-
for more deployment-related parameters.
64-
65-
You can also specify the following options:
66-
67-
* `projects.QtUDev.useStaticAnalyzer:true` to enable the Clang static analyzer
68-
* `projects.QtUDev.autotestEnabled:true` to build and run unit tests
40+
Replace `/path/to/prefix` to your installation prefix.
41+
Default is `/usr/local`.
6942

7043
### Logging categories
7144

cmake/FindLibudev.cmake

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
find_package(PkgConfig)
2+
3+
pkg_check_modules(Libudev libudev REQUIRED IMPORTED_TARGET)

cmake/FindUmockdev.cmake

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
find_package(PkgConfig)
2+
3+
pkg_check_modules(Umockdev umockdev-1.0 REQUIRED IMPORTED_TARGET)

src/udev/CMakeLists.txt

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
find_package(Libudev REQUIRED)
2+
3+
liri_add_module(Qt5Udev
4+
DESCRIPTION
5+
"Qt style API for udev"
6+
MODULE_NAME
7+
Qt5Udev
8+
VERSIONED_MODULE_NAME
9+
Qt5Udev
10+
SOURCES
11+
udev.cpp
12+
udevdevice.cpp
13+
udevdevice.h
14+
udevdevice_p.h
15+
udevenumerate.cpp
16+
udevenumerate.h
17+
udevenumerate_p.h
18+
udev.h
19+
udevmonitor.cpp
20+
udevmonitor.h
21+
udevmonitor_p.h
22+
udev_p.h
23+
FORWARDING_HEADERS
24+
Udev
25+
UdevDevice
26+
UdevEnumerate
27+
UdevMonitor
28+
PRIVATE_HEADERS
29+
udevdevice_p.h
30+
udevenumerate_p.h
31+
udevmonitor_p.h
32+
udev_p.h
33+
DEFINES
34+
QT_NO_CAST_FROM_ASCII
35+
QT_NO_FOREACH
36+
PUBLIC_LIBRARIES
37+
Qt5::Core
38+
LIBRARIES
39+
PkgConfig::Libudev
40+
PKGCONFIG_DEPENDENCIES
41+
Qt5Core
42+
libudev
43+
)

src/udev/udev.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@
2626

2727
#include <QtCore/QString>
2828

29-
#include <Qt5Udev/qtudevglobal.h>
29+
#include <Qt5Udev/qt5udevglobal.h>
3030

3131
namespace QtUdev {
3232

3333
class UdevDevice;
3434
class UdevPrivate;
3535

36-
class QTUDEV_EXPORT Udev
36+
class QT5UDEV_EXPORT Udev
3737
{
3838
Q_DECLARE_PRIVATE(Udev)
3939
public:

src/udev/udev_p.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
#include <QLoggingCategory>
3939

40-
#include <Qt5Udev/qtudevglobal.h>
40+
#include <Qt5Udev/qt5udevglobal.h>
4141

4242
extern "C" {
4343
#include <libudev.h>
@@ -49,7 +49,7 @@ namespace QtUdev {
4949

5050
class Udev;
5151

52-
class QTUDEV_EXPORT UdevPrivate
52+
class QT5UDEV_EXPORT UdevPrivate
5353
{
5454
public:
5555
UdevPrivate();

src/udev/udevdevice.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
#include <QtCore/QObject>
2828

29-
#include <Qt5Udev/qtudevglobal.h>
29+
#include <Qt5Udev/qt5udevglobal.h>
3030

3131
struct udev_device;
3232

@@ -37,7 +37,7 @@ class UdevEnumerate;
3737
class UdevDevicePrivate;
3838
class UdevMonitorPrivate;
3939

40-
class QTUDEV_EXPORT UdevDevice
40+
class QT5UDEV_EXPORT UdevDevice
4141
{
4242
Q_DECLARE_PRIVATE(UdevDevice)
4343
public:

src/udev/udevenumerate.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace QtUdev {
3030

3131
class UdevEnumeratePrivate;
3232

33-
class QTUDEV_EXPORT UdevEnumerate
33+
class QT5UDEV_EXPORT UdevEnumerate
3434
{
3535
Q_DECLARE_PRIVATE(UdevEnumerate)
3636
public:

src/udev/udevmonitor.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@
2626

2727
#include <QtCore/QObject>
2828

29-
#include <Qt5Udev/qtudevglobal.h>
29+
#include <Qt5Udev/qt5udevglobal.h>
3030

3131
namespace QtUdev {
3232

3333
class Udev;
3434
class UdevDevice;
3535
class UdevMonitorPrivate;
3636

37-
class QTUDEV_EXPORT UdevMonitor : public QObject
37+
class QT5UDEV_EXPORT UdevMonitor : public QObject
3838
{
3939
Q_OBJECT
4040
Q_DECLARE_PRIVATE(UdevMonitor)

tests/auto/udev/CMakeLists.txt

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
find_package(Umockdev REQUIRED)
2+
3+
liri_add_test(tst_qtudev
4+
SOURCES
5+
tst_udev.cpp
6+
DEFINES
7+
QT_NO_KEYWORDS
8+
LIBRARIES
9+
Liri::Qt5Udev
10+
PkgConfig::Umockdev
11+
)

0 commit comments

Comments
 (0)