From add3e05da2ec83d9080e6e4d2f17ca685a020dd3 Mon Sep 17 00:00:00 2001 From: Nickolay Olshevsky Date: Sat, 9 Nov 2024 12:47:57 +0200 Subject: [PATCH] Add and use manifest file to force use of utf-8 encoding for executables. --- .github/workflows/windows-msys2.yml | 20 ++++++++++++++++++++ ci/utf8-manifest | 7 +++++++ 2 files changed, 27 insertions(+) create mode 100644 ci/utf8-manifest diff --git a/.github/workflows/windows-msys2.yml b/.github/workflows/windows-msys2.yml index e7c0f2f92a..1cccf51945 100644 --- a/.github/workflows/windows-msys2.yml +++ b/.github/workflows/windows-msys2.yml @@ -131,6 +131,13 @@ jobs: - name: Build run: cmake --build build --config "Release" --parallel ${{ env.CORES }} + - name: Find Visual Studio root via vswhere + shell: cmd + run: | + FOR /F "delims=" %%i in ('C:\ProgramData\Chocolatey\bin\vswhere.exe -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath') DO SET "VS_PATH=%%i" + echo "Detected Visual Studio path: %VS_PATH%" + echo VS_PATH=%VS_PATH%>> "%GITHUB_ENV%" + - name: Test run: | # Change codepage to utf-8 @@ -164,6 +171,19 @@ jobs: export PYTHONUTF8=1 export PATH="$PWD/build/src/lib:$PATH" export RNP_LOG_CONSOLE=1 + # Add mt.exe (manifest tool) to PATH + vsp=$(cygpath -u "${VS_PATH}") + ts_ver=$(<"$vsp/VC/Auxiliary/Build/Microsoft.VCToolsVersion.v143.default.txt") + lib_dir="${vsp}/VC/Tools/MSVC/${ts_ver}/bin/Hostx64/x64" + if [[ ! -d "$lib_dir" ]]; then + echo "Looks like directory with sanitizer libs changed from ${lib_dir}. Available ones:" + ls -la "${vsp}/VC/Tools/MSVC" + exit 1 + fi + export PATH=$lib_dir:$PATH + # Add manifest which forces utf-8 encoding + pwd + mt.exe -manifest ./ci/utf8-manifest -outputresource:./build/src/tests/rnp_tests;1 ctest --test-dir build -C Debug -V -R rnp_tests.test_windows_unicode || true ctest --parallel ${{ env.CORES }} --test-dir build -C Debug --output-on-failure -R rnp_tests.test_cli_rnpkeys_unicode diff --git a/ci/utf8-manifest b/ci/utf8-manifest new file mode 100644 index 0000000000..84eca6d8c0 --- /dev/null +++ b/ci/utf8-manifest @@ -0,0 +1,7 @@ + + + + UTF-8 + + +