# Building ## Supported platforms * Raspbian / Debian ~~Jessie~~, ~~Stretch~~, Buster, Bullseye, Bookworm, and Trixie * Ubuntu ~~Xenial~~, Bionic, Focal Fossa and Jammy * Windows 7, 10, 11 There are two ways to build the plugin: 1. [CMake](#build-with-cmake) 2. [QMake (deprecated)](#build-with-qmake) ## Build with CMake 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. ### Linux with Qt6 Building on Debian Trixie uses Qt6. The following development packages need to be installed: ``` apt-get update && \ apt-get install --no-install-recommends -y \ lsb-release \ ca-certificates \ build-essential \ cmake \ pkg-config \ git \ sqlite3 \ libsqlite3-dev \ libgpiod-dev \ libssl-dev \ qt6-base-dev \ qt6-base-dev-tools \ qt6-serialport-dev \ qt6-websockets-dev \ qt6-declarative-dev \ qt6-5compat-dev \ dpkg-dev \ fakeroot \ curl \ wget ``` 1. Checkout the repository git clone https://github.com/dresden-elektronik/deconz-rest-plugin.git 2. Compile the plugin cmake -DCMAKE_INSTALL_PREFIX=/usr -DQT_VERSION_MAJOR=6 -G Ninja -B build cmake --build build 3. Install in local temporary directory (This step changes the RPATH so the plugin can find the official `/usr/lib/libdeCONZ.so` library.) cmake --install build --prefix tmp The compiled plugin is located at: `tmp/share/deCONZ/plugins/libde_rest_plugin.so` -------- ### Linux with Qt5 Building on older Debian versions uses Qt5. The following development packages need to be installed. **Note:** On newer Ubuntu versions `qt5-default` isn't available, replace it with `qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools` instead. ``` apt-get update && \ apt-get install --no-install-recommends -y \ qt5-default \ lsb-release ca-certificates build-essential pkg-config git \ libqt5serialport5-dev libqt5websockets5-dev qtdeclarative5-dev \ sqlite3 libsqlite3-dev libgpiod-dev libssl-dev curl cmake ninja-build ``` 1. Checkout the repository git clone https://github.com/dresden-elektronik/deconz-rest-plugin.git 2. Compile the plugin cmake -DCMAKE_INSTALL_PREFIX=/usr -DQT_VERSION_MAJOR=5 -G Ninja -B build cmake --build build 3. Install in local temporary directory (This step changes the RPATH so the plugin can find the official `/usr/lib/libdeCONZ.so` library.) cmake --install build --prefix tmp The compiled plugin is located at: `tmp/share/deCONZ/plugins/libde_rest_plugin.so` -------- ### Windows MSYS2 MINGW32 needs to be installed, it can be downloaded from https://msys2.org In MSYS2 MINGW32 shell the following packages need to be installed: ``` pacman -Sy mingw-w64-i686-qt5 mingw-w64-i686-openssl mingw-w64-i686-sqlite3 ``` 1. Checkout this repository git clone https://github.com/dresden-elektronik/deconz-rest-plugin.git 2. Open MSYS2 MINGW32 shell via Windows Start Menu 3. Navigate to the source directory cd /c/src/deconz-rest-plugin 3. Compile the plugin with CMake cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/mingw32/lib/cmake -B build cmake --build build After compilation the plugin can be found in the build directory: `de_rest_plugin.dll` ----------- ### macOS Currently only supported on Intel Macs (x86_64). Install dependencies via Homebrew. ``` brew install qt@5 ninja cmake ``` 1. Checkout this repository git clone https://github.com/dresden-elektronik/deconz-rest-plugin.git 3. Navigate to the source directory cd deconz-rest-plugin 4. Compile the plugin with CMake ./build-macos.sh After compilation the plugin can be found in the build directory: `de_rest_plugin.dylib` 5. Copy the plugin to the app bundle cp build/de_rest_plugin.dylib /Applications/deCONZ.app/Contents/Plugins ## Build with QMake **Important:** Building via QMake is deprecated and will be removed in future. This method is only supported on Linux. ### Install deCONZ development package sudo apt install deconz-dev ### Get and compile the plugin 1. Checkout the repository git clone https://github.com/dresden-elektronik/deconz-rest-plugin.git 2. Checkout the latest version cd deconz-rest-plugin git checkout -b mybranch HEAD 3. Compile the plugin qmake && make -j2 **Note** On Raspberry Pi 1 use `qmake && make` 4. Replace original plugin sudo cp ../libde_rest_plugin.so /usr/share/deCONZ/plugins