Statistics
| Branch: | Tag: | Revision:

root / host / include / uhd / config.hpp @ 09af5cbf

History | View | Annotate | Download (4.08 KB)

1
//
2
// Copyright 2010 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_HPP
19
#define INCLUDED_UHD_CONFIG_HPP
20

    
21
// suppress warnings
22
#include <boost/config.hpp>
23
#ifdef BOOST_MSVC
24
//# pragma warning(push)
25
//# pragma warning(disable: 4511) // copy constructor can't not be generated
26
//# pragma warning(disable: 4512) // assignment operator can't not be generated
27
//# pragma warning(disable: 4100) // unreferenced formal parameter
28
//# pragma warning(disable: 4996) // <symbol> was declared deprecated
29
//# pragma warning(disable: 4355) // 'this' : used in base member initializer list
30
//# pragma warning(disable: 4706) // assignment within conditional expression
31
# pragma warning(disable: 4251) // class 'A<T>' needs to have dll-interface to be used by clients of class 'B'
32
//# pragma warning(disable: 4127) // conditional expression is constant
33
//# pragma warning(disable: 4290) // C++ exception specification ignored except to ...
34
# pragma warning(disable: 4180) // qualifier applied to function type has no meaning; ignored
35
# pragma warning(disable: 4275) // non dll-interface class ... used as base for dll-interface class ...
36
//# pragma warning(disable: 4267) // 'var' : conversion from 'size_t' to 'type', possible loss of data
37
//# pragma warning(disable: 4511) // 'class' : copy constructor could not be generated
38
# pragma warning(disable: 4250) // 'class' : inherits 'method' via dominance
39
#endif
40

    
41
// define logical operators
42
#ifdef BOOST_MSVC
43
    #include <ciso646>
44
#endif
45

    
46
// define ssize_t
47
#ifdef BOOST_MSVC
48
    #include <cstddef>
49
    typedef ptrdiff_t ssize_t;
50
#endif
51

    
52
// http://gcc.gnu.org/wiki/Visibility
53
// Generic helper definitions for shared library support
54
#if defined(BOOST_HAS_DECLSPEC)
55
    #define UHD_HELPER_DLL_IMPORT __declspec(dllimport)
56
    #define UHD_HELPER_DLL_EXPORT __declspec(dllexport)
57
    #define UHD_HELPER_DLL_LOCAL
58
#elif defined(__GNUG__) && __GNUG__ >= 4
59
    #define UHD_HELPER_DLL_IMPORT __attribute__ ((visibility("default")))
60
    #define UHD_HELPER_DLL_EXPORT __attribute__ ((visibility("default")))
61
    #define UHD_HELPER_DLL_LOCAL  __attribute__ ((visibility("hidden")))
62
#else
63
    #define UHD_HELPER_DLL_IMPORT
64
    #define UHD_HELPER_DLL_EXPORT
65
    #define UHD_HELPER_DLL_LOCAL
66
#endif
67

    
68
// Now we use the generic helper definitions above to define UHD_API and UHD_LOCAL.
69
// UHD_API is used for the public API symbols. It either DLL imports or DLL exports (or does nothing for static build)
70
// UHD_LOCAL is used for non-api symbols.
71

    
72
#define UHD_DLL // defined here, put into configuration if we need to make static libs
73

    
74
#ifdef UHD_DLL // defined if UHD is compiled as a DLL
75
    #ifdef UHD_DLL_EXPORTS // defined if we are building the UHD DLL (instead of using it)
76
        #define UHD_API UHD_HELPER_DLL_EXPORT
77
    #else
78
        #define UHD_API UHD_HELPER_DLL_IMPORT
79
    #endif // UHD_DLL_EXPORTS
80
    #define UHD_LOCAL UHD_HELPER_DLL_LOCAL
81
#else // UHD_DLL is not defined: this means UHD is a static lib.
82
    #define UHD_API
83
    #define UHD_LOCAL
84
#endif // UHD_DLL
85

    
86
// Define force inline macro
87
#if defined(BOOST_MSVC)
88
    #define UHD_INLINE __forceinline
89
#elif defined(__GNUG__) && __GNUG__ >= 4
90
    #define UHD_INLINE inline __attribute__((always_inline))
91
#else
92
    #define UHD_INLINE inline
93
#endif
94

    
95
// Define deprecated attribute macro
96
#if defined(BOOST_MSVC)
97
    #define UHD_DEPRECATED __declspec(deprecated)
98
#elif defined(__GNUG__) && __GNUG__ >= 4
99
    #define UHD_DEPRECATED __attribute__ ((deprecated))
100
#else
101
    #define UHD_DEPRECATED
102
#endif
103

    
104
#endif /* INCLUDED_UHD_CONFIG_HPP */