cmake: Set process code page to UTF-8 on Windows

Additionally, this change adds app manifests to targets that were
previously missing them.
This commit is contained in:
Hennadii Stepanov
2025-09-22 12:13:48 +01:00
parent dccbb17806
commit f366408492
7 changed files with 19 additions and 1 deletions

View File

@@ -1,10 +1,15 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<assemblyIdentity
type="win32"
name="org.bitcoincore.${target}"
version="${CLIENT_VERSION_MAJOR}.${CLIENT_VERSION_MINOR}.${CLIENT_VERSION_BUILD}.0"
/>
<asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">
<activeCodePage>UTF-8</activeCodePage>
</asmv3:windowsSettings>
</asmv3:application>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>

View File

@@ -410,6 +410,7 @@ if(BUILD_UTIL_CHAINSTATE)
add_executable(bitcoin-chainstate
bitcoin-chainstate.cpp
)
add_windows_application_manifest(bitcoin-chainstate)
# TODO: The `SKIP_BUILD_RPATH` property setting can be deleted
# in the future after reordering Guix script commands to
# perform binary checks after the installation step.

View File

@@ -56,6 +56,8 @@ add_executable(bench_bitcoin
verify_script.cpp
)
add_windows_application_manifest(bench_bitcoin)
include(TargetDataSources)
target_raw_data_sources(bench_bitcoin NAMESPACE benchmark::data
data/block413567.raw

View File

@@ -6,6 +6,7 @@
#include <clientversion.h>
#include <common/args.h>
#include <common/system.h>
#include <util/fs.h>
#include <util/exec.h>
#include <util/strencodings.h>
@@ -61,6 +62,8 @@ static void ExecCommand(const std::vector<const char*>& args, std::string_view a
int main(int argc, char* argv[])
{
SetupEnvironment();
try {
CommandLine cmd{ParseCommandLine(argc, argv)};
if (cmd.show_version) {

View File

@@ -12,6 +12,7 @@
#include <util/time.h>
#ifdef WIN32
#include <cassert>
#include <codecvt>
#include <compat/compat.h>
#include <windows.h>
@@ -83,6 +84,7 @@ void SetupEnvironment()
setenv("LC_ALL", "C.UTF-8", 1);
}
#elif defined(WIN32)
assert(GetACP() == CP_UTF8);
// Set the default input/output charset is utf-8
SetConsoleCP(CP_UTF8);
SetConsoleOutputCP(CP_UTF8);

View File

@@ -14,6 +14,8 @@ add_executable(test_bitcoin-qt
../../init/bitcoin-qt.cpp
)
add_windows_application_manifest(test_bitcoin-qt)
target_link_libraries(test_bitcoin-qt
core_interface
bitcoinqt

View File

@@ -134,6 +134,9 @@ add_executable(fuzz
vecdeque.cpp
versionbits.cpp
)
add_windows_application_manifest(fuzz)
target_link_libraries(fuzz
core_interface
fuzzer_interface