mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-25 09:59:07 +08:00
Revert "Extract function for duplicated code"
This reverts commit eca068e4c5
.
This commit is contained in:
parent
f37e66b34d
commit
450cb8591a
@ -273,29 +273,10 @@ namespace vcpkg
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
static std::vector<ToolsetArchOption> detect_supported_architectures(const Files::Filesystem& fs,
|
||||
const fs::path& vcvarsall_dir)
|
||||
{
|
||||
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)
|
||||
{
|
||||
using CPU = System::CPUArchitecture;
|
||||
|
||||
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";
|
||||
|
Loading…
Reference in New Issue
Block a user