mirror of
https://github.com/davisking/dlib.git
synced 2024-11-01 10:14:53 +08:00
When using visual studio, made cmake only show the supported SSE options.
This commit is contained in:
parent
6a037bc1c1
commit
6dcaaab661
14
dlib/cmake
14
dlib/cmake
@ -13,7 +13,7 @@ if (NOT TARGET dlib)
|
||||
endif()
|
||||
|
||||
# Setup some options to allow a user to enable SSE and AVX instruction use.
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
if (CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
option(USE_SSE2_INSTRUCTIONS "Compile your program with SSE2 instructions" OFF)
|
||||
option(USE_SSE4_INSTRUCTIONS "Compile your program with SSE4 instructions" OFF)
|
||||
option(USE_AVX_INSTRUCTIONS "Compile your program with AVX instructions" OFF)
|
||||
@ -24,11 +24,17 @@ if (NOT TARGET dlib)
|
||||
elseif(USE_SSE2_INSTRUCTIONS)
|
||||
add_definitions(-msse2)
|
||||
endif()
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") # else if using Visual Studio
|
||||
elseif (MSVC OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") # else if using Visual Studio
|
||||
# Use SSE2 by default when using Visual Studio.
|
||||
option(USE_SSE2_INSTRUCTIONS "Compile your program with SSE2 instructions" ON)
|
||||
option(USE_SSE4_INSTRUCTIONS "Compile your program with SSE4 instructions" OFF)
|
||||
option(USE_AVX_INSTRUCTIONS "Compile your program with AVX instructions" OFF)
|
||||
# Visual Studio 2005 didn't support SSE4
|
||||
if (NOT MSVC80)
|
||||
option(USE_SSE4_INSTRUCTIONS "Compile your program with SSE4 instructions" OFF)
|
||||
endif()
|
||||
# Visual Studio 2005 and 2008 didn't support AVX
|
||||
if (NOT MSVC80 AND NOT MSVC90)
|
||||
option(USE_AVX_INSTRUCTIONS "Compile your program with AVX instructions" OFF)
|
||||
endif()
|
||||
include(CheckTypeSize)
|
||||
check_type_size( "void*" SIZE_OF_VOID_PTR)
|
||||
if(USE_AVX_INSTRUCTIONS)
|
||||
|
Loading…
Reference in New Issue
Block a user