mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-01-18 12:53:02 +08:00
- Added support for VS2013 build chain tools.
This commit is contained in:
parent
35a9d223bc
commit
c167c70c27
@ -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")
|
||||
|
@ -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."
|
||||
throw "Could not find MSBuild version with C++ support. VS2013, VS2015 or VS2017 (with C++) needs to be installed."
|
@ -60,7 +60,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 std::string& toolset_version) const;
|
||||
|
||||
|
@ -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)"}};
|
||||
|
||||
|
@ -268,6 +268,19 @@ namespace vcpkg
|
||||
|
||||
return nullopt;
|
||||
}
|
||||
|
||||
static Optional<fs::path> get_vs2013_installation_instance()
|
||||
{
|
||||
const Optional<std::wstring> 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<Toolset> find_toolset_instances(const VcpkgPaths& paths)
|
||||
{
|
||||
@ -275,12 +288,46 @@ namespace vcpkg
|
||||
|
||||
const auto& fs = paths.get_filesystem();
|
||||
|
||||
const std::vector<std::string> vs2017_installation_instances = get_vs2017_installation_instances(paths);
|
||||
// Note: this will contain a mix of vcvarsall.bat locations and dumpbin.exe locations.
|
||||
std::vector<fs::path> paths_examined;
|
||||
|
||||
std::vector<Toolset> found_toolsets;
|
||||
|
||||
// VS2013
|
||||
const Optional<fs::path> 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<ToolsetArchOption> 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<fs::path> 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<Toolset> vs2017_toolset;
|
||||
const std::vector<std::string> 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";
|
||||
|
Loading…
Reference in New Issue
Block a user