Allow set current working dir

This commit is contained in:
crazywhalecc
2026-03-21 00:30:15 +08:00
parent 19bfb6bc83
commit d1ec473f21
2 changed files with 9 additions and 3 deletions

View File

@@ -17,7 +17,7 @@ class zstd
public function buildWin(LibraryPackage $package): void
{
WindowsCMakeExecutor::create($package)
->setRootDir("{$package->getSourceDir()}/build/cmake")
->setWorkingDir("{$package->getSourceDir()}/build/cmake")
->setBuildDir("{$package->getSourceDir()}/build/cmake/build")
->addConfigureArgs(
'-DZSTD_BUILD_STATIC=ON',

View File

@@ -176,6 +176,12 @@ class WindowsCMakeExecutor extends Executor
return implode(' ', array_merge($this->configure_args, $this->getDefaultCMakeArgs()));
}
public function setWorkingDir(string $dir): static
{
$this->cmd = $this->cmd->cd($dir);
return $this;
}
/**
* Returns the default CMake args.
*/
@@ -207,12 +213,12 @@ class WindowsCMakeExecutor extends Executor
private function initBuildDir(): void
{
if ($this->build_dir === null) {
$this->build_dir = "{$this->package->getSourceDir()}\\build";
$this->build_dir = "{$this->package->getSourceRoot()}\\build";
}
}
private function initCmd(): void
{
$this->cmd = cmd()->cd($this->package->getSourceDir());
$this->cmd = cmd()->cd($this->package->getSourceRoot());
}
}