Add optional lib log

This commit is contained in:
crazywhalecc 2025-06-10 15:37:54 +08:00 committed by Jerry Ma
parent da45aa7f15
commit 474fe63ad3
2 changed files with 5 additions and 0 deletions

View File

@ -80,8 +80,10 @@ class UnixAutoconfExecutor extends Executor
public function optionalLib(string $name, \Closure|string $true_args, string $false_args = ''): static
{
if ($get = $this->library->getBuilder()->getLib($name)) {
logger()->info("Building library [{$this->library->getName()}] with {$name} support");
$args = $true_args instanceof \Closure ? $true_args($get) : $true_args;
} else {
logger()->info("Building library [{$this->library->getName()}] without {$name} support");
$args = $false_args;
}
$this->addConfigureArgs($args);

View File

@ -58,8 +58,10 @@ class UnixCMakeExecutor extends Executor
public function optionalLib(string $name, \Closure|string $true_args, string $false_args = ''): static
{
if ($get = $this->library->getBuilder()->getLib($name)) {
logger()->info("Building library [{$this->library->getName()}] with {$name} support");
$args = $true_args instanceof \Closure ? $true_args($get) : $true_args;
} else {
logger()->info("Building library [{$this->library->getName()}] without {$name} support");
$args = $false_args;
}
$this->addConfigureArgs($args);
@ -193,6 +195,7 @@ SET(CMAKE_INSTALL_PREFIX "{$root}")
SET(CMAKE_INSTALL_LIBDIR "lib")
set(PKG_CONFIG_EXECUTABLE "{$root}/bin/pkg-config")
list(APPEND PKG_CONFIG_EXECUTABLE "--static")
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)