mirror of
https://github.com/extism/extism.git
synced 2026-01-11 23:08:06 -05:00
Compare commits
1 Commits
latest
...
fix-php-sp
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a4eb1da47b |
29
php/src/generate.php
Normal file
29
php/src/generate.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
require_once "vendor/autoload.php";
|
||||
|
||||
|
||||
function generate() {
|
||||
return (new FFIMe\FFIMe("libextism.".soext()))
|
||||
->include("extism.h")
|
||||
->showWarnings(false)
|
||||
->codeGen('ExtismLib', __DIR__.'/ExtismLib.php');
|
||||
}
|
||||
|
||||
function soext() {
|
||||
$platform = php_uname("s");
|
||||
switch ($platform) {
|
||||
case "Darwin":
|
||||
return "dylib";
|
||||
case "Linux":
|
||||
return "so";
|
||||
case "Windows":
|
||||
return "dll";
|
||||
default:
|
||||
throw new Exception("Extism: unsupported platform ".$platform);
|
||||
}
|
||||
}
|
||||
|
||||
if (!file_exists(__DIR__."/ExtismLib.php")) {
|
||||
generate();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user