Skip to content

Commit 7d7313f

Browse files
authored
CMake build system support (dresden-elektronik#7053)
1 parent 0c335df commit 7d7313f

File tree

7 files changed

+464
-55
lines changed

7 files changed

+464
-55
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ ui_ddf_editor.h
1010
ui_device_widget.h
1111
.vscode
1212
.devcontainer
13+
build*
14+

BUILDING.md

+117
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
# Building
2+
3+
## Supported platforms
4+
* Raspbian / Debian ~~Jessie~~, ~~Stretch~~, Buster, Bullseye and Bookworm
5+
* Ubuntu ~~Xenial~~, Bionic, Focal Fossa and Jammy
6+
* Windows 7, 10, 11
7+
8+
There are two ways to build the plugin:
9+
1. [CMake](#build-with-cmake)
10+
2. [QMake (deprecated)](#build-with-qmake)
11+
12+
## Build with CMake
13+
14+
CMake is the new build system to compile the REST-API plugin. The former `deconz-dev` package isn't needed anymore since the headers and sources of the deCONZ library are pulled from https://github.com/dresden-elektronik/deconz-lib automatically.
15+
16+
### Linux
17+
18+
On Debian Buster the following development packages need to be installed.
19+
20+
**Note:** On newer Ubuntu versions `qt5-default` isn't available, replace it with `qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools` instead.
21+
22+
```
23+
apt-get update && \
24+
apt-get install --no-install-recommends -y \
25+
qt5-default \
26+
lsb-release ca-certificates build-essential pkg-config git \
27+
libqt5serialport5-dev libqt5websockets5-dev qtdeclarative5-dev \
28+
sqlite3 libsqlite3-dev libgpiod-dev libssl-dev curl cmake ninja-build
29+
```
30+
31+
1. Checkout the repository
32+
33+
git clone https://github.com/dresden-elektronik/deconz-rest-plugin.git
34+
35+
2. Compile the plugin
36+
37+
cmake -DCMAKE_INSTALL_PREFIX=/usr -G Ninja -B build
38+
cmake --build build
39+
40+
3. Install in local temporary directory
41+
(This step changes the RPATH so the plugin can find the official `/usr/lib/libdeCONZ.so` library.)
42+
43+
cmake --install build --prefix tmp
44+
45+
The compiled plugin is located at: `tmp/share/deCONZ/plugins/libde_rest_plugin.so`
46+
47+
### Windows
48+
49+
MSYS2 MINGW32 needs to be installed, it can be downloaded from https://msys2.org
50+
51+
52+
In MSYS2 MINGW32 shell the following packages need to be installed:
53+
54+
```
55+
pacman -Sy mingw-w64-i686-qt5 mingw-w64-i686-openssl mingw-w64-i686-sqlite3
56+
```
57+
58+
### Build
59+
60+
1. Checkout this repository
61+
62+
2. Open MSYS2 MINGW32 shell via Windows Start Menu
63+
64+
3. Navigate to the source directory, e.g. `cd /c/src/deconz-rest-plugin`
65+
66+
3. Compile the plugin with CMake
67+
68+
```
69+
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/mingw32/lib/cmake -B build
70+
cmake --build build
71+
```
72+
73+
After compilation the plugin can be found in the build directory: `de_rest_plugin.dll`
74+
75+
### macOS
76+
77+
(not officially supported yet, requires core sources for macOS build)
78+
79+
Install dependencies via Homebrew.
80+
```
81+
brew install qt@5 ninja cmake
82+
```
83+
84+
```
85+
cmake -DCMAKE_PREFIX_PATH=/usr/local/Cellar/qt\@5/5.15.9/lib/cmake -B build
86+
```
87+
88+
## Build with QMake
89+
90+
**Important:** Building via QMake is deprecated and will be removed in future.
91+
92+
This method is only supported on Linux.
93+
94+
### Install deCONZ development package
95+
96+
sudo apt install deconz-dev
97+
98+
### Get and compile the plugin
99+
100+
1. Checkout the repository
101+
102+
git clone https://github.com/dresden-elektronik/deconz-rest-plugin.git
103+
104+
2. Checkout the latest version
105+
106+
cd deconz-rest-plugin
107+
git checkout -b mybranch HEAD
108+
109+
3. Compile the plugin
110+
111+
qmake && make -j2
112+
113+
**Note** On Raspberry Pi 1 use `qmake && make`
114+
115+
4. Replace original plugin
116+
117+
sudo cp ../libde_rest_plugin.so /usr/share/deCONZ/plugins

0 commit comments

Comments
 (0)