mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-01-15 02:57:56 +08:00
Merge pull request #1752 from martin-s/patch-vs2013
Added support for VS2013 build chain tools.
This commit is contained in:
commit
f7c10858f7
@ -61,6 +61,14 @@ function(vcpkg_configure_cmake)
|
||||
set(GENERATOR ${_csc_GENERATOR})
|
||||
elseif(_csc_PREFER_NINJA AND NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND NOT _csc_HOST_ARCHITECTURE STREQUAL "x86")
|
||||
set(GENERATOR "Ninja")
|
||||
|
||||
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v120")
|
||||
set(GENERATOR "Visual Studio 12 2013")
|
||||
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v120")
|
||||
set(GENERATOR "Visual Studio 12 2013 Win64")
|
||||
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "arm" AND VCPKG_PLATFORM_TOOLSET MATCHES "v120")
|
||||
set(GENERATOR "Visual Studio 12 2013 ARM")
|
||||
|
||||
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND VCPKG_TARGET_ARCHITECTURE MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140")
|
||||
set(GENERATOR "Visual Studio 14 2015")
|
||||
elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND VCPKG_TARGET_ARCHITECTURE MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140")
|
||||
|
@ -67,7 +67,7 @@ namespace vcpkg
|
||||
|
||||
/// <summary>Retrieve a toolset matching a VS version</summary>
|
||||
/// <remarks>
|
||||
/// Valid version strings are "v140", "v141", and "". Empty string gets the latest.
|
||||
/// Valid version strings are "v120", "v140", "v141", and "". Empty string gets the latest.
|
||||
/// </remarks>
|
||||
const Toolset& get_toolset(const Optional<std::string>& toolset_version,
|
||||
const Optional<fs::path>& visual_studio_path) const;
|
||||
@ -83,5 +83,6 @@ namespace vcpkg
|
||||
Lazy<fs::path> ifw_binarycreator_exe;
|
||||
Lazy<fs::path> ifw_repogen_exe;
|
||||
Lazy<std::vector<Toolset>> toolsets;
|
||||
Lazy<std::vector<Toolset>> toolsets_vs2013;
|
||||
};
|
||||
}
|
||||
|
@ -38,27 +38,41 @@ namespace vcpkg::PostBuildLint
|
||||
}
|
||||
};
|
||||
|
||||
Span<const OutdatedDynamicCrt> get_outdated_dynamic_crts(CStringView toolset)
|
||||
Span<const OutdatedDynamicCrt> get_outdated_dynamic_crts(const Optional<std::string>& toolset_version)
|
||||
{
|
||||
static const std::vector<OutdatedDynamicCrt> V_NO_MSVCRT = {
|
||||
static const std::vector<OutdatedDynamicCrt> V_NO_120 = {
|
||||
{"msvcp100.dll", R"(msvcp100\.dll)"},
|
||||
{"msvcp100d.dll", R"(msvcp100d\.dll)"},
|
||||
{"msvcp110.dll", R"(msvcp110\.dll)"},
|
||||
{"msvcp110_win.dll", R"(msvcp110_win\.dll)"},
|
||||
{"msvcp120.dll", R"(msvcp120\.dll)"},
|
||||
{"msvcp120_clr0400.dll", R"(msvcp120_clr0400\.dll)"},
|
||||
{"msvcp60.dll", R"(msvcp60\.dll)"},
|
||||
{"msvcp60.dll", R"(msvcp60\.dll)"},
|
||||
|
||||
{"msvcrt.dll", R"(msvcrt\.dll)"},
|
||||
{"msvcr100.dll", R"(msvcr100\.dll)"},
|
||||
{"msvcr100d.dll", R"(msvcr100d\.dll)"},
|
||||
{"msvcr100_clr0400.dll", R"(msvcr100_clr0400\.dll)"},
|
||||
{"msvcr110.dll", R"(msvcr110\.dll)"},
|
||||
{"msvcr120.dll", R"(msvcr120\.dll)"},
|
||||
{"msvcr120_clr0400.dll", R"(msvcr120_clr0400\.dll)"},
|
||||
{"msvcrt20.dll", R"(msvcrt20\.dll)"},
|
||||
{"msvcrt40.dll", R"(msvcrt40\.dll)"}};
|
||||
{"msvcrt40.dll", R"(msvcrt40\.dll)"},
|
||||
};
|
||||
|
||||
static const std::vector<OutdatedDynamicCrt> V_NO_MSVCRT = [&]() {
|
||||
auto ret = V_NO_120;
|
||||
ret.push_back({"msvcp120.dll", R"(msvcp120\.dll)"});
|
||||
ret.push_back({"msvcp120_clr0400.dll", R"(msvcp120_clr0400\.dll)"});
|
||||
ret.push_back({"msvcr120.dll", R"(msvcr120\.dll)"});
|
||||
ret.push_back({"msvcr120_clr0400.dll", R"(msvcr120_clr0400\.dll)"});
|
||||
return ret;
|
||||
}();
|
||||
|
||||
const auto tsv = toolset_version.get();
|
||||
if (tsv && (*tsv) == "v120")
|
||||
{
|
||||
return V_NO_120;
|
||||
}
|
||||
|
||||
// Default case for all version >= VS 2015.
|
||||
return V_NO_MSVCRT;
|
||||
}
|
||||
|
||||
@ -639,7 +653,8 @@ namespace vcpkg::PostBuildLint
|
||||
|
||||
static LintStatus check_outdated_crt_linkage_of_dlls(const std::vector<fs::path>& dlls,
|
||||
const fs::path dumpbin_exe,
|
||||
const BuildInfo& build_info)
|
||||
const BuildInfo& build_info,
|
||||
const PreBuildInfo& pre_build_info)
|
||||
{
|
||||
if (build_info.policies.is_enabled(BuildPolicy::ALLOW_OBSOLETE_MSVCRT)) return LintStatus::SUCCESS;
|
||||
|
||||
@ -651,7 +666,7 @@ namespace vcpkg::PostBuildLint
|
||||
System::ExitCodeAndOutput ec_data = System::cmd_execute_and_capture_output(cmd_line);
|
||||
Checks::check_exit(VCPKG_LINE_INFO, ec_data.exit_code == 0, "Running command:\n %s\n failed", cmd_line);
|
||||
|
||||
for (const OutdatedDynamicCrt& outdated_crt : get_outdated_dynamic_crts("v141"))
|
||||
for (const OutdatedDynamicCrt& outdated_crt : get_outdated_dynamic_crts(pre_build_info.platform_toolset))
|
||||
{
|
||||
if (std::regex_search(ec_data.output.cbegin(), ec_data.output.cend(), outdated_crt.regex))
|
||||
{
|
||||
@ -777,7 +792,7 @@ namespace vcpkg::PostBuildLint
|
||||
error_count += check_uwp_bit_of_dlls(pre_build_info.cmake_system_name, dlls, toolset.dumpbin);
|
||||
error_count += check_dll_architecture(pre_build_info.target_architecture, dlls);
|
||||
|
||||
error_count += check_outdated_crt_linkage_of_dlls(dlls, toolset.dumpbin, build_info);
|
||||
error_count += check_outdated_crt_linkage_of_dlls(dlls, toolset.dumpbin, build_info, pre_build_info);
|
||||
break;
|
||||
}
|
||||
case Build::LinkageType::STATIC:
|
||||
|
@ -447,38 +447,38 @@ namespace vcpkg
|
||||
continue;
|
||||
}
|
||||
|
||||
if (major_version == "14")
|
||||
if (major_version == "14" || major_version == "12")
|
||||
{
|
||||
const fs::path vcvarsall_bat = vs_instance.root_path / "VC" / "vcvarsall.bat";
|
||||
|
||||
paths_examined.push_back(vcvarsall_bat);
|
||||
if (fs.exists(vcvarsall_bat))
|
||||
{
|
||||
const fs::path vs2015_dumpbin_exe = vs_instance.root_path / "VC" / "bin" / "dumpbin.exe";
|
||||
paths_examined.push_back(vs2015_dumpbin_exe);
|
||||
const fs::path vs_dumpbin_exe = vs_instance.root_path / "VC" / "bin" / "dumpbin.exe";
|
||||
paths_examined.push_back(vs_dumpbin_exe);
|
||||
|
||||
const fs::path vs2015_bin_dir = vcvarsall_bat.parent_path() / "bin";
|
||||
const fs::path vs_bin_dir = vcvarsall_bat.parent_path() / "bin";
|
||||
std::vector<ToolsetArchOption> supported_architectures;
|
||||
if (fs.exists(vs2015_bin_dir / "vcvars32.bat"))
|
||||
if (fs.exists(vs_bin_dir / "vcvars32.bat"))
|
||||
supported_architectures.push_back({"x86", CPU::X86, CPU::X86});
|
||||
if (fs.exists(vs2015_bin_dir / "amd64\\vcvars64.bat"))
|
||||
if (fs.exists(vs_bin_dir / "amd64\\vcvars64.bat"))
|
||||
supported_architectures.push_back({"x64", CPU::X64, CPU::X64});
|
||||
if (fs.exists(vs2015_bin_dir / "x86_amd64\\vcvarsx86_amd64.bat"))
|
||||
if (fs.exists(vs_bin_dir / "x86_amd64\\vcvarsx86_amd64.bat"))
|
||||
supported_architectures.push_back({"x86_amd64", CPU::X86, CPU::X64});
|
||||
if (fs.exists(vs2015_bin_dir / "x86_arm\\vcvarsx86_arm.bat"))
|
||||
if (fs.exists(vs_bin_dir / "x86_arm\\vcvarsx86_arm.bat"))
|
||||
supported_architectures.push_back({"x86_arm", CPU::X86, CPU::ARM});
|
||||
if (fs.exists(vs2015_bin_dir / "amd64_x86\\vcvarsamd64_x86.bat"))
|
||||
if (fs.exists(vs_bin_dir / "amd64_x86\\vcvarsamd64_x86.bat"))
|
||||
supported_architectures.push_back({"amd64_x86", CPU::X64, CPU::X86});
|
||||
if (fs.exists(vs2015_bin_dir / "amd64_arm\\vcvarsamd64_arm.bat"))
|
||||
if (fs.exists(vs_bin_dir / "amd64_arm\\vcvarsamd64_arm.bat"))
|
||||
supported_architectures.push_back({"amd64_arm", CPU::X64, CPU::ARM});
|
||||
|
||||
if (fs.exists(vs2015_dumpbin_exe))
|
||||
if (fs.exists(vs_dumpbin_exe))
|
||||
{
|
||||
found_toolsets.push_back({vs_instance.root_path,
|
||||
vs2015_dumpbin_exe,
|
||||
vs_dumpbin_exe,
|
||||
vcvarsall_bat,
|
||||
{},
|
||||
V_140,
|
||||
major_version == "14" ? V_140 : V_120,
|
||||
supported_architectures});
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user