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 26, 2024
1 parent 6b3ad02 commit 88b41d3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ jobs:
- ubuntu-22.04
#- ubuntu-20.04 -> disabled during introduction of KDMqtt
- windows-2022
#- macos-13 -> disabled during introduction of KDMqtt
#- macos-14 -> disabled during introduction of KDMqtt
- macos-13
- macos-14
build_type:
- Debug
- Release
Expand Down Expand Up @@ -49,6 +49,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 88b41d3

Please sign in to comment.