Skip to content

Commit 9182cf1

Browse files
committed
Add ext-glfw support for Windows
1 parent c207269 commit 9182cf1

3 files changed

Lines changed: 22 additions & 0 deletions

File tree

config/pkg/lib/glfw.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
glfw:
22
type: library
33
artifact: glfw
4+
headers:
5+
- GLFW/glfw3.h
6+
- GLFW/glfw3native.h
47
lang: cpp
58
static-libs@unix:
69
- libglfw3.a
10+
static-libs@windows:
11+
- glfw3.lib

src/Package/Extension/glfw.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
class glfw extends PhpExtensionPackage
1717
{
1818
#[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-glfw')]
19+
#[BeforeStage('php', [php::class, 'buildconfForWindows'], 'ext-glfw')]
1920
#[PatchDescription('Patch glfw extension before buildconf')]
2021
public function patchBeforeBuildconf(): void
2122
{

src/Package/Library/glfw.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use StaticPHP\Exception\ValidationException;
1212
use StaticPHP\Package\LibraryPackage;
1313
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
14+
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
1415
use StaticPHP\Runtime\SystemTarget;
1516
use StaticPHP\Toolchain\Interface\ToolchainInterface;
1617

@@ -97,4 +98,19 @@ public function buildForMac(LibraryPackage $lib): void
9798
// patch pkgconf
9899
$lib->patchPkgconfPrefix(['glfw3.pc']);
99100
}
101+
102+
#[BuildFor('Windows')]
103+
public function buildForWin(LibraryPackage $lib): void
104+
{
105+
WindowsCMakeExecutor::create($lib)
106+
->setWorkingDir("{$lib->getSourceDir()}/vendor/glfw")
107+
->setBuildDir("{$lib->getSourceDir()}/vendor/glfw")
108+
->setReset(false)
109+
->addConfigureArgs(
110+
'-DGLFW_BUILD_EXAMPLES=OFF',
111+
'-DGLFW_BUILD_TESTS=OFF',
112+
'-DGLFW_BUILD_DOCS=OFF',
113+
)
114+
->build();
115+
}
100116
}

0 commit comments

Comments
 (0)