ability to enable OpenMP simultaneously with other parallel framework
authorIlya Lavrenov <ilya.lavrenov@itseez.com>
Wed, 3 Dec 2014 11:59:51 +0000 (14:59 +0300)
committerIlya Lavrenov <ilya.lavrenov@itseez.com>
Wed, 10 Dec 2014 10:34:39 +0000 (13:34 +0300)
cmake/OpenCVFindLibsPerf.cmake

index 33ea36f..077550f 100644 (file)
@@ -46,25 +46,15 @@ else()
   set(HAVE_CSTRIPES 0)
 endif()
 
-# --- OpenMP ---
-if(WITH_OPENMP AND NOT HAVE_TBB AND NOT HAVE_CSTRIPES)
-  find_package(OpenMP)
-  if(OPENMP_FOUND)
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
-  endif()
-  set(HAVE_OPENMP "${OPENMP_FOUND}")
-endif()
-
 # --- GCD ---
-if(APPLE AND NOT HAVE_TBB AND NOT HAVE_CSTRIPES AND NOT HAVE_OPENMP)
+if(APPLE AND NOT HAVE_TBB AND NOT HAVE_CSTRIPES)
   set(HAVE_GCD 1)
 else()
   set(HAVE_GCD 0)
 endif()
 
 # --- Concurrency ---
-if(MSVC AND NOT HAVE_TBB AND NOT HAVE_CSTRIPES AND NOT HAVE_OPENMP)
+if(MSVC AND NOT HAVE_TBB AND NOT HAVE_CSTRIPES)
   set(_fname "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/concurrencytest.cpp")
   file(WRITE "${_fname}" "#if _MSC_VER < 1600\n#error\n#endif\nint main() { return 0; }\n")
   try_compile(HAVE_CONCURRENCY "${CMAKE_BINARY_DIR}" "${_fname}")
@@ -72,3 +62,13 @@ if(MSVC AND NOT HAVE_TBB AND NOT HAVE_CSTRIPES AND NOT HAVE_OPENMP)
 else()
   set(HAVE_CONCURRENCY 0)
 endif()
+
+# --- OpenMP ---
+if(WITH_OPENMP)
+  find_package(OpenMP)
+  if(OPENMP_FOUND)
+    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
+  endif()
+  set(HAVE_OPENMP "${OPENMP_FOUND}")
+endif()