#1813 fixed compiler options with profiling enabled
authorAndrey Kamaev <no@email>
Tue, 17 Apr 2012 11:45:24 +0000 (11:45 +0000)
committerAndrey Kamaev <no@email>
Tue, 17 Apr 2012 11:45:24 +0000 (11:45 +0000)
android/android.toolchain.cmake
cmake/OpenCVCompilerOptions.cmake
cmake/OpenCVIOLibs.cmake

index d171f3c..a469715 100644 (file)
@@ -1056,6 +1056,7 @@ endif()
 #   ANDROID_NDK_ABI_NAME : "armeabi", "armeabi-v7a" or "x86" depending on ANDROID_ABI
 #   ANDROID_ARCH_NAME : "arm" or "x86" depending on ANDROID_ABI
 #   TOOL_OS_SUFFIX : "" or ".exe" depending on host platform
+#   ANDROID_SYSROOT : path to the compiler sysroot
 #   ANDROID_SYSTEM_INCLUDE_DIRS
 #   ANDROID_SYSTEM_LIB_DIRS
 # Obsolete:
@@ -1065,7 +1066,6 @@ endif()
 #   ANDROID_COMPILER_VERSION : GCC version used
 #   ANDROID_CXX_FLAGS : C/C++ compiler flags required by Android platform
 #   ANDROID_SUPPORTED_ABIS : list of currently allowed values for ANDROID_ABI
-#   ANDROID_SYSROOT : path to the compiler sysroot
 #   ANDROID_TOOLCHAIN_NAME : "standalone", "arm-linux-androideabi-4.4.3" or "x86-4.4.3" or something similar.
 #   ANDROID_TOOLCHAIN_MACHINE_NAME : "arm-linux-androideabi", "arm-eabi" or "i686-android-linux"
 #   ANDROID_TOOLCHAIN_ROOT : path to the top level of toolchain (standalone or placed inside NDK)
index 8f8bdc7..45e5b23 100644 (file)
@@ -116,6 +116,11 @@ if(CMAKE_COMPILER_IS_GNUCXX)
   # Profiling?
   if(ENABLE_PROFILING)
     set(OPENCV_EXTRA_C_FLAGS_RELEASE "${OPENCV_EXTRA_C_FLAGS_RELEASE} -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}}")
+      string(REPLACE "-ffunction-sections" "" ${flags} "${${flags}}")
+    endforeach()
   elseif(NOT APPLE AND NOT ANDROID)
     # Remove unreferenced functions: function level linking
     set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} -ffunction-sections")
index 5788ecf..223b0c6 100644 (file)
@@ -9,9 +9,15 @@ if(BUILD_ZLIB)
   unset_all(ZLIB_FOUND)
 else()
   include(FindZLIB)
-  if(NOT ZLIB_VERSION_STRING)
+  if(ZLIB_FOUND AND NOT ZLIB_VERSION_STRING)
     ocv_parse_header2(ZLIB "${ZLIB_INCLUDE_DIR}/zlib.h" ZLIB_VERSION "")
   endif()
+  if(ZLIB_FOUND AND ANDROID)
+    if(ZLIB_LIBRARY STREQUAL "${ANDROID_SYSROOT}/usr/lib/libz.so")
+      set(ZLIB_LIBRARY z)
+      set(ZLIB_LIBRARIES z)
+    endif()
+  endif()
 endif()
 
 if(NOT ZLIB_FOUND)