Updated CMake instruction set selection

This commit is contained in:
Christophe Riccio 2013-09-15 03:09:10 +02:00
parent 8658704bf6
commit bb9cc43a6d
2 changed files with 43 additions and 15 deletions

View File

@ -49,25 +49,53 @@ if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") OR (("${CMAKE_CXX_COMPILER_ID}"
endif()
endif()
#set(GLM_SIMD_INSTRUCTION_SET "" CACHE STRING "Instruction set. Possible values are SSE1, SSE2")
option(GLM_TEST_ENABLE_SSE2 "Enable SSE2 optimizations" OFF)
option(GLM_TEST_ENABLE_SSE3 "Enable SSE3 optimizations" OFF)
option(GLM_TEST_ENABLE_AVX "Enable AVX optimizations" OFF)
option(GLM_TEST_ENABLE_AVX2 "Enable AVX2 optimizations" OFF)
option(GLM_TEST_FORCE_PURE "Force 'pure' instructions" OFF)
option(GLM_TEST_ENABLE_SIMD "Enable SIMD optimizations" OFF)
if(GLM_TEST_ENABLE_SIMD)
if(CMAKE_COMPILER_IS_GNUCXX)
add_definitions(-msse2)
elseif(GLM_USE_INTEL)
add_definitions(/QxAVX)
elseif(MSVC10)
add_definitions(/arch:AVX)
elseif(MSVC)
add_definitions(/arch:SSE2)
endif()
elseif(NOT GLM_TEST_ENABLE_SIMD)
if(GLM_TEST_FORCE_PURE)
add_definitions(-DGLM_FORCE_PURE)
if(CMAKE_COMPILER_IS_GNUCXX)
add_definitions(-mfpmath=387)
elseif(MSVC)
add_definitions(/arch:IA32)
endif()
elseif(GLM_TEST_ENABLE_AVX2)
if(CMAKE_COMPILER_IS_GNUCXX)
add_definitions(-mavx2)
elseif(GLM_USE_INTEL)
add_definitions(/QxAVX2)
elseif(MSVC)
add_definitions(/arch:AVX2)
endif()
elseif(GLM_TEST_ENABLE_AVX)
if(CMAKE_COMPILER_IS_GNUCXX)
add_definitions(-mavx)
elseif(GLM_USE_INTEL)
add_definitions(/QxAVX)
elseif(MSVC)
add_definitions(/arch:AVX)
endif()
elseif(GLM_TEST_ENABLE_SSE3)
if(CMAKE_COMPILER_IS_GNUCXX)
add_definitions(-msse3)
elseif(GLM_USE_INTEL)
add_definitions(/QxSSE3)
elseif(MSVC)
add_definitions(/arch:SSE3)
endif()
elseif(GLM_TEST_ENABLE_SSE2)
if(CMAKE_COMPILER_IS_GNUCXX)
add_definitions(-msse2)
elseif(GLM_USE_INTEL)
add_definitions(/QxSSE2)
elseif(MSVC)
if(NOT CMAKE_CL_64)
add_definitions(/arch:SSE2)
endif()
endif()
endif()

View File

@ -685,7 +685,7 @@
#if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_SWIZZLE_DISPLAYED))
# define GLM_MESSAGE_SWIZZLE_DISPLAYED
# if defined(GLM_SWIZZL)E
# if defined(GLM_SWIZZL)
# pragma message("GLM: Swizzling operators enabled")
# else
# pragma message("GLM: Swizzling operators disabled")