Refactor GLM messages and build targets

This commit is contained in:
Groove 2018-07-14 00:17:46 +02:00
parent c432dfaad8
commit f27a24de0e
15 changed files with 270 additions and 270 deletions

View File

@ -62,14 +62,11 @@ if(GLM_TEST_ENABLE_LANG_EXTENSIONS)
if((CMAKE_CXX_COMPILER_ID MATCHES "Clang") OR (CMAKE_CXX_COMPILER_ID MATCHES "GNU")) if((CMAKE_CXX_COMPILER_ID MATCHES "Clang") OR (CMAKE_CXX_COMPILER_ID MATCHES "GNU"))
add_compile_options(-fms-extensions) add_compile_options(-fms-extensions)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
add_compile_options(/Ze) add_compile_options(/Za)
endif() endif()
message(STATUS "GLM: Build with C++ language extensions") message(STATUS "GLM: Build with C++ language extensions")
else() else()
set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_EXTENSIONS OFF)
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
add_compile_options(/Za)
endif()
endif() endif()
option(GLM_TEST_ENABLE_FAST_MATH "Enable fast math optimizations" OFF) option(GLM_TEST_ENABLE_FAST_MATH "Enable fast math optimizations" OFF)

View File

@ -781,6 +781,6 @@ namespace detail
} }
}//namespace glm }//namespace glm
#if GLM_ARCH != GLM_ARCH_PURE && GLM_HAS_ANONYMOUS_STRUCT #if (GLM_ARCH & GLM_ARCH_SIMD_BIT) && (GLM_HAS_ANONYMOUS_STRUCT)
# include "func_common_simd.inl" # include "func_common_simd.inl"
#endif #endif

View File

@ -146,7 +146,7 @@ namespace detail
} }
}//namespace glm }//namespace glm
#if GLM_ARCH != GLM_ARCH_PURE && GLM_HAS_ANONYMOUS_STRUCT #if (GLM_ARCH & GLM_ARCH_SIMD_BIT) && (GLM_HAS_ANONYMOUS_STRUCT)
# include "func_exponential_simd.inl" # include "func_exponential_simd.inl"
#endif #endif

View File

@ -242,6 +242,6 @@ namespace detail
} }
}//namespace glm }//namespace glm
#if GLM_ARCH != GLM_ARCH_PURE && GLM_HAS_ANONYMOUS_STRUCT #if (GLM_ARCH & GLM_ARCH_SIMD_BIT) && (GLM_HAS_ANONYMOUS_STRUCT)
# include "func_geometric_simd.inl" # include "func_geometric_simd.inl"
#endif #endif

View File

@ -372,7 +372,7 @@ namespace detail
} }
}//namespace glm }//namespace glm
#if GLM_ARCH != GLM_ARCH_PURE && GLM_HAS_ANONYMOUS_STRUCT #if (GLM_ARCH & GLM_ARCH_SIMD_BIT) && (GLM_HAS_ANONYMOUS_STRUCT)
# include "func_integer_simd.inl" # include "func_integer_simd.inl"
#endif #endif

View File

@ -395,7 +395,7 @@ namespace detail
} }
}//namespace glm }//namespace glm
#if GLM_ARCH != GLM_ARCH_PURE && GLM_HAS_ANONYMOUS_STRUCT #if (GLM_ARCH & GLM_ARCH_SIMD_BIT) && (GLM_HAS_ANONYMOUS_STRUCT)
# include "func_matrix_simd.inl" # include "func_matrix_simd.inl"
#endif #endif

View File

@ -184,7 +184,7 @@ namespace glm
} }
}//namespace glm }//namespace glm
#if GLM_ARCH != GLM_ARCH_PURE && GLM_HAS_ANONYMOUS_STRUCT #if (GLM_ARCH & GLM_ARCH_SIMD_BIT) && (GLM_HAS_ANONYMOUS_STRUCT)
# include "func_packing_simd.inl" # include "func_packing_simd.inl"
#endif #endif

View File

@ -194,7 +194,7 @@ namespace glm
} }
}//namespace glm }//namespace glm
#if GLM_ARCH != GLM_ARCH_PURE && GLM_HAS_ANONYMOUS_STRUCT #if (GLM_ARCH & GLM_ARCH_SIMD_BIT) && (GLM_HAS_ANONYMOUS_STRUCT)
# include "func_trigonometric_simd.inl" # include "func_trigonometric_simd.inl"
#endif #endif

View File

@ -100,6 +100,6 @@ namespace glm
} }
}//namespace glm }//namespace glm
#if GLM_ARCH != GLM_ARCH_PURE && GLM_HAS_ANONYMOUS_STRUCT #if (GLM_ARCH & GLM_ARCH_SIMD_BIT) && (GLM_HAS_ANONYMOUS_STRUCT)
# include "func_vector_relational_simd.inl" # include "func_vector_relational_simd.inl"
#endif #endif

View File

