Compare commits

..

10 Commits

6 changed files with 211 additions and 11 deletions

View File

@ -7,6 +7,9 @@ add_definitions(/D_WIN32 /D_WINDOWS /DWINDOWS=1 /DZEND_WIN32=1 /DPHP_WIN32=1 /DW
if(NOT CMAKE_CL_64)
add_definitions(-D_USE_32BIT_TIME_T)
endif(NOT CMAKE_CL_64)
if(WITH_THREAD_SAFETY)
add_definitions(-DZTS=1)
endif(WITH_THREAD_SAFETY)
ENDIF(WIN32)
string(SUBSTRING $ENV{VSCMD_VER} 0 2 VSCMD_VER)
@ -16,8 +19,12 @@ include_directories (C:/php-sdk/phpmaster/vc${VSCMD_VER}/$ENV{VSCMD_ARG_TGT_ARCH
include_directories (C:/php-sdk/phpmaster/vc${VSCMD_VER}/$ENV{VSCMD_ARG_TGT_ARCH}/php-src/TSRM)
include_directories (${CMAKE_CURRENT_SOURCE_DIR})
add_library(example STATIC example.c)
set_property(SOURCE example.i PROPERTY CPLUSPLUS ON)
add_library(example STATIC example.cxx)
swig_add_library(php_example TYPE MODULE LANGUAGE php7 SOURCES example.i)
target_compile_options(php_example PRIVATE /D_WIN32 /D_WINDOWS /DWINDOWS=1 /DZEND_WIN32=1 /DPHP_WIN32=1 /DWIN32 /DNDebug /DNDEBUG /DZEND_DEBUG=0)
SWIG_LINK_LIBRARIES(php_example "C:/php-sdk/phpmaster/vc${VSCMD_VER}/$ENV{VSCMD_ARG_TGT_ARCH}/php-src/x64/Release/php7.lib")
if(WITH_THREAD_SAFETY)
target_compile_options(php_example PRIVATE /DZTS=1)
endif(WITH_THREAD_SAFETY)
SWIG_LINK_LIBRARIES(php_example "C:/php-sdk/phpmaster/vc${VSCMD_VER}/$ENV{VSCMD_ARG_TGT_ARCH}/php-src/$ENV{VSCMD_ARG_TGT_ARCH}/Release/php7.lib")
target_link_libraries(php_example example)

View File

@ -29,3 +29,4 @@ cmake --build .
```
Thats it.
To see all commands, have a look into appveyor.yml

View File

@ -8,16 +8,25 @@ environment:
VS_VERSION: Visual Studio 15 2017
matrix:
- THREAD_SAFE: "true"
PHP_BRANCH: "7.2"
PHP_VERSION: "7.2.10"
- THREAD_SAFE: "false"
PHP:
- PHP_VERSION: 7.2.10
PHP_BRANCH: 7.2
PHP_BRANCH: "7.2"
PHP_VERSION: "7.2.10"
- THREAD_SAFE: "true"
PHP_BRANCH: "7.1"
PHP_VERSION: "7.1.22"
- THREAD_SAFE: "false"
PHP_BRANCH: "7.1"
PHP_VERSION: "7.1.22"
shallow_clone: true
build_script:
- if "%platform%" == "x64" SET VS_FULL=%VS_VERSION% Win64
- if "%platform%" == "x86" SET VS_FULL=%VS_VERSION%
- if "%platform%" == "x64" call "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Auxiliary/Build/vcvars64.bat"
- if "%platform%" == "x86" call "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Auxiliary/Build/vcvars32.bat"
#Build PHP
- move C:\cygwin C:\cygwin_disabled
- move C:\cygwin64 C:\cygwin64_disabled

View File

@ -1,7 +1,6 @@
/* File : example.c */
double My_variable = 3.0;
/* Compute factorial of n */
int fact(int n) {
if (n <= 1) return 1;
@ -11,4 +10,6 @@ int fact(int n) {
/* Compute n mod m */
int my_mod(int n, int m) {
return(n % m);
}
}
int empty = 11;

View File

@ -2,11 +2,11 @@
%module example
%{
/* Put headers and other declarations here */
extern double My_variable;
extern int fact(int);
extern int my_mod(int n, int m);
#include "example.cxx"
%}
extern double My_variable;
extern int fact(int);
extern int my_mod(int n, int m);
extern int my_mod(int n, int m);
extern int empty;

182
test_keywords.php Normal file
View File

@ -0,0 +1,182 @@
<?php
//PHPFN(__halt_compiler);
$__halt_compiler = "\n\rContent of variable __halt_compiler";
echo $__halt_compiler;
class test__halt_compiler {
public $__halt_compiler = "\n\rContent of property __halt_compiler";
}
$instance = new test__halt_compiler;
echo $instance->__halt_compiler;
//PHPFN(array);
$array = "\n\rContent of variable array";
echo $array;
class test_array {
public $array = "\n\rContent of property array";
}
$instance = new test_array;
echo $instance->array;
//PHPFN(die);
$die = "\n\rContent of variable die";
echo $die;
class test_die {
public $die = "\n\rContent of property die";
}
$instance = new test_die;
echo $instance->die;
//PHPFN(echo);
$echo = "\n\rContent of variable echo";
echo $echo;
class test_echo {
public $echo = "\n\rContent of property echo";
}
$instance = new test_echo;
echo $instance->echo;
//PHPFN(empty); // "Language construct"
$empty = "\n\rContent of variable empty";
echo $empty;
class test_empty {
public $empty = "\n\rContent of property empty";
}
$instance = new test_empty;
echo $instance->empty;
//PHPFN(eval); // "Language construct"
$eval = "\n\rContent of variable eval";
echo $eval;
class test_eval {
public $eval = "\n\rContent of property eval";
}
$instance = new test_eval;
echo $instance->eval;
//PHPFN(exit); // "Language construct"
$exit = "\n\rContent of variable exit";
echo $exit;
class test_exit {
public $exit = "\n\rContent of property exit";
}
$instance = new test_exit;
echo $instance->exit;
//PHPFN(include); // "Language construct"
$include = "\n\rContent of variable include";
echo $include;
class test_include {
public $include = "\n\rContent of property include";
}
$instance = new test_include;
echo $instance->include;
//PHPFN(include_once); // "Language construct"
$include_once = "\n\rContent of variable include_once";
echo $include_once;
class test_include_once {
public $include_once = "\n\rContent of property include_once";
}
$instance = new test_include_once;
echo $instance->include_once;
//PHPFN(isset); // "Language construct"
$isset = "\n\rContent of variable isset";
echo $isset;
class test_isset {
public $isset = "\n\rContent of property isset";
}
$instance = new test_isset;
echo $instance->isset;
//PHPFN(list); // "Language construct"
$list = "\n\rContent of variable list";
echo $list;
class test_list {
public $list = "\n\rContent of property list";
}
$instance = new test_list;
echo $instance->list;
//PHPFN(print); // "Language construct"
$print = "\n\rContent of variable print";
echo $print;
class test_print {
public $print = "\n\rContent of property print";
}
$instance = new test_print;
echo $instance->print;
//PHPFN(require); // "Language construct"
$require = "\n\rContent of variable require";
echo $require;
class test_require {
public $require = "\n\rContent of property require";
}
$instance = new test_require;
echo $instance->require;
//PHPFN(require_once); // "Language construct"
$require_once = "\n\rContent of variable require_once";
echo $require_once;
class test_require_once {
public $require_once = "\n\rContent of property require_once";
}
$instance = new test_require_once;
echo $instance->require_once;
//PHPFN(return); // "Language construct"
$return = "\n\rContent of variable return";
echo $return;
class test_return {
public $return = "\n\rContent of property return";
}
$instance = new test_return;
echo $instance->return;
//PHPFN(unset); // "Language construct"
$unset = "\n\rContent of variable unset";
echo $unset;
class test_unset {
public $unset = "\n\rContent of property unset";
}
$instance = new test_unset;
echo $instance->unset;
//dl("example");
require_once("build/example.php");
class test extends example {
}
$empty = new test();
echo "\n\rContent of empty: ".$empty->empty_get();