aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-07-14 11:54:05 -0700
committerJosh Blum <josh@joshknows.com>2010-07-14 11:54:05 -0700
commit0cf6819b46456d6dde3e8dc67a8ea5131e618a4b (patch)
treeae17d3f1450503e61892de72a4a240e2a573cf79 /host
parent76d3ccce2598c1c91ee7e55f92bc571db455cc18 (diff)
downloaduhd-0cf6819b46456d6dde3e8dc67a8ea5131e618a4b.tar.gz
uhd-0cf6819b46456d6dde3e8dc67a8ea5131e618a4b.tar.bz2
uhd-0cf6819b46456d6dde3e8dc67a8ea5131e618a4b.zip
uhd: platform define macros
Diffstat (limited to 'host')
-rw-r--r--host/include/uhd/config.hpp11
-rw-r--r--host/include/uhd/utils/byteswap.ipp6
2 files changed, 14 insertions, 3 deletions
diff --git a/host/include/uhd/config.hpp b/host/include/uhd/config.hpp
index 2360174a4..dacd3a96b 100644
--- a/host/include/uhd/config.hpp
+++ b/host/include/uhd/config.hpp
@@ -101,4 +101,15 @@
#define UHD_DEPRECATED
#endif
+// Platform defines for conditional parts of headers:
+// Taken from boost/config/select_platform_config.hpp,
+// however, we define macros, not strings for platforms.
+#if defined(linux) || defined(__linux) || defined(__linux__)
+ #define UHD_PLATFORM_LINUX
+#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
+ #define UHD_PLATFORM_WIN32
+#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
+ #define UHD_PLATFORM_MACOS
+#endif
+
#endif /* INCLUDED_UHD_CONFIG_HPP */
diff --git a/host/include/uhd/utils/byteswap.ipp b/host/include/uhd/utils/byteswap.ipp
index 11c82a4ec..a070a7cf5 100644
--- a/host/include/uhd/utils/byteswap.ipp
+++ b/host/include/uhd/utils/byteswap.ipp
@@ -21,7 +21,7 @@
/***********************************************************************
* Platform-specific implementation details for byteswap below:
**********************************************************************/
-#ifdef BOOST_MSVC //http://msdn.microsoft.com/en-us/library/a3140177%28VS.80%29.aspx
+#if defined(UHD_PLATFORM_WIN32) //http://msdn.microsoft.com/en-us/library/a3140177%28VS.80%29.aspx
#include <stdlib.h>
UHD_INLINE boost::uint16_t uhd::byteswap(boost::uint16_t x){
@@ -50,7 +50,7 @@
return __builtin_bswap64(x);
}
-#elif defined(__FreeBSD__) || defined(__MACOSX__) || defined(__APPLE__)
+#elif defined(UHD_PLATFORM_MACOS)
#include <libkern/OSByteOrder.h>
UHD_INLINE boost::uint16_t uhd::byteswap(boost::uint16_t x){
@@ -65,7 +65,7 @@
return OSSwapInt64(x);
}
-#elif defined(linux) || defined(__linux)
+#elif defined(UHD_PLATFORM_LINUX)
#include <byteswap.h>
UHD_INLINE boost::uint16_t uhd::byteswap(boost::uint16_t x){