From 10ab3d44a74abb0592b3c8870d9610ce383947d5 Mon Sep 17 00:00:00 2001 From: tianfenghan Date: Tue, 28 Apr 2026 18:57:38 +0800 Subject: [PATCH] =?UTF-8?q?feat(php):=20=E6=B7=BB=E5=8A=A0C++=E6=A0=87?= =?UTF-8?q?=E5=87=86=E7=89=88=E6=9C=AC=E9=85=8D=E7=BD=AE=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 引入cxxStd属性,默认设置为c++14标准 - 在编译命令中自动添加-std参数 - 避免重复添加标准参数的逻辑检查 - 支持自定义C++编译标准版本配置 --- src/Php/CompilerBase.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Php/CompilerBase.php b/src/Php/CompilerBase.php index 40bfe68c..517f6c10 100644 --- a/src/Php/CompilerBase.php +++ b/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; + } } }