@ -11,6 +11,7 @@
#define GLM_VERSION_PATCH 9 #define GLM_VERSION_PATCH 9
#define GLM_VERSION_REVISION 1 #define GLM_VERSION_REVISION 1
#define GLM_VERSION 991 #define GLM_VERSION 991
#define GLM_VERSION_MESSAGE "GLM: version 0.9.9.1"
#define GLM_SETUP_INCLUDED GLM_VERSION #define GLM_SETUP_INCLUDED GLM_VERSION
@ -34,32 +35,6 @@
#include "../simd/platform.h" #include "../simd/platform.h"
///////////////////////////////////////////////////////////////////////////////////
// Version
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_MESSAGE_VERSION_DISPLAYED)
# define GLM_MESSAGE_VERSION_DISPLAYED
# pragma message ("GLM: version 0.9.9.1")
#endif//GLM_MESSAGES
// Report compiler detection
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_MESSAGE_COMPILER_DISPLAYED)
# define GLM_MESSAGE_COMPILER_DISPLAYED
# if GLM_COMPILER & GLM_COMPILER_CUDA
# pragma message("GLM: CUDA compiler detected")
# elif GLM_COMPILER & GLM_COMPILER_VC
# pragma message("GLM: Visual C++ compiler detected")
# elif GLM_COMPILER & GLM_COMPILER_CLANG
# pragma message("GLM: Clang compiler detected")
# elif GLM_COMPILER & GLM_COMPILER_INTEL
# pragma message("GLM: Intel Compiler detected")
# elif GLM_COMPILER & GLM_COMPILER_GCC
# pragma message("GLM: GCC compiler detected")
# else
# pragma message("GLM: Compiler not detected")
# endif
#endif//GLM_MESSAGES
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
// Incompatible GLM_FORCE defines // Incompatible GLM_FORCE defines
@ -82,46 +57,6 @@
# error "GLM_MODEL undefined, your compiler may not be supported by GLM. Add #define GLM_MODEL 0 to ignore this message." # error "GLM_MODEL undefined, your compiler may not be supported by GLM. Add #define GLM_MODEL 0 to ignore this message."
#endif//GLM_MODEL #endif//GLM_MODEL
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_MESSAGE_MODEL_DISPLAYED)
# define GLM_MESSAGE_MODEL_DISPLAYED
# if(GLM_MODEL == GLM_MODEL_64)
# pragma message("GLM: 64 bits model")
# elif(GLM_MODEL == GLM_MODEL_32)
# pragma message("GLM: 32 bits model")
# endif//GLM_MODEL
#endif//GLM_MESSAGES
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_MESSAGE_ARCH_DISPLAYED)
# define GLM_MESSAGE_ARCH_DISPLAYED
# if(GLM_ARCH == GLM_ARCH_PURE)
# pragma message("GLM: Platform independent code")
# elif(GLM_ARCH == GLM_ARCH_AVX2)
# pragma message("GLM: AVX2 instruction set")
# elif(GLM_ARCH == GLM_ARCH_AVX)
# pragma message("GLM: AVX instruction set")
# elif(GLM_ARCH == GLM_ARCH_SSE42)
# pragma message("GLM: SSE4.2 instruction set")
# elif(GLM_ARCH == GLM_ARCH_SSE41)
# pragma message("GLM: SSE4.1 instruction set")
# elif(GLM_ARCH == GLM_ARCH_SSSE3)
# pragma message("GLM: SSSE3 instruction set")
# elif(GLM_ARCH == GLM_ARCH_SSE3)
# pragma message("GLM: SSE3 instruction set")
# elif(GLM_ARCH == GLM_ARCH_SSE2)
# pragma message("GLM: SSE2 instruction set")
# elif(GLM_ARCH == GLM_ARCH_X86)
# pragma message("GLM: x86 instruction set")
# elif(GLM_ARCH == GLM_ARCH_NEON)
# pragma message("GLM: NEON instruction set")
# elif(GLM_ARCH == GLM_ARCH_ARM)
# pragma message("GLM: ARM instruction set")
# elif(GLM_ARCH == GLM_ARCH_MIPS)
# pragma message("GLM: MIPS instruction set")
# elif(GLM_ARCH == GLM_ARCH_PPC)
# pragma message("GLM: PowerPC architechture")
# endif//GLM_ARCH
#endif//GLM_MESSAGES
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
// C++ Version // C++ Version
@ -153,16 +88,6 @@
# define GLM_MSC_EXT 0 # define GLM_MSC_EXT 0
#endif #endif
#ifdef _MSVC_LANG
# if _MSVC_LANG == 201402
# define GLM_FORCE_CXX14
# elif _MSVC_LANG == 201703
# define GLM_FORCE_CXX17
# elif _MSVC_LANG > 201703
# define GLM_FORCE_CXX2A
# endif
#endif
#if defined(GLM_FORCE_CXX2A) #if defined(GLM_FORCE_CXX2A)
# if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_MESSAGE_FORCE_CXX2A_DISPLAYED) # if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_MESSAGE_FORCE_CXX2A_DISPLAYED)
# define GLM_MESSAGE_FORCE_CXX2A_DISPLAYED # define GLM_MESSAGE_FORCE_CXX2A_DISPLAYED
@ -208,45 +133,27 @@
#elif defined(GLM_FORCE_CXX98) #elif defined(GLM_FORCE_CXX98)
# define GLM_LANG GLM_LANG_CXX98 # define GLM_LANG GLM_LANG_CXX98
#else #else
# if __cplusplus >= 201703L # ifndef _MSVC_LANG
# define _MSVC_LANG 0
# endif
# if __cplusplus > 201703L || _MSVC_LANG > 201703L
# define GLM_LANG (GLM_LANG_CXX2A | GLM_MSC_EXT)
# elif __cplusplus == 201703L || _MSVC_LANG == 201703L
# define GLM_LANG (GLM_LANG_CXX17 | GLM_MSC_EXT) # define GLM_LANG (GLM_LANG_CXX17 | GLM_MSC_EXT)
# elif __cplusplus >= 201402L # elif __cplusplus == 201402L || _MSVC_LANG == 201402L
# define GLM_LANG (GLM_LANG_CXX14 | GLM_MSC_EXT) # define GLM_LANG (GLM_LANG_CXX14 | GLM_MSC_EXT)
# elif __cplusplus >= 201103L # elif __cplusplus == 201103L || _MSVC_LANG == 201103L
# define GLM_LANG (GLM_LANG_CXX11 | GLM_MSC_EXT) # define GLM_LANG (GLM_LANG_CXX11 | GLM_MSC_EXT)
# elif defined(__INTEL_CXX11_MODE__) || defined(_MSC_VER) || defined(__GXX_EXPERIMENTAL_CXX0X__) # elif defined(__INTEL_CXX11_MODE__) || defined(_MSC_VER) || defined(__GXX_EXPERIMENTAL_CXX0X__)
# define GLM_LANG (GLM_LANG_CXX0X | GLM_MSC_EXT) # define GLM_LANG (GLM_LANG_CXX0X | GLM_MSC_EXT)
# elif __cplusplus >= 199711L # elif __cplusplus == 199711L
# define GLM_LANG (GLM_LANG_CXX98 | GLM_MSC_EXT) # define GLM_LANG (GLM_LANG_CXX98 | GLM_MSC_EXT)
# else # else
# define GLM_LANG (GLM_LANG_CXX | GLM_MSC_EXT) # define GLM_LANG (GLM_LANG_CXX | GLM_MSC_EXT)
# endif # endif
#endif #endif
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_MESSAGE_LANG_DISPLAYED)
# define GLM_MESSAGE_LANG_DISPLAYED
# if GLM_LANG & GLM_LANG_CXX17_FLAG
# pragma message("GLM: C++17")
# elif GLM_LANG & GLM_LANG_CXX14_FLAG
# pragma message("GLM: C++14")
# elif GLM_LANG & GLM_LANG_CXX11_FLAG
# pragma message("GLM: C++11")
# elif GLM_LANG & GLM_LANG_CXX0X_FLAG
# pragma message("GLM: C++0x")
# elif GLM_LANG & GLM_LANG_CXX03_FLAG
# pragma message("GLM: C++03")
# elif GLM_LANG & GLM_LANG_CXX98_FLAG
# pragma message("GLM: C++98")
# else
# pragma message("GLM: C++ language undetected")
# endif//GLM_LANG
# if GLM_LANG & (GLM_LANG_CXXGNU_FLAG | GLM_LANG_CXXMS_FLAG)
# pragma message("GLM: C++ language extensions enabled")
# endif//GLM_LANG
#endif//GLM_MESSAGES
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
// Has of C++ features // Has of C++ features
@ -387,14 +294,14 @@
#endif #endif
// N2235 Generalized Constant Expressions http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2235.pdf // N2235 Generalized Constant Expressions http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2235.pdf
#if (GLM_COMPILER & GLM_COMPILER_CLANG) && (GLM_ARCH == GLM_ARCH_PURE) #if (GLM_COMPILER & GLM_COMPILER_CLANG) && !(GLM_ARCH & GLM_ARCH_SIMD_BIT)
# define GLM_HAS_CONSTEXPR_CXX11 __has_feature(cxx_constexpr) # define GLM_HAS_CONSTEXPR_CXX11 __has_feature(cxx_constexpr)
#elif (GLM_LANG & GLM_LANG_CXX11_FLAG) && (GLM_ARCH == GLM_ARCH_PURE) #elif (GLM_LANG & GLM_LANG_CXX11_FLAG) && !(GLM_ARCH & GLM_ARCH_SIMD_BIT)
# define GLM_HAS_CONSTEXPR_CXX11 1 # define GLM_HAS_CONSTEXPR_CXX11 1
#else #else
// GCC 4.6 support constexpr but there is a compiler bug causing a crash // GCC 4.6 support constexpr but there is a compiler bug causing a crash
// Visual C++ has a bug #594 https://github.com/g-truc/glm/issues/594 // Visual C++ has a bug #594 https://github.com/g-truc/glm/issues/594
# define GLM_HAS_CONSTEXPR_CXX11 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_ARCH == GLM_ARCH_PURE) && (\ # define GLM_HAS_CONSTEXPR_CXX11 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && !(GLM_ARCH & GLM_ARCH_SIMD_BIT) && (\
((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL14)) || \ ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL14)) || \
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC14)))) ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC14))))
#endif #endif
@ -406,12 +313,12 @@
#endif #endif
// N3652 Extended Constant Expressions http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3652.html // N3652 Extended Constant Expressions http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3652.html
#if (GLM_COMPILER & GLM_COMPILER_CLANG) && (GLM_ARCH == GLM_ARCH_PURE) #if (GLM_COMPILER & GLM_COMPILER_CLANG) && !(GLM_ARCH & GLM_ARCH_SIMD_BIT)
# define GLM_HAS_CONSTEXPR_CXX14 __has_feature(cxx_relaxed_constexpr) # define GLM_HAS_CONSTEXPR_CXX14 __has_feature(cxx_relaxed_constexpr)
#elif (GLM_LANG & GLM_LANG_CXX14_FLAG) && (GLM_ARCH == GLM_ARCH_PURE) #elif (GLM_LANG & GLM_LANG_CXX14_FLAG) && !(GLM_ARCH & GLM_ARCH_SIMD_BIT)
# define GLM_HAS_CONSTEXPR_CXX14 1 # define GLM_HAS_CONSTEXPR_CXX14 1
#else #else
# define GLM_HAS_CONSTEXPR_CXX14 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_ARCH == GLM_ARCH_PURE) && GLM_HAS_INITIALIZER_LISTS && (\ # define GLM_HAS_CONSTEXPR_CXX14 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && !(GLM_ARCH & GLM_ARCH_SIMD_BIT) && GLM_HAS_INITIALIZER_LISTS && (\
((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL17)) || \ ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL17)) || \
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC15)))) ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC15))))
#endif #endif
@ -443,7 +350,7 @@
((GLM_COMPILER & GLM_COMPILER_CUDA)))) ((GLM_COMPILER & GLM_COMPILER_CUDA))))
#endif #endif
#if GLM_ARCH == GLM_ARCH_PURE #if defined(GLM_FORCE_PURE)
# define GLM_HAS_BITSCAN_WINDOWS 0 # define GLM_HAS_BITSCAN_WINDOWS 0
#else #else
# define GLM_HAS_BITSCAN_WINDOWS ((GLM_PLATFORM & GLM_PLATFORM_WINDOWS) && (\ # define GLM_HAS_BITSCAN_WINDOWS ((GLM_PLATFORM & GLM_PLATFORM_WINDOWS) && (\
@ -561,15 +468,6 @@
# define GLM_SWIZZLE GLM_DISABLE # define GLM_SWIZZLE GLM_DISABLE
#endif #endif
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_MESSAGE_SWIZZLE_DISPLAYED)
# define GLM_MESSAGE_SWIZZLE_DISPLAYED
# if GLM_SWIZZLE == GLM_ENABLE
# pragma message("GLM: Swizzling operators enabled")
# else
# pragma message("GLM: Swizzling operators disabled, #define GLM_FORCE_SWIZZLE to enable swizzle operators")
# endif
#endif//GLM_MESSAGES
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
// Allows using not basic types as genType // Allows using not basic types as genType
@ -581,23 +479,6 @@
# define GLM_UNRESTRICTED_GENTYPE 0 # define GLM_UNRESTRICTED_GENTYPE 0
#endif #endif
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_MESSAGE_UNRESTRICTED_GENTYPE_DISPLAYED)
# define GLM_MESSAGE_UNRESTRICTED_GENTYPE_DISPLAYED
# ifdef GLM_FORCE_UNRESTRICTED_GENTYPE
# pragma message("GLM: Use unrestricted genType")
# endif
#endif//GLM_MESSAGES
///////////////////////////////////////////////////////////////////////////////////
// Force single only (remove explicit float64 types)
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_MESSAGE_SINGLE_ONLY_DISPLAYED)
# define GLM_MESSAGE_SINGLE_ONLY_DISPLAYED
# ifdef GLM_FORCE_SINGLE_ONLY
# pragma message("GLM: Using only single precision floating-point types")
# endif
#endif//GLM_MESSAGES
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
// Clip control // Clip control
@ -610,15 +491,6 @@
# define GLM_DEPTH_CLIP_SPACE GLM_DEPTH_NEGATIVE_ONE_TO_ONE # define GLM_DEPTH_CLIP_SPACE GLM_DEPTH_NEGATIVE_ONE_TO_ONE
#endif #endif
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_MESSAGE_DEPTH_DISPLAYED)
# define GLM_MESSAGE_DEPTH_DISPLAYED
# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE
# pragma message("GLM: Depth clip space: Zero to one")
# else
# pragma message("GLM: Depth clip space: negative one to one")
# endif
#endif//GLM_MESSAGES
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
// Coordinate system, define GLM_FORCE_LEFT_HANDED before including GLM // Coordinate system, define GLM_FORCE_LEFT_HANDED before including GLM
// to use left handed coordinate system by default. // to use left handed coordinate system by default.
@ -632,15 +504,6 @@
# define GLM_COORDINATE_SYSTEM GLM_RIGHT_HANDED # define GLM_COORDINATE_SYSTEM GLM_RIGHT_HANDED
#endif #endif
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_MESSAGE_HANDED_DISPLAYED)
# define GLM_MESSAGE_HANDED_DISPLAYED
# if GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED
# pragma message("GLM: Coordinate system: left handed")
# else
# pragma message("GLM: Coordinate system: right handed")
# endif
#endif//GLM_MESSAGES
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
// Qualifiers // Qualifiers
@ -736,15 +599,6 @@ namespace glm
# endif # endif
}//namespace glm }//namespace glm
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_MESSAGE_FORCE_SIZE_T_LENGTH)
# define GLM_MESSAGE_FORCE_SIZE_T_LENGTH
# if defined GLM_FORCE_SIZE_T_LENGTH
# pragma message("GLM: .length() returns glm::length_t, a typedef of std::size_t")
# else
# pragma message("GLM: .length() returns glm::length_t, a typedef of int following the GLSL specification")
# endif
#endif//GLM_MESSAGES
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
// countof // countof
@ -771,4 +625,212 @@ namespace glm
# error "GLM error: A different version of GLM is already included. Define GLM_FORCE_IGNORE_VERSION before including GLM headers to ignore this error." # 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 #elif GLM_SETUP_INCLUDED == GLM_VERSION
///////////////////////////////////////////////////////////////////////////////////
// Messages
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_MESSAGE_DISPLAYED)
# define GLM_MESSAGE_DISPLAYED
// Report GLM version
# pragma message (GLM_VERSION_MESSAGE)
// Report C++ language
# if GLM_LANG & GLM_LANG_CXX2A_FLAG
# if GLM_LANG & (GLM_LANG_CXXGNU_FLAG | GLM_LANG_CXXMS_FLAG)
# pragma message("GLM: C++ 2A with extensions")
# else
# pragma message("GLM: C++ 2A")
# endif
# elif GLM_LANG & GLM_LANG_CXX17_FLAG
# if GLM_LANG & (GLM_LANG_CXXGNU_FLAG | GLM_LANG_CXXMS_FLAG)
# pragma message("GLM: C++ 17 with extensions")
# else
# pragma message("GLM: C++ 17")
# endif
# elif GLM_LANG & GLM_LANG_CXX14_FLAG
# if GLM_LANG & (GLM_LANG_CXXGNU_FLAG | GLM_LANG_CXXMS_FLAG)
# pragma message("GLM: C++ 14 with extensions")
# else
# pragma message("GLM: C++ 14")
# endif
# elif GLM_LANG & GLM_LANG_CXX11_FLAG
# if GLM_LANG & (GLM_LANG_CXXGNU_FLAG | GLM_LANG_CXXMS_FLAG)
# pragma message("GLM: C++ 11 with extensions")
# else
# pragma message("GLM: C++ 11")
# endif
# elif GLM_LANG & GLM_LANG_CXX0X_FLAG
# if GLM_LANG & (GLM_LANG_CXXGNU_FLAG | GLM_LANG_CXXMS_FLAG)
# pragma message("GLM: C++ 0x with extensions")
# else
# pragma message("GLM: C++ 0x")
# endif
# elif GLM_LANG & GLM_LANG_CXX03_FLAG
# if GLM_LANG & (GLM_LANG_CXXGNU_FLAG | GLM_LANG_CXXMS_FLAG)
# pragma message("GLM: C++ 03 with extensions")
# else
# pragma message("GLM: C++ 03")
# endif
# elif GLM_LANG & GLM_LANG_CXX98_FLAG
# if GLM_LANG & (GLM_LANG_CXXGNU_FLAG | GLM_LANG_CXXMS_FLAG)
# pragma message("GLM: C++ 98 with extensions")
# else
# pragma message("GLM: C++ 98")
# endif
# else
# pragma message("GLM: C++ language undetected")
# endif//GLM_LANG
// Report compiler detection
# if GLM_COMPILER & GLM_COMPILER_CUDA
# pragma message("GLM: CUDA compiler detected")
# elif GLM_COMPILER & GLM_COMPILER_VC
# pragma message("GLM: Visual C++ compiler detected")
# elif GLM_COMPILER & GLM_COMPILER_CLANG
# pragma message("GLM: Clang compiler detected")
# elif GLM_COMPILER & GLM_COMPILER_INTEL
# pragma message("GLM: Intel Compiler detected")
# elif GLM_COMPILER & GLM_COMPILER_GCC
# pragma message("GLM: GCC compiler detected")
# else
# pragma message("GLM: Compiler not detected")
# endif
// Report build target
# if GLM_ARCH == GLM_ARCH_X86
# if GLM_MODEL == GLM_MODEL_64
# pragma message("GLM: x86 64 bits build target")
# else
# pragma message("GLM: x86 32 bits build target")
# endif
# elif GLM_ARCH == GLM_ARCH_AVX2
# if GLM_MODEL == GLM_MODEL_64
# pragma message("GLM: x86 64 bits with AVX2 instruction set build target")
# else
# pragma message("GLM: x86 32 bits with AVX2 instruction set build target")
# endif
# elif(GLM_ARCH == GLM_ARCH_AVX)
# if GLM_MODEL == GLM_MODEL_64
# pragma message("GLM: x86 64 bits with AVX instruction set build target")
# else
# pragma message("GLM: x86 32 bits with AVX instruction set build target")
# endif
# elif(GLM_ARCH == GLM_ARCH_SSE42)
# if GLM_MODEL == GLM_MODEL_64
# pragma message("GLM: x86 64 bits with SSE4.2 instruction set build target")
# else
# pragma message("GLM: x86 32 bits with SSE4.2 instruction set build target")
# endif
# elif(GLM_ARCH == GLM_ARCH_SSE41)
# if GLM_MODEL == GLM_MODEL_64
# pragma message("GLM: x86 64 bits with SSE4.1 instruction set build target")
# else
# pragma message("GLM: x86 32 bits with SSE4.1 instruction set build target")
# endif
# elif(GLM_ARCH == GLM_ARCH_SSSE3)
# if GLM_MODEL == GLM_MODEL_64
# pragma message("GLM: x86 64 bits with SSSE3 instruction set build target")
# else
# pragma message("GLM: x86 32 bits with SSSE3 instruction set build target")
# endif
# elif(GLM_ARCH == GLM_ARCH_SSE3)
# if GLM_MODEL == GLM_MODEL_64
# pragma message("GLM: x86 64 bits with SSE3 instruction set build target")
# else
# pragma message("GLM: x86 32 bits with SSE3 instruction set build target")
# endif
# elif(GLM_ARCH == GLM_ARCH_SSE2)
# if GLM_MODEL == GLM_MODEL_64
# pragma message("GLM: x86 64 bits with SSE2 instruction set build target")
# else
# pragma message("GLM: x86 32 bits with SSE2 instruction set build target")
# endif
# elif(GLM_ARCH == GLM_ARCH_ARM)
# if GLM_MODEL == GLM_MODEL_64
# pragma message("GLM: ARM 64 bits build target")
# else
# pragma message("GLM: ARM 32 bits build target")
# endif
# elif(GLM_ARCH == GLM_ARCH_NEON)
# if GLM_MODEL == GLM_MODEL_64
# pragma message("GLM: ARM 64 bits with Neon instruction set build target")
# else
# pragma message("GLM: ARM 32 bits with Neon instruction set build target")
# endif
# elif(GLM_ARCH == GLM_ARCH_MIPS)
# if GLM_MODEL == GLM_MODEL_64
# pragma message("GLM: MIPS 64 bits build target")
# else
# pragma message("GLM: MIPS 32 bits build target")
# endif
# elif(GLM_ARCH == GLM_ARCH_PPC)
# if GLM_MODEL == GLM_MODEL_64
# pragma message("GLM: PowerPC 64 bits build target")
# else
# pragma message("GLM: PowerPC 32 bits build target")
# endif
# else
# pragma message("GLM: Unknown build target")
# endif//GLM_ARCH
// Report platform name
# if(GLM_PLATFORM & GLM_PLATFORM_QNXNTO)
# pragma message("GLM: QNX platform detected")
//# elif(GLM_PLATFORM & GLM_PLATFORM_IOS)
//# pragma message("GLM: iOS platform detected")
# elif(GLM_PLATFORM & GLM_PLATFORM_APPLE)
# pragma message("GLM: Apple platform detected")
# elif(GLM_PLATFORM & GLM_PLATFORM_WINCE)
# pragma message("GLM: WinCE platform detected")
# elif(GLM_PLATFORM & GLM_PLATFORM_WINDOWS)
# pragma message("GLM: Windows platform detected")
# elif(GLM_PLATFORM & GLM_PLATFORM_CHROME_NACL)
# pragma message("GLM: Native Client detected")
# elif(GLM_PLATFORM & GLM_PLATFORM_ANDROID)
# pragma message("GLM: Android platform detected")
# elif(GLM_PLATFORM & GLM_PLATFORM_LINUX)
# pragma message("GLM: Linux platform detected")
# elif(GLM_PLATFORM & GLM_PLATFORM_UNIX)
# pragma message("GLM: UNIX platform detected")
# elif(GLM_PLATFORM & GLM_PLATFORM_UNKNOWN)
# pragma message("GLM: platform unknown")
# else
# pragma message("GLM: platform not detected")
# endif
// Report swizzle operator support
# if GLM_SWIZZLE == GLM_ENABLE
# pragma message("GLM: Swizzling operators enabled")
# else
# pragma message("GLM: Swizzling operators disabled, #define GLM_FORCE_SWIZZLE to enable swizzle operators")
# endif
// Report .length() type
# if defined GLM_FORCE_SIZE_T_LENGTH
# pragma message("GLM: .length() returns glm::length_t, a typedef of std::size_t")
# else
# pragma message("GLM: .length() returns glm::length_t, a typedef of int following the GLSL specification")
# endif
# ifdef GLM_FORCE_UNRESTRICTED_GENTYPE
# pragma message("GLM: Use unrestricted genType")
# endif
# ifdef GLM_FORCE_SINGLE_ONLY
# pragma message("GLM: Using only single precision floating-point types")
# endif
# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE
# pragma message("GLM: Depth clip space: Zero to one")
# else
# pragma message("GLM: Depth clip space: negative one to one")
# endif
# if GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED
# pragma message("GLM: Coordinate system: left handed")
# else
# pragma message("GLM: Coordinate system: right handed")
# endif
#endif//GLM_MESSAGES
#endif//GLM_SETUP_INCLUDED #endif//GLM_SETUP_INCLUDED

