lbry-android/p4a/pythonforandroid/recipes/opencv/patches/p4a_build-2.4.10.1.patch

67 lines
2.4 KiB
Diff
Raw Normal View History

2017-08-13 03:24:00 +02:00
diff --git a/cmake/OpenCVDetectPython.cmake b/cmake/OpenCVDetectPython.cmake
index 31c2c1e..c890917 100644
--- a/cmake/OpenCVDetectPython.cmake
+++ b/cmake/OpenCVDetectPython.cmake
@@ -36,7 +36,7 @@ if(PYTHON_EXECUTABLE)
unset(PYTHON_VERSION_FULL)
endif()
- if(NOT ANDROID AND NOT IOS)
+ if(P4A OR NOT ANDROID AND NOT IOS)
ocv_check_environment_variables(PYTHON_LIBRARY PYTHON_INCLUDE_DIR)
if(CMAKE_CROSSCOMPILING)
find_host_package(PythonLibs ${PYTHON_VERSION_MAJOR_MINOR})
@@ -51,7 +51,7 @@ if(PYTHON_EXECUTABLE)
endif()
endif()
- if(NOT ANDROID AND NOT IOS)
+ if(P4A OR NOT ANDROID AND NOT IOS)
if(CMAKE_HOST_UNIX)
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import *; print get_python_lib()"
RESULT_VARIABLE PYTHON_CVPY_PROCESS
@@ -117,7 +117,7 @@ if(PYTHON_EXECUTABLE)
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
endif()
- endif(NOT ANDROID AND NOT IOS)
+ endif(P4A OR NOT ANDROID AND NOT IOS)
if(BUILD_DOCS)
find_host_program(SPHINX_BUILD sphinx-build)
diff --git a/modules/python/CMakeLists.txt b/modules/python/CMakeLists.txt
index 3c0f2fd..7ba234a 100644
--- a/modules/python/CMakeLists.txt
+++ b/modules/python/CMakeLists.txt
@@ -5,7 +5,7 @@
if(WIN32 AND CMAKE_BUILD_TYPE STREQUAL "Debug")
ocv_module_disable(python)
endif()
-if(ANDROID OR IOS OR NOT PYTHONLIBS_FOUND OR NOT PYTHON_USE_NUMPY)
+if(ANDROID AND NOT P4A OR IOS OR NOT PYTHONLIBS_FOUND OR NOT PYTHON_USE_NUMPY)
ocv_module_disable(python)
endif()
diff --git a/modules/androidcamera/src/camera_activity.cpp b/modules/androidcamera/src/camera_activity.cpp
index 84db3e1..4222526 100644
--- a/modules/androidcamera/src/camera_activity.cpp
+++ b/modules/androidcamera/src/camera_activity.cpp
@@ -7,6 +7,7 @@
#include <string>
#include <vector>
#include <algorithm>
+#include <stdlib.h>
#include <opencv2/core/version.hpp>
#include "camera_activity.hpp"
#include "camera_wrapper.h"
@@ -342,6 +343,8 @@ std::string CameraWrapperConnector::getPathLibFolder()
char* pathEnd = strrchr(pathBegin, '/');
pathEnd[1] = 0;
+ pathBegin = realpath((std::string(pathBegin)+"../../../../lib").c_str(), lineBuf);
+ pathBegin = strcat(pathBegin, "/");
LOGD("Libraries folder found: %s", pathBegin);