The set of QMake include files for using Eclipse Paho C Client Library (v1.3.1) and Eclipse Paho MQTT C++ Client Library (v1.1) as directly built-in into executable.
This is useful in cases when dynamic/static linking is not possible for some reasons.
Add into your *.pro
file next lines:
PAHO_MQTT_C_SRC_PATH = <path/to>/paho.mqtt.c/src/
include(<path/to>/paho_mqtt_c_builtin/paho_mqtt_c_builtin.pri)
Notice, that C++ library depends on C library, and requires async support:
Add into your *.pro
file next lines:
PAHO_MQTT_C_SRC_PATH = <path/to>/paho.mqtt.c/src/
CONFIG += PAHO_MQTT_C_ASYNC
include(<path/to>/paho_mqtt_c_builtin/paho_mqtt_c_builtin.pri)
PAHO_MQTT_CPP_SRC_PATH = <path/to>/paho.mqtt.cpp/src/
include(<path/to>/paho_mqtt_cpp_builtin/paho_mqtt_cpp_builtin.pri)
- Prepare dependencies
cd your_project_dir
# Clone Eclipse Paho MQTT C and C++ libraries into third_party/ directory
mkdir third_party
cd third_party
git clone https://github.com/eclipse/paho.mqtt.c.git
git clone https://github.com/eclipse/paho.mqtt.cpp.git
cd ..
# Clone this repository
git clone https://github.com/inobelar/Builtin-QMake-Paho-MQTT.git
- In
*.pro
file add:
PAHO_MQTT_C_SRC_PATH = $$PWD/third_party/paho.mqtt.c/src/
CONFIG += PAHO_MQTT_C_ASYNC
include($$PWD/Builtin-QMake-Paho-MQTT/paho_mqtt_c_builtin/paho_mqtt_c_builtin.pri)
PAHO_MQTT_CPP_SRC_PATH = $$PWD/third_party/paho.mqtt.cpp/src/
include($$PWD/Builtin-QMake-Paho-MQTT/paho_mqtt_cpp_builtin/paho_mqtt_cpp_builtin.pri)
- Try to compile C examples or C++ examples