diff --git a/CMakeLists.txt b/CMakeLists.txt index 03db8f5..9af43d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,6 +84,7 @@ elseif(APPLE) find_library(OPENGL_LIBRARY OpenGL) if (NOT CMAKE_OSX_DEPLOYMENT_TARGET OR CMAKE_OSX_DEPLOYMENT_TARGET VERSION_GREATER 10.10) find_library(METAL_LIBRARY Metal) + list(APPEND _BOO_SYS_DEFINES -DBOO_HAS_METAL=1) else() set(METAL_LIBRARY "") endif() diff --git a/include/boo/System.hpp b/include/boo/System.hpp index 1592744..4ca25a1 100644 --- a/include/boo/System.hpp +++ b/include/boo/System.hpp @@ -5,29 +5,29 @@ #ifndef ENABLE_BITWISE_ENUM #define ENABLE_BITWISE_ENUM(type)\ -inline type operator|(type a, type b)\ +constexpr type operator|(type a, type b)\ {\ using T = std::underlying_type_t;\ return type(static_cast(a) | static_cast(b));\ }\ -inline type operator&(type a, type b)\ +constexpr type operator&(type a, type b)\ {\ using T = std::underlying_type_t;\ return type(static_cast(a) & static_cast(b));\ }\ -inline type& operator|=(type& a, const type& b)\ +constexpr type& operator|=(type& a, const type& b)\ {\ using T = std::underlying_type_t;\ a = type(static_cast(a) | static_cast(b));\ return a;\ }\ -inline type& operator&=(type& a, const type& b)\ +constexpr type& operator&=(type& a, const type& b)\ {\ using T = std::underlying_type_t;\ a = type(static_cast(a) & static_cast(b));\ return a;\ }\ -inline type operator~(const type& key)\ +constexpr type operator~(const type& key)\ {\ using T = std::underlying_type_t;\ return type(~static_cast(key));\ diff --git a/include/boo/graphicsdev/Metal.hpp b/include/boo/graphicsdev/Metal.hpp index 60a6fb0..1ea7851 100644 --- a/include/boo/graphicsdev/Metal.hpp +++ b/include/boo/graphicsdev/Metal.hpp @@ -1,11 +1,7 @@ #ifndef GDEV_METAL_HPP #define GDEV_METAL_HPP #ifdef __APPLE__ - -#include - -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101100 -#define BOO_HAS_METAL 1 +#if BOO_HAS_METAL #include "IGraphicsDataFactory.hpp" #include "IGraphicsCommandQueue.hpp" @@ -80,9 +76,6 @@ public: } -#else -#define BOO_HAS_METAL 0 #endif - #endif // __APPLE__ #endif // GDEV_METAL_HPP diff --git a/lib/graphicsdev/Metal.mm b/lib/graphicsdev/Metal.mm index 7ea1e62..e93aa3d 100644 --- a/lib/graphicsdev/Metal.mm +++ b/lib/graphicsdev/Metal.mm @@ -621,10 +621,6 @@ struct MetalShaderDataBinding : IShaderDataBinding } for (size_t i=0 ; i - -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101100 -#define BOO_HAS_METAL 1 +#if BOO_HAS_METAL #include #include @@ -35,7 +32,6 @@ struct MetalContext } #else -#define BOO_HAS_METAL 0 namespace boo { struct MetalContext {};