diff --git a/CMakeLists.txt b/CMakeLists.txt index fd7600401..799a3177a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,18 +35,10 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) if(MSVC) add_compile_definitions(_CRT_SECURE_NO_WARNINGS) add_compile_options(/arch:SSE2) - # Pin both charsets. Sources are UTF-8; narrow string literals are Windows-1252, - # because the .vf bitmap fonts are indexed by Windows-1252 byte value and several - # literals embed those bytes directly (\x95 bullet, \xA6 chat prefix, ...). - # Without this the ordinary literal encoding follows the build machine's system - # code page: on a DBCS locale such as 932 those bytes become invalid multi-byte - # sequences and std::format throws std::format_error at runtime. - add_compile_options(/source-charset:utf-8 /execution-charset:windows-1252) # Statically link Microsoft's CRT. set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") else() add_compile_options(-msse2) - add_compile_options(-finput-charset=UTF-8 -fexec-charset=WINDOWS-1252) endif() # Macros @@ -81,6 +73,19 @@ macro(setup_debug_info target) endmacro() add_subdirectory(vendor) + +# Pin both charsets for Alpine Faction's own code. Sources are UTF-8; narrow string literals are Windows-1252, +# because the .vf bitmap fonts are indexed by Windows-1252 byte value and several literals embed those bytes +# directly (\x95 bullet, \xA6 chat prefix, ...). Without this the ordinary literal encoding follows the build +# machine's system code page: on a DBCS locale such as 932 those bytes become invalid multi-byte sequences and +# std::format throws std::format_error at runtime. +# This is applied AFTER vendor/ so third-party code keeps its own charset settings. +if(MSVC) + add_compile_options(/source-charset:utf-8 /execution-charset:windows-1252) +else() + add_compile_options(-finput-charset=UTF-8 -fexec-charset=WINDOWS-1252) +endif() + add_subdirectory(launcher_common) add_subdirectory(launcher) add_subdirectory(common)