From 1c6726c12d46ed144d6764a5621c04c87f01305d Mon Sep 17 00:00:00 2001 From: tqfx Date: Sun, 12 May 2024 22:29:09 +0800 Subject: Fix build on msys2/mingw64 --- core/src/xmake/xmake.sh | 1 + core/xmake.sh | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/core/src/xmake/xmake.sh b/core/src/xmake/xmake.sh index 62af5b2fa..d6bd0c2c4 100755 --- a/core/src/xmake/xmake.sh +++ b/core/src/xmake/xmake.sh @@ -72,6 +72,7 @@ target "xmake" add_files "string/*.c" add_files "tty/*.c" if is_plat "mingw"; then + add_defines "UNICODE" "_UNICODE" add_files "winos/*.c" fi diff --git a/core/xmake.sh b/core/xmake.sh index 1abf0dcfc..531b34202 100755 --- a/core/xmake.sh +++ b/core/xmake.sh @@ -38,7 +38,7 @@ option "external" "Always use external dependencies" false # the readline option option "readline" add_links "readline" - add_cincludes "readline/readline.h" + add_cincludes "stdio.h" "readline/readline.h" add_cfuncs "readline" add_defines "XM_CONFIG_API_HAVE_READLINE" option_end @@ -52,11 +52,15 @@ option "curses" option_end option_find_curses() { + local ncurses="ncurses" + if is_plat "mingw"; then + ncurses="ncursesw" + fi local ncurses_ldflags="" - ncurses_ldflags=$(pkg-config --libs ncurses 2>/dev/null) + ncurses_ldflags=$(pkg-config --libs ${ncurses} 2>/dev/null) option "curses" if test_nz "${ncurses_ldflags}"; then - add_cflags `pkg-config --cflags ncurses 2>/dev/null` + add_cflags `pkg-config --cflags ${ncurses} 2>/dev/null` add_ldflags "${ncurses_ldflags}" else add_links "curses" -- cgit v1.3.1