From bdd082a439852c20fc730dcdb8e5fd5530d982fc Mon Sep 17 00:00:00 2001 From: Andras Lasso Date: Sat, 30 Jul 2022 00:30:46 +0200 Subject: [PATCH 1/2] Add Visual Studio 17 2022 support --- msvc-static-configure.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/msvc-static-configure.cmake b/msvc-static-configure.cmake index 7ec43f4..30c52f3 100644 --- a/msvc-static-configure.cmake +++ b/msvc-static-configure.cmake @@ -29,6 +29,10 @@ elseif ("$ENV{APPLAUNCHER_CMAKE_GENERATOR}" STREQUAL "Visual Studio 16 2019") # For local build with Visual Studio 2019 with modern CMake set(APPLAUNCHER_CMAKE_GENERATOR -G "Visual Studio 16 2019" -T v141 -A Win32) set(APPLAUNCHER_USE_NINJA OFF) +elseif ("$ENV{APPLAUNCHER_CMAKE_GENERATOR}" STREQUAL "Visual Studio 17 2022") + # For local build with Visual Studio 2019 with modern CMake + set(APPLAUNCHER_CMAKE_GENERATOR -G "Visual Studio 17 2022" -T v143 -A Win32) + set(APPLAUNCHER_USE_NINJA OFF) else() message(FATAL_ERROR "Env. variable APPLAUNCHER_CMAKE_GENERATOR is expected to match 'Ninja' or 'Visual Studio 15 2017' or 'Visual Studio 16 2019' [$ENV{APPLAUNCHER_CMAKE_GENERATOR}]") endif() From 9998a7df39a3232f5b292de857dd52d11c96cb99 Mon Sep 17 00:00:00 2001 From: Andras Lasso Date: Sat, 30 Jul 2022 00:31:26 +0200 Subject: [PATCH 2/2] Fix passing of non-ASCII characters as command-line arguments Should fix the issues described here: https://discourse.slicer.org/t/slicer-ignoring-command-line-path-with-accents/24569 --- Base/Testing/Cpp/ctkAppLauncherEnvironmentTest.cpp | 8 ++++---- Base/ctkAppArguments.cpp | 2 +- Base/ctkAppLauncherEnvironment.cpp | 6 +++--- Base/ctkTest.h | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Base/Testing/Cpp/ctkAppLauncherEnvironmentTest.cpp b/Base/Testing/Cpp/ctkAppLauncherEnvironmentTest.cpp index 9f0c141..8d6be64 100644 --- a/Base/Testing/Cpp/ctkAppLauncherEnvironmentTest.cpp +++ b/Base/Testing/Cpp/ctkAppLauncherEnvironmentTest.cpp @@ -52,14 +52,14 @@ void ctkAppLauncherEnvironmentTester::cleanup() QStringList originalEnvKeys = ctkAppLauncherEnvironment::envKeys(this->OriginalEnv); foreach(const QString& varName, originalEnvKeys) { - qputenv(varName.toLatin1(), this->OriginalEnv.value(varName).toLatin1()); + qputenv(varName.toLocal8Bit(), this->OriginalEnv.value(varName).toLocal8Bit()); } } // ---------------------------------------------------------------------------- void ctkAppLauncherEnvironmentTester::setEnv(const QString& name, const QString& value) { - qputenv(name.toLatin1(), value.toLatin1()); + qputenv(name.toLocal8Bit(), value.toLocal8Bit()); this->VariableNames.insert(name); } @@ -67,9 +67,9 @@ void ctkAppLauncherEnvironmentTester::setEnv(const QString& name, const QString& void ctkAppLauncherEnvironmentTester::unsetEnv(const QString& name) { #if defined(_MSC_VER) - qputenv(name.toLatin1(), QString("").toLatin1()); + qputenv(name.toLocal8Bit(), QString().toLocal8Bit()); #else - unsetenv(name.toLatin1()); + unsetenv(name.toLocal8Bit()); #endif } diff --git a/Base/ctkAppArguments.cpp b/Base/ctkAppArguments.cpp index 82988ce..32be628 100644 --- a/Base/ctkAppArguments.cpp +++ b/Base/ctkAppArguments.cpp @@ -58,7 +58,7 @@ void ctkChar2DArray::setValues(const QStringList& list) { QString item = d->List.at(index); d->Values[index] = new char[item.size() + 1]; - qstrcpy(d->Values[index], item.toLatin1().data()); + qstrcpy(d->Values[index], item.toLocal8Bit().data()); } } diff --git a/Base/ctkAppLauncherEnvironment.cpp b/Base/ctkAppLauncherEnvironment.cpp index d6274ea..4cfc508 100644 --- a/Base/ctkAppLauncherEnvironment.cpp +++ b/Base/ctkAppLauncherEnvironment.cpp @@ -166,9 +166,9 @@ void ctkAppLauncherEnvironment::updateCurrentEnvironment(const QProcessEnvironme foreach(const QString& varName, variablesToUnset) { #if defined(Q_OS_WIN32) - bool success = qputenv(varName.toLatin1(), QString("").toLatin1()); + bool success = qputenv(varName.toLocal8Bit(), QString().toLocal8Bit()); #else - bool success = unsetenv(varName.toLatin1()) == EXIT_SUCCESS; + bool success = unsetenv(varName.toLocal8Bit()) == EXIT_SUCCESS; #endif if (!success) { @@ -180,7 +180,7 @@ void ctkAppLauncherEnvironment::updateCurrentEnvironment(const QProcessEnvironme foreach(const QString& varName, envKeys) { QString varValue = environment.value(varName); - bool success = qputenv(varName.toLatin1(), varValue.toLatin1()); + bool success = qputenv(varName.toLocal8Bit(), varValue.toLocal8Bit()); if (!success) { qWarning() << "Failed to set environment variable" diff --git a/Base/ctkTest.h b/Base/ctkTest.h index 7de3bbf..223997c 100644 --- a/Base/ctkTest.h +++ b/Base/ctkTest.h @@ -97,8 +97,8 @@ static void mouseEvent(QTest::MouseAction action, QWidget *widget, Qt::MouseButt { static const char *mouseActionNames[] = { "MousePress", "MouseRelease", "MouseClick", "MouseDClick", "MouseMove" }; - QString warning = QString::fromLatin1("Mouse event \"%1\" not accepted by receiving widget"); - QTest::qWarn(warning.arg(QString::fromLatin1(mouseActionNames[static_cast(action)])).toLatin1()); + QString warning = QLatin1String("Mouse event \"%1\" not accepted by receiving widget"); + QTest::qWarn(warning.arg(QLatin1String(mouseActionNames[static_cast(action)])).toLocal8Bit()); } }