Fixed compiler flags for debug builds

pull/13383/head
Andrey Kamaev 13 years ago
parent f208535bb6
commit 3d0f4fe167
  1. 36
      cmake/OpenCVCompilerOptions.cmake

@ -62,27 +62,27 @@ if(CMAKE_COMPILER_IS_GNUCXX)
# Other optimizations # Other optimizations
if(ENABLE_OMIT_FRAME_POINTER) 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() 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() endif()
if(ENABLE_FAST_MATH) 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() endif()
if(ENABLE_POWERPC) 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() endif()
if(ENABLE_SSE) 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() endif()
if(ENABLE_SSE2) 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() endif()
# SSE3 and further should be disabled under MingW because it generates compiler errors # SSE3 and further should be disabled under MingW because it generates compiler errors
if(NOT MINGW) if(NOT MINGW)
if(ENABLE_SSE3) 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() endif()
if(${CMAKE_OPENCV_GCC_VERSION_NUM} GREATER 402) 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(HAVE_GCC42_OR_NEWER OR APPLE)
if(ENABLE_SSSE3) 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() endif()
if(HAVE_GCC43_OR_NEWER) if(HAVE_GCC43_OR_NEWER)
if(ENABLE_SSE41) 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() endif()
if(ENABLE_SSE42) 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() endif()
endif() endif()
@ -110,16 +110,16 @@ if(CMAKE_COMPILER_IS_GNUCXX)
if(X86 OR X86_64) if(X86 OR X86_64)
if(NOT APPLE AND CMAKE_SIZEOF_VOID_P EQUAL 4) if(NOT APPLE AND CMAKE_SIZEOF_VOID_P EQUAL 4)
if(ENABLE_SSE2) 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() 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() endif()
endif() endif()
# Profiling? # Profiling?
if(ENABLE_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 # 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) 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}}") string(REPLACE "-fomit-frame-pointer" "" ${flags} "${${flags}}")
@ -141,20 +141,20 @@ if(MSVC)
# 64-bit MSVC compiler uses SSE/SSE2 by default # 64-bit MSVC compiler uses SSE/SSE2 by default
if(NOT MSVC64) if(NOT MSVC64)
if(ENABLE_SSE) 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() endif()
if(ENABLE_SSE2) 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()
endif() endif()
if(ENABLE_SSE3) 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() endif()
if(ENABLE_SSE4_1) 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() endif()
if(ENABLE_SSE OR ENABLE_SSE2 OR ENABLE_SSE3 OR ENABLE_SSE4_1) 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()
endif() endif()

Loading…
Cancel
Save