From 8202b3e7dc17d3e659379787bbc13f16e418d381 Mon Sep 17 00:00:00 2001 From: Hao Zhong Date: Fri, 15 Nov 2019 10:43:47 +0100 Subject: [PATCH 1/2] vs2017 support and x64 fix for vs2015 --- Source/cmGlobalFastbuildGenerator.cxx | 32 ++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/Source/cmGlobalFastbuildGenerator.cxx b/Source/cmGlobalFastbuildGenerator.cxx index 899de71b05a..4d607e2c64d 100644 --- a/Source/cmGlobalFastbuildGenerator.cxx +++ b/Source/cmGlobalFastbuildGenerator.cxx @@ -1501,12 +1501,29 @@ class cmGlobalFastbuildGenerator::Detail::Detection bool clIsX64 = (dirName == "amd64"); const std::string prefixBinCL = "$CompilerRoot$\\"; - const std::string prefixBinMS = inSubdir ? prefixBinCL+"..\\" : prefixBinCL; + const std::string prefixBinMS = (inSubdir&&!clIsX64) ? prefixBinCL+"..\\" : prefixBinCL; const std::string prefixBinUI = prefixBinCL + "1033\\"; - const std::string prefixBinCRT = clIsX64 ? prefixBinMS + "..\\redist\\x64\\" : prefixBinMS + "..\\redist\\x86\\"; - - - if (version.compare(0, 3, "19.") != std::string::npos) + const std::string prefixBinCRT = (inSubdir ? prefixBinCL + "..\\" : prefixBinCL) + (clIsX64 ? "..\\redist\\x64\\" : "..\\redist\\x86\\"); + + if (version.compare(0, 4, "19.1") != std::string::npos) { + //using vs2017 + std::string vs2017_extraFiles[11] = { + prefixBinCL + "c1.dll", + prefixBinCL + "c1xx.dll", + prefixBinCL + "c2.dll", + + prefixBinCL + "msobj140.dll", + prefixBinCL + "mspdb140.dll", + prefixBinCL + "mspdbsrv.exe", // not sure this one makes sense... + prefixBinCL + "mspdbcore.dll", + prefixBinCL + "mspft140.dll", + prefixBinUI + "clui.dll", + prefixBinCL + "msvcp140.dll", + prefixBinCL + "vcruntime140.dll", + }; + extraFiles.insert(extraFiles.end(), &vs2017_extraFiles[0], &vs2017_extraFiles[11]); + } + else if (version.compare(0, 3, "19.") != std::string::npos) { // Using vs2015 std::string vs2015_extraFiles[12] = { @@ -3908,7 +3925,10 @@ class cmGlobalFastbuildGenerator::Detail::Generation std::string compilerVersion = mf->GetSafeDefinition(compilerVar + "_VERSION"); if (compilerId == "MSVC") { - if (compilerVersion.compare(0, 3, "19.") != std::string::npos) + if (compilerVersion.compare(0, 4, "19.1") != std::string::npos) { + platformToolset = "v141"; + } + else if (compilerVersion.compare(0, 3, "19.") != std::string::npos) { // Using vs2015 / vc14 platformToolset = "v140"; From 96b66f7f21d5644ce54adc1cf80756ce2dce1488 Mon Sep 17 00:00:00 2001 From: Hao Zhong Date: Fri, 15 Nov 2019 16:21:52 +0100 Subject: [PATCH 2/2] add vs 2019 support --- Source/cmGlobalFastbuildGenerator.cxx | 71 ++++++++++++++++++--------- 1 file changed, 48 insertions(+), 23 deletions(-) diff --git a/Source/cmGlobalFastbuildGenerator.cxx b/Source/cmGlobalFastbuildGenerator.cxx index 4d607e2c64d..611c227f163 100644 --- a/Source/cmGlobalFastbuildGenerator.cxx +++ b/Source/cmGlobalFastbuildGenerator.cxx @@ -1503,26 +1503,48 @@ class cmGlobalFastbuildGenerator::Detail::Detection const std::string prefixBinCL = "$CompilerRoot$\\"; const std::string prefixBinMS = (inSubdir&&!clIsX64) ? prefixBinCL+"..\\" : prefixBinCL; const std::string prefixBinUI = prefixBinCL + "1033\\"; - const std::string prefixBinCRT = (inSubdir ? prefixBinCL + "..\\" : prefixBinCL) + (clIsX64 ? "..\\redist\\x64\\" : "..\\redist\\x86\\"); - - if (version.compare(0, 4, "19.1") != std::string::npos) { - //using vs2017 - std::string vs2017_extraFiles[11] = { - prefixBinCL + "c1.dll", - prefixBinCL + "c1xx.dll", - prefixBinCL + "c2.dll", - - prefixBinCL + "msobj140.dll", - prefixBinCL + "mspdb140.dll", - prefixBinCL + "mspdbsrv.exe", // not sure this one makes sense... - prefixBinCL + "mspdbcore.dll", - prefixBinCL + "mspft140.dll", - prefixBinUI + "clui.dll", - prefixBinCL + "msvcp140.dll", - prefixBinCL + "vcruntime140.dll", - }; - extraFiles.insert(extraFiles.end(), &vs2017_extraFiles[0], &vs2017_extraFiles[11]); - } + const std::string prefixBinCRT = (inSubdir ? prefixBinCL + "..\\" : prefixBinCL) + (clIsX64 ? "..\\redist\\x64\\" : "..\\redist\\x86\\"); + if( version.compare(0,4,"19.2")!=std::string::npos ) { + // vs 2019 + std::string vs_2019_extraFiles[12] = { + prefixBinCL + "c1.dll", + prefixBinCL + "c1xx.dll", + prefixBinCL + "c2.dll", + + prefixBinCL + "msobj140.dll", + prefixBinCL + "mspdb140.dll", + prefixBinCL + "mspdbsrv.exe", // not sure this one makes sense... + prefixBinCL + "mspdbcore.dll", + prefixBinCL + "mspft140.dll", + prefixBinUI + "clui.dll", + prefixBinCL + "msvcp140.dll", + prefixBinCL + "vcruntime140.dll", + prefixBinCL + "tbbmalloc.dll" // tbbmalloc.dll is added and used by vs 2019 compiler + }; + extraFiles.insert(extraFiles.end(), &vs_2019_extraFiles[0], &vs_2019_extraFiles[12]); + } + else if( version.compare(0,4,"19.1")!=std::string::npos ) { + // vs 2017 + // in certain versions of vs 2017 there are bugs that some of the mspdb files are not available + // for x64 x86 cross compilation, at least the latest version of vs 2017 have those fixed + std::string vs_2017_extraFiles[11] = { + prefixBinCL + "c1.dll", + prefixBinCL + "c1xx.dll", + prefixBinCL + "c2.dll", + + prefixBinCL + "msobj140.dll", + prefixBinCL + "mspdb140.dll", + prefixBinCL + "mspdbsrv.exe", // not sure this one makes sense... + prefixBinCL + "mspdbcore.dll", + prefixBinCL + "mspft140.dll", + prefixBinUI + "clui.dll", + prefixBinCL + "msvcp140.dll", + prefixBinCL + "vcruntime140.dll" + // the location of vccorlib140 seems to be harder to reach, but that seems not to be needed + // can be added later if necessary + }; + extraFiles.insert(extraFiles.end(), &vs_2017_extraFiles[0], &vs_2017_extraFiles[11]); + } else if (version.compare(0, 3, "19.") != std::string::npos) { // Using vs2015 @@ -3925,9 +3947,12 @@ class cmGlobalFastbuildGenerator::Detail::Generation std::string compilerVersion = mf->GetSafeDefinition(compilerVar + "_VERSION"); if (compilerId == "MSVC") { - if (compilerVersion.compare(0, 4, "19.1") != std::string::npos) { - platformToolset = "v141"; - } + if (compilerVersion.compare(0, 4, "19.1") != std::string::npos) { + platformToolset = "v141"; + } + else if (compilerVersion.compare(0, 4, "19.2") != std::string::npos) { + platformToolset = "v142"; + } else if (compilerVersion.compare(0, 3, "19.") != std::string::npos) { // Using vs2015 / vc14