Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand Down
8 changes: 8 additions & 0 deletions tools/utf8.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<activeCodePage xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">UTF-8</activeCodePage>
</windowsSettings>
</application>
</assembly>