fix(build): compilation on macos

After some commits on the master branch compilation
for macos was not working. This PR restores macos
to a building state.

Co-authored-by: Jón Bjarni Bjarnason <jon@centroid.is>
This commit is contained in:
Ómar Högni Guðmarsson 2025-03-02 10:21:15 +00:00 committed by Julius Pfrommer
parent de932080cf
commit 9056bbf887
8 changed files with 22 additions and 8 deletions

View File

@ -645,6 +645,8 @@ if((CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang") AND
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
check_add_cc_flag("-fprofile-instr-generate")
check_add_cc_flag("-fcoverage-mapping")
check_add_cc_flag("-fprofile-arcs")
check_add_cc_flag("-ftest-coverage")
endif()
endif()

View File

@ -175,12 +175,12 @@ _UA_END_DECLS
/*---------------------*/
#include <sys/socket.h>
#include <sys/select.h>
#include <sys/ioctl.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <netdb.h>
#include <sys/ioctl.h>
#include <sys/select.h>
#include <net/if.h>
#include <poll.h>
#include <fcntl.h>
@ -263,11 +263,15 @@ typedef int SOCKET;
#include <libgen.h>
#include <limits.h>
#include <stdio.h>
#include <sys/inotify.h>
#ifndef __APPLE__
# include <sys/inotify.h>
#endif /* !__APPLE__ */
#include <sys/stat.h>
#ifndef __ANDROID__
#ifndef __APPLE__
#include <bits/stdio_lim.h>
#endif /* !__APPLE__ */
#endif /* !__ANDROID__ */
#define UA_STAT stat

View File

@ -190,7 +190,9 @@ if(UA_ENABLE_PUBSUB)
add_example(server_pubsub_publish_rt_offsets pubsub_realtime/server_pubsub_publish_rt_offsets.c)
add_example(server_pubsub_subscribe_rt_offsets pubsub_realtime/server_pubsub_subscribe_rt_offsets.c)
if(UA_ARCHITECTURE_POSIX)
## Apple does not implement timer functions required by one of the examples
## And apple does not implement librt posix extension
if(UA_ARCHITECTURE_POSIX AND NOT APPLE)
add_example(server_pubsub_publish_rt_state_machine
pubsub_realtime/server_pubsub_publish_rt_state_machine.c)
target_link_libraries(server_pubsub_publish_rt_state_machine "rt")

View File

@ -8,6 +8,8 @@
*/
#include <open62541/util.h>
#include "../../arch/posix/eventloop_posix.h"
#include "ua_filestore_common.h"
#include <open62541/plugin/certificategroup_default.h>
#include "ua_filestore_common.h"
@ -15,7 +17,7 @@
#ifdef UA_ENABLE_ENCRYPTION
#if defined(__linux__) || defined(UA_ARCHITECTURE_WIN32)
#if defined(__linux__) || defined(UA_ARCHITECTURE_WIN32) || defined(__APPLE__)
#ifdef __linux__
#define EVENT_SIZE (sizeof(struct inotify_event))

View File

@ -5,11 +5,12 @@
* Copyright 2024 (c) Fraunhofer IOSB (Author: Noel Graf)
*/
#include "../../arch/posix/eventloop_posix.h"
#include "ua_filestore_common.h"
#ifdef UA_ENABLE_ENCRYPTION
#if defined(__linux__) || defined(UA_ARCHITECTURE_WIN32)
#if defined(__linux__) || defined(UA_ARCHITECTURE_WIN32) || defined(__APPLE__)
#ifdef UA_ARCHITECTURE_WIN32
/* TODO: Replace with a proper dirname implementation. This is a just minimal

View File

@ -12,7 +12,7 @@
#ifdef UA_ENABLE_ENCRYPTION
#if defined(__linux__) || defined(UA_ARCHITECTURE_WIN32)
#if defined(__linux__) || defined(UA_ARCHITECTURE_WIN32) || defined(__APPLE__)
#include "../../arch/posix/eventloop_posix.h"

View File

@ -39,7 +39,7 @@ UA_CertificateGroup_Memorystore(UA_CertificateGroup *certGroup,
const UA_Logger *logger,
const UA_KeyValueMap *params);
#if defined(__linux__) || defined(UA_ARCHITECTURE_WIN32)
#if defined(__linux__) || defined(UA_ARCHITECTURE_WIN32) || defined(__APPLE__)
/*
* Initialises and configures a certificate group with a filestore backend.
*

View File

@ -15,6 +15,9 @@
#include <open62541/server.h>
#include <open62541/util.h>
#include <open62541/common.h>
// Not used in this translation unit, but exposes symbols that are used in other translation units
#include <open62541/server_config_default.h>
#include <open62541/transport_generated.h>
#include "ua_util_internal.h"
#include "pcg_basic.h"