Created
May 20, 2019 16:14
-
-
Save cmb69/037555cadd0a9daab9f32ea78550e407 to your computer and use it in GitHub Desktop.
PGO CRT selection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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