diff options
| author | Cristian Adam <cristian.adam@gmail.com> | 2020-01-18 00:36:08 +0100 |
|---|---|---|
| committer | Victor Romero <romerosanchezv@gmail.com> | 2020-01-17 15:36:08 -0800 |
| commit | 38b959022cec1b865489d97a697eda84b49cc4e5 (patch) | |
| tree | 20fcc2f8eedbb65f7067a1d6e077d2c616111e48 /toolsrc/src | |
| parent | f56645c3fd9a1561c430e90ce00836489b372ef8 (diff) | |
| download | vcpkg-38b959022cec1b865489d97a697eda84b49cc4e5.tar.gz vcpkg-38b959022cec1b865489d97a697eda84b49cc4e5.zip | |
Add support for building with MinGW (#9137)
* Add support for building with MinGW
Tested with MSYS2 MinGW 8.3.0, gcc-mcf.lhmouse MinGW 9.2.1,
and StephanTLavavej/mingw-distro!
* Add MinGW toolchain
From your MinGW configured shell you could just use vcpkg to
configure packages.
An x64-mingw triplet would look like:
```
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_ENV_PASSTHROUGH PATH)
set(VCPKG_CMAKE_SYSTEM_NAME MinGW)
```
* Add MinGW community tripplets
x64 tested with https://github.com/StephanTLavavej/mingw-distro
x86, arm64, arm tested with https://github.com/mstorsjo/llvm-mingw
Diffstat (limited to 'toolsrc/src')
| -rw-r--r-- | toolsrc/src/vcpkg.cpp | 13 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/base/hash.cpp | 8 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/base/system.cpp | 4 |
3 files changed, 18 insertions, 7 deletions
diff --git a/toolsrc/src/vcpkg.cpp b/toolsrc/src/vcpkg.cpp index 2dd13f43d..1f212dd94 100644 --- a/toolsrc/src/vcpkg.cpp +++ b/toolsrc/src/vcpkg.cpp @@ -263,7 +263,18 @@ static void load_config() #if defined(_WIN32) // note: this prevents a false positive for -Wmissing-prototypes on clang-cl -int wmain(int, const wchar_t* const*); +int wmain(int, const wchar_t* const* const); + +#if !defined(_MSC_VER) +#include <shellapi.h> +int main(int argc, const char* const* const /*argv*/) +{ + wchar_t **wargv; + wargv = CommandLineToArgvW(GetCommandLineW(), &argc); + return wmain(argc, wargv); +} +#endif + int wmain(const int argc, const wchar_t* const* const argv) #else int main(const int argc, const char* const* const argv) diff --git a/toolsrc/src/vcpkg/base/hash.cpp b/toolsrc/src/vcpkg/base/hash.cpp index 11df3e329..81635b875 100644 --- a/toolsrc/src/vcpkg/base/hash.cpp +++ b/toolsrc/src/vcpkg/base/hash.cpp @@ -123,9 +123,9 @@ namespace vcpkg::Hash void top_bits(T) = delete; static constexpr uchar top_bits(uchar x) noexcept { return x; } - static constexpr uchar top_bits(std::uint32_t x) noexcept { return (x >> 24) & 0xFF; } - static constexpr uchar top_bits(std::uint64_t x) noexcept { return (x >> 56) & 0xFF; } - static constexpr uchar top_bits(UInt128 x) noexcept { return top_bits(x.top); } + [[maybe_unused]] static constexpr uchar top_bits(std::uint32_t x) noexcept { return (x >> 24) & 0xFF; } + [[maybe_unused]] static constexpr uchar top_bits(std::uint64_t x) noexcept { return (x >> 56) & 0xFF; } + [[maybe_unused]] static constexpr uchar top_bits(UInt128 x) noexcept { return top_bits(x.top); } // treats UIntTy as big endian for the purpose of this mapping template<class UIntTy> @@ -145,7 +145,7 @@ namespace vcpkg::Hash for (uchar& ch : buff) { ch = top_bits(tmp); - tmp <<= 8; + tmp = UIntTy(tmp << 8); } for (const auto byte : buff) diff --git a/toolsrc/src/vcpkg/base/system.cpp b/toolsrc/src/vcpkg/base/system.cpp index c84b7f8be..5a446a330 100644 --- a/toolsrc/src/vcpkg/base/system.cpp +++ b/toolsrc/src/vcpkg/base/system.cpp @@ -378,7 +378,7 @@ namespace vcpkg g_ctrl_c_state.transition_to_spawn_process(); auto clean_env = compute_clean_environment(extra_env, prepend_to_path); - windows_create_process(cmd_line, clean_env.data(), process_info, NULL); + windows_create_process(cmd_line, clean_env.data(), process_info, 0); CloseHandle(process_info.hThread); @@ -542,7 +542,7 @@ namespace vcpkg { HKEY k = nullptr; const LSTATUS ec = - RegOpenKeyExW(reinterpret_cast<HKEY>(base_hkey), Strings::to_utf16(sub_key).c_str(), NULL, KEY_READ, &k); + RegOpenKeyExW(reinterpret_cast<HKEY>(base_hkey), Strings::to_utf16(sub_key).c_str(), 0, KEY_READ, &k); if (ec != ERROR_SUCCESS) return nullopt; auto w_valuename = Strings::to_utf16(valuename); |
