MSVC by default decodes source files in the current Windows code page if
they don't have a Unicode BOM, and also encodes strings and chars into
the current code page before storing them into the compiled binary. Our
files are always encoded in UTF-8, and our code always assumes runtime
strings are encoded in UTF-8, so we should pass the `/utf-8` flag to
MSVC.
Microsoft Docs:
https://learn.microsoft.com/en-us/cpp/build/reference/utf-8-set-source-and-executable-character-sets-to-utf-8
Setting `-DENABLE_UTILS=0 -DENABLE_TESTS=1` causes CMake errors due to
tests/utils/CMakeLists.txt referencing
`$<TARGET_FILE:transmission-show>` which is undefined. Fixed by
including the tests/utils/ directory only if `ENABLE_UTILS` is true.
* Support in-source builds
Don't copy third-party directories into themselves (actually, don't copy
them at all) by switching from `URL` to `SOURCE_DIR`. Separate build,
source, and install directories for third-party libraries.
* Trigger builds on changes to cmake/
That directory contains TrMacros.cmake which influences build logic in
other places.
The `popcnt` feature checks weren't actually checking the ISA feature
or cpuid. This caused an illegal instruction exception on x86 hardware
that doesn't support `popcnt` when compiled with MSVC.
Since MSVC doesn't support any x86 ISA defines, the only way to check
for `popcnt` is with cpuid. Since this is a tiny inline function,
dynamic dispatch is likley not worth it so just removing the MSVC
for `popcnt`. MSVC will now fallback to the generic implementation.
From what I observed, ctor accepting `(begin, end)` is getting called
instead of one accepting `(data, size)` for no apparent reason in some
cases. Switch to a ctor accepting a `std::string` in those problematic
places.
Bring back old configuration that was using Qt 5 and split Qt build in
two to support both Qt 5 and Qt 6. Last Qt 5 builds were using 5.14.2,
bump that to latest 5.15.8.
Qt 6 only supports Windows 10+, so adjust the system version check
accordingly. Not bumping Qt 6 version (although 6.4.2 is available)
while we're still in patch release mode.
Building a whole new package is not nice since Qt client is only one
part of it, the rest doesn't require newer OS version. Nevertheless,
it's a quick and easy fix.
Hides a warning when building the dht library.
CMake Warning:
Manually-specified variables were not used by the project:
CMAKE_CXX_FLAGS
CMAKE_INSTALL_LIBDIR