USRP Hardware Driver and USRP Manual  Version: 004.000.000.HEAD-0-g8773fb2c
UHD and USRP Manual
config.h
Go to the documentation of this file.
1 //
2 // Copyright 2015-2016 Ettus Research LLC
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 //
17 
18 #ifndef INCLUDED_UHD_CONFIG_H
19 #define INCLUDED_UHD_CONFIG_H
20 
21 #ifdef _MSC_VER
22 // Bring in "and", "or", and "not"
23 #include <iso646.h>
24 
25 // Define ssize_t
26 #include <stddef.h>
27 typedef ptrdiff_t ssize_t;
28 
29 #endif /* _MSC_VER */
30 
31 // Define cross-platform macros
32 #if defined(_MSC_VER)
33  #define UHD_EXPORT __declspec(dllexport)
34  #define UHD_IMPORT __declspec(dllimport)
35  #define UHD_INLINE __forceinline
36  #define UHD_DEPRECATED __declspec(deprecated)
37  #define UHD_ALIGNED(x) __declspec(align(x))
38  #define UHD_UNUSED(x) x
39 #elif defined(__MINGW32__)
40  #define UHD_EXPORT __declspec(dllexport)
41  #define UHD_IMPORT __declspec(dllimport)
42  #define UHD_INLINE inline
43  #define UHD_DEPRECATED __declspec(deprecated)
44  #define UHD_ALIGNED(x) __declspec(align(x))
45  #define UHD_UNUSED(x) x __attribute__((unused))
46 #elif defined(__GNUC__) && __GNUC__ >= 4
47  #define UHD_EXPORT __attribute__((visibility("default")))
48  #define UHD_IMPORT __attribute__((visibility("default")))
49  #define UHD_INLINE inline __attribute__((always_inline))
50  #define UHD_DEPRECATED __attribute__((deprecated))
51  #define UHD_ALIGNED(x) __attribute__((aligned(x)))
52  #define UHD_UNUSED(x) x __attribute__((unused))
53 #elif defined(__clang__)
54  #define UHD_EXPORT __attribute__((visibility("default")))
55  #define UHD_IMPORT __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_INLINE inline
64  #define UHD_DEPRECATED
65  #define UHD_ALIGNED(x)
66  #define UHD_UNUSED(x) x
67 #endif
68 
69 // API declaration macro
70 #ifdef UHD_DLL_EXPORTS
71  #define UHD_API UHD_EXPORT
72 #else
73  #define UHD_API UHD_IMPORT
74 #endif // UHD_DLL_EXPORTS
75 
76 // Platform defines for conditional code:
77 // Taken from boost/config/select_platform_config.hpp,
78 // However, we define macros, not strings, for platforms.
79 #if (defined(linux) || defined(__linux) || defined(__linux__) || defined(__GLIBC__)) && !defined(_CRAYC) && !defined(__FreeBSD_kernel__) && !defined(__GNU__)
80  #define UHD_PLATFORM_LINUX
81 #elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
82  #define UHD_PLATFORM_WIN32
83 #elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
84  #define UHD_PLATFORM_MACOS
85 #elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD_kernel__)
86  #define UHD_PLATFORM_BSD
87 #endif
88 
89 #endif /* INCLUDED_UHD_CONFIG_H */