mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-02 14:25:41 +08:00
Add ext-glfw support for Windows
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
glfw:
|
||||
type: library
|
||||
artifact: glfw
|
||||
headers:
|
||||
- GLFW/glfw3.h
|
||||
- GLFW/glfw3native.h
|
||||
lang: cpp
|
||||
static-libs@unix:
|
||||
- libglfw3.a
|
||||
static-libs@windows:
|
||||
- glfw3.lib
|
||||
|
||||
@@ -16,6 +16,7 @@ use StaticPHP\Util\FileSystem;
|
||||
class glfw extends PhpExtensionPackage
|
||||
{
|
||||
#[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-glfw')]
|
||||
#[BeforeStage('php', [php::class, 'buildconfForWindows'], 'ext-glfw')]
|
||||
#[PatchDescription('Patch glfw extension before buildconf')]
|
||||
public function patchBeforeBuildconf(): void
|
||||
{
|
||||
|
||||
@@ -11,6 +11,7 @@ use StaticPHP\Exception\BuildFailureException;
|
||||
use StaticPHP\Exception\ValidationException;
|
||||
use StaticPHP\Package\LibraryPackage;
|
||||
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
|
||||
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
|
||||
use StaticPHP\Runtime\SystemTarget;
|
||||
use StaticPHP\Toolchain\Interface\ToolchainInterface;
|
||||
|
||||
@@ -97,4 +98,19 @@ class glfw
|
||||
// patch pkgconf
|
||||
$lib->patchPkgconfPrefix(['glfw3.pc']);
|
||||
}
|
||||
|
||||
#[BuildFor('Windows')]
|
||||
public function buildForWin(LibraryPackage $lib): void
|
||||
{
|
||||
WindowsCMakeExecutor::create($lib)
|
||||
->setWorkingDir("{$lib->getSourceDir()}/vendor/glfw")
|
||||
->setBuildDir("{$lib->getSourceDir()}/vendor/glfw")
|
||||
->setReset(false)
|
||||
->addConfigureArgs(
|
||||
'-DGLFW_BUILD_EXAMPLES=OFF',
|
||||
'-DGLFW_BUILD_TESTS=OFF',
|
||||
'-DGLFW_BUILD_DOCS=OFF',
|
||||
)
|
||||
->build();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user