Skip to content

Commit

Permalink
- Added error for including of different versions of GLM #619 - Added…
Browse files Browse the repository at this point in the history
… GLM_FORCE_IGNORE_VERSION to ignore error caused by including different version of GLM #619
  • Loading branch information
Groovounet committed Jun 4, 2017
1 parent 83602bd commit a9a832e
Show file tree
Hide file tree
Showing 32 changed files with 87 additions and 21 deletions.
2 changes: 2 additions & 0 deletions glm/common.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/// @ref core
/// @file glm/common.hpp

#include "detail/setup.hpp"

#pragma once

#include "detail/func_common.hpp"
2 changes: 1 addition & 1 deletion glm/detail/func_exponential.inl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace detail
}
# endif

template<length_t L, typename T, precision P, template<int, class, precision> class vecType, bool isFloat, bool Aligned>
template<length_t L, typename T, precision P, template<length_t, class, precision> class vecType, bool isFloat, bool Aligned>
struct compute_log2
{
GLM_FUNC_QUALIFIER static vec<L, T, P> call(vec<L, T, P> const& v)
Expand Down
2 changes: 1 addition & 1 deletion glm/detail/func_matrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ namespace detail
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/outerProduct.xml">GLSL outerProduct man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>
template<int DA, int DB, typename T, precision P, template<length_t, typename, precision> class vecTypeA, template<length_t, typename, precision> class vecTypeB>
template<length_t DA, length_t DB, typename T, precision P, template<length_t, typename, precision> class vecTypeA, template<length_t, typename, precision> class vecTypeB>
GLM_FUNC_DECL typename detail::outerProduct_trait<DA, DB, T, P, vecTypeA, vecTypeB>::type outerProduct(vecTypeA<DA, T, P> const & c, vecTypeB<DB, T, P> const & r);

/// Returns the transposed matrix of x
Expand Down
2 changes: 1 addition & 1 deletion glm/detail/func_matrix.inl
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ namespace detail
return detail::compute_matrixCompMult<matType, C, R, T, P, detail::is_aligned<P>::value>::call(x, y);
}

template<int DA, int DB, typename T, precision P, template<length_t, typename, precision> class vecTypeA, template<length_t, typename, precision> class vecTypeB>
template<length_t DA, length_t DB, typename T, precision P, template<length_t, typename, precision> class vecTypeA, template<length_t, typename, precision> class vecTypeB>
GLM_FUNC_QUALIFIER typename detail::outerProduct_trait<DA, DB, T, P, vecTypeA, vecTypeB>::type outerProduct(vecTypeA<DA, T, P> const & c, vecTypeB<DB, T, P> const & r)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_UNRESTRICTED_GENTYPE, "'outerProduct' only accept floating-point inputs");
Expand Down
39 changes: 28 additions & 11 deletions glm/detail/setup.hpp
Original file line number Diff line number Diff line change
@@ -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 <cassert>
#include <cstddef>

///////////////////////////////////////////////////////////////////////////////////
// Messages

Expand All @@ -19,19 +30,14 @@
# define GLM_MESSAGES GLM_MESSAGES_DISABLE
#endif

