Merge remote-tracking branch 'upstream/master'

This commit is contained in:
jasjuang 2017-09-27 22:21:17 -07:00
commit 7e6da0c9e7
5 changed files with 102 additions and 50 deletions

View File

@ -1,3 +1,3 @@
Source: geos
Version: 3.5.0-1
Version: 3.6.2
Description: Geometry Engine Open Source

View File

@ -7,25 +7,26 @@
#
include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/3.5)
#downloading 3.5 from their SVN repo and not the release tarball
#because the 3.5 release did not build on windows, and fixes were backported
#without generating a new release tarball (I don't think very many GIS people use win)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/geos-3.6.2)
vcpkg_download_distfile(ARCHIVE
URLS "https://trac.osgeo.org/geos/browser/branches/3.5?rev=4261&format=zip"
FILENAME "geos-3.5.0.zip"
SHA512 3b91e8992f60b99a3f01069d955b71bce425ae5e5c599252fa26a337494e1a5a8ea796be124766d054710d6c03806f56dc1c63539b4660e2bb894d7ef779d4b9
URLS "http://download.osgeo.org/geos/geos-3.6.2.tar.bz2"
FILENAME "geos-3.6.2.tar.bz2"
SHA512 515d8700b8a28282678e481faee355e3a43d7b70160472a63335b8d7225d9ba10437be782378f18f31a15288118126d411a2d862f01ce35d27c96f6bc0a73016
)
vcpkg_extract_source_archive(${ARCHIVE})
#we need to do this because GEOS deploy process is totally broken for cmake
#file(DOWNLOAD http://svn.osgeo.org/geos/tags/3.5.0/cmake/modules/GenerateSourceGroups.cmake
# ${SOURCE_PATH}/cmake/modules/GenerateSourceGroups.cmake)
file(WRITE ${SOURCE_PATH}/geos_svn_revision.h "#define GEOS_SVN_REVISION 4261")
# NOTE: GEOS provides CMake as optional build configuration, it might not be actively
# maintained, so CMake build issues may happen between releases.
# Pull modules referred in the main CMakeLists.txt but missing from the released package.
# TODO: GEOS 3.6.3 or later will include the missing script in release package.
file(DOWNLOAD http://svn.osgeo.org/geos/branches/3.6/cmake/modules/GenerateSourceGroups.cmake
${SOURCE_PATH}/cmake/modules/GenerateSourceGroups.cmake)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS -DGEOS_ENABLE_TESTS=False
-DBUILD_TESTING=False
)
vcpkg_build_cmake()

View File

@ -19,6 +19,7 @@ namespace vcpkg
{
fs::path dumpbin;
fs::path vcvarsall;
std::vector<std::wstring> vcvarsall_options;
CWStringView version;
std::vector<ToolsetArchOption> supported_architectures;
};
@ -71,5 +72,6 @@ namespace vcpkg
Lazy<fs::path> git_exe;
Lazy<fs::path> nuget_exe;
Lazy<std::vector<Toolset>> toolsets;
Lazy<std::vector<Toolset>> toolsets_vs2017_v140;
};
}

View File

