USRP Hardware Driver and USRP Manual  Version: 4.4.0.HEAD-0-g5fac246b
UHD and USRP Manual
config.h
Go to the documentation of this file.
1 //
2 // Copyright 2015-2016 Ettus Research LLC
3 // Copyright 2018 Ettus Research, a National Instruments Company
4 //
5 // SPDX-License-Identifier: GPL-3.0-or-later
6 //
7 
8 #pragma once
9 
10 #ifdef _MSC_VER
11 // Bring in "and", "or", and "not"
12 #include <iso646.h>
13 
14 // Define ssize_t
15 #ifndef _SSIZE_T_DEFINED
16 #define _SSIZE_T_DEFINED
17 # include <BaseTsd.h>
18 typedef SSIZE_T ssize_t;
19 #endif /* _SSIZE_T_DEFINED */
20 
21 #endif /* _MSC_VER */
22 
23 // Define cross-platform macros
24 #if defined(_MSC_VER)
25  #define UHD_EXPORT __declspec(dllexport)
26  #define UHD_IMPORT __declspec(dllimport)
27  #define UHD_EXPORT_HEADER
28  #define UHD_IMPORT_HEADER
29  #define UHD_INLINE __forceinline
30  #define UHD_DEPRECATED __declspec(deprecated)
31  #define UHD_ALIGNED(x) __declspec(align(x))
32  #define UHD_UNUSED(x) x
33 #elif defined(__MINGW32__)
34  #define UHD_EXPORT __declspec(dllexport)
35  #define UHD_IMPORT __declspec(dllimport)
36  #define UHD_EXPORT_HEADER
37  #define UHD_IMPORT_HEADER
38  #define UHD_INLINE inline
39  #define UHD_DEPRECATED __declspec(deprecated)
40  #define UHD_ALIGNED(x) __declspec(align(x))
41  #define UHD_UNUSED(x) x __attribute__((unused))
42 #elif defined(__clang__)
43  #define UHD_EXPORT __attribute__((visibility("default")))
44  #define UHD_IMPORT __attribute__((visibility("default")))
45  #define UHD_EXPORT_HEADER __attribute__((visibility("default")))
46  #define UHD_IMPORT_HEADER __attribute__((visibility("default")))
47  #define UHD_INLINE inline __attribute__((always_inline))
48  #define UHD_DEPRECATED __attribute__((deprecated))
49  #define UHD_ALIGNED(x) __attribute__((aligned(x)))
50  #define UHD_UNUSED(x) x __attribute__((unused))
51 #elif defined(__GNUC__) && (__GNUC__ >= 4)
52  #define UHD_EXPORT __attribute__((visibility("default")))
53  #define UHD_IMPORT __attribute__((visibility("default")))
54  #define UHD_EXPORT_HEADER __attribute__((visibility("default")))
55  #define UHD_IMPORT_HEADER __attribute__((visibility("default")))
56  #define UHD_INLINE inline __attribute__((always_inline))
57  #define UHD_DEPRECATED __attribute__((deprecated))
58  #define UHD_ALIGNED(x) __attribute__((aligned(x)))
59  #define UHD_UNUSED(x) x __attribute__((unused))
60 #else
61  #define UHD_EXPORT
62  #define UHD_IMPORT
63  #define UHD_EXPORT_HEADER
64  #define UHD_IMPORT_HEADER
65  #define UHD_INLINE inline
66  #define UHD_DEPRECATED
67  #define UHD_ALIGNED(x)
68  #define UHD_UNUSED(x) x
69 #endif
70 
71 // Define API declaration macro
72 //
73 // UHD_API should be used for classes/structs that
74 // have a direct cpp implementations that get directly
75 // built into a so/dylib/dll.
76 //
77 // UHD_API_HEADER should be used for classes/structs
78 // that are implemented in header only like hpp/ipp.
79 #ifdef UHD_STATIC_LIB
80  #define UHD_API
81  #define UHD_API_HEADER
82 #else
83  #ifdef UHD_DLL_EXPORTS
84  #define UHD_API UHD_EXPORT
85  #define UHD_API_HEADER UHD_EXPORT_HEADER
86  #else
87  #define UHD_API UHD_IMPORT
88  #define UHD_API_HEADER UHD_IMPORT_HEADER
89  #endif // UHD_DLL_EXPORTS
90 #endif // UHD_STATIC_LIB
91 
92 // Platform defines for conditional code:
93 // Taken from boost/config/select_platform_config.hpp,
94 // However, we define macros, not strings, for platforms.
95 #if (defined(linux) || defined(__linux) || defined(__linux__) || defined(__GLIBC__)) && !defined(_CRAYC) && !defined(__FreeBSD_kernel__) && !defined(__GNU__)
96  #define UHD_PLATFORM_LINUX
97 #elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
98  #define UHD_PLATFORM_WIN32
99 #elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
100  #define UHD_PLATFORM_MACOS
101 #elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD_kernel__)
102  #define UHD_PLATFORM_BSD
103 #endif