#include <cassert>
#include <cstddef>
///////////////////////////////////////////////////////////////////////////////////
// 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")
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion glm/detail/type_mat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace glm{
namespace detail
{
template<int Columns, int Rows, typename T, precision P, template<int, class, precision> class colType, template<int, class, precision> class rowType>
template<length_t Columns, length_t Rows, typename T, precision P, template<length_t, class, precision> class colType, template<length_t, class, precision> class rowType>
struct outerProduct_trait{};
}//namespace detail

Expand Down
2 changes: 2 additions & 0 deletions glm/exponential.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/// @ref core
/// @file glm/exponential.hpp

#include "detail/setup.hpp"

#pragma once

#include "detail/func_exponential.hpp"
2 changes: 2 additions & 0 deletions glm/ext.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
/// at once by including <glm/ext.hpp>. Otherwise, each extension needs to be
/// included a specific file.

#include "detail/setup.hpp"

#pragma once

#include "glm.hpp"
Expand Down
2 changes: 2 additions & 0 deletions glm/fwd.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/// @ref core
/// @file glm/fwd.hpp

#include "detail/setup.hpp"

#pragma once

#include "detail/type_int.hpp"
Expand Down
2 changes: 2 additions & 0 deletions glm/geometric.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/// @ref core
/// @file glm/geometric.hpp

#include "detail/setup.hpp"

#pragma once

#include "detail/func_geometric.hpp"
2 changes: 2 additions & 0 deletions glm/glm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@

#include "detail/_fixes.hpp"

#include "detail/setup.hpp"

#pragma once

#include <cmath>
Expand Down
3 changes: 2 additions & 1 deletion glm/gtc/bitfield.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@
///
/// <glm/gtc/bitfield.hpp> 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"
Expand Down
8 changes: 4 additions & 4 deletions glm/gtc/random.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ namespace glm
/// @param Max
/// @tparam genType Value type. Currently supported: float or double scalars.
/// @see gtc_random
template<typename genTYpe>
GLM_FUNC_DECL genTYpe linearRand(
genTYpe Min,
genTYpe Max);
template<typename genType>
GLM_FUNC_DECL genType linearRand(
genType Min,
genType Max);

/// Generate random numbers in the interval [Min, Max], according a linear distribution
///
Expand Down
2 changes: 1 addition & 1 deletion glm/gtc/random.inl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
namespace glm{
namespace detail
{
template<length_t L, typename T, precision P, template<int, class, precision> class vecType>
template<length_t L, typename T, precision P, template<length_t, class, precision> class vecType>
struct compute_rand
{
GLM_FUNC_QUALIFIER static vecType<L, T, P> call();
Expand Down
2 changes: 2 additions & 0 deletions glm/integer.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/// @ref core
/// @file glm/integer.hpp

#include "detail/setup.hpp"

#pragma once

#include "detail/func_integer.hpp"
2 changes: 2 additions & 0 deletions glm/mat2x2.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/// @ref core
/// @file glm/mat2x2.hpp

#include "detail/setup.hpp"

#pragma once

#include "detail/type_mat2x2.hpp"
Expand Down
2 changes: 2 additions & 0 deletions glm/mat2x3.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/// @ref core
/// @file glm/mat2x3.hpp

#include "detail/setup.hpp"

#pragma once

#include "detail/type_mat2x3.hpp"
Expand Down
2 changes: 2 additions & 0 deletions glm/mat2x4.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/// @ref core
/// @file glm/mat2x4.hpp

#include "detail/setup.hpp"

#pragma once

#include "detail/type_mat2x4.hpp"
Expand Down
2 changes: 2 additions & 0 deletions glm/mat3x2.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/// @ref core
/// @file glm/mat3x2.hpp

#include "detail/setup.hpp"

#pragma once

#include "detail/type_mat3x2.hpp"
Expand Down
2 changes: 2 additions & 0 deletions glm/mat3x3.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/// @ref core
/// @file glm/mat3x3.hpp

#include "detail/setup.hpp"

#pragma once

#include "detail/type_mat3x3.hpp"
Expand Down
2 changes: 2 additions & 0 deletions glm/mat3x4.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/// @ref core
/// @file glm/mat3x4.hpp

#include "detail/setup.hpp"

#pragma once

#include "detail/type_mat3x4.hpp"
Expand Down
2 changes: 2 additions & 0 deletions glm/mat4x2.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/// @ref core
/// @file glm/mat4x2.hpp

#include "detail/setup.hpp"

#pragma once

#include "detail/type_mat4x2.hpp"
Expand Down
2 changes: 2 additions & 0 deletions glm/mat4x3.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/// @ref core
/// @file glm/mat4x3.hpp

#include "detail/setup.hpp"

#pragma once

#include "detail/type_mat4x3.hpp"
Expand Down
2 changes: 2 additions & 0 deletions glm/mat4x4.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/// @ref core
/// @file glm/mat4x4.hpp

#include "detail/setup.hpp"

#pragma once

#include "detail/type_mat4x4.hpp"
Expand Down
2 changes: 2 additions & 0 deletions glm/matrix.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/// @ref core
/// @file glm/matrix.hpp

#include "detail/setup.hpp"

#pragma once

#include "detail/func_matrix.hpp"
2 changes: 2 additions & 0 deletions glm/packing.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/// @ref core
/// @file glm/packing.hpp

#include "detail/setup.hpp"

#pragma once

#include "detail/func_packing.hpp"
2 changes: 2 additions & 0 deletions glm/trigonometric.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/// @ref core
/// @file glm/trigonometric.hpp

#include "detail/setup.hpp"

#pragma once

#include "detail/func_trigonometric.hpp"
2 changes: 2 additions & 0 deletions glm/vec2.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/// @ref core
/// @file glm/vec2.hpp

#include "detail/setup.hpp"

#pragma once

#include "detail/type_vec2.hpp"
2 changes: 2 additions & 0 deletions glm/vec3.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/// @ref core
/// @file glm/vec3.hpp

#include "detail/setup.hpp"

#pragma once

#include "detail/type_vec3.hpp"
2 changes: 2 additions & 0 deletions glm/vec4.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/// @ref core
/// @file glm/vec4.hpp

#include "detail/setup.hpp"

#pragma once

#include "detail/type_vec4.hpp"
2 changes: 2 additions & 0 deletions glm/vector_relational.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/// @ref core
/// @file glm/vector_relational.hpp

#include "detail/setup.hpp"

#pragma once

#include "detail/func_vector_relational.hpp"
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a9a832e

Please sign in to comment.