aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src/VcpkgPaths.cpp
diff options
context:
space:
mode:
authorAlexander Karatarakis <alkarata@microsoft.com>2017-09-28 19:39:11 -0700
committerAlexander Karatarakis <alkarata@microsoft.com>2017-09-28 19:39:11 -0700
commit450cb8591a5023f762b4b928cb36ca632d0fe7b3 (patch)
tree4710c8032d19238dd8863fd91d2ad60d5e200a8b /toolsrc/src/VcpkgPaths.cpp
parentf37e66b34d0a65a615117944334aca25f49e3d8e (diff)
downloadvcpkg-450cb8591a5023f762b4b928cb36ca632d0fe7b3.tar.gz
vcpkg-450cb8591a5023f762b4b928cb36ca632d0fe7b3.zip
Revert "Extract function for duplicated code"
This reverts commit eca068e4c5673b888d6470b42d6b5b44b21c4007.
Diffstat (limited to 'toolsrc/src/VcpkgPaths.cpp')
-rw-r--r--toolsrc/src/VcpkgPaths.cpp51
1 files changed, 27 insertions, 24 deletions
diff --git a/toolsrc/src/VcpkgPaths.cpp b/toolsrc/src/VcpkgPaths.cpp
index 8892207bd..4634a87c0 100644
--- a/toolsrc/src/VcpkgPaths.cpp
+++ b/toolsrc/src/VcpkgPaths.cpp
@@ -273,29 +273,10 @@ namespace vcpkg
return nullopt;
}
- static std::vector<ToolsetArchOption> detect_supported_architectures(const Files::Filesystem& fs,
- const fs::path& vcvarsall_dir)
+ static std::vector<Toolset> find_toolset_instances(const VcpkgPaths& paths)
{
using CPU = System::CPUArchitecture;
- std::vector<ToolsetArchOption> supported_architectures;
-
- if (fs.exists(vcvarsall_dir / "vcvars32.bat")) supported_architectures.push_back({L"x86", CPU::X86, CPU::X86});
- if (fs.exists(vcvarsall_dir / "vcvars64.bat"))
- supported_architectures.push_back({L"amd64", CPU::X64, CPU::X64});
- if (fs.exists(vcvarsall_dir / "vcvarsx86_amd64.bat"))
- supported_architectures.push_back({L"x86_amd64", CPU::X86, CPU::X64});
- if (fs.exists(vcvarsall_dir / "vcvarsx86_arm.bat"))
- supported_architectures.push_back({L"x86_arm", CPU::X86, CPU::ARM});
- if (fs.exists(vcvarsall_dir / "vcvarsamd64_x86.bat"))
- supported_architectures.push_back({L"amd64_x86", CPU::X64, CPU::X86});
- if (fs.exists(vcvarsall_dir / "vcvarsamd64_arm.bat"))
- supported_architectures.push_back({L"amd64_arm", CPU::X64, CPU::ARM});
-
- return supported_architectures;
- }
- static std::vector<Toolset> find_toolset_instances(const VcpkgPaths& paths)
- {
const auto& fs = paths.get_filesystem();
// Note: this will contain a mix of vcvarsall.bat locations and dumpbin.exe locations.
@@ -316,8 +297,19 @@ namespace vcpkg
paths_examined.push_back(vs2015_dumpbin_exe);
const fs::path vs2015_bin_dir = vs2015_vcvarsall_bat.parent_path() / "bin";
- const std::vector<ToolsetArchOption> supported_architectures =
- detect_supported_architectures(fs, vs2015_bin_dir);
+ std::vector<ToolsetArchOption> supported_architectures;
+ if (fs.exists(vs2015_bin_dir / "vcvars32.bat"))
+ supported_architectures.push_back({L"x86", CPU::X86, CPU::X86});
+ if (fs.exists(vs2015_bin_dir / "amd64\\vcvars64.bat"))
+ supported_architectures.push_back({L"x64", CPU::X64, CPU::X64});
+ if (fs.exists(vs2015_bin_dir / "x86_amd64\\vcvarsx86_amd64.bat"))
+ supported_architectures.push_back({L"x86_amd64", CPU::X86, CPU::X64});
+ if (fs.exists(vs2015_bin_dir / "x86_arm\\vcvarsx86_arm.bat"))
+ supported_architectures.push_back({L"x86_arm", CPU::X86, CPU::ARM});
+ if (fs.exists(vs2015_bin_dir / "amd64_x86\\vcvarsamd64_x86.bat"))
+ supported_architectures.push_back({L"amd64_x86", CPU::X64, CPU::X86});
+ if (fs.exists(vs2015_bin_dir / "amd64_arm\\vcvarsamd64_arm.bat"))
+ supported_architectures.push_back({L"amd64_arm", CPU::X64, CPU::ARM});
if (fs.exists(vs2015_dumpbin_exe))
{
@@ -342,8 +334,19 @@ namespace vcpkg
if (!fs.exists(vcvarsall_bat)) continue;
// Get all supported architectures
- const std::vector<ToolsetArchOption> supported_architectures =
- detect_supported_architectures(fs, vcvarsall_dir);
+ std::vector<ToolsetArchOption> supported_architectures;
+ if (fs.exists(vcvarsall_dir / "vcvars32.bat"))
+ supported_architectures.push_back({L"x86", CPU::X86, CPU::X86});
+ if (fs.exists(vcvarsall_dir / "vcvars64.bat"))
+ supported_architectures.push_back({L"amd64", CPU::X64, CPU::X64});
+ if (fs.exists(vcvarsall_dir / "vcvarsx86_amd64.bat"))
+ supported_architectures.push_back({L"x86_amd64", CPU::X86, CPU::X64});
+ if (fs.exists(vcvarsall_dir / "vcvarsx86_arm.bat"))
+ supported_architectures.push_back({L"x86_arm", CPU::X86, CPU::ARM});
+ if (fs.exists(vcvarsall_dir / "vcvarsamd64_x86.bat"))
+ supported_architectures.push_back({L"amd64_x86", CPU::X64, CPU::X86});
+ if (fs.exists(vcvarsall_dir / "vcvarsamd64_arm.bat"))
+ supported_architectures.push_back({L"amd64_arm", CPU::X64, CPU::ARM});
// Locate the "best" MSVC toolchain version
const fs::path msvc_path = vc_dir / "Tools" / "MSVC";