@ -10,6 +10,10 @@
namespace vcpkg
{
// Intentionally wstring so we can easily use operator== with CWStringView.
static const std::wstring V_140 = L"v140";
static const std::wstring V_141 = L"v141";
static bool exists_and_has_equal_or_greater_version(const std::wstring& version_cmd,
const std::array<int, 3>& expected_version)
{
@ -269,13 +273,31 @@ namespace vcpkg
return nullopt;
}
static std::vector<Toolset> find_toolset_instances(const VcpkgPaths& paths)
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)
{
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;
@ -294,28 +316,19 @@ namespace vcpkg
paths_examined.push_back(vs2015_dumpbin_exe);
const fs::path vs2015_bin_dir = vs2015_vcvarsall_bat.parent_path() / "bin";
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});
const std::vector<ToolsetArchOption> supported_architectures =
detect_supported_architectures(fs, vs2015_bin_dir);
if (fs.exists(vs2015_dumpbin_exe))
{
found_toolsets.push_back(
{vs2015_dumpbin_exe, vs2015_vcvarsall_bat, L"v140", supported_architectures});
{vs2015_dumpbin_exe, vs2015_vcvarsall_bat, {}, V_140, supported_architectures});
}
}
}
const std::vector<std::string> vs2017_installation_instances = get_vs2017_installation_instances(paths);
// VS2017
Optional<Toolset> vs2017_toolset;
for (const std::string& instance : vs2017_installation_instances)
@ -329,19 +342,8 @@ namespace vcpkg
if (!fs.exists(vcvarsall_bat)) continue;
// Get all supported architectures
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});
const std::vector<ToolsetArchOption> supported_architectures =
detect_supported_architectures(fs, vcvarsall_dir);
// Locate the "best" MSVC toolchain version
const fs::path msvc_path = vc_dir / "Tools" / "MSVC";
@ -359,14 +361,13 @@ namespace vcpkg
paths_examined.push_back(dumpbin_path);
if (fs.exists(dumpbin_path))
{
vs2017_toolset = Toolset{dumpbin_path, vcvarsall_bat, L"v141", supported_architectures};
vs2017_toolset = Toolset{dumpbin_path, vcvarsall_bat, {}, V_141, supported_architectures};
break;
}
}
if (const auto value = vs2017_toolset.get())
{
found_toolsets.push_back(*value);
break;
}
}
@ -384,20 +385,63 @@ namespace vcpkg
return found_toolsets;
}
static std::vector<Toolset> create_vs2017_v140_toolset_instances(const std::vector<Toolset>& vs_toolsets)
{
std::vector<Toolset> vs2017_v140_toolsets;
// In constrast to v141 and above, there can only be a single instance of v140 (VS2017 vs VS2015).
const auto it = Util::find_if(vs_toolsets, [&](const Toolset& t) { return t.version == V_140; });
// If v140 is not available, then VS2017 cant use them. Return empty.
if (it == vs_toolsets.cend())
{
return vs2017_v140_toolsets;
}
// If it does exist, then create a matching v140 toolset for each v141 toolset
const Toolset v140_toolset = *it;
for (const Toolset& toolset : vs_toolsets)
{
if (toolset.version != V_141)
{
continue;
}
Toolset t = Toolset{
toolset.dumpbin, toolset.vcvarsall, {L"-vcvars_ver=14.0"}, V_140, toolset.supported_architectures};
vs2017_v140_toolsets.push_back(std::move(t));
}
return vs2017_v140_toolsets;
}
const Toolset& VcpkgPaths::get_toolset(const std::string& toolset_version) const
{
// Invariant: toolsets are non-empty and sorted with newest at back()
const auto& vs_toolsets = this->toolsets.get_lazy([this]() { return find_toolset_instances(*this); });
const std::wstring& w_toolset_version = Strings::to_utf16(toolset_version);
if (toolset_version.empty())
// Invariant: toolsets are non-empty and sorted with newest at back()
const std::vector<Toolset>& vs_toolsets =
this->toolsets.get_lazy([this]() { return find_toolset_instances(*this); });
if (w_toolset_version.empty())
{
return vs_toolsets.back();
}
const auto toolset = Util::find_if(
vs_toolsets, [&](const Toolset& t) { return toolset_version == Strings::to_utf8(t.version); });
const auto toolset =
Util::find_if(vs_toolsets, [&](const Toolset& t) { return w_toolset_version == t.version; });
Checks::check_exit(
VCPKG_LINE_INFO, toolset != vs_toolsets.end(), "Could not find toolset '%s'", toolset_version);
// If v140 is the selected toolset and VS2017 is available, then use VS2017's vcvarsall with the
// -vcvars_ver=14.0 option
const std::vector<Toolset>& vs2017_v140_toolsets = this->toolsets_vs2017_v140.get_lazy(
[&vs_toolsets]() { return create_vs2017_v140_toolset_instances(vs_toolsets); });
if (w_toolset_version == V_140 && !vs2017_v140_toolsets.empty())
{
return vs2017_v140_toolsets.back();
}
return *toolset;
}

View File

@ -67,7 +67,12 @@ namespace vcpkg::Build
const auto arch = to_vcvarsall_toolchain(pre_build_info.target_architecture, toolset);
const auto target = to_vcvarsall_target(pre_build_info.cmake_system_name);
return Strings::wformat(LR"("%s" %s %s %s 2>&1)", toolset.vcvarsall.native(), arch, target, tonull);
return Strings::wformat(LR"("%s" %s %s %s %s 2>&1)",
toolset.vcvarsall.native(),
Strings::join(L" ", toolset.vcvarsall_options),
arch,
target,
tonull);
}
static void create_binary_feature_control_file(const SourceParagraph& source_paragraph,