mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-03 23:05:41 +08:00
force minimum version 3.12 for cmake policies in freetype, only when cmake >= 4
This commit is contained in:
@@ -18,6 +18,10 @@ trait freetype
|
||||
*/
|
||||
protected function build(): void
|
||||
{
|
||||
$extra = '';
|
||||
if (version_compare(get_cmake_version(), '4.0.0', '>=')) {
|
||||
$extra .= '-DCMAKE_POLICY_VERSION_MINIMUM=3.12 ';
|
||||
}
|
||||
$extra_libs = $this->builder->getLib('libpng') ? '-DFT_DISABLE_PNG=OFF ' : '-DFT_DISABLE_PNG=ON ';
|
||||
$extra_libs .= $this->builder->getLib('bzip2') ? '-DFT_DISABLE_BZIP2=OFF ' : '-DFT_DISABLE_BZIP2=ON ';
|
||||
$extra_libs .= $this->builder->getLib('brotli') ? '-DFT_DISABLE_BROTLI=OFF ' : '-DFT_DISABLE_BROTLI=ON ';
|
||||
@@ -25,7 +29,7 @@ trait freetype
|
||||
shell()->cd($this->source_dir . '/build')
|
||||
->setEnv(['CFLAGS' => $this->getLibExtraCFlags(), 'LDFLAGS' => $this->getLibExtraLdFlags(), 'LIBS' => $this->getLibExtraLibs()])
|
||||
->execWithEnv(
|
||||
"cmake {$this->builder->makeCmakeArgs()} -DFT_DISABLE_HARFBUZZ=ON -DCMAKE_POLICY_VERSION_MINIMUM=3.5 " .
|
||||
"cmake {$this->builder->makeCmakeArgs()} -DFT_DISABLE_HARFBUZZ=ON {$extra}" .
|
||||
'-DBUILD_SHARED_LIBS=OFF ' .
|
||||
"{$extra_libs}.."
|
||||
)
|
||||
|
||||
@@ -87,17 +87,14 @@ class LinuxToolCheckList
|
||||
#[AsCheckItem('if cmake version >= 3.18', limit_os: 'Linux')]
|
||||
public function checkCMakeVersion(): ?CheckResult
|
||||
{
|
||||
$check_cmd = 'cmake --version';
|
||||
$pattern = '/cmake version (.*)/m';
|
||||
$out = shell()->execWithResult($check_cmd, false)[1][0];
|
||||
if (preg_match($pattern, $out, $match)) {
|
||||
$ver = $match[1];
|
||||
if (version_compare($ver, '3.18.0') <= 0) {
|
||||
return CheckResult::fail('cmake version is too low (' . $ver . '), please update it manually!');
|
||||
}
|
||||
return CheckResult::ok($match[1]);
|
||||
$ver = get_cmake_version();
|
||||
if ($ver === null) {
|
||||
return CheckResult::fail('Failed to get cmake version');
|
||||
}
|
||||
return CheckResult::fail('Failed to get cmake version');
|
||||
if (version_compare($ver, '3.18.0') < 0) {
|
||||
return CheckResult::fail('cmake version is too low (' . $ver . '), please update it manually!');
|
||||
}
|
||||
return CheckResult::ok($ver);
|
||||
}
|
||||
|
||||
/** @noinspection PhpUnused */
|
||||
|
||||
Reference in New Issue
Block a user