Made the default cmake settings enable SSE2 instructions when using Visual Studio.

This commit is contained in:
Davis King 2014-01-02 12:10:00 -05:00
parent 5481a8073d
commit d4cd8779ee
1 changed files with 3 additions and 1 deletions

View File

@ -12,11 +12,11 @@ if (NOT TARGET dlib)
add_definitions("-Wreturn-type") add_definitions("-Wreturn-type")
endif() endif()
option(USE_SSE2_INSTRUCTIONS "Compile your program with SSE2 instructions" OFF)
option(USE_SSE4_INSTRUCTIONS "Compile your program with SSE4 instructions" OFF) option(USE_SSE4_INSTRUCTIONS "Compile your program with SSE4 instructions" OFF)
option(USE_AVX_INSTRUCTIONS "Compile your program with AVX instructions" OFF) option(USE_AVX_INSTRUCTIONS "Compile your program with AVX instructions" OFF)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
option(USE_SSE2_INSTRUCTIONS "Compile your program with SSE2 instructions" OFF)
if(USE_AVX_INSTRUCTIONS) if(USE_AVX_INSTRUCTIONS)
add_definitions(-mavx) add_definitions(-mavx)
elseif (USE_SSE4_INSTRUCTIONS) elseif (USE_SSE4_INSTRUCTIONS)
@ -25,6 +25,8 @@ if (NOT TARGET dlib)
add_definitions(-msse2) add_definitions(-msse2)
endif() endif()
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") # Visual Studio elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") # Visual Studio
# Use SSE2 by default when using Visual Studio
option(USE_SSE2_INSTRUCTIONS "Compile your program with SSE2 instructions" ON)
if(USE_AVX_INSTRUCTIONS) if(USE_AVX_INSTRUCTIONS)
add_definitions(/arch:AVX) add_definitions(/arch:AVX)
elseif (USE_SSE4_INSTRUCTIONS) elseif (USE_SSE4_INSTRUCTIONS)