Use cmake executor instead of raw command

This commit is contained in:
crazywhalecc
2025-06-09 01:07:30 +08:00
parent 7d26aa533a
commit 1718806042
23 changed files with 151 additions and 394 deletions

View File

@@ -4,9 +4,9 @@ declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\builder\unix\executor\UnixCMakeExecutor;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\store\FileSystem;
trait libheif
{
@@ -16,26 +16,16 @@ trait libheif
*/
protected function build(): void
{
// CMake needs a clean build directory
FileSystem::resetDir($this->source_dir . '/build');
// Start build
shell()->cd($this->source_dir . '/build')
->exec(
'cmake ' .
'--preset=release ' .
'-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' ' .
"-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " .
'-DCMAKE_BUILD_TYPE=Release ' .
'-DBUILD_SHARED_LIBS=OFF ' .
'-DWITH_EXAMPLES=OFF ' .
'-DWITH_GDK_PIXBUF=OFF ' .
'-DBUILD_TESTING=OFF ' .
'-DWITH_LIBSHARPYUV=ON ' . // optional: libwebp
'-DENABLE_PLUGIN_LOADING=OFF ' .
'..'
UnixCMakeExecutor::create($this)
->addConfigureArgs(
'--preset=release',
'-DWITH_EXAMPLES=OFF',
'-DWITH_GDK_PIXBUF=OFF',
'-DBUILD_TESTING=OFF',
'-DWITH_LIBSHARPYUV=ON', // optional: libwebp
'-DENABLE_PLUGIN_LOADING=OFF',
)
->exec("cmake --build . -j {$this->builder->concurrency}")
->exec('make install');
->build();
$this->patchPkgconfPrefix(['libheif.pc']);
}
}