* Build fix with MinGW GCC 9.2.0

* Fix MinGW tripplets

Fixes #12065

* clang-format

* Fix unused read_symlink_implementation warning marked as error

read_symlink_implementation was used only in copy_symlink_implementation
when #if defined(_WIN32) && !VCPKG_USE_STD_FILESYSTEM  was true.

Removed the warning otherwise.

Co-authored-by: JackBoosY <yuzaiyang@beyondsoft.com>
This commit is contained in:
Cristian Adam 2020-07-18 17:48:01 +02:00 коммит произвёл GitHub
Родитель 751fc627ef
Коммит f4bd64233a
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 18 добавлений и 8 удалений

Просмотреть файл

@ -17,6 +17,9 @@ if((NOT DEFINED VCPKG_ROOT_DIR)
]]) ]])
endif() endif()
file(TO_CMAKE_PATH ${BUILDTREES_DIR} BUILDTREES_DIR)
file(TO_CMAKE_PATH ${PACKAGES_DIR} PACKAGES_DIR)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake) list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake)
set(CURRENT_INSTALLED_DIR ${_VCPKG_INSTALLED_DIR}/${TARGET_TRIPLET} CACHE PATH "Location to install final packages") set(CURRENT_INSTALLED_DIR ${_VCPKG_INSTALLED_DIR}/${TARGET_TRIPLET} CACHE PATH "Location to install final packages")
set(SCRIPTS ${CMAKE_CURRENT_LIST_DIR} CACHE PATH "Location to stored scripts") set(SCRIPTS ${CMAKE_CURRENT_LIST_DIR} CACHE PATH "Location to stored scripts")

Просмотреть файл

@ -2,8 +2,13 @@
#if defined(_WIN32) #if defined(_WIN32)
#ifndef NOMINMAX
#define NOMINMAX #define NOMINMAX
#endif
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#endif
#pragma warning(suppress : 4768) #pragma warning(suppress : 4768)
#include <windows.h> #include <windows.h>

Просмотреть файл

@ -102,9 +102,9 @@ namespace vcpkg::Files
return status_implementation(false, p, ec); return status_implementation(false, p, ec);
} }
#if defined(_WIN32) && !VCPKG_USE_STD_FILESYSTEM
fs::path read_symlink_implementation(const fs::path& oldpath, std::error_code& ec) fs::path read_symlink_implementation(const fs::path& oldpath, std::error_code& ec)
{ {
#if defined(_WIN32) && !VCPKG_USE_STD_FILESYSTEM
ec.clear(); ec.clear();
auto handle = CreateFileW(oldpath.c_str(), auto handle = CreateFileW(oldpath.c_str(),
0, // open just the metadata 0, // open just the metadata
@ -132,10 +132,8 @@ namespace vcpkg::Files
} }
CloseHandle(handle); CloseHandle(handle);
return target; return target;
#else // ^^^ defined(_WIN32) && !VCPKG_USE_STD_FILESYSTEM // !defined(_WIN32) || VCPKG_USE_STD_FILESYSTEM vvv
return fs::stdfs::read_symlink(oldpath, ec);
#endif // ^^^ !defined(_WIN32) || VCPKG_USE_STD_FILESYSTEM
} }
#endif // ^^^ !defined(_WIN32) || VCPKG_USE_STD_FILESYSTEM
void copy_symlink_implementation(const fs::path& oldpath, const fs::path& newpath, std::error_code& ec) void copy_symlink_implementation(const fs::path& oldpath, const fs::path& newpath, std::error_code& ec)
{ {

Просмотреть файл

@ -598,7 +598,7 @@ namespace vcpkg
#if defined(_WIN32) #if defined(_WIN32)
using vcpkg::g_ctrl_c_state; using vcpkg::g_ctrl_c_state;
g_ctrl_c_state.transition_to_spawn_process(); g_ctrl_c_state.transition_to_spawn_process();
auto proc_info = windows_create_process(cmd_line, env, NULL); auto proc_info = windows_create_process(cmd_line, env, 0);
auto long_exit_code = [&]() -> unsigned long { auto long_exit_code = [&]() -> unsigned long {
if (auto p = proc_info.get()) if (auto p = proc_info.get())
return p->wait(); return p->wait();
@ -660,7 +660,7 @@ namespace vcpkg
using vcpkg::g_ctrl_c_state; using vcpkg::g_ctrl_c_state;
g_ctrl_c_state.transition_to_spawn_process(); g_ctrl_c_state.transition_to_spawn_process();
auto maybe_proc_info = windows_create_process_redirect(cmd_line, env, NULL); auto maybe_proc_info = windows_create_process_redirect(cmd_line, env, 0);
auto exit_code = [&]() -> unsigned long { auto exit_code = [&]() -> unsigned long {
if (auto p = maybe_proc_info.get()) if (auto p = maybe_proc_info.get())
return p->wait_and_stream_output(data_cb); return p->wait_and_stream_output(data_cb);

Просмотреть файл

@ -490,7 +490,7 @@ namespace vcpkg::Build
std::ofstream out_file(stdoutlog.native().c_str(), std::ios::out | std::ios::binary | std::ios::trunc); std::ofstream out_file(stdoutlog.native().c_str(), std::ios::out | std::ios::binary | std::ios::trunc);
Checks::check_exit(VCPKG_LINE_INFO, out_file, "Failed to open '%s' for writing", stdoutlog.u8string()); Checks::check_exit(VCPKG_LINE_INFO, out_file, "Failed to open '%s' for writing", stdoutlog.u8string());
std::string compiler_hash; std::string compiler_hash;
const int return_code = System::cmd_execute_and_stream_lines( System::cmd_execute_and_stream_lines(
command, command,
[&](const std::string& s) { [&](const std::string& s) {
static const StringLiteral s_marker = "#COMPILER_HASH#"; static const StringLiteral s_marker = "#COMPILER_HASH#";
@ -616,6 +616,10 @@ namespace vcpkg::Build
{ {
return m_paths.scripts / fs::u8path("toolchains/ios.cmake"); return m_paths.scripts / fs::u8path("toolchains/ios.cmake");
} }
else if (cmake_system_name == "MinGW")
{
return m_paths.scripts / fs::u8path("toolchains/mingw.cmake");
}
else if (cmake_system_name.empty() || cmake_system_name == "Windows" || cmake_system_name == "WindowsStore") else if (cmake_system_name.empty() || cmake_system_name == "Windows" || cmake_system_name == "WindowsStore")
{ {
return m_paths.scripts / fs::u8path("toolchains/windows.cmake"); return m_paths.scripts / fs::u8path("toolchains/windows.cmake");
@ -1148,7 +1152,7 @@ namespace vcpkg::Build
PreBuildInfo::PreBuildInfo(const VcpkgPaths& paths, PreBuildInfo::PreBuildInfo(const VcpkgPaths& paths,
Triplet triplet, Triplet triplet,
const std::unordered_map<std::string, std::string>& cmakevars) const std::unordered_map<std::string, std::string>& cmakevars)
: m_paths(paths), triplet(triplet) : triplet(triplet), m_paths(paths)
{ {
enum class VcpkgTripletVar enum class VcpkgTripletVar
{ {