From a9a832e187b6a33638b8e769887a35e39638dbeb Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sun, 4 Jun 2017 11:36:13 +0200 Subject: [PATCH] - Added error for including of different versions of GLM #619 - Added GLM_FORCE_IGNORE_VERSION to ignore error caused by including different version of GLM #619 --- glm/common.hpp | 2 ++ glm/detail/func_exponential.inl | 2 +- glm/detail/func_matrix.hpp | 2 +- glm/detail/func_matrix.inl | 2 +- glm/detail/setup.hpp | 39 +++++++++++++++++++++++---------- glm/detail/type_mat.hpp | 2 +- glm/exponential.hpp | 2 ++ glm/ext.hpp | 2 ++ glm/fwd.hpp | 2 ++ glm/geometric.hpp | 2 ++ glm/glm.hpp | 2 ++ glm/gtc/bitfield.hpp | 3 ++- glm/gtc/random.hpp | 8 +++---- glm/gtc/random.inl | 2 +- glm/integer.hpp | 2 ++ glm/mat2x2.hpp | 2 ++ glm/mat2x3.hpp | 2 ++ glm/mat2x4.hpp | 2 ++ glm/mat3x2.hpp | 2 ++ glm/mat3x3.hpp | 2 ++ glm/mat3x4.hpp | 2 ++ glm/mat4x2.hpp | 2 ++ glm/mat4x3.hpp | 2 ++ glm/mat4x4.hpp | 2 ++ glm/matrix.hpp | 2 ++ glm/packing.hpp | 2 ++ glm/trigonometric.hpp | 2 ++ glm/vec2.hpp | 2 ++ glm/vec3.hpp | 2 ++ glm/vec4.hpp | 2 ++ glm/vector_relational.hpp | 2 ++ readme.md | 2 ++ 32 files changed, 87 insertions(+), 21 deletions(-) diff --git a/glm/common.hpp b/glm/common.hpp index f57e800e..66d2495c 100644 --- a/glm/common.hpp +++ b/glm/common.hpp @@ -1,6 +1,8 @@ /// @ref core /// @file glm/common.hpp +#include "detail/setup.hpp" + #pragma once #include "detail/func_common.hpp" diff --git a/glm/detail/func_exponential.inl b/glm/detail/func_exponential.inl index 3f51de1a..a1e49a3e 100644 --- a/glm/detail/func_exponential.inl +++ b/glm/detail/func_exponential.inl @@ -20,7 +20,7 @@ namespace detail } # endif - template class vecType, bool isFloat, bool Aligned> + template class vecType, bool isFloat, bool Aligned> struct compute_log2 { GLM_FUNC_QUALIFIER static vec call(vec const& v) diff --git a/glm/detail/func_matrix.hpp b/glm/detail/func_matrix.hpp index ac8f350c..6909613a 100644 --- a/glm/detail/func_matrix.hpp +++ b/glm/detail/func_matrix.hpp @@ -111,7 +111,7 @@ namespace detail /// /// @see GLSL outerProduct man page /// @see GLSL 4.20.8 specification, section 8.6 Matrix Functions - template class vecTypeA, template class vecTypeB> + template class vecTypeA, template class vecTypeB> GLM_FUNC_DECL typename detail::outerProduct_trait::type outerProduct(vecTypeA const & c, vecTypeB const & r); /// Returns the transposed matrix of x diff --git a/glm/detail/func_matrix.inl b/glm/detail/func_matrix.inl index aa605fc1..cdfe8258 100644 --- a/glm/detail/func_matrix.inl +++ b/glm/detail/func_matrix.inl @@ -362,7 +362,7 @@ namespace detail return detail::compute_matrixCompMult::value>::call(x, y); } - template class vecTypeA, template class vecTypeB> + template class vecTypeA, template class vecTypeB> GLM_FUNC_QUALIFIER typename detail::outerProduct_trait::type outerProduct(vecTypeA const & c, vecTypeB const & r) { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'outerProduct' only accept floating-point inputs"); diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index 3b5b6070..c2ed8ade 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -1,12 +1,23 @@ /// @ref core /// @file glm/detail/setup.hpp -#pragma once +#ifndef GLM_SETUP_INCLUDED + +#define GLM_VERSION_MAJOR 0 +#define GLM_VERSION_MINOR 9 +#define GLM_VERSION_PATCH 9 +#define GLM_VERSION_REVISION 0 +#define GLM_VERSION 990 + +#define GLM_SETUP_INCLUDED GLM_VERSION #if defined(GLM_FORCE_SWIZZLE) && defined(GLM_FORCE_UNRESTRICTED_GENTYPE) # error "Both GLM_FORCE_SWIZZLE and GLM_FORCE_UNRESTRICTED_GENTYPE can't be defined at the same time" #endif +#include +#include + /////////////////////////////////////////////////////////////////////////////////// // Messages @@ -19,19 +30,14 @@ # define GLM_MESSAGES GLM_MESSAGES_DISABLE #endif -#include -#include +/////////////////////////////////////////////////////////////////////////////////// +// Detect the platform + #include "../simd/platform.h" /////////////////////////////////////////////////////////////////////////////////// // Version -#define GLM_VERSION 99 -#define GLM_VERSION_MAJOR 0 -#define GLM_VERSION_MINOR 9 -#define GLM_VERSION_PATCH 9 -#define GLM_VERSION_REVISION 0 - #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_MESSAGE_VERSION_DISPLAYED) # define GLM_MESSAGE_VERSION_DISPLAYED # pragma message ("GLM: version 0.9.9.0") @@ -731,9 +737,11 @@ #define GLM_HAS_ALIGNED_TYPE GLM_HAS_UNRESTRICTED_UNIONS /////////////////////////////////////////////////////////////////////////////////// -// Length type +// Length type: all length functions returns a length_t type. +// When GLM_FORCE_SIZE_T_LENGTH is defined, length_t is a typedef of size_t otherwise +// length_t is a typedef of int like GLSL defines it. -// User defines: GLM_FORCE_SIZE_T_LENGTH GLM_FORCE_SIZE_FUNC +// User define: GLM_FORCE_SIZE_T_LENGTH namespace glm { @@ -784,3 +792,12 @@ namespace glm { enum ctor{uninitialize}; }//namespace glm + +/////////////////////////////////////////////////////////////////////////////////// +// Check inclusions of different versions of GLM + +#elif ((GLM_SETUP_INCLUDED != GLM_VERSION) && !defined(GLM_FORCE_IGNORE_VERSION)) +# error "GLM error: A different version of GLM is already included. Define GLM_FORCE_IGNORE_VERSION before including GLM headers to ignore this error." +#elif GLM_SETUP_INCLUDED == GLM_VERSION + +#endif//GLM_SETUP_INCLUDED diff --git a/glm/detail/type_mat.hpp b/glm/detail/type_mat.hpp index 8cabc378..3c418dae 100644 --- a/glm/detail/type_mat.hpp +++ b/glm/detail/type_mat.hpp @@ -8,7 +8,7 @@ namespace glm{ namespace detail { - template class colType, template class rowType> + template class colType, template class rowType> struct outerProduct_trait{}; }//namespace detail diff --git a/glm/exponential.hpp b/glm/exponential.hpp index f3a7842c..a7180baa 100644 --- a/glm/exponential.hpp +++ b/glm/exponential.hpp @@ -1,6 +1,8 @@ /// @ref core /// @file glm/exponential.hpp +#include "detail/setup.hpp" + #pragma once #include "detail/func_exponential.hpp" diff --git a/glm/ext.hpp b/glm/ext.hpp index 9dedc01c..64574541 100644 --- a/glm/ext.hpp +++ b/glm/ext.hpp @@ -25,6 +25,8 @@ /// at once by including . Otherwise, each extension needs to be /// included a specific file. +#include "detail/setup.hpp" + #pragma once #include "glm.hpp" diff --git a/glm/fwd.hpp b/glm/fwd.hpp index 04c7c5a7..1a08b3b7 100644 --- a/glm/fwd.hpp +++ b/glm/fwd.hpp @@ -1,6 +1,8 @@ /// @ref core /// @file glm/fwd.hpp +#include "detail/setup.hpp" + #pragma once #include "detail/type_int.hpp" diff --git a/glm/geometric.hpp b/glm/geometric.hpp index eea45b12..8e1f9f1f 100644 --- a/glm/geometric.hpp +++ b/glm/geometric.hpp @@ -1,6 +1,8 @@ /// @ref core /// @file glm/geometric.hpp +#include "detail/setup.hpp" + #pragma once #include "detail/func_geometric.hpp" diff --git a/glm/glm.hpp b/glm/glm.hpp index bf226da7..284648ec 100644 --- a/glm/glm.hpp +++ b/glm/glm.hpp @@ -51,6 +51,8 @@ #include "detail/_fixes.hpp" +#include "detail/setup.hpp" + #pragma once #include diff --git a/glm/gtc/bitfield.hpp b/glm/gtc/bitfield.hpp index 8a34139b..cbeb84d8 100644 --- a/glm/gtc/bitfield.hpp +++ b/glm/gtc/bitfield.hpp @@ -11,10 +11,11 @@ /// /// need to be included to use these functionalities. +#include "../detail/setup.hpp" + #pragma once // Dependencies -#include "../detail/setup.hpp" #include "../detail/precision.hpp" #include "../detail/type_int.hpp" #include "../detail/_vectorize.hpp" diff --git a/glm/gtc/random.hpp b/glm/gtc/random.hpp index f8d9f729..549cc50e 100644 --- a/glm/gtc/random.hpp +++ b/glm/gtc/random.hpp @@ -32,10 +32,10 @@ namespace glm /// @param Max /// @tparam genType Value type. Currently supported: float or double scalars. /// @see gtc_random - template - GLM_FUNC_DECL genTYpe linearRand( - genTYpe Min, - genTYpe Max); + template + GLM_FUNC_DECL genType linearRand( + genType Min, + genType Max); /// Generate random numbers in the interval [Min, Max], according a linear distribution /// diff --git a/glm/gtc/random.inl b/glm/gtc/random.inl index 834c485c..974da1f5 100644 --- a/glm/gtc/random.inl +++ b/glm/gtc/random.inl @@ -10,7 +10,7 @@ namespace glm{ namespace detail { - template class vecType> + template class vecType> struct compute_rand { GLM_FUNC_QUALIFIER static vecType call(); diff --git a/glm/integer.hpp b/glm/integer.hpp index 178e10e7..5380c490 100644 --- a/glm/integer.hpp +++ b/glm/integer.hpp @@ -1,6 +1,8 @@ /// @ref core /// @file glm/integer.hpp +#include "detail/setup.hpp" + #pragma once #include "detail/func_integer.hpp" diff --git a/glm/mat2x2.hpp b/glm/mat2x2.hpp index 72ebce15..e4c3de19 100644 --- a/glm/mat2x2.hpp +++ b/glm/mat2x2.hpp @@ -1,6 +1,8 @@ /// @ref core /// @file glm/mat2x2.hpp +#include "detail/setup.hpp" + #pragma once #include "detail/type_mat2x2.hpp" diff --git a/glm/mat2x3.hpp b/glm/mat2x3.hpp index 9e2ba654..16fd5428 100644 --- a/glm/mat2x3.hpp +++ b/glm/mat2x3.hpp @@ -1,6 +1,8 @@ /// @ref core /// @file glm/mat2x3.hpp +#include "detail/setup.hpp" + #pragma once #include "detail/type_mat2x3.hpp" diff --git a/glm/mat2x4.hpp b/glm/mat2x4.hpp index f7905c89..03983794 100644 --- a/glm/mat2x4.hpp +++ b/glm/mat2x4.hpp @@ -1,6 +1,8 @@ /// @ref core /// @file glm/mat2x4.hpp +#include "detail/setup.hpp" + #pragma once #include "detail/type_mat2x4.hpp" diff --git a/glm/mat3x2.hpp b/glm/mat3x2.hpp index d3fce6aa..903122eb 100644 --- a/glm/mat3x2.hpp +++ b/glm/mat3x2.hpp @@ -1,6 +1,8 @@ /// @ref core /// @file glm/mat3x2.hpp +#include "detail/setup.hpp" + #pragma once #include "detail/type_mat3x2.hpp" diff --git a/glm/mat3x3.hpp b/glm/mat3x3.hpp index c1963090..fe7250b8 100644 --- a/glm/mat3x3.hpp +++ b/glm/mat3x3.hpp @@ -1,6 +1,8 @@ /// @ref core /// @file glm/mat3x3.hpp +#include "detail/setup.hpp" + #pragma once #include "detail/type_mat3x3.hpp" diff --git a/glm/mat3x4.hpp b/glm/mat3x4.hpp index b2d585dc..3e6cf7e7 100644 --- a/glm/mat3x4.hpp +++ b/glm/mat3x4.hpp @@ -1,6 +1,8 @@ /// @ref core /// @file glm/mat3x4.hpp +#include "detail/setup.hpp" + #pragma once #include "detail/type_mat3x4.hpp" diff --git a/glm/mat4x2.hpp b/glm/mat4x2.hpp index 654c97c1..d92b1823 100644 --- a/glm/mat4x2.hpp +++ b/glm/mat4x2.hpp @@ -1,6 +1,8 @@ /// @ref core /// @file glm/mat4x2.hpp +#include "detail/setup.hpp" + #pragma once #include "detail/type_mat4x2.hpp" diff --git a/glm/mat4x3.hpp b/glm/mat4x3.hpp index 6b7364a1..a66bf459 100644 --- a/glm/mat4x3.hpp +++ b/glm/mat4x3.hpp @@ -1,6 +1,8 @@ /// @ref core /// @file glm/mat4x3.hpp +#include "detail/setup.hpp" + #pragma once #include "detail/type_mat4x3.hpp" diff --git a/glm/mat4x4.hpp b/glm/mat4x4.hpp index 30d45dc5..5f9c538c 100644 --- a/glm/mat4x4.hpp +++ b/glm/mat4x4.hpp @@ -1,6 +1,8 @@ /// @ref core /// @file glm/mat4x4.hpp +#include "detail/setup.hpp" + #pragma once #include "detail/type_mat4x4.hpp" diff --git a/glm/matrix.hpp b/glm/matrix.hpp index 736dd499..5fdd616a 100644 --- a/glm/matrix.hpp +++ b/glm/matrix.hpp @@ -1,6 +1,8 @@ /// @ref core /// @file glm/matrix.hpp +#include "detail/setup.hpp" + #pragma once #include "detail/func_matrix.hpp" diff --git a/glm/packing.hpp b/glm/packing.hpp index 4545adb1..8e968868 100644 --- a/glm/packing.hpp +++ b/glm/packing.hpp @@ -1,6 +1,8 @@ /// @ref core /// @file glm/packing.hpp +#include "detail/setup.hpp" + #pragma once #include "detail/func_packing.hpp" diff --git a/glm/trigonometric.hpp b/glm/trigonometric.hpp index a9ce87cb..55a8ba36 100644 --- a/glm/trigonometric.hpp +++ b/glm/trigonometric.hpp @@ -1,6 +1,8 @@ /// @ref core /// @file glm/trigonometric.hpp +#include "detail/setup.hpp" + #pragma once #include "detail/func_trigonometric.hpp" diff --git a/glm/vec2.hpp b/glm/vec2.hpp index 764c2e00..8f5bf601 100644 --- a/glm/vec2.hpp +++ b/glm/vec2.hpp @@ -1,6 +1,8 @@ /// @ref core /// @file glm/vec2.hpp +#include "detail/setup.hpp" + #pragma once #include "detail/type_vec2.hpp" diff --git a/glm/vec3.hpp b/glm/vec3.hpp index eccda312..d2aedd1b 100644 --- a/glm/vec3.hpp +++ b/glm/vec3.hpp @@ -1,6 +1,8 @@ /// @ref core /// @file glm/vec3.hpp +#include "detail/setup.hpp" + #pragma once #include "detail/type_vec3.hpp" diff --git a/glm/vec4.hpp b/glm/vec4.hpp index ad66f5ef..428b5415 100644 --- a/glm/vec4.hpp +++ b/glm/vec4.hpp @@ -1,6 +1,8 @@ /// @ref core /// @file glm/vec4.hpp +#include "detail/setup.hpp" + #pragma once #include "detail/type_vec4.hpp" diff --git a/glm/vector_relational.hpp b/glm/vector_relational.hpp index d2341902..73db0ecd 100644 --- a/glm/vector_relational.hpp +++ b/glm/vector_relational.hpp @@ -1,6 +1,8 @@ /// @ref core /// @file glm/vector_relational.hpp +#include "detail/setup.hpp" + #pragma once #include "detail/func_vector_relational.hpp" diff --git a/readme.md b/readme.md index 3af5a77c..9f08db56 100644 --- a/readme.md +++ b/readme.md @@ -69,6 +69,8 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate) - Optimized GTX_matrix_interpolation axisAngle function - Added FAQ 12: Windows headers cause build errors... #557 - Removed GCC shadow warnings #595 +- Added error for including of different versions of GLM #619 +- Added GLM_FORCE_IGNORE_VERSION to ignore error caused by including different version of GLM #619 #### Fixes: - Removed doxygen references to GTC_half_float which was removed in 0.9.4