From c167c70c272a417779e601fffcbdb72278da1848 Mon Sep 17 00:00:00 2001 From: martin-s Date: Sat, 2 Sep 2017 16:48:29 +0200 Subject: [PATCH 1/5] - Added support for VS2013 build chain tools. --- scripts/cmake/vcpkg_configure_cmake.cmake | 8 +++ .../findAnyMSBuildWithCppPlatformToolset.ps1 | 39 +++++++++++++-- toolsrc/include/VcpkgPaths.h | 2 +- toolsrc/src/PostBuildLint.cpp | 8 +-- toolsrc/src/VcpkgPaths.cpp | 50 ++++++++++++++++++- 5 files changed, 96 insertions(+), 11 deletions(-) diff --git a/scripts/cmake/vcpkg_configure_cmake.cmake b/scripts/cmake/vcpkg_configure_cmake.cmake index 07acfc8ea..e43075961 100644 --- a/scripts/cmake/vcpkg_configure_cmake.cmake +++ b/scripts/cmake/vcpkg_configure_cmake.cmake @@ -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(TRIPLET_SYSTEM_ARCH MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v120") + set(GENERATOR "Visual Studio 12 2013") + elseif(TRIPLET_SYSTEM_ARCH MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v120") + set(GENERATOR "Visual Studio 12 2013 Win64") + elseif(TRIPLET_SYSTEM_ARCH MATCHES "arm" AND VCPKG_PLATFORM_TOOLSET MATCHES "v120") + set(GENERATOR "Visual Studio 12 2013 ARM") + elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND TRIPLET_SYSTEM_ARCH MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") set(GENERATOR "Visual Studio 14 2015") elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND TRIPLET_SYSTEM_ARCH MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") diff --git a/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 b/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 index f72491e5d..82d9f7c16 100644 --- a/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 +++ b/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 @@ -4,12 +4,15 @@ param( [switch]$DisableVS2017 = $False, [Parameter(Mandatory=$False)] - [switch]$DisableVS2015 = $False + [switch]$DisableVS2015 = $False, + + [Parameter(Mandatory=$False)] + [switch]$DisableVS2013 = $False ) -if ($DisableVS2017 -and $DisableVS2015) +if ($DisableVS2017 -and $DisableVS2015 -and $DisableVS2013) { - throw "Both VS2015 and VS2017 were disabled." + throw "VS013, VS2015 and VS2017 were disabled." } function New-MSBuildInstance() @@ -23,7 +26,7 @@ function New-MSBuildInstance() return $instance } -Write-Verbose "Executing $($MyInvocation.MyCommand.Name) with DisableVS2017=$DisableVS2017, DisableVS2015=$DisableVS2015" +Write-Verbose "Executing $($MyInvocation.MyCommand.Name) with DisableVS2017=$DisableVS2017, DisableVS2015=$DisableVS2015, DisableVS2013=$DisableVS2013" $scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition $validInstances = New-Object System.Collections.ArrayList @@ -139,6 +142,27 @@ foreach ($pair in $registryPairs) $validInstances.Add($instance) > $null } +# VS2013 - in Program Files +Write-Verbose "`n`n" +Write-Verbose "Checking for MSBuild from VS2013 in Program Files..." +$CandidateProgramFiles = $(& $scriptsDir\getProgramFiles32bit.ps1), $(& $scriptsDir\getProgramFilesPlatformBitness.ps1) +Write-Verbose "Program Files Candidate locations: $([system.String]::Join(',', $CandidateProgramFiles))" +foreach ($ProgramFiles in $CandidateProgramFiles) +{ + $clExe= "$ProgramFiles\Microsoft Visual Studio 12.0\VC\bin\cl.exe" + + if (!(Test-Path $clExe)) + { + Write-Verbose "$clExe - Not Found" + continue + } + + Write-Verbose "$clExe - Found" + $instance = New-MSBuildInstance "$ProgramFiles\MSBuild\12.0\Bin\MSBuild.exe" "v120" + Write-Verbose "Found $instance" + $validInstances.Add($instance) > $null +} + Write-Verbose "`n`n`n" Write-Verbose "The following MSBuild instances were found:" foreach ($instance in $validInstances) @@ -158,7 +182,12 @@ foreach ($instance in $validInstances) { return $instance.msbuildExePath, $instance.toolsetVersion } + + if (!$DisableVS2013 -and $instance.toolsetVersion -eq "v120") + { + return $instance.msbuildExePath, $instance.toolsetVersion + } } -throw "Could not find MSBuild version with C++ support. VS2015 or VS2017 (with C++) needs to be installed." \ No newline at end of file +throw "Could not find MSBuild version with C++ support. VS2013, VS2015 or VS2017 (with C++) needs to be installed." \ No newline at end of file diff --git a/toolsrc/include/VcpkgPaths.h b/toolsrc/include/VcpkgPaths.h index d55c95fe1..9b650bb6d 100644 --- a/toolsrc/include/VcpkgPaths.h +++ b/toolsrc/include/VcpkgPaths.h @@ -60,7 +60,7 @@ namespace vcpkg /// Retrieve a toolset matching a VS version /// - /// 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. /// const Toolset& get_toolset(const std::string& toolset_version) const; diff --git a/toolsrc/src/PostBuildLint.cpp b/toolsrc/src/PostBuildLint.cpp index 1fd48d3ec..33dc446cf 100644 --- a/toolsrc/src/PostBuildLint.cpp +++ b/toolsrc/src/PostBuildLint.cpp @@ -45,8 +45,8 @@ namespace vcpkg::PostBuildLint {"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)"}, + //{"msvcp120.dll", R"(msvcp120\.dll)"}, + //{"msvcp120_clr0400.dll", R"(msvcp120_clr0400\.dll)"}, {"msvcp60.dll", R"(msvcp60\.dll)"}, {"msvcp60.dll", R"(msvcp60\.dll)"}, @@ -54,8 +54,8 @@ namespace vcpkg::PostBuildLint {"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)"}, + //{"msvcr120.dll", R"(msvcr120\.dll)"}, + //{"msvcr120_clr0400.dll", R"(msvcr120_clr0400\.dll)"}, {"msvcrt20.dll", R"(msvcrt20\.dll)"}, {"msvcrt40.dll", R"(msvcrt40\.dll)"}}; diff --git a/toolsrc/src/VcpkgPaths.cpp b/toolsrc/src/VcpkgPaths.cpp index 906a5e67f..71a35d24c 100644 --- a/toolsrc/src/VcpkgPaths.cpp +++ b/toolsrc/src/VcpkgPaths.cpp @@ -268,6 +268,19 @@ namespace vcpkg return nullopt; } + + static Optional get_vs2013_installation_instance() + { + const Optional vs2013_cmntools_optional = System::get_environment_variable(L"VS120COMNTOOLS"); + if (const auto v = vs2013_cmntools_optional.get()) + { + const fs::path vs2013_cmntools = fs::path(*v).parent_path(); // The call to parent_path() is needed because + // the env variable has a trailing backslash + return vs2013_cmntools.parent_path().parent_path(); + } + + return nullopt; + } static std::vector find_toolset_instances(const VcpkgPaths& paths) { @@ -275,12 +288,46 @@ namespace vcpkg const auto& fs = paths.get_filesystem(); - const std::vector vs2017_installation_instances = get_vs2017_installation_instances(paths); // Note: this will contain a mix of vcvarsall.bat locations and dumpbin.exe locations. std::vector paths_examined; std::vector found_toolsets; + // VS2013 + const Optional vs_2013_installation_instance = get_vs2013_installation_instance(); + if (const auto v = vs_2013_installation_instance.get()) + { + const fs::path vs2013_vcvarsall_bat = *v / "VC" / "vcvarsall.bat"; + + paths_examined.push_back(vs2013_vcvarsall_bat); + if (fs.exists(vs2013_vcvarsall_bat)) + { + const fs::path vs2013_dumpbin_exe = *v / "VC" / "bin" / "dumpbin.exe"; + paths_examined.push_back(vs2013_dumpbin_exe); + + const fs::path vs2013_bin_dir = vs2013_vcvarsall_bat.parent_path() / "bin"; + std::vector supported_architectures; + if (fs.exists(vs2013_bin_dir / "vcvars32.bat")) + supported_architectures.push_back({L"x86", CPU::X86, CPU::X86}); + if (fs.exists(3 / "amd64\\vcvars64.bat")) + supported_architectures.push_back({L"x64", CPU::X64, CPU::X64}); + if (fs.exists(vs2013_bin_dir / "x86_amd64\\vcvarsx86_amd64.bat")) + supported_architectures.push_back({L"x86_amd64", CPU::X86, CPU::X64}); + if (fs.exists(vs2013_bin_dir / "x86_arm\\vcvarsx86_arm.bat")) + supported_architectures.push_back({L"x86_arm", CPU::X86, CPU::ARM}); + if (fs.exists(vs2013_bin_dir / "amd64_x86\\vcvarsamd64_x86.bat")) + supported_architectures.push_back({L"amd64_x86", CPU::X64, CPU::X86}); + if (fs.exists(vs2013_bin_dir / "amd64_arm\\vcvarsamd64_arm.bat")) + supported_architectures.push_back({L"amd64_arm", CPU::X64, CPU::ARM}); + + if (fs.exists(vs2013_dumpbin_exe)) + { + found_toolsets.push_back( + {vs2013_dumpbin_exe, vs2013_vcvarsall_bat, L"v120", supported_architectures}); + } + } + } + // VS2015 const Optional vs_2015_installation_instance = get_vs2015_installation_instance(); if (const auto v = vs_2015_installation_instance.get()) @@ -318,6 +365,7 @@ namespace vcpkg // VS2017 Optional vs2017_toolset; + const std::vector vs2017_installation_instances = get_vs2017_installation_instances(paths); for (const std::string& instance : vs2017_installation_instances) { const fs::path vc_dir = fs::path{instance} / "VC"; From 433c505e32ec38b8a3395e1f0fe3fca0e9c12cad Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Tue, 3 Oct 2017 15:58:10 -0700 Subject: [PATCH 2/5] [vcpkg] Revert attempt to build vcpkg.exe with VS2013 --- .../findAnyMSBuildWithCppPlatformToolset.ps1 | 39 +++---------------- 1 file changed, 5 insertions(+), 34 deletions(-) diff --git a/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 b/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 index 82d9f7c16..f72491e5d 100644 --- a/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 +++ b/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 @@ -4,15 +4,12 @@ param( [switch]$DisableVS2017 = $False, [Parameter(Mandatory=$False)] - [switch]$DisableVS2015 = $False, - - [Parameter(Mandatory=$False)] - [switch]$DisableVS2013 = $False + [switch]$DisableVS2015 = $False ) -if ($DisableVS2017 -and $DisableVS2015 -and $DisableVS2013) +if ($DisableVS2017 -and $DisableVS2015) { - throw "VS013, VS2015 and VS2017 were disabled." + throw "Both VS2015 and VS2017 were disabled." } function New-MSBuildInstance() @@ -26,7 +23,7 @@ function New-MSBuildInstance() return $instance } -Write-Verbose "Executing $($MyInvocation.MyCommand.Name) with DisableVS2017=$DisableVS2017, DisableVS2015=$DisableVS2015, DisableVS2013=$DisableVS2013" +Write-Verbose "Executing $($MyInvocation.MyCommand.Name) with DisableVS2017=$DisableVS2017, DisableVS2015=$DisableVS2015" $scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition $validInstances = New-Object System.Collections.ArrayList @@ -142,27 +139,6 @@ foreach ($pair in $registryPairs) $validInstances.Add($instance) > $null } -# VS2013 - in Program Files -Write-Verbose "`n`n" -Write-Verbose "Checking for MSBuild from VS2013 in Program Files..." -$CandidateProgramFiles = $(& $scriptsDir\getProgramFiles32bit.ps1), $(& $scriptsDir\getProgramFilesPlatformBitness.ps1) -Write-Verbose "Program Files Candidate locations: $([system.String]::Join(',', $CandidateProgramFiles))" -foreach ($ProgramFiles in $CandidateProgramFiles) -{ - $clExe= "$ProgramFiles\Microsoft Visual Studio 12.0\VC\bin\cl.exe" - - if (!(Test-Path $clExe)) - { - Write-Verbose "$clExe - Not Found" - continue - } - - Write-Verbose "$clExe - Found" - $instance = New-MSBuildInstance "$ProgramFiles\MSBuild\12.0\Bin\MSBuild.exe" "v120" - Write-Verbose "Found $instance" - $validInstances.Add($instance) > $null -} - Write-Verbose "`n`n`n" Write-Verbose "The following MSBuild instances were found:" foreach ($instance in $validInstances) @@ -182,12 +158,7 @@ foreach ($instance in $validInstances) { return $instance.msbuildExePath, $instance.toolsetVersion } - - if (!$DisableVS2013 -and $instance.toolsetVersion -eq "v120") - { - return $instance.msbuildExePath, $instance.toolsetVersion - } } -throw "Could not find MSBuild version with C++ support. VS2013, VS2015 or VS2017 (with C++) needs to be installed." \ No newline at end of file +throw "Could not find MSBuild version with C++ support. VS2015 or VS2017 (with C++) needs to be installed." \ No newline at end of file From 63753e86a60ef508760d9f4dd98b7f2336cd089c Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Tue, 3 Oct 2017 16:00:23 -0700 Subject: [PATCH 3/5] [vcpkg] Split toolset searches based on triplet's specification (don't pick v120 if it's blank). --- toolsrc/include/VcpkgPaths.h | 1 + toolsrc/src/PostBuildLint.cpp | 31 ++++++++++----- toolsrc/src/VcpkgPaths.cpp | 71 +++++++++++++++++++++++------------ 3 files changed, 68 insertions(+), 35 deletions(-) diff --git a/toolsrc/include/VcpkgPaths.h b/toolsrc/include/VcpkgPaths.h index 9914c6f35..9f55dc5ac 100644 --- a/toolsrc/include/VcpkgPaths.h +++ b/toolsrc/include/VcpkgPaths.h @@ -73,5 +73,6 @@ namespace vcpkg Lazy nuget_exe; Lazy> toolsets; Lazy> toolsets_vs2017_v140; + Lazy> toolsets_vs2013; }; } diff --git a/toolsrc/src/PostBuildLint.cpp b/toolsrc/src/PostBuildLint.cpp index 69008fab3..58d6f987b 100644 --- a/toolsrc/src/PostBuildLint.cpp +++ b/toolsrc/src/PostBuildLint.cpp @@ -40,26 +40,36 @@ namespace vcpkg::PostBuildLint Span get_outdated_dynamic_crts(CStringView toolset) { - static const std::vector V_NO_MSVCRT = { + static const std::vector 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)"}, + }; - return V_NO_MSVCRT; + static const std::vector V = [&]() { + 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; + }(); + + if (toolset == "v120") + return V_NO_120; + else + return V; } static LintStatus check_for_files_in_include_directory(const Files::Filesystem& fs, @@ -646,7 +656,8 @@ namespace vcpkg::PostBuildLint static LintStatus check_outdated_crt_linkage_of_dlls(const std::vector& 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; @@ -662,7 +673,7 @@ namespace vcpkg::PostBuildLint "Running command:\n %s\n failed", Strings::to_utf8(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)) { @@ -788,7 +799,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: diff --git a/toolsrc/src/VcpkgPaths.cpp b/toolsrc/src/VcpkgPaths.cpp index 651d4d834..e8eb4f01c 100644 --- a/toolsrc/src/VcpkgPaths.cpp +++ b/toolsrc/src/VcpkgPaths.cpp @@ -277,48 +277,38 @@ namespace vcpkg return nullopt; } - - static Optional get_vs2013_installation_instance() - { - const Optional vs2013_cmntools_optional = System::get_environment_variable(L"VS120COMNTOOLS"); - if (const auto v = vs2013_cmntools_optional.get()) - { - const fs::path vs2013_cmntools = fs::path(*v).parent_path(); // The call to parent_path() is needed because - // the env variable has a trailing backslash - return vs2013_cmntools.parent_path().parent_path(); - } - return nullopt; - } - - static std::vector find_toolset_instances(const VcpkgPaths& paths) + static std::vector find_v120_toolset_instances(const Files::Filesystem& fs) { using CPU = System::CPUArchitecture; - const auto& fs = paths.get_filesystem(); - // Note: this will contain a mix of vcvarsall.bat locations and dumpbin.exe locations. std::vector paths_examined; std::vector found_toolsets; // VS2013 - const Optional vs_2013_installation_instance = get_vs2013_installation_instance(); - if (const auto v = vs_2013_installation_instance.get()) + const Optional vs2013_cmntools_optional = System::get_environment_variable(L"VS120COMNTOOLS"); + if (const auto vs120comntools = vs2013_cmntools_optional.get()) { - const fs::path vs2013_vcvarsall_bat = *v / "VC" / "vcvarsall.bat"; + const fs::path vs2013_cmntools = + fs::path(*vs120comntools).parent_path(); // The call to parent_path() is needed because + // the env variable has a trailing backslash + auto v = vs2013_cmntools.parent_path().parent_path(); + + const fs::path vs2013_vcvarsall_bat = v / "VC" / "vcvarsall.bat"; paths_examined.push_back(vs2013_vcvarsall_bat); if (fs.exists(vs2013_vcvarsall_bat)) { - const fs::path vs2013_dumpbin_exe = *v / "VC" / "bin" / "dumpbin.exe"; + const fs::path vs2013_dumpbin_exe = v / "VC" / "bin" / "dumpbin.exe"; paths_examined.push_back(vs2013_dumpbin_exe); const fs::path vs2013_bin_dir = vs2013_vcvarsall_bat.parent_path() / "bin"; std::vector supported_architectures; if (fs.exists(vs2013_bin_dir / "vcvars32.bat")) supported_architectures.push_back({L"x86", CPU::X86, CPU::X86}); - if (fs.exists(3 / "amd64\\vcvars64.bat")) + if (fs.exists(vs2013_bin_dir / "amd64\\vcvars64.bat")) supported_architectures.push_back({L"x64", CPU::X64, CPU::X64}); if (fs.exists(vs2013_bin_dir / "x86_amd64\\vcvarsx86_amd64.bat")) supported_architectures.push_back({L"x86_amd64", CPU::X86, CPU::X64}); @@ -332,11 +322,36 @@ namespace vcpkg if (fs.exists(vs2013_dumpbin_exe)) { found_toolsets.push_back( - {vs2013_dumpbin_exe, vs2013_vcvarsall_bat, L"v120", supported_architectures}); + {vs2013_dumpbin_exe, vs2013_vcvarsall_bat, {}, V_120, supported_architectures}); } } } - + + if (found_toolsets.empty()) + { + System::println(System::Color::error, "Could not locate a complete toolset."); + System::println("The following paths were examined:"); + for (const fs::path& path : paths_examined) + { + System::println(" %s", path.u8string()); + } + Checks::exit_fail(VCPKG_LINE_INFO); + } + + return found_toolsets; + } + + static std::vector 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. + std::vector paths_examined; + + std::vector found_toolsets; + // VS2015 const Optional vs_2015_installation_instance = get_vs2015_installation_instance(); if (const auto v = vs_2015_installation_instance.get()) @@ -372,8 +387,6 @@ namespace vcpkg } } - const std::vector vs2017_installation_instances = get_vs2017_installation_instances(paths); - // VS2017 Optional vs2017_toolset; const std::vector vs2017_installation_instances = get_vs2017_installation_instances(paths); @@ -476,6 +489,14 @@ namespace vcpkg { const std::wstring& w_toolset_version = Strings::to_utf16(toolset_version); + if (w_toolset_version == V_120) + { + const auto& v120_toolsets = this->toolsets_vs2013.get_lazy( + [this]() { return find_v120_toolset_instances(this->get_filesystem()); }); + Checks::check_exit(VCPKG_LINE_INFO, v120_toolsets.size() > 0); + return v120_toolsets.back(); + } + // Invariant: toolsets are non-empty and sorted with newest at back() const std::vector& vs_toolsets = this->toolsets.get_lazy([this]() { return find_toolset_instances(*this); }); From 630bcd84b8325217c440def11681e375f5ef4652 Mon Sep 17 00:00:00 2001 From: martin-s Date: Sat, 14 Oct 2017 18:31:53 +0200 Subject: [PATCH 4/5] - Updated naming of msvcrt vector. --- toolsrc/src/PostBuildLint.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/toolsrc/src/PostBuildLint.cpp b/toolsrc/src/PostBuildLint.cpp index 58d6f987b..5de1078cd 100644 --- a/toolsrc/src/PostBuildLint.cpp +++ b/toolsrc/src/PostBuildLint.cpp @@ -57,7 +57,7 @@ namespace vcpkg::PostBuildLint {"msvcrt40.dll", R"(msvcrt40\.dll)"}, }; - static const std::vector V = [&]() { + static const std::vector 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)"}); @@ -69,7 +69,7 @@ namespace vcpkg::PostBuildLint if (toolset == "v120") return V_NO_120; else - return V; + return V_NO_MSVCRT; } static LintStatus check_for_files_in_include_directory(const Files::Filesystem& fs, From c6d69fac625706c52fc8e48615bc0c6d7b8dad25 Mon Sep 17 00:00:00 2001 From: martin-s Date: Sun, 15 Oct 2017 02:13:36 +0200 Subject: [PATCH 5/5] - Fixed formatting. --- toolsrc/src/vcpkg/postbuildlint.cpp | 14 +++++++------- toolsrc/src/vcpkg/vcpkgpaths.cpp | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/toolsrc/src/vcpkg/postbuildlint.cpp b/toolsrc/src/vcpkg/postbuildlint.cpp index b2422b4b2..548093c6f 100644 --- a/toolsrc/src/vcpkg/postbuildlint.cpp +++ b/toolsrc/src/vcpkg/postbuildlint.cpp @@ -66,14 +66,14 @@ namespace vcpkg::PostBuildLint return ret; }(); - const auto tsv = toolset_version.get(); - if (tsv && (*tsv) == "v120") - { - return V_NO_120; - } + 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; + // Default case for all version >= VS 2015. + return V_NO_MSVCRT; } static LintStatus check_for_files_in_include_directory(const Files::Filesystem& fs, diff --git a/toolsrc/src/vcpkg/vcpkgpaths.cpp b/toolsrc/src/vcpkg/vcpkgpaths.cpp index f0e02db8a..b6ec2cb52 100644 --- a/toolsrc/src/vcpkg/vcpkgpaths.cpp +++ b/toolsrc/src/vcpkg/vcpkgpaths.cpp @@ -448,7 +448,7 @@ namespace vcpkg vs_dumpbin_exe, vcvarsall_bat, {}, - major_version == "14" ? V_140 : V_120, + major_version == "14" ? V_140 : V_120, supported_architectures}); } }