mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-03 14:55:39 +08:00
40 lines
1018 B
PHP
40 lines
1018 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Package\Library;
|
|
|
|
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
|
|
{
|
|
#[BuildFor('Darwin')]
|
|
#[BuildFor('Linux')]
|
|
public function buildUnix(LibraryPackage $lib): void
|
|
{
|
|
UnixCMakeExecutor::create($lib)
|
|
->setBuildDir("{$lib->getSourceDir()}/cmake/build")
|
|
->addConfigureArgs(
|
|
'-DSNAPPY_BUILD_TESTS=OFF',
|
|
'-DSNAPPY_BUILD_BENCHMARKS=OFF',
|
|
)
|
|
->build('../..');
|
|
}
|
|
|
|
#[BuildFor('Windows')]
|
|
public function buildWin(LibraryPackage $lib): void
|
|
{
|
|
WindowsCMakeExecutor::create($lib)
|
|
->addConfigureArgs(
|
|
'-DSNAPPY_BUILD_TESTS=OFF',
|
|
'-DSNAPPY_BUILD_BENCHMARKS=OFF',
|
|
)
|
|
->build();
|
|
}
|
|
}
|