|
|
|
@ -62,27 +62,27 @@ if(CMAKE_COMPILER_IS_GNUCXX) |
|
|
|
|
|
|
|
|
|
# Other optimizations |
|
|
|
|
if(ENABLE_OMIT_FRAME_POINTER) |
|
|
|
|
set(OPENCV_EXTRA_C_FLAGS_RELEASE "${OPENCV_EXTRA_C_FLAGS_RELEASE} -fomit-frame-pointer") |
|
|
|
|
set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} -fomit-frame-pointer") |
|
|
|
|
else() |
|
|
|
|
set(OPENCV_EXTRA_C_FLAGS_RELEASE "${OPENCV_EXTRA_C_FLAGS_RELEASE} -fno-omit-frame-pointer") |
|
|
|
|
set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} -fno-omit-frame-pointer") |
|
|
|
|
endif() |
|
|
|
|
if(ENABLE_FAST_MATH) |
|
|
|
|
set(OPENCV_EXTRA_C_FLAGS_RELEASE "${OPENCV_EXTRA_C_FLAGS_RELEASE} -ffast-math") |
|
|
|
|
set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} -ffast-math") |
|
|
|
|
endif() |
|
|
|
|
if(ENABLE_POWERPC) |
|
|
|
|
set(OPENCV_EXTRA_C_FLAGS_RELEASE "${OPENCV_EXTRA_C_FLAGS_RELEASE} -mcpu=G3 -mtune=G5") |
|
|
|
|
set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} -mcpu=G3 -mtune=G5") |
|
|
|
|
endif() |
|
|
|
|
if(ENABLE_SSE) |
|
|
|
|
set(OPENCV_EXTRA_C_FLAGS_RELEASE "${OPENCV_EXTRA_C_FLAGS_RELEASE} -msse") |
|
|
|
|
set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} -msse") |
|
|
|
|
endif() |
|
|
|
|
if(ENABLE_SSE2) |
|
|
|
|
set(OPENCV_EXTRA_C_FLAGS_RELEASE "${OPENCV_EXTRA_C_FLAGS_RELEASE} -msse2") |
|
|
|
|
set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} -msse2") |
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
# SSE3 and further should be disabled under MingW because it generates compiler errors |
|
|
|
|
if(NOT MINGW) |
|
|
|
|
if(ENABLE_SSE3) |
|
|
|
|
set(OPENCV_EXTRA_C_FLAGS_RELEASE "${OPENCV_EXTRA_C_FLAGS_RELEASE} -msse3") |
|
|
|
|
set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} -msse3") |
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
if(${CMAKE_OPENCV_GCC_VERSION_NUM} GREATER 402) |
|
|
|
@ -94,14 +94,14 @@ if(CMAKE_COMPILER_IS_GNUCXX) |
|
|
|
|
|
|
|
|
|
if(HAVE_GCC42_OR_NEWER OR APPLE) |
|
|
|
|
if(ENABLE_SSSE3) |
|
|
|
|
set(OPENCV_EXTRA_C_FLAGS_RELEASE "${OPENCV_EXTRA_C_FLAGS_RELEASE} -mssse3") |
|
|
|
|
set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} -mssse3") |
|
|
|
|
endif() |
|
|
|
|
if(HAVE_GCC43_OR_NEWER) |
|
|
|
|
if(ENABLE_SSE41) |
|
|
|
|
set(OPENCV_EXTRA_C_FLAGS_RELEASE "${OPENCV_EXTRA_C_FLAGS_RELEASE} -msse4.1") |
|
|
|
|
set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} -msse4.1") |
|
|
|
|
endif() |
|
|
|
|
if(ENABLE_SSE42) |
|
|
|
|
set(OPENCV_EXTRA_C_FLAGS_RELEASE "${OPENCV_EXTRA_C_FLAGS_RELEASE} -msse4.2") |
|
|
|
|
set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} -msse4.2") |
|
|
|
|
endif() |
|
|
|
|
endif() |
|
|
|
|
endif() |
|
|
|
@ -110,16 +110,16 @@ if(CMAKE_COMPILER_IS_GNUCXX) |
|
|
|
|
if(X86 OR X86_64) |
|
|
|
|
if(NOT APPLE AND CMAKE_SIZEOF_VOID_P EQUAL 4) |
|
|
|
|
if(ENABLE_SSE2) |
|
|
|
|
set(OPENCV_EXTRA_C_FLAGS_RELEASE "${OPENCV_EXTRA_C_FLAGS_RELEASE} -mfpmath=sse")# !! important - be on the same wave with x64 compilers |
|
|
|
|
set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} -mfpmath=sse")# !! important - be on the same wave with x64 compilers |
|
|
|
|
else() |
|
|
|
|
set(OPENCV_EXTRA_C_FLAGS_RELEASE "${OPENCV_EXTRA_C_FLAGS_RELEASE} -mfpmath=387") |
|
|
|
|
set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} -mfpmath=387") |
|
|
|
|
endif() |
|
|
|
|
endif() |
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
# Profiling? |
|
|
|
|
if(ENABLE_PROFILING) |
|
|
|
|
set(OPENCV_EXTRA_C_FLAGS_RELEASE "${OPENCV_EXTRA_C_FLAGS_RELEASE} -pg -g") |
|
|
|
|
set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} -pg -g") |
|
|
|
|
# turn off incompatible options |
|
|
|
|
foreach(flags CMAKE_CXX_FLAGS CMAKE_C_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_C_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG OPENCV_EXTRA_C_FLAGS_RELEASE) |
|
|
|
|
string(REPLACE "-fomit-frame-pointer" "" ${flags} "${${flags}}") |
|
|
|
@ -141,20 +141,20 @@ if(MSVC) |
|
|
|
|
# 64-bit MSVC compiler uses SSE/SSE2 by default |
|
|
|
|
if(NOT MSVC64) |
|
|
|
|
if(ENABLE_SSE) |
|
|
|
|
set(OPENCV_EXTRA_C_FLAGS_RELEASE "${OPENCV_EXTRA_C_FLAGS_RELEASE} /arch:SSE") |
|
|
|
|
set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} /arch:SSE") |
|
|
|
|
endif() |
|
|
|
|
if(ENABLE_SSE2) |
|
|
|
|
set(OPENCV_EXTRA_C_FLAGS_RELEASE "${OPENCV_EXTRA_C_FLAGS_RELEASE} /arch:SSE2") |
|
|
|
|
set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} /arch:SSE2") |
|
|
|
|
endif() |
|
|
|
|
endif() |
|
|
|
|
if(ENABLE_SSE3) |
|
|
|
|
set(OPENCV_EXTRA_C_FLAGS_RELEASE "${OPENCV_EXTRA_C_FLAGS_RELEASE} /arch:SSE3") |
|
|
|
|
set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} /arch:SSE3") |
|
|
|
|
endif() |
|
|
|
|
if(ENABLE_SSE4_1) |
|
|
|
|
set(OPENCV_EXTRA_C_FLAGS_RELEASE "${OPENCV_EXTRA_C_FLAGS_RELEASE} /arch:SSE4.1") |
|
|
|
|
set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} /arch:SSE4.1") |
|
|
|
|
endif() |
|
|
|
|
if(ENABLE_SSE OR ENABLE_SSE2 OR ENABLE_SSE3 OR ENABLE_SSE4_1) |
|
|
|
|
set(OPENCV_EXTRA_C_FLAGS_RELEASE "${OPENCV_EXTRA_C_FLAGS_RELEASE} /Oi") |
|
|
|
|
set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} /Oi") |
|
|
|
|
endif() |
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|