Create Project

Esse commit está contido em:
hihozhou
2017-05-07 17:22:38 +08:00
commit 5c3c004f77
9 arquivos alterados com 409 adições e 0 exclusões
+35
Ver Arquivo
@@ -0,0 +1,35 @@
.deps
*.lo
*.la
.libs
acinclude.m4
aclocal.m4
autom4te.cache
build
config.guess
config.h
config.h.in
config.log
config.nice
config.status
config.sub
configure
configure.in
include
install-sh
libtool
ltmain.sh
Makefile
Makefile.fragments
Makefile.global
Makefile.objects
missing
mkinstalldirs
modules
run-tests.php
tests/*/*.diff
tests/*/*.out
tests/*/*.php
tests/*/*.exp
tests/*/*.log
tests/*/*.sh
+1
Ver Arquivo
@@ -0,0 +1 @@
opencv
Ver Arquivo
+63
Ver Arquivo
@@ -0,0 +1,63 @@
dnl $Id$
dnl config.m4 for extension opencv
dnl Comments in this file start with the string 'dnl'.
dnl Remove where necessary. This file will not work
dnl without editing.
dnl If your extension references something external, use with:
dnl PHP_ARG_WITH(opencv, for opencv support,
dnl Make sure that the comment is aligned:
dnl [ --with-opencv Include opencv support])
dnl Otherwise use enable:
dnl PHP_ARG_ENABLE(opencv, whether to enable opencv support,
dnl Make sure that the comment is aligned:
dnl [ --enable-opencv Enable opencv support])
if test "$PHP_OPENCV" != "no"; then
dnl Write more examples of tests here...
dnl # --with-opencv -> check with-path
dnl SEARCH_PATH="/usr/local /usr" # you might want to change this
dnl SEARCH_FOR="/include/opencv.h" # you most likely want to change this
dnl if test -r $PHP_OPENCV/$SEARCH_FOR; then # path given as parameter
dnl OPENCV_DIR=$PHP_OPENCV
dnl else # search default path list
dnl AC_MSG_CHECKING([for opencv files in default path])
dnl for i in $SEARCH_PATH ; do
dnl if test -r $i/$SEARCH_FOR; then
dnl OPENCV_DIR=$i
dnl AC_MSG_RESULT(found in $i)
dnl fi
dnl done
dnl fi
dnl
dnl if test -z "$OPENCV_DIR"; then
dnl AC_MSG_RESULT([not found])
dnl AC_MSG_ERROR([Please reinstall the opencv distribution])
dnl fi
dnl # --with-opencv -> add include path
dnl PHP_ADD_INCLUDE($OPENCV_DIR/include)
dnl # --with-opencv -> check for lib and symbol presence
dnl LIBNAME=opencv # you may want to change this
dnl LIBSYMBOL=opencv # you most likely want to change this
dnl PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL,
dnl [
dnl PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $OPENCV_DIR/$PHP_LIBDIR, OPENCV_SHARED_LIBADD)
dnl AC_DEFINE(HAVE_OPENCVLIB,1,[ ])
dnl ],[
dnl AC_MSG_ERROR([wrong opencv lib version or lib not found])
dnl ],[
dnl -L$OPENCV_DIR/$PHP_LIBDIR -lm
dnl ])
dnl
dnl PHP_SUBST(OPENCV_SHARED_LIBADD)
PHP_NEW_EXTENSION(opencv, opencv.c, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
fi
+13
Ver Arquivo
@@ -0,0 +1,13 @@
// $Id$
// vim:ft=javascript
// If your extension references something external, use ARG_WITH
// ARG_WITH("opencv", "for opencv support", "no");
// Otherwise, use ARG_ENABLE
// ARG_ENABLE("opencv", "enable opencv support", "no");
if (PHP_OPENCV != "no") {
EXTENSION("opencv", "opencv.c", PHP_EXTNAME_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
}
+184
Ver Arquivo
@@ -0,0 +1,184 @@
/*
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2017 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "php.h"
#include "php_ini.h"
#include "ext/standard/info.h"
#include "php_opencv.h"
/* If you declare any globals in php_opencv.h uncomment this:
ZEND_DECLARE_MODULE_GLOBALS(opencv)
*/
/* True global resources - no need for thread safety here */
static int le_opencv;
/* {{{ PHP_INI
*/
/* Remove comments and fill if you need to have entries in php.ini
PHP_INI_BEGIN()
STD_PHP_INI_ENTRY("opencv.global_value", "42", PHP_INI_ALL, OnUpdateLong, global_value, zend_opencv_globals, opencv_globals)
STD_PHP_INI_ENTRY("opencv.global_string", "foobar", PHP_INI_ALL, OnUpdateString, global_string, zend_opencv_globals, opencv_globals)
PHP_INI_END()
*/
/* }}} */
/* Remove the following function when you have successfully modified config.m4
so that your module can be compiled into PHP, it exists only for testing
purposes. */
/* Every user-visible function in PHP should document itself in the source */
/* {{{ proto string confirm_opencv_compiled(string arg)
Return a string to confirm that the module is compiled in */
PHP_FUNCTION(confirm_opencv_compiled)
{
char *arg = NULL;
size_t arg_len, len;
zend_string *strg;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &arg, &arg_len) == FAILURE) {
return;
}
strg = strpprintf(0, "Congratulations! You have successfully modified ext/%.78s/config.m4. Module %.78s is now compiled into PHP.", "opencv", arg);
RETURN_STR(strg);
}
/* }}} */
/* The previous line is meant for vim and emacs, so it can correctly fold and
unfold functions in source code. See the corresponding marks just before
function definition, where the functions purpose is also documented. Please
follow this convention for the convenience of others editing your code.
*/
/* {{{ php_opencv_init_globals
*/
/* Uncomment this function if you have INI entries
static void php_opencv_init_globals(zend_opencv_globals *opencv_globals)
{
opencv_globals->global_value = 0;
opencv_globals->global_string = NULL;
}
*/
/* }}} */
/* {{{ PHP_MINIT_FUNCTION
*/
PHP_MINIT_FUNCTION(opencv)
{
/* If you have INI entries, uncomment these lines
REGISTER_INI_ENTRIES();
*/
return SUCCESS;
}
/* }}} */
/* {{{ PHP_MSHUTDOWN_FUNCTION
*/
PHP_MSHUTDOWN_FUNCTION(opencv)
{
/* uncomment this line if you have INI entries
UNREGISTER_INI_ENTRIES();
*/
return SUCCESS;
}
/* }}} */
/* Remove if there's nothing to do at request start */
/* {{{ PHP_RINIT_FUNCTION
*/
PHP_RINIT_FUNCTION(opencv)
{
#if defined(COMPILE_DL_OPENCV) && defined(ZTS)
ZEND_TSRMLS_CACHE_UPDATE();
#endif
return SUCCESS;
}
/* }}} */
/* Remove if there's nothing to do at request end */
/* {{{ PHP_RSHUTDOWN_FUNCTION
*/
PHP_RSHUTDOWN_FUNCTION(opencv)
{
return SUCCESS;
}
/* }}} */
/* {{{ PHP_MINFO_FUNCTION
*/
PHP_MINFO_FUNCTION(opencv)
{
php_info_print_table_start();
php_info_print_table_header(2, "opencv support", "enabled");
php_info_print_table_end();
/* Remove comments if you have entries in php.ini
DISPLAY_INI_ENTRIES();
*/
}
/* }}} */
/* {{{ opencv_functions[]
*
* Every user visible function must have an entry in opencv_functions[].
*/
const zend_function_entry opencv_functions[] = {
PHP_FE(confirm_opencv_compiled, NULL) /* For testing, remove later. */
PHP_FE_END /* Must be the last line in opencv_functions[] */
};
/* }}} */
/* {{{ opencv_module_entry
*/
zend_module_entry opencv_module_entry = {
STANDARD_MODULE_HEADER,
"opencv",
opencv_functions,
PHP_MINIT(opencv),
PHP_MSHUTDOWN(opencv),
PHP_RINIT(opencv), /* Replace with NULL if there's nothing to do at request start */
PHP_RSHUTDOWN(opencv), /* Replace with NULL if there's nothing to do at request end */
PHP_MINFO(opencv),
PHP_OPENCV_VERSION,
STANDARD_MODULE_PROPERTIES
};
/* }}} */
#ifdef COMPILE_DL_OPENCV
#ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE()
#endif
ZEND_GET_MODULE(opencv)
#endif
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/
+21
Ver Arquivo
@@ -0,0 +1,21 @@
<?php
$br = (php_sapi_name() == "cli")? "":"<br>";
if(!extension_loaded('opencv')) {
dl('opencv.' . PHP_SHLIB_SUFFIX);
}
$module = 'opencv';
$functions = get_extension_funcs($module);
echo "Functions available in the test extension:$br\n";
foreach($functions as $func) {
echo $func."$br\n";
}
echo "$br\n";
$function = 'confirm_' . $module . '_compiled';
if (extension_loaded($module)) {
$str = $function($module);
} else {
$str = "Module $module is not compiled into PHP";
}
echo "$str\n";
?>
+71
Ver Arquivo
@@ -0,0 +1,71 @@
/*
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2017 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifndef PHP_OPENCV_H
#define PHP_OPENCV_H
extern zend_module_entry opencv_module_entry;
#define phpext_opencv_ptr &opencv_module_entry
#define PHP_OPENCV_VERSION "0.1.0" /* Replace with version number for your extension */
#ifdef PHP_WIN32
# define PHP_OPENCV_API __declspec(dllexport)
#elif defined(__GNUC__) && __GNUC__ >= 4
# define PHP_OPENCV_API __attribute__ ((visibility("default")))
#else
# define PHP_OPENCV_API
#endif
#ifdef ZTS
#include "TSRM.h"
#endif
/*
Declare any global variables you may need between the BEGIN
and END macros here:
ZEND_BEGIN_MODULE_GLOBALS(opencv)
zend_long global_value;
char *global_string;
ZEND_END_MODULE_GLOBALS(opencv)
*/
/* Always refer to the globals in your function as OPENCV_G(variable).
You are encouraged to rename these macros something shorter, see
examples in any other php module directory.
*/
#define OPENCV_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(opencv, v)
#if defined(ZTS) && defined(COMPILE_DL_OPENCV)
ZEND_TSRMLS_CACHE_EXTERN()
#endif
#endif /* PHP_OPENCV_H */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/
+21
Ver Arquivo
@@ -0,0 +1,21 @@
--TEST--
Check for opencv presence
--SKIPIF--
<?php if (!extension_loaded("opencv")) print "skip"; ?>
--FILE--
<?php
echo "opencv extension is available";
/*
you can add regression tests for your extension here
the output of your test code has to be equal to the
text in the --EXPECT-- section below for the tests
to pass, differences between the output and the
expected text are interpreted as failure
see php7/README.TESTING for further information on
writing regression tests
*/
?>
--EXPECT--
opencv extension is available