123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300 |
- #ifndef UA_CONFIG_H_
- #define UA_CONFIG_H_
- #ifdef __cplusplus
- extern "C" {
- #endif
- #define UA_OPEN62541_VER_MAJOR ${OPEN62541_VER_MAJOR}
- #define UA_OPEN62541_VER_MINOR ${OPEN62541_VER_MINOR}
- #define UA_OPEN62541_VER_PATCH ${OPEN62541_VER_PATCH}
- #define UA_OPEN62541_VER_LABEL "${OPEN62541_VER_LABEL}"
- #define UA_OPEN62541_VER_COMMIT "${OPEN62541_VER_COMMIT}"
- #define UA_LOGLEVEL ${UA_LOGLEVEL}
- #cmakedefine UA_ENABLE_METHODCALLS
- #cmakedefine UA_ENABLE_NODEMANAGEMENT
- #cmakedefine UA_ENABLE_SUBSCRIPTIONS
- #cmakedefine UA_ENABLE_MULTITHREADING
- #cmakedefine UA_ENABLE_ENCRYPTION
- #cmakedefine UA_ENABLE_STATUSCODE_DESCRIPTIONS
- #cmakedefine UA_ENABLE_TYPENAMES
- #cmakedefine UA_ENABLE_DETERMINISTIC_RNG
- #cmakedefine UA_ENABLE_GENERATE_NAMESPACE0
- #cmakedefine UA_ENABLE_NONSTANDARD_UDP
- #cmakedefine UA_ENABLE_DISCOVERY
- #cmakedefine UA_ENABLE_DISCOVERY_MULTICAST
- #cmakedefine UA_ENABLE_DISCOVERY_SEMAPHORE
- #cmakedefine UA_ENABLE_UNIT_TEST_FAILURE_HOOKS
- #cmakedefine UA_DEBUG
- #cmakedefine UA_DEBUG_DUMP_PKGS
- #include <string.h>
- #include <stddef.h>
- #if !defined(_MSC_VER) || _MSC_VER >= 1600
- # include <stdint.h>
- # include <stdbool.h> /* C99 Boolean */
- # if defined(_WRS_KERNEL)
- # define UINT32_C(x) ((x) + (UINT32_MAX - UINT32_MAX))
- # endif
- #else
- # include "ms_stdint.h"
- # if !defined(__bool_true_false_are_defined)
- # define bool short
- # define true 1
- # define false 0
- # define __bool_true_false_are_defined
- # endif
- #endif
- #ifdef UA_DEBUG
- # include <assert.h>
- # define UA_assert(ignore) assert(ignore)
- #else
- # define UA_assert(ignore)
- #endif
- #if defined(__cplusplus) && __cplusplus >= 201103L
- # define UA_STATIC_ASSERT(cond,msg) static_assert(cond, #msg)
- #elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
- # define UA_STATIC_ASSERT(cond,msg) _Static_assert(cond, #msg)
- #elif defined(__GNUC__) || defined(__clang__) || defined(_MSC_VER)
- # define UA_CTASTR2(pre,post) pre ## post
- # define UA_CTASTR(pre,post) UA_CTASTR2(pre,post)
- # define UA_STATIC_ASSERT(cond,msg) \
- typedef struct { \
- int UA_CTASTR(static_assertion_failed_,msg) : !!(cond); \
- } UA_CTASTR(static_assertion_failed_,__COUNTER__)
- #else
- # define UA_STATIC_ASSERT(cond,msg) typedef char static_assertion_##msg[(cond)?1:-1]
- #endif
- #include <stdlib.h>
- #if defined(_WIN32) && !defined(__clang__)
- # include <malloc.h>
- #endif
- #if !defined(UA_FREERTOS)
- # define UA_free(ptr) free(ptr)
- # define UA_malloc(size) malloc(size)
- # define UA_calloc(num, size) calloc(num, size)
- # define UA_realloc(ptr, size) realloc(ptr, size)
- #else
- # include <FreeRTOS.h>
- # define UA_free(ptr) vPortFree(ptr)
- # define UA_malloc(size) pvPortMalloc(size)
- # define UA_calloc(num, size) pvPortCalloc(num, size)
- # define UA_realloc(ptr, size) pvPortRealloc(ptr, size)
- #endif
- #if defined(__GNUC__) || defined(__clang__)
- # define UA_alloca(size) __builtin_alloca (size)
- #elif defined(_WIN32)
- # define UA_alloca(SIZE) _alloca(SIZE)
- #else
- # include <alloca.h>
- # define UA_alloca(SIZE) alloca(SIZE)
- #endif
- #cmakedefine UA_DYNAMIC_LINKING
- #if defined(_WIN32) && defined(UA_DYNAMIC_LINKING)
- # ifdef UA_DYNAMIC_LINKING_EXPORT
- # ifdef __GNUC__
- # define UA_EXPORT __attribute__ ((dllexport))
- # else
- # define UA_EXPORT __declspec(dllexport)
- # endif
- # else
- # ifdef __GNUC__
- # define UA_EXPORT __attribute__ ((dllimport))
- # else
- # define UA_EXPORT __declspec(dllimport)
- # endif
- # endif
- #else
- # if __GNUC__ || __clang__
- # define UA_EXPORT __attribute__ ((visibility ("default")))
- # endif
- #endif
- #ifndef UA_EXPORT
- # define UA_EXPORT
- #endif
- #ifdef _MSC_VER
- # define UA_INLINE __inline
- #else
- # define UA_INLINE inline
- #endif
- #ifdef _MSC_VER
- # define UA_RESTRICT __restrict
- #elif defined(__GNUC__)
- # define UA_RESTRICT __restrict__
- #else
- # define UA_RESTRICT restrict
- #endif
- #if defined(__GNUC__) || defined(__clang__)
- # define UA_FUNC_ATTR_MALLOC __attribute__((malloc))
- # define UA_FUNC_ATTR_PURE __attribute__ ((pure))
- # define UA_FUNC_ATTR_CONST __attribute__((const))
- # define UA_FUNC_ATTR_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
- # define UA_FORMAT(X,Y) __attribute__ ((format (printf, X, Y)))
- #else
- # define UA_FUNC_ATTR_MALLOC
- # define UA_FUNC_ATTR_PURE
- # define UA_FUNC_ATTR_CONST
- # define UA_FUNC_ATTR_WARN_UNUSED_RESULT
- # define UA_FORMAT(X,Y)
- #endif
- #if defined(__GNUC__) || defined(__clang__)
- # define UA_DEPRECATED __attribute__((deprecated))
- #elif defined(_MSC_VER)
- # define UA_DEPRECATED __declspec(deprecated)
- #else
- # define UA_DEPRECATED
- #endif
- #if defined(_WIN32)
- # define UA_BINARY_OVERLAYABLE_INTEGER 1
- #elif (defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && \
- (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__))
- # define UA_BINARY_OVERLAYABLE_INTEGER 1
- #elif defined(__linux__)
- # include <endian.h>
- # if __BYTE_ORDER == __LITTLE_ENDIAN
- # define UA_BINARY_OVERLAYABLE_INTEGER 1
- # endif
- #elif defined(__OpenBSD__)
- # include <sys/endian.h>
- # if BYTE_ORDER == LITTLE_ENDIAN
- # define UA_BINARY_OVERLAYABLE_INTEGER 1
- # endif
- #elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__)
- # include <sys/endian.h>
- # if _BYTE_ORDER == _LITTLE_ENDIAN
- # define UA_BINARY_OVERLAYABLE_INTEGER 1
- # endif
- #elif defined(__APPLE__)
- # include <libkern/OSByteOrder.h>
- # if defined(__LITTLE_ENDIAN__)
- # define UA_BINARY_OVERLAYABLE_INTEGER 1
- # endif
- #elif defined(__QNX__) || defined(__QNXNTO__)
- # include <gulliver.h>
- # if defined(__LITTLEENDIAN__)
- # define UA_BINARY_OVERLAYABLE_INTEGER 1
- # endif
- #endif
- #ifndef UA_BINARY_OVERLAYABLE_INTEGER
- # define UA_BINARY_OVERLAYABLE_INTEGER 0
- #endif
- #if defined(_WIN32)
- # define UA_BINARY_OVERLAYABLE_FLOAT 1
- #elif defined(__FLOAT_WORD_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && \
- (__FLOAT_WORD_ORDER__ == __ORDER_LITTLE_ENDIAN__)
- # define UA_BINARY_OVERLAYABLE_FLOAT 1
- #elif defined(__FLOAT_WORD_ORDER) && defined(__LITTLE_ENDIAN) && \
- (__FLOAT_WORD_ORDER == __LITTLE_ENDIAN)
- # define UA_BINARY_OVERLAYABLE_FLOAT 1
- #elif defined(__linux__)
- # include <endian.h>
- # if __FLOAT_WORD_ORDER == __LITTLE_ENDIAN
- # define UA_BINARY_OVERLAYABLE_FLOAT 1
- # endif
- #elif defined(_WRS_KERNEL)
- # define UA_BINARY_OVERLAYABLE_FLOAT 1
- #endif
- #ifndef UA_BINARY_OVERLAYABLE_FLOAT
- # define UA_BINARY_OVERLAYABLE_FLOAT 0
- #endif
- #ifdef __cplusplus
- }
- #endif
- #endif
|