Skip to content

Instantly share code, notes, and snippets.

@cmb69 cmb69/.diff
Created May 20, 2019

Embed
What would you like to do?
PGO CRT selection
lib/php/libsdk/SDK/Build/PGO/Abstracts/PHP.php | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/lib/php/libsdk/SDK/Build/PGO/Abstracts/PHP.php b/lib/php/libsdk/SDK/Build/PGO/Abstracts/PHP.php
index 7cba0ba..5cb76fc 100644
--- a/lib/php/libsdk/SDK/Build/PGO/Abstracts/PHP.php
+++ b/lib/php/libsdk/SDK/Build/PGO/Abstracts/PHP.php
@@ -117,6 +117,30 @@ abstract class PHP
return $ret;
}
+ public function getCrtName() : string
+ {
+ $cli = new CLI($this->conf, $this->scenario);
+
+ $out = shell_exec($cli->getExeFilename() . " -n -v");
+
+ if (!preg_match(",Visual C\\+\\+ (\d{4}),", $out, $m)) {
+ return 'unknown';
+ }
+
+ switch ($m[1]) {
+ case 2012:
+ return 'vc11';
+ case 2015:
+ return 'vc14';
+ case 2017:
+ return 'vc15';
+ case 2019:
+ return 'vs16';
+ default:
+ return 'unknown';
+ }
+ }
+
public function isThreadSafe() : bool
{
$cli = new CLI($this->conf, $this->scenario);
@@ -238,7 +262,7 @@ abstract class PHP
public function getIdString(): string
{
return $this->getVersion() . "-"
- . SDKConfig::getCurrentCrtName() . "-"
+ . $this->getCrtName() . "-"
. ($this->isThreadSafe() ? "ts" : "nts") . "-"
. ($this->is64bit() ? "x64" : "x86")
. "-" . substr(md5(uniqid()), 0, 8);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.