Code review notes fixed.
authorAlexander Smorkalov <alexander.smorkalov@itseez.com>
Mon, 27 Jan 2014 13:57:11 +0000 (17:57 +0400)
committerAlexander Smorkalov <alexander.smorkalov@itseez.com>
Mon, 27 Jan 2014 14:47:09 +0000 (18:47 +0400)
Env setup for testing package implemented using /etc/profile.d;
Variable with path for all native samples added;
Path for test binaries and test data updated.

CMakeLists.txt
cmake/OpenCVModule.cmake
cmake/OpenCVPackaging.cmake
cmake/templates/postinst [deleted file]
samples/c/CMakeLists.txt
samples/cpp/CMakeLists.txt
samples/gpu/CMakeLists.txt
samples/gpu/performance/CMakeLists.txt
samples/ocl/CMakeLists.txt

index 2adc320..752c991 100644 (file)
@@ -283,6 +283,7 @@ if(ANDROID)
   set(OPENCV_3P_LIB_INSTALL_PATH  sdk/native/3rdparty/libs/${ANDROID_NDK_ABI_NAME})
   set(OPENCV_CONFIG_INSTALL_PATH  sdk/native/jni)
   set(OPENCV_INCLUDE_INSTALL_PATH sdk/native/jni/include)
+  set(OPENCV_SAMPLES_SRC_INSTALL_PATH samples/native)
 else()
   set(LIBRARY_OUTPUT_PATH         "${OpenCV_BINARY_DIR}/lib")
   set(3P_LIBRARY_OUTPUT_PATH      "${OpenCV_BINARY_DIR}/3rdparty/lib${LIB_SUFFIX}")
@@ -293,9 +294,11 @@ else()
       set(OPENCV_LIB_INSTALL_PATH   "${OpenCV_INSTALL_BINARIES_PREFIX}lib${LIB_SUFFIX}")
     endif()
     set(OPENCV_3P_LIB_INSTALL_PATH  "${OpenCV_INSTALL_BINARIES_PREFIX}staticlib${LIB_SUFFIX}")
+    set(OPENCV_SAMPLES_SRC_INSTALL_PATH    samples/native)
   else()
     set(OPENCV_LIB_INSTALL_PATH     lib${LIB_SUFFIX})
     set(OPENCV_3P_LIB_INSTALL_PATH  share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH})
+    set(OPENCV_SAMPLES_SRC_INSTALL_PATH    share/OpenCV/samples)
   endif()
   set(OPENCV_INCLUDE_INSTALL_PATH "include")
 
index 0e1ee25..2328d89 100644 (file)
@@ -712,11 +712,7 @@ function(ocv_add_perf_tests)
       # TODO: warn about unsatisfied dependencies
     endif(OCV_DEPENDENCIES_FOUND)
     if(INSTALL_TESTS)
-      if(ANDROID)
-        install(TARGETS ${the_target} RUNTIME DESTINATION sdk/etc/bin COMPONENT tests)
-      elseif(NOT WIN32)
-        install(TARGETS ${the_target} RUNTIME DESTINATION share/OpenCV/bin COMPONENT tests)
-      endif()
+      install(TARGETS ${the_target} RUNTIME DESTINATION ${OPENCV_BIN_INSTALL_PATH} COMPONENT tests)
     endif()
   endif()
 endfunction()
@@ -773,11 +769,7 @@ function(ocv_add_accuracy_tests)
     endif(OCV_DEPENDENCIES_FOUND)
 
     if(INSTALL_TESTS)
-      if(ANDROID)
-        install(TARGETS ${the_target} RUNTIME DESTINATION sdk/etc/bin COMPONENT tests)
-      elseif(NOT WIN32)
-        install(TARGETS ${the_target} RUNTIME DESTINATION share/OpenCV/bin COMPONENT tests)
-      endif()
+      install(TARGETS ${the_target} RUNTIME DESTINATION ${OPENCV_BIN_INSTALL_PATH} COMPONENT tests)
     endif()
   endif()
 endfunction()
@@ -819,7 +811,7 @@ function(ocv_add_samples)
   if(INSTALL_C_EXAMPLES AND NOT WIN32 AND EXISTS "${samples_path}")
     file(GLOB sample_files "${samples_path}/*")
     install(FILES ${sample_files}
-            DESTINATION share/OpenCV/samples/${module_id}
+            DESTINATION ${OPENCV_SAMPLES_SRC_INSTALL_PATH}/${module_id}
             PERMISSIONS OWNER_READ GROUP_READ WORLD_READ COMPONENT samples)
   endif()
 endfunction()
index 32d5c5d..0117873 100644 (file)
@@ -58,9 +58,9 @@ set(CPACK_DEBIAN_PACKAGE_SECTION "libs")
 set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "http://opencv.org")
 if(INSTALL_TESTS AND OPENCV_TEST_DATA_PATH)
   set(prefix "${CMAKE_INSTALL_PREFIX}")
-  configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/postinst"
-                 "${CMAKE_BINARY_DIR}/junk/postinst" @ONLY IMMEDIATE)
-  set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_BINARY_DIR}/junk/postinst")
+  configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/opencv_testing.sh.in"
+                 "${CMAKE_BINARY_DIR}/unix-install/opencv_testing.sh" @ONLY IMMEDIATE)
+  install(FILES "${CMAKE_BINARY_DIR}/unix-install/opencv_testing.sh" DESTINATION /etc/profile.d/ COMPONENT tests)
 endif()
 
 #depencencies
@@ -70,9 +70,7 @@ set(CPACK_COMPONENT_dev_DEPENDS libs)
 set(CPACK_COMPONENT_docs_DEPENDS libs)
 set(CPACK_COMPONENT_java_DEPENDS libs)
 set(CPACK_COMPONENT_python_DEPENDS libs)
-if(INSTALL_TESTS)
 set(CPACK_COMPONENT_tests_DEPENDS libs)
-endif()
 
 if(HAVE_CUDA)
   string(REPLACE "." "-" cuda_version_suffix ${CUDA_VERSION})
diff --git a/cmake/templates/postinst b/cmake/templates/postinst
deleted file mode 100644 (file)
index f676378..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-echo "export OPENCV_TEST_DATA_PATH=@prefix@/share/OpenCV/testdata" >> /etc/profile
\ No newline at end of file
index aca8886..6d374e7 100644 (file)
@@ -53,13 +53,7 @@ endif()
 
 if (INSTALL_C_EXAMPLES AND NOT WIN32)
   file(GLOB C_SAMPLES *.c *.cpp *.jpg *.png *.data makefile.* build_all.sh *.dsp *.cmd )
-  if (ANDROID)
-    install(FILES ${C_SAMPLES}
-            DESTINATION samples/native/c
-            PERMISSIONS OWNER_READ GROUP_READ WORLD_READ COMPONENT samples)
-  else()
-    install(FILES ${C_SAMPLES}
-            DESTINATION share/OpenCV/samples/c
-            PERMISSIONS OWNER_READ GROUP_READ WORLD_READ COMPONENT samples)
-  endif()
+  install(FILES ${C_SAMPLES}
+          DESTINATION ${OPENCV_SAMPLES_SRC_INSTALL_PATH}/c
+          PERMISSIONS OWNER_READ GROUP_READ WORLD_READ COMPONENT samples)
 endif ()
index 6ccc75a..b21fe86 100644 (file)
@@ -90,13 +90,7 @@ endif()
 
 if (INSTALL_C_EXAMPLES AND NOT WIN32)
   file(GLOB C_SAMPLES *.c *.cpp *.jpg *.png *.data makefile.* build_all.sh *.dsp *.cmd )
-  if (ANDROID)
-    install(FILES ${C_SAMPLES}
-            DESTINATION samples/native/cpp
-            PERMISSIONS OWNER_READ GROUP_READ WORLD_READ COMPONENT samples)
-  else()
-    install(FILES ${C_SAMPLES}
-            DESTINATION share/OpenCV/samples/cpp
-            PERMISSIONS OWNER_READ GROUP_READ WORLD_READ COMPONENT samples)
-  endif()
+  install(FILES ${C_SAMPLES}
+          DESTINATION ${OPENCV_SAMPLES_SRC_INSTALL_PATH}/cpp
+          PERMISSIONS OWNER_READ GROUP_READ WORLD_READ COMPONENT samples)
 endif()
index 226869a..8fa5394 100644 (file)
@@ -82,13 +82,7 @@ endif()
 
 if (INSTALL_C_EXAMPLES AND NOT WIN32)
   file(GLOB install_list *.c *.cpp *.jpg *.png *.data makefile.* build_all.sh *.dsp *.cmd )
-  if(ANDROID)
-    install(FILES ${install_list}
-            DESTINATION samples/native/gpu
-            PERMISSIONS OWNER_READ GROUP_READ WORLD_READ COMPONENT samples)
-  else()
-    install(FILES ${install_list}
-            DESTINATION share/OpenCV/samples/gpu
-            PERMISSIONS OWNER_READ GROUP_READ WORLD_READ COMPONENT samples)
-  endif()
+  install(FILES ${install_list}
+          DESTINATION ${OPENCV_SAMPLES_SRC_INSTALL_PATH}/gpu
+          PERMISSIONS OWNER_READ GROUP_READ WORLD_READ COMPONENT samples)
 endif()
index 32dc002..de0fead 100644 (file)
@@ -29,7 +29,7 @@ endif()
 if(INSTALL_C_EXAMPLES AND NOT WIN32)
   file(GLOB GPU_FILES performance/*.cpp performance/*.h)
   install(FILES ${GPU_FILES}
-          DESTINATION share/OpenCV/samples/gpu/performance
+          DESTINATION ${OPENCV_SAMPLES_SRC_INSTALL_PATH}/gpu/performance
           PERMISSIONS OWNER_READ GROUP_READ WORLD_READ
           COMPONENT samples)
 endif()
index 8889452..7fc20fd 100644 (file)
@@ -53,13 +53,7 @@ endif()
 
 if (INSTALL_C_EXAMPLES AND NOT WIN32)
   file(GLOB install_list *.c *.cpp *.jpg *.png *.data makefile.* build_all.sh *.dsp *.cmd )
-  if(ANDROID)
-    install(FILES ${install_list}
-            DESTINATION samples/native/ocl
-            PERMISSIONS OWNER_READ GROUP_READ WORLD_READ COMPONENT samples)
-  else()
-    install(FILES ${install_list}
-            DESTINATION share/OpenCV/samples/ocl
-            PERMISSIONS OWNER_READ GROUP_READ WORLD_READ COMPONENT samples)
-  endif()
+  install(FILES ${install_list}
+          DESTINATION ${OPENCV_SAMPLES_SRC_INSTALL_PATH}/ocl
+          PERMISSIONS OWNER_READ GROUP_READ WORLD_READ COMPONENT samples)
 endif()