View File

@ -704,6 +704,6 @@ namespace glm
} }
}//namespace glm }//namespace glm
#if GLM_ARCH != GLM_ARCH_PURE && GLM_HAS_ANONYMOUS_STRUCT #if (GLM_ARCH & GLM_ARCH_SIMD_BIT) && (GLM_HAS_ANONYMOUS_STRUCT)
# include "type_mat4x4_simd.inl" # include "type_mat4x4_simd.inl"
#endif #endif

View File

@ -1142,6 +1142,6 @@ namespace detail
} }
}//namespace glm }//namespace glm
#if GLM_ARCH != GLM_ARCH_PURE && GLM_HAS_ANONYMOUS_STRUCT #if (GLM_ARCH & GLM_ARCH_SIMD_BIT) && (GLM_HAS_ANONYMOUS_STRUCT)
# include "type_vec4_simd.inl" # include "type_vec4_simd.inl"
#endif #endif

View File

@ -801,7 +801,7 @@ namespace detail
} }
}//namespace glm }//namespace glm
#if GLM_ARCH != GLM_ARCH_PURE && GLM_HAS_ANONYMOUS_STRUCT #if (GLM_ARCH & GLM_ARCH_SIMD_BIT) && (GLM_HAS_ANONYMOUS_STRUCT)
# include "quaternion_simd.inl" # include "quaternion_simd.inl"
#endif #endif

View File

@ -42,34 +42,6 @@
# define GLM_PLATFORM GLM_PLATFORM_UNKNOWN # define GLM_PLATFORM GLM_PLATFORM_UNKNOWN
#endif// #endif//
// Report platform detection
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_MESSAGE_PLATFORM_DISPLAYED)
# define GLM_MESSAGE_PLATFORM_DISPLAYED
# if(GLM_PLATFORM & GLM_PLATFORM_QNXNTO)
# pragma message("GLM: QNX platform detected")
//# elif(GLM_PLATFORM & GLM_PLATFORM_IOS)
//# pragma message("GLM: iOS platform detected")
# elif(GLM_PLATFORM & GLM_PLATFORM_APPLE)
# pragma message("GLM: Apple platform detected")
# elif(GLM_PLATFORM & GLM_PLATFORM_WINCE)
# pragma message("GLM: WinCE platform detected")
# elif(GLM_PLATFORM & GLM_PLATFORM_WINDOWS)
# pragma message("GLM: Windows platform detected")
# elif(GLM_PLATFORM & GLM_PLATFORM_CHROME_NACL)
# pragma message("GLM: Native Client detected")
# elif(GLM_PLATFORM & GLM_PLATFORM_ANDROID)
# pragma message("GLM: Android platform detected")
# elif(GLM_PLATFORM & GLM_PLATFORM_LINUX)
# pragma message("GLM: Linux platform detected")
# elif(GLM_PLATFORM & GLM_PLATFORM_UNIX)
# pragma message("GLM: UNIX platform detected")
# elif(GLM_PLATFORM & GLM_PLATFORM_UNKNOWN)
# pragma message("GLM: platform unknown")
# else
# pragma message("GLM: platform not detected")
# endif
#endif//GLM_MESSAGES
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
// Compiler // Compiler
@ -250,21 +222,21 @@
// User defines: GLM_FORCE_PURE GLM_FORCE_SSE2 GLM_FORCE_SSE3 GLM_FORCE_AVX GLM_FORCE_AVX2 GLM_FORCE_AVX2 // User defines: GLM_FORCE_PURE GLM_FORCE_SSE2 GLM_FORCE_SSE3 GLM_FORCE_AVX GLM_FORCE_AVX2 GLM_FORCE_AVX2
#define GLM_ARCH_X86_BIT 0x00000001 #define GLM_ARCH_SIMD_BIT (0x00001000)
#define GLM_ARCH_SSE2_BIT 0x00000002 #define GLM_ARCH_MIPS_BIT (0x10000000)
#define GLM_ARCH_SSE3_BIT 0x00000004 #define GLM_ARCH_PPC_BIT (0x20000000)
#define GLM_ARCH_SSSE3_BIT 0x00000008 #define GLM_ARCH_ARM_BIT (0x40000000)
#define GLM_ARCH_SSE41_BIT 0x00000010 #define GLM_ARCH_NEON_BIT (0x00000001 | GLM_ARCH_SIMD_BIT)
#define GLM_ARCH_SSE42_BIT 0x00000020 #define GLM_ARCH_X86_BIT (0x80000000)
#define GLM_ARCH_AVX_BIT 0x00000040 #define GLM_ARCH_SSE2_BIT (0x80000002 | GLM_ARCH_SIMD_BIT)
#define GLM_ARCH_AVX2_BIT 0x00000080 #define GLM_ARCH_SSE3_BIT (0x80000004 | GLM_ARCH_SIMD_BIT)
#define GLM_ARCH_AVX512_BIT 0x00000200 // Skylake subset #define GLM_ARCH_SSSE3_BIT (0x80000008 | GLM_ARCH_SIMD_BIT)
#define GLM_ARCH_ARM_BIT 0x00000400 #define GLM_ARCH_SSE41_BIT (0x80000010 | GLM_ARCH_SIMD_BIT)
#define GLM_ARCH_NEON_BIT 0x00000800 #define GLM_ARCH_SSE42_BIT (0x80000020 | GLM_ARCH_SIMD_BIT)
#define GLM_ARCH_MIPS_BIT 0x00010000 #define GLM_ARCH_AVX_BIT (0x80000040 | GLM_ARCH_SIMD_BIT)
#define GLM_ARCH_PPC_BIT 0x01000000 #define GLM_ARCH_AVX2_BIT (0x80000080 | GLM_ARCH_SIMD_BIT)
#define GLM_ARCH_PURE (0x00000000) #define GLM_ARCH_UNKNOWED (0)
#define GLM_ARCH_X86 (GLM_ARCH_X86_BIT) #define GLM_ARCH_X86 (GLM_ARCH_X86_BIT)
#define GLM_ARCH_SSE2 (GLM_ARCH_SSE2_BIT | GLM_ARCH_X86) #define GLM_ARCH_SSE2 (GLM_ARCH_SSE2_BIT | GLM_ARCH_X86)
#define GLM_ARCH_SSE3 (GLM_ARCH_SSE3_BIT | GLM_ARCH_SSE2) #define GLM_ARCH_SSE3 (GLM_ARCH_SSE3_BIT | GLM_ARCH_SSE2)
@ -273,22 +245,25 @@
#define GLM_ARCH_SSE42 (GLM_ARCH_SSE42_BIT | GLM_ARCH_SSE41) #define GLM_ARCH_SSE42 (GLM_ARCH_SSE42_BIT | GLM_ARCH_SSE41)
#define GLM_ARCH_AVX (GLM_ARCH_AVX_BIT | GLM_ARCH_SSE42) #define GLM_ARCH_AVX (GLM_ARCH_AVX_BIT | GLM_ARCH_SSE42)
#define GLM_ARCH_AVX2 (GLM_ARCH_AVX2_BIT | GLM_ARCH_AVX) #define GLM_ARCH_AVX2 (GLM_ARCH_AVX2_BIT | GLM_ARCH_AVX)
#define GLM_ARCH_AVX512 (GLM_ARCH_AVX512_BIT | GLM_ARCH_AVX2) // Skylake subset
#define GLM_ARCH_ARM (GLM_ARCH_ARM_BIT) #define GLM_ARCH_ARM (GLM_ARCH_ARM_BIT)
#define GLM_ARCH_NEON (GLM_ARCH_NEON_BIT | GLM_ARCH_ARM) #define GLM_ARCH_NEON (GLM_ARCH_NEON_BIT | GLM_ARCH_ARM)
#define GLM_ARCH_MIPS (GLM_ARCH_MIPS_BIT) #define GLM_ARCH_MIPS (GLM_ARCH_MIPS_BIT)
#define GLM_ARCH_PPC (GLM_ARCH_PPC_BIT) #define GLM_ARCH_PPC (GLM_ARCH_PPC_BIT)
#if defined(GLM_FORCE_PURE) #if defined(GLM_FORCE_PURE)
# define GLM_ARCH GLM_ARCH_PURE # if defined(__x86_64__) || defined(_M_X64) || defined(_M_IX86) || defined(__i386__)
#elif defined(GLM_FORCE_MIPS) # define GLM_ARCH (GLM_ARCH_X86)
# define GLM_ARCH (GLM_ARCH_MIPS) # elif defined(__arm__ ) || defined(_M_ARM)
#elif defined(GLM_FORCE_PPC) # define GLM_ARCH (GLM_ARCH_ARM)
# define GLM_ARCH (GLM_ARCH_PPC) # elif defined(__powerpc__ ) || defined(_M_PPC)
# define GLM_ARCH (GLM_ARCH_PPC)
# elif defined(__mips__ )
# define GLM_ARCH (GLM_ARCH_MIPS)
# else
# define GLM_ARCH (GLM_ARCH_UNKNOWN)
# endif
#elif defined(GLM_FORCE_NEON) #elif defined(GLM_FORCE_NEON)
# define GLM_ARCH (GLM_ARCH_NEON) # define GLM_ARCH (GLM_ARCH_NEON)
#elif defined(GLM_FORCE_AVX512)
# define GLM_ARCH (GLM_ARCH_AVX512)
#elif defined(GLM_FORCE_AVX2) #elif defined(GLM_FORCE_AVX2)
# define GLM_ARCH (GLM_ARCH_AVX2) # define GLM_ARCH (GLM_ARCH_AVX2)
#elif defined(GLM_FORCE_AVX) #elif defined(GLM_FORCE_AVX)
@ -303,11 +278,8 @@
# define GLM_ARCH (GLM_ARCH_SSE3) # define GLM_ARCH (GLM_ARCH_SSE3)
#elif defined(GLM_FORCE_SSE2) #elif defined(GLM_FORCE_SSE2)
# define GLM_ARCH (GLM_ARCH_SSE2) # define GLM_ARCH (GLM_ARCH_SSE2)
#elif (GLM_COMPILER & (GLM_COMPILER_CLANG | GLM_COMPILER_GCC)) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_LINUX)) #else
// This is Skylake set of instruction set # if defined(__AVX2__)
# if defined(__AVX512BW__) && defined(__AVX512F__) && defined(__AVX512CD__) && defined(__AVX512VL__) && defined(__AVX512DQ__)
# define GLM_ARCH (GLM_ARCH_AVX512)
# elif defined(__AVX2__)
# define GLM_ARCH (GLM_ARCH_AVX2) # define GLM_ARCH (GLM_ARCH_AVX2)
# elif defined(__AVX__) # elif defined(__AVX__)
# define GLM_ARCH (GLM_ARCH_AVX) # define GLM_ARCH (GLM_ARCH_AVX)
@ -319,50 +291,21 @@
# define GLM_ARCH (GLM_ARCH_SSSE3) # define GLM_ARCH (GLM_ARCH_SSSE3)
# elif defined(__SSE3__) # elif defined(__SSE3__)
# define GLM_ARCH (GLM_ARCH_SSE3) # define GLM_ARCH (GLM_ARCH_SSE3)
# elif defined(__SSE2__) # elif defined(__SSE2__) || defined(__x86_64__) || defined(_M_X64) || defined(_M_IX86_FP)
# define GLM_ARCH (GLM_ARCH_SSE2) # define GLM_ARCH (GLM_ARCH_SSE2)
# elif defined(__i386__) || defined(__x86_64__) # elif defined(__i386__)
# define GLM_ARCH (GLM_ARCH_X86) # define GLM_ARCH (GLM_ARCH_X86)
# elif defined(__ARM_NEON) # elif defined(__ARM_NEON)
# define GLM_ARCH (GLM_ARCH_ARM | GLM_ARCH_NEON) # define GLM_ARCH (GLM_ARCH_ARM | GLM_ARCH_NEON)
# elif defined(__arm__ ) # elif defined(__arm__ ) || defined(_M_ARM)
# define GLM_ARCH (GLM_ARCH_ARM) # define GLM_ARCH (GLM_ARCH_ARM)
# elif defined(__mips__ ) # elif defined(__mips__ )
# define GLM_ARCH (GLM_ARCH_MIPS) # define GLM_ARCH (GLM_ARCH_MIPS)
# elif defined(__powerpc__ ) # elif defined(__powerpc__ ) || defined(_M_PPC)
# define GLM_ARCH (GLM_ARCH_PPC) # define GLM_ARCH (GLM_ARCH_PPC)
# else # else
# define GLM_ARCH (GLM_ARCH_PURE) # define GLM_ARCH (GLM_ARCH_UNKNOWN)
# endif # endif
#elif (GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS))
# if defined(_M_ARM)
# define GLM_ARCH (GLM_ARCH_ARM)
# elif defined(__AVX2__)
# define GLM_ARCH (GLM_ARCH_AVX2)
# elif defined(__AVX__)
# define GLM_ARCH (GLM_ARCH_AVX)
# elif defined(_M_X64)
# define GLM_ARCH (GLM_ARCH_SSE2)
# elif defined(_M_IX86_FP)
# if _M_IX86_FP >= 2
# define GLM_ARCH (GLM_ARCH_SSE2)
# else
# define GLM_ARCH (GLM_ARCH_PURE)
# endif
# elif defined(_M_PPC)
# define GLM_ARCH (GLM_ARCH_PPC)
# else
# define GLM_ARCH (GLM_ARCH_PURE)
# endif
#else
# define GLM_ARCH GLM_ARCH_PURE
#endif
// With MinGW-W64, including intrinsic headers before intrin.h will produce some errors. The problem is
// that windows.h (and maybe other headers) will silently include intrin.h, which of course causes problems.
// To fix, we just explicitly include intrin.h here.
#if defined(__MINGW64__) && (GLM_ARCH != GLM_ARCH_PURE)
# include <intrin.h>
#endif #endif
#if GLM_ARCH & GLM_ARCH_AVX2_BIT #if GLM_ARCH & GLM_ARCH_AVX2_BIT

View File

@ -162,8 +162,6 @@ int test_instruction_set()
std::printf("GLM_ARCH: "); std::printf("GLM_ARCH: ");
if(GLM_ARCH == GLM_ARCH_PURE)
std::printf("GLM_ARCH_PURE ");
if(GLM_ARCH & GLM_ARCH_ARM_BIT) if(GLM_ARCH & GLM_ARCH_ARM_BIT)
std::printf("ARM "); std::printf("ARM ");
if(GLM_ARCH & GLM_ARCH_NEON_BIT) if(GLM_ARCH & GLM_ARCH_NEON_BIT)