Add QNX support by including necessary header for threads and endian functions.

Signed-off-by: Erlend Ese <erlendese@gmail.com>
This commit is contained in:
Erlend Ese 2025-05-18 00:41:26 +02:00
parent 9ef8f4d865
commit 2d15027863
4 changed files with 21 additions and 1 deletions

View File

@ -80,6 +80,7 @@ elseif(UNIX)
set(LIBS_SYSTEM compat pthread)
elseif(CMAKE_SYSTEM_NAME MATCHES "QNX")
set(LIBS_SYSTEM c)
add_definitions(-D_QNX_SOURCE -DGULLIVER)
else()
set(LIBS_SYSTEM c pthread)
endif()

View File

@ -28,7 +28,15 @@
#include "LinkedList.h"
#include "Clients.h"
typedef unsigned int bool;
#ifdef __cplusplus
#include <stdbool.h>
#else
#ifndef __bool_true_false_are_defined
#ifndef bool
typedef unsigned int bool;
#endif
#endif
#endif
typedef void* (*pf)(int, unsigned char, char*, size_t);
#include "MQTTProperties.h"

View File

@ -16,6 +16,13 @@
#include "SHA1.h"
// In the source files using endian functions (like SHA1.c):
#ifdef QNX_OS
#include <gulliver.h>
#define be32toh(x) ENDIAN_BE32(x)
#define htobe32(x) ENDIAN_BE32(x)
#endif
#if !defined(OPENSSL)
#if defined(_WIN32) || defined(_WIN64)
#pragma comment(lib, "crypt32.lib")

View File

@ -46,6 +46,10 @@
#undef ETIMEDOUT
#define ETIMEDOUT WSAETIMEDOUT
#else
#if defined(QNX_OS)
#include <sys/neutrino.h>
#include <process.h>
#endif
#include <pthread.h>
#define thread_type pthread_t