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.
This commit is contained in:
Lioncash 2019-04-15 17:32:47 -04:00
parent 1f4dfb3998
commit 819c21d99e
2 changed files with 9 additions and 4 deletions

View file

@ -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. # 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) add_definitions(-DWIN32_LEAN_AND_MEAN)
# Ensure that projects build with Unicode support.
add_definitions(-DUNICODE -D_UNICODE)
# /W3 - Level 3 warnings # /W3 - Level 3 warnings
# /MP - Multi-threaded compilation # /MP - Multi-threaded compilation
# /Zi - Output debugging information # /Zi - Output debugging information

View file

@ -32,11 +32,7 @@
#include "yuzu_cmd/config.h" #include "yuzu_cmd/config.h"
#include "yuzu_cmd/emu_window/emu_window_sdl2.h" #include "yuzu_cmd/emu_window/emu_window_sdl2.h"
#include <getopt.h>
#include "core/file_sys/registered_cache.h" #include "core/file_sys/registered_cache.h"
#ifndef _MSC_VER
#include <unistd.h>
#endif
#ifdef _WIN32 #ifdef _WIN32
// windows.h needs to be included before shellapi.h // windows.h needs to be included before shellapi.h
@ -45,6 +41,12 @@
#include <shellapi.h> #include <shellapi.h>
#endif #endif
#undef _UNICODE
#include <getopt.h>
#ifndef _MSC_VER
#include <unistd.h>
#endif
#ifdef _WIN32 #ifdef _WIN32
extern "C" { extern "C" {
// tells Nvidia and AMD drivers to use the dedicated GPU by default on laptops with switchable // tells Nvidia and AMD drivers to use the dedicated GPU by default on laptops with switchable