return handle;
}
+#ifdef __ANDROID__
+
+static const char *defaultAndroidPaths[] = {
+ "libOpenCL.so",
+ "/system/lib64/libOpenCL.so",
+ "/system/vendor/lib64/libOpenCL.so",
+ "/system/vendor/lib64/egl/libGLES_mali.so",
+ "/system/vendor/lib64/libPVROCL.so",
+ "/data/data/org.pocl.libs/files/lib64/libpocl.so",
+ "/system/lib/libOpenCL.so",
+ "/system/vendor/lib/libOpenCL.so",
+ "/system/vendor/lib/egl/libGLES_mali.so",
+ "/system/vendor/lib/libPVROCL.so",
+ "/data/data/org.pocl.libs/files/lib/libpocl.so"
+};
+
+static void* GetProcAddress(const char* name)
+{
+ static bool initialized = false;
+ static void* handle = NULL;
+ if (!handle && !initialized)
+ {
+ cv::AutoLock lock(cv::getInitializationMutex());
+ if (!initialized)
+ {
+ bool foundOpenCL = false;
+ for (unsigned int i = 0; i < (sizeof(defaultAndroidPaths)/sizeof(char*)); i++)
+ {
+ const char* path = (i==0) ? getRuntimePath(defaultAndroidPaths[i]) : defaultAndroidPaths[i];
+ if (path) {
+ handle = GetHandle(path);
+ if (handle) {
+ foundOpenCL = true;
+ break;
+ }
+ }
+ }
+ initialized = true;
+ if (!foundOpenCL)
+ fprintf(stderr, ERROR_MSG_CANT_LOAD);
+ }
+ }
+ if (!handle)
+ return NULL;
+ return dlsym(handle, name);
+}
+
+#else // NOT __ANDROID__
+
static void* GetProcAddress(const char* name)
{
static bool initialized = false;
return NULL;
return dlsym(handle, name);
}
+#endif // __ANDROID__
+
#define CV_CL_GET_PROC_ADDRESS(name) GetProcAddress(name)
#endif
self.debug = True if config.debug else False
self.debug_info = True if config.debug_info else False
self.no_samples_build = True if config.no_samples_build else False
+ self.opencl = True if config.opencl else False
def get_cmake(self):
if not self.config.use_android_buildtools and check_executable(['cmake', '--version']):
if self.debug_info: # Release with debug info
cmake_vars['BUILD_WITH_DEBUG_INFO'] = "ON"
+ if self.opencl:
+ cmake_vars['WITH_OPENCL'] = "ON"
+
if self.config.modules_list is not None:
cmd.append("-DBUILD_LIST='%s'" % self.config.modules_list)
parser.add_argument('--debug', action="store_true", help="Build 'Debug' binaries (CMAKE_BUILD_TYPE=Debug)")
parser.add_argument('--debug_info', action="store_true", help="Build with debug information (useful for Release mode: BUILD_WITH_DEBUG_INFO=ON)")
parser.add_argument('--no_samples_build', action="store_true", help="Do not build samples (speeds up build)")
+ parser.add_argument('--opencl', action="store_true", help="Enable OpenCL support")
args = parser.parse_args()
log.basicConfig(format='%(message)s', level=log.DEBUG)