From 1f2b44d24db541ff3de99e4e23b82e565ad33df6 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 15 Apr 2019 17:32:47 -0400 Subject: [PATCH] CMakeLists: Ensure we specify Unicode as the codepage on Windows Previously we were building with MBCS, which is pretty undesirable. We want the application to be Unicode-aware in general. Currently, we make the command line variant of yuzu use ANSI variants of the non-standard getopt functions that we link in for Windows, given we only have an ANSI option-set. We should really replace getopt with a library that we make all build types of yuzu link in, but this will have to do for the time being. --- src/CMakeLists.txt | 3 +++ src/citra/citra.cpp | 11 ++++++----- src/dedicated_room/citra-room.cpp | 13 ++++++------- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index be1638e26..a6fb5c8f2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -18,6 +18,9 @@ if (MSVC) # Avoid windows.h from including some usually unused libs like winsocks.h, since this might cause some redefinition errors. add_definitions(-DWIN32_LEAN_AND_MEAN) + # Ensure that projects build with Unicode support. + add_definitions(-DUNICODE -D_UNICODE) + # /W3 - Level 3 warnings # /MP - Multi-threaded compilation # /Zi - Output debugging information diff --git a/src/citra/citra.cpp b/src/citra/citra.cpp index a71aa7dbe..db5900eae 100644 --- a/src/citra/citra.cpp +++ b/src/citra/citra.cpp @@ -11,11 +11,6 @@ // This needs to be included before getopt.h because the latter #defines symbols used by it #include "common/microprofile.h" -#include -#ifndef _MSC_VER -#include -#endif - #ifdef _WIN32 // windows.h needs to be included before shellapi.h #include @@ -45,6 +40,12 @@ #include "core/settings.h" #include "network/network.h" +#undef _UNICODE +#include +#ifndef _MSC_VER +#include +#endif + #ifdef _WIN32 extern "C" { // tells Nvidia drivers to use the dedicated GPU by default on laptops with switchable graphics diff --git a/src/dedicated_room/citra-room.cpp b/src/dedicated_room/citra-room.cpp index 5f776e12b..3ba3972ac 100644 --- a/src/dedicated_room/citra-room.cpp +++ b/src/dedicated_room/citra-room.cpp @@ -11,13 +11,6 @@ #include #include -#ifdef _MSC_VER -#include -#else -#include -#include -#endif - #ifdef _WIN32 // windows.h needs to be included before shellapi.h #include @@ -40,6 +33,12 @@ #include "web_service/verify_user_jwt.h" #endif +#undef _UNICODE +#include +#ifndef _MSC_VER +#include +#endif + static void PrintHelp(const char* argv0) { std::cout << "Usage: " << argv0 << " [options] \n"