Skip to content

Commit

Permalink
Support building KDMqtt on macOS
Browse files Browse the repository at this point in the history
* add missing header include
* add macOS specific paths to FindMosquitto.cmake
* (re)enable CI run on macOS
  • Loading branch information
marcothaller committed Nov 11, 2024
1 parent 09f2ac2 commit 196c31d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
#- ubuntu-20.04 -> disabled during introduction of KDMqtt
- windows-2022
#- windows-2019
#- macos-12 -> disabled during introduction of KDMqtt
- macos-12
#- macos-11
build_type:
- Debug
Expand Down Expand Up @@ -50,6 +50,11 @@ jobs:
libwayland-dev xvfb ninja-build \
libmosquittopp-dev
- name: Download mosquitto (MacOS)
if: runner.os == 'macOS'
run: |
brew install mosquitto
- name: Download mosquitto (Windows)
if: runner.os == 'Windows'
run: |
Expand Down
6 changes: 4 additions & 2 deletions cmake/FindMosquitto.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,19 @@ find_file(MOSQUITTO_HEADER
PATHS
/usr/include
/usr/local/include
/usr/local/opt/mosquitto/include
$ENV{PROGRAMFILES}/mosquitto/devel
$ENV{PROGRAMFILES\(X86\)}/mosquitto/devel
)

if(UNIX)
if(APPLE OR UNIX)
find_library(MOSQUITTO_LIBRARY
NAMES
mosquitto
PATHS
/usr/lib
/usr/local/lib
/usr/local/opt/mosquitto/lib
)

if(MOSQUITTO_HEADER AND MOSQUITTO_LIBRARY)
Expand Down Expand Up @@ -64,7 +66,7 @@ if(Mosquitto_FOUND)

add_library(Mosquitto::Mosquitto SHARED IMPORTED)

if(UNIX)
if(APPLE OR UNIX)
set_target_properties(Mosquitto::Mosquitto PROPERTIES
IMPORTED_LOCATION "${MOSQUITTO_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${MOSQUITTO_INCLUDE_DIRECTORY}"
Expand Down
1 change: 1 addition & 0 deletions src/KDMqtt/mqtt.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <KDMqtt/mosquitto_wrapper.h>
#include <KDUtils/file.h>
#include <KDUtils/url.h>
#include <unordered_map>

using namespace KDFoundation;
using namespace KDUtils;
Expand Down

0 comments on commit 196c31d

Please sign in to comment.