diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b4b437480..2a2489e82 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -19,6 +19,7 @@ set(Magnum_SRCS Shader.cpp SizeTraits.cpp Texture.cpp + TypeTraits.cpp Trade/AbstractImporter.cpp Trade/Mesh.cpp diff --git a/src/TypeTraits.cpp b/src/TypeTraits.cpp new file mode 100644 index 000000000..0945f7b93 --- /dev/null +++ b/src/TypeTraits.cpp @@ -0,0 +1,31 @@ +/* + Copyright © 2010, 2011, 2012 Vladimír Vondruš + + This file is part of Magnum. + + Magnum is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 3 + only, as published by the Free Software Foundation. + + Magnum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License version 3 for more details. +*/ + +#include "TypeTraits.h" + +namespace Magnum { + +#ifndef DOXYGEN_GENERATING_OUTPUT +static_assert(sizeof(GLubyte) == sizeof(unsigned char), "GLubyte is not the same as unsigned char"); +static_assert(sizeof(GLbyte) == sizeof(char), "GLbyte is not the same as char"); +static_assert(sizeof(GLushort) == sizeof(unsigned short), "GLushort is not the same as unsigned short"); +static_assert(sizeof(GLshort) == sizeof(short), "GLshort is not the same as short"); +static_assert(sizeof(GLuint) == sizeof(unsigned int), "GLuint is not the same as unsigned int"); +static_assert(sizeof(GLint) == sizeof(int), "GLint is not the same as int"); +static_assert(sizeof(GLfloat) == sizeof(float), "GLfloat is not the same as float"); +static_assert(sizeof(GLdouble) == sizeof(double), "GLdouble is not the same as double"); +#endif + +} diff --git a/src/TypeTraits.h b/src/TypeTraits.h index d82189641..53c71e0d3 100644 --- a/src/TypeTraits.h +++ b/src/TypeTraits.h @@ -81,7 +81,6 @@ template struct TypeTraits {}; /** @todo Using Vector3 for textures? */ #ifndef DOXYGEN_GENERATING_OUTPUT -static_assert(sizeof(GLubyte) == sizeof(unsigned char), "GLubyte is not the same as unsigned char"); template<> struct TypeTraits: public Math::TypeTraits { typedef GLubyte IndexType; typedef GLubyte TextureType; @@ -91,7 +90,6 @@ template<> struct TypeTraits: public Math::TypeTraits { inline constexpr static size_t count() { return 1; } }; -static_assert(sizeof(GLbyte) == sizeof(char), "GLbyte is not the same as char"); template<> struct TypeTraits: public Math::TypeTraits { /* Can not be used for indices */ typedef GLbyte TextureType; @@ -101,7 +99,6 @@ template<> struct TypeTraits: public Math::TypeTraits { inline constexpr static size_t count() { return 1; } }; -static_assert(sizeof(GLushort) == sizeof(unsigned short), "GLushort is not the same as unsigned short"); template<> struct TypeTraits: public Math::TypeTraits { typedef GLushort IndexType; typedef GLushort TextureType; @@ -111,7 +108,6 @@ template<> struct TypeTraits: public Math::TypeTraits inline constexpr static size_t count() { return 1; } }; -static_assert(sizeof(GLshort) == sizeof(short), "GLshort is not the same as short"); template<> struct TypeTraits: public Math::TypeTraits { /* Can not be used for indices */ typedef GLshort TextureType; @@ -121,7 +117,6 @@ template<> struct TypeTraits: public Math::TypeTraits { inline constexpr static size_t count() { return 1; } }; -static_assert(sizeof(GLuint) == sizeof(unsigned int), "GLuint is not the same as unsigned int"); template<> struct TypeTraits: public Math::TypeTraits { typedef GLuint IndexType; typedef GLuint TextureType; @@ -131,7 +126,6 @@ template<> struct TypeTraits: public Math::TypeTraits { inline constexpr static size_t count() { return 1; } }; -static_assert(sizeof(GLint) == sizeof(int), "GLint is not the same as int"); template<> struct TypeTraits: public Math::TypeTraits { /* Can not be used for indices */ typedef GLint TextureType; @@ -141,7 +135,6 @@ template<> struct TypeTraits: public Math::TypeTraits { inline constexpr static size_t count() { return 1; } }; -static_assert(sizeof(GLfloat) == sizeof(float), "GLfloat is not the same as float"); template<> struct TypeTraits: public Math::TypeTraits { /* Can not be used for indices */ typedef GLfloat TextureType; @@ -151,7 +144,6 @@ template<> struct TypeTraits: public Math::TypeTraits { inline constexpr static size_t count() { return 1; } }; -static_assert(sizeof(GLdouble) == sizeof(double), "GLdouble is not the same as double"); template<> struct TypeTraits: public Math::TypeTraits { /* Can not be used for indices */ /* Can not be used for textures */