feat(php): 添加C++标准版本配置选项

- 引入cxxStd属性,默认设置为c++14标准
- 在编译命令中自动添加-std参数
- 避免重复添加标准参数的逻辑检查
- 支持自定义C++编译标准版本配置
pull/1/head
韩天峰 4 months ago
parent 4293e95664
commit 10ab3d44a7
  1. 4
      src/Php/CompilerBase.php

@ -156,6 +156,7 @@ class CompilerBase extends \PhpAot\Core\Translator
protected int $maxJob = 4;
protected string $buildMode = 'bin';
protected string $cxxflags = '';
protected string $cxxStd = 'c++14';
protected string $ldflags = '';
protected int $floatPrecision = 17;
protected bool $debugInfo = false;
@ -2110,6 +2111,9 @@ class CompilerBase extends \PhpAot\Core\Translator
if ($this->cxxflags) {
$cmd .= ' ' . $this->cxxflags;
}
if (!str_contains($this->cxxflags, ' -std=')) {
$cmd .= ' -std=' . $this->cxxStd;
}
}
}

Loading…
Cancel
Save