Add ext-snappy and snappy support on Windows

This commit is contained in:
crazywhalecc
2026-04-10 15:34:55 +08:00
parent 323f1ec00e
commit 35b23a532f
3 changed files with 20 additions and 0 deletions

View File

@@ -16,3 +16,4 @@ ext-snappy:
lang: cpp
php-extension:
arg-type@unix: '--enable-snappy --with-snappy-includedir=@build_root_path@'
arg-type@windows: '--enable-snappy'

View File

@@ -15,6 +15,13 @@ snappy:
- snappy-c.h
- snappy-sinksource.h
- snappy-stubs-public.h
headers@windows:
- snappy.h
- snappy-c.h
- snappy-sinksource.h
- snappy-stubs-public.h
lang: cpp
static-libs@unix:
- libsnappy.a
static-libs@windows:
- snappy.lib

View File

@@ -8,6 +8,7 @@ use StaticPHP\Attribute\Package\BuildFor;
use StaticPHP\Attribute\Package\Library;
use StaticPHP\Package\LibraryPackage;
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
#[Library('snappy')]
class snappy
@@ -24,4 +25,15 @@ class snappy
)
->build('../..');
}
#[BuildFor('Windows')]
public function buildWin(LibraryPackage $lib): void
{
WindowsCMakeExecutor::create($lib)
->addConfigureArgs(
'-DSNAPPY_BUILD_TESTS=OFF',
'-DSNAPPY_BUILD_BENCHMARKS=OFF',
)
->build();
}
}