diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a2ea75..f215649 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,6 +62,16 @@ add_subdirectory(${GGML_SOURCE_DIR} ggml) # cpp-httplib (HTTP server library, used by yue-server) add_subdirectory(vendor/cpp-httplib) +# Windows: the process code page is UTF-8, so paths and arguments outside the +# system's ANSI code page reach the narrow file APIs (fopen, CreateFileA, +# FindFirstFileA) intact instead of as '?'. +macro(utf8_code_page target) + get_target_property(UTF8_TARGET_TYPE ${target} TYPE) + if(MSVC AND UTF8_TARGET_TYPE STREQUAL "EXECUTABLE") + target_sources(${target} PRIVATE ${CMAKE_SOURCE_DIR}/tools/utf8.manifest) + endif() +endmacro() + # Shared compile options and ggml linkage macro(link_ggml_backends target) target_include_directories(${target} PRIVATE @@ -99,6 +109,7 @@ macro(link_ggml_backends target) target_link_options(${target} PRIVATE -fsycl) endif() add_dependencies(${target} version) + utf8_code_page(${target}) endmacro() # yyjson (MIT, fast JSON parser/writer) @@ -162,6 +173,7 @@ target_include_directories(mp3-codec PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ) add_dependencies(mp3-codec version) +utf8_code_page(mp3-codec) if(MSVC) target_compile_options(mp3-codec PRIVATE /W4 /wd4100 /wd4505) else() diff --git a/tools/utf8.manifest b/tools/utf8.manifest new file mode 100644 index 0000000..bddb2d9 --- /dev/null +++ b/tools/utf8.manifest @@ -0,0 +1,8 @@ + + + + + UTF-8 + + +