Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cmake version check #400

Merged
merged 2 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/SPC/doctor/item/LinuxToolCheckList.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,22 @@ public function checkCliTools(): ?CheckResult
return CheckResult::ok();
}

#[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]);
}
return CheckResult::fail('Failed to get cmake version');
}

/** @noinspection PhpUnused */
#[AsCheckItem('if necessary linux headers are installed', limit_os: 'Linux')]
public function checkSystemOSPackages(): ?CheckResult
Expand Down
2 changes: 1 addition & 1 deletion src/SPC/doctor/item/OSCheckList.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function checkOS(): ?CheckResult
return CheckResult::fail('Current OS is not supported: ' . PHP_OS_FAMILY);
}
$distro = PHP_OS_FAMILY === 'Linux' ? (' ' . SystemUtil::getOSRelease()['dist']) : '';
$known_distro = PHP_OS_FAMILY === 'Linux' && in_array(SystemUtil::getOSRelease()['dist'], SystemUtil::getSupportedDistros());
$known_distro = PHP_OS_FAMILY !== 'Linux' || in_array(SystemUtil::getOSRelease()['dist'], SystemUtil::getSupportedDistros());
return CheckResult::ok(PHP_OS_FAMILY . ' ' . php_uname('m') . $distro . ', supported' . ($known_distro ? '' : ' (but not tested on this distro)'));
}
}
Loading