mirror of
https://github.com/Mercantec-GHC/h5-projekt-mst.git
synced 2026-08-27 05:37:39 +02:00
add mqtt compile arg
This commit is contained in:
parent
ad332fb309
commit
398ce3675a
@ -4,7 +4,7 @@ MAKEFLAGS += -j16
|
||||
CXX=g++
|
||||
LD=g++
|
||||
|
||||
CXXFLAGS = -std=c++23 -pedantic-errors -Wall -Wextra -Wconversion -ftemplate-backtrace-limit=0
|
||||
CXXFLAGS = -std=c++23 -pedantic-errors -Wall -Wextra -Wconversion
|
||||
LDFLAGS =
|
||||
|
||||
libraries = libmosquitto
|
||||
@ -30,6 +30,11 @@ ifeq ($(ASAN),1)
|
||||
CXXFLAGS += -fsanitize=address
|
||||
endif
|
||||
|
||||
MQTT_HOST=
|
||||
ifneq ($(MQTT_HOST),)
|
||||
CXXFLAGS += -DBACKEND_MQTT_HOST=\"$(MQTT_HOST)\"
|
||||
endif
|
||||
|
||||
build_dir = build
|
||||
obj_dir = $(build_dir)/obj
|
||||
src_dir = src
|
||||
|
||||
@ -23,10 +23,15 @@
|
||||
#define BACKEND_MQTT_PORT 1883
|
||||
#endif
|
||||
|
||||
#ifndef BACKEND_MQTT_HOST
|
||||
#define BACKEND_MQTT_HOST "mosquitto"
|
||||
#endif
|
||||
|
||||
int main(void)
|
||||
{
|
||||
auto mqtt_client
|
||||
= mst::mqtt::Client("10.133.51.127", BACKEND_MQTT_PORT, "test", "1234");
|
||||
|
||||
auto mqtt_client = mst::mqtt::Client(
|
||||
BACKEND_MQTT_HOST, BACKEND_MQTT_PORT, "test", "1234");
|
||||
|
||||
mqtt_client.subscribe("/skateboard/update", [&](std::string_view text) {
|
||||
//
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user