From 0cf6819b46456d6dde3e8dc67a8ea5131e618a4b Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 14 Jul 2010 11:54:05 -0700 Subject: uhd: platform define macros --- host/include/uhd/config.hpp | 11 +++++++++++ host/include/uhd/utils/byteswap.ipp | 6 +++--- 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'host/include') 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 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 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 UHD_INLINE boost::uint16_t uhd::byteswap(boost::uint16_t x){ -- cgit v1.2.3