diff --git a/core/src/lua/xmake.lua b/core/src/lua/xmake.lua index 8803dd2b3ef..00648039772 100644 --- a/core/src/lua/xmake.lua +++ b/core/src/lua/xmake.lua @@ -21,7 +21,7 @@ target("lua") -- add definitions add_defines("LUA_COMPAT_5_1", "LUA_COMPAT_5_2", "LUA_COMPAT_5_3", {public = true}) - if is_plat("windows") then + if is_plat("windows", "mingw") then -- it has been defined in luaconf.h --add_defines("LUA_USE_WINDOWS") elseif is_plat("macosx", "iphoneos") then diff --git a/core/src/lua/xmake.sh b/core/src/lua/xmake.sh index 78e05bd21be..59eff5dd3b4 100755 --- a/core/src/lua/xmake.sh +++ b/core/src/lua/xmake.sh @@ -44,8 +44,9 @@ target "lua" # add definitions add_defines "LUA_COMPAT_5_1" "LUA_COMPAT_5_2" "LUA_COMPAT_5_3" "{public}" - if is_plat "mingw"; then - add_defines "LUA_USE_WINDOWS" + if is_plat "mingw"; then true + # it has been defined in luaconf.h + #add_defines "LUA_USE_WINDOWS" elif is_plat "macosx"; then add_defines "LUA_USE_MACOSX" else diff --git a/core/src/xmake/curses/curses.c b/core/src/xmake/curses/curses.c index 29577658a70..2ff4cb77e95 100644 --- a/core/src/xmake/curses/curses.c +++ b/core/src/xmake/curses/curses.c @@ -36,7 +36,11 @@ # undef MOUSE_MOVED #endif #define NCURSES_MOUSE_VERSION 2 -#include +#ifdef TB_COMPILER_IS_MINGW +# include +#else +# include +#endif #if defined(NCURSES_VERSION) # include #endif diff --git a/core/src/xmake/io/stdfile.c b/core/src/xmake/io/stdfile.c index 13edbfc797f..5f94126fa27 100644 --- a/core/src/xmake/io/stdfile.c +++ b/core/src/xmake/io/stdfile.c @@ -56,7 +56,7 @@ static tb_size_t xm_io_stdfile_isatty(tb_size_t type) tb_bool_t answer = tb_false; #if defined(TB_CONFIG_OS_WINDOWS) DWORD mode; - HANDLE console_handle; + HANDLE console_handle = tb_null; switch (type) { case XM_IO_FILE_TYPE_STDIN: console_handle = GetStdHandle(STD_INPUT_HANDLE); break; diff --git a/core/src/xmake/process/openv.c b/core/src/xmake/process/openv.c index 21add6d5527..5903dab2723 100644 --- a/core/src/xmake/process/openv.c +++ b/core/src/xmake/process/openv.c @@ -30,7 +30,7 @@ */ #include "prefix.h" #include "../io/prefix.h" -#if defined(TB_CONFIG_OS_MACOSX) || defined(TB_CONFIG_OS_LINUX) || defined(TB_CONFIG_OS_BSD) || defined(TB_CONFIG_OS_HAIKU) +#if defined(TB_CONFIG_OS_MACOSX) || defined(TB_CONFIG_OS_LINUX) || defined(TB_CONFIG_OS_BSD) || defined(TB_CONFIG_OS_HAIKU) || defined(TB_COMPILER_IS_MINGW) # include #endif diff --git a/core/src/xmake/winos/ansi.c b/core/src/xmake/winos/ansi.c index ee86d13ea1b..7caad7797ea 100644 --- a/core/src/xmake/winos/ansi.c +++ b/core/src/xmake/winos/ansi.c @@ -96,7 +96,6 @@ tb_int_t xm_winos_cp_info(lua_State* lua) // check tb_assert_and_check_return_val(lua, 0); - tb_int_t n = lua_gettop(lua); lua_Integer cp = luaL_checkinteger(lua, 1); luaL_argcheck(lua, cp >= 0 && cp < 65536, 1, "invalid code page"); CPINFOEX cp_info; diff --git a/core/src/xmake/winos/logical_drives.c b/core/src/xmake/winos/logical_drives.c index fe62edd04aa..14fa72fac70 100644 --- a/core/src/xmake/winos/logical_drives.c +++ b/core/src/xmake/winos/logical_drives.c @@ -41,7 +41,6 @@ tb_int_t xm_winos_logical_drives(lua_State* lua) lua_newtable(lua); // get logical drives - tb_bool_t ok = tb_false; tb_char_t* data = tb_null; do { @@ -70,10 +69,6 @@ tb_int_t xm_winos_logical_drives(lua_State* lua) // next drive p += tb_strlen(p) + 1; } - - // ok - ok = tb_true; - } while (0); // exit data diff --git a/core/src/xmake/xmake.lua b/core/src/xmake/xmake.lua index 15702c808f0..af0bfd877ff 100644 --- a/core/src/xmake/xmake.lua +++ b/core/src/xmake/xmake.lua @@ -38,7 +38,7 @@ target("xmake") -- add the common source files add_files("**.c|winos/*.c") - if is_plat("windows", "msys", "cygwin") then + if is_plat("windows", "msys", "mingw", "cygwin") then add_files("winos/*.c") end diff --git a/core/xmake.lua b/core/xmake.lua index e14961d08ef..b64953ad756 100644 --- a/core/xmake.lua +++ b/core/xmake.lua @@ -65,7 +65,7 @@ option_end() option("readline") set_description("Enable or disable readline library") 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() @@ -73,8 +73,15 @@ option_end() -- the curses option option("curses") set_description("Enable or disable curses library") - add_links("curses") - add_cincludes("curses.h") + before_check(function (option) + if is_plat("mingw") then + option:add("cincludes", "ncursesw/curses.h") + option:add("links", "ncursesw") + else + option:add("cincludes", "curses.h") + option:add("links", "curses") + end + end) add_defines("XM_CONFIG_API_HAVE_CURSES") option_end()