LuaSocket now working on Windows.
This commit is contained in:
parent
4cc9e1b6d8
commit
405881f2d7
6 changed files with 37 additions and 15 deletions
|
@ -63,9 +63,9 @@ function doBuild() {
|
|||
# The grep nonsense hides a warning we don't care about.
|
||||
${CROSS}-${CPPCOMPILER} -o "${TARGET}" ${OFILES} ${EXTRA_OFILES} "-L${SOURCE_DIR}/../thirdparty-build/${OSNAME}/${OSARCH}/installed/lib" ${EXTRA_LD_FLAGS} 2>&1 | grep -v loslib || true
|
||||
|
||||
echo "Compressing ${TARGET}..."
|
||||
${CROSS}-strip "${TARGET}"
|
||||
upx -9 "${TARGET}"
|
||||
#echo "Compressing ${TARGET}..."
|
||||
#${CROSS}-strip "${TARGET}"
|
||||
#upx -9 "${TARGET}"
|
||||
|
||||
cd ..
|
||||
rm -rf temp
|
||||
|
@ -103,9 +103,9 @@ echo -e "${G_L}\nWindows i686\n${G_L}"
|
|||
CROSS="i686-w64-mingw32"
|
||||
CCOMPILER="gcc"
|
||||
CPPCOMPILER="g++"
|
||||
EXTRA_CFLAGS="-O2"
|
||||
EXTRA_CFLAGS="-O2 -DLUASOCKET_INET_PTON"
|
||||
EXTRA_OFILES="/tmp/singe.res"
|
||||
EXTRA_LD_FLAGS="-mwindows -static -lmingw32 -l:everything.a -lm -lbcrypt -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid -Dmain=SDL_main"
|
||||
EXTRA_LD_FLAGS="-mwindows -static -lmingw32 -l:everything.a -lm -lbcrypt -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid -lws2_32 -Dmain=SDL_main"
|
||||
xcf2png icon.xcf -o /tmp/icon.png
|
||||
icotool -c -o /tmp/icon.ico /tmp/icon.png
|
||||
${CROSS}-windres singe.rc -O coff -o /tmp/singe.res
|
||||
|
@ -119,9 +119,9 @@ echo -e "${G_L}\nWindows x86_64\n${G_L}"
|
|||
CROSS="x86_64-w64-mingw32"
|
||||
CCOMPILER="gcc"
|
||||
CPPCOMPILER="g++"
|
||||
EXTRA_CFLAGS="-O2"
|
||||
EXTRA_CFLAGS="-O2 -DLUASOCKET_INET_PTON"
|
||||
EXTRA_OFILES="/tmp/singe.res"
|
||||
EXTRA_LD_FLAGS="-mwindows -static -lmingw32 -l:everything.a -lm -lbcrypt -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid -Dmain=SDL_main"
|
||||
EXTRA_LD_FLAGS="-mwindows -static -lmingw32 -l:everything.a -lm -lbcrypt -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid -lws2_32 -Dmain=SDL_main"
|
||||
xcf2png icon.xcf -o /tmp/icon.png
|
||||
icotool -c -o /tmp/icon.ico /tmp/icon.png
|
||||
${CROSS}-windres singe.rc -O coff -o /tmp/singe.res
|
||||
|
|
|
@ -34,6 +34,12 @@
|
|||
#include "thirdparty/manymouse/manymouse.h"
|
||||
#include "thirdparty/luafilesystem/src/lfs.h"
|
||||
#include "thirdparty/luasocket/src/luasocket.h"
|
||||
#ifndef _WIN32
|
||||
#include "thirdparty/luasocket/src/unixdgram.h"
|
||||
#include "thirdparty/luasocket/src/unixstream.h"
|
||||
// There is no serial.h, so fake it.
|
||||
LUASOCKET_API int luaopen_socket_serial(lua_State *L);
|
||||
#endif
|
||||
|
||||
#include "main.h"
|
||||
#include "util.h"
|
||||
|
@ -338,6 +344,7 @@ void luaTrace(lua_State *L, char *method, char *fmt, ...);
|
|||
void processKey(bool down, int keysym, int32_t scancode);
|
||||
void putPixel(int32_t x, int32_t y);
|
||||
void startControllers(void);
|
||||
void startLuaContext(lua_State *L);
|
||||
void stopControllers(void);
|
||||
void takeScreenshot(void);
|
||||
void updatePauseState(void);
|
||||
|
@ -3408,10 +3415,7 @@ void singe(SDL_Window *window, SDL_Renderer *renderer, ConfigT *conf) {
|
|||
|
||||
// Load controller mappings
|
||||
_global.luaContext = luaL_newstate();
|
||||
luaL_openlibs(_global.luaContext);
|
||||
lua_atpanic(_global.luaContext, luaError);
|
||||
luaopen_lfs(_global.luaContext);
|
||||
luaopen_socket_core(_global.luaContext);
|
||||
startLuaContext(_global.luaContext);
|
||||
// Load framework
|
||||
if (luaL_loadbuffer(_global.luaContext, (char *)Framework_singe, Framework_singe_len, "Input Mappings") || lua_pcall(_global.luaContext, 0, 0, 0)) utilDie("%s", lua_tostring(_global.luaContext, -1));
|
||||
// Load default mappings
|
||||
|
@ -3489,10 +3493,7 @@ void singe(SDL_Window *window, SDL_Renderer *renderer, ConfigT *conf) {
|
|||
|
||||
// Start Lua for game
|
||||
_global.luaContext = luaL_newstate();
|
||||
luaL_openlibs(_global.luaContext);
|
||||
lua_atpanic(_global.luaContext, luaError);
|
||||
luaopen_lfs(_global.luaContext);
|
||||
luaopen_socket_core(_global.luaContext);
|
||||
startLuaContext(_global.luaContext);
|
||||
|
||||
// Lua API for Singe
|
||||
lua_register(_global.luaContext, "colorBackground", apiColorBackground);
|
||||
|
@ -4138,6 +4139,19 @@ void startControllers(void) {
|
|||
}
|
||||
|
||||
|
||||
void startLuaContext(lua_State *L) {
|
||||
luaL_openlibs(L);
|
||||
lua_atpanic(L, luaError);
|
||||
luaopen_lfs(L);
|
||||
luaopen_socket_core(L);
|
||||
#ifndef _WIN32
|
||||
unixdgram_open(L);
|
||||
unixstream_open(L);
|
||||
luaopen_socket_serial(L);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void stopControllers(void) {
|
||||
int32_t x;
|
||||
|
||||
|
|
2
singe/thirdparty/luasocket/src/serial.c
vendored
2
singe/thirdparty/luasocket/src/serial.c
vendored
|
@ -1,3 +1,4 @@
|
|||
#ifndef _WIN32
|
||||
/*=========================================================================*\
|
||||
* Serial stream
|
||||
* LuaSocket toolkit
|
||||
|
@ -169,3 +170,4 @@ static int global_create(lua_State *L) {
|
|||
buffer_init(&un->buf, &un->io, &un->tm);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
|
2
singe/thirdparty/luasocket/src/unix.c
vendored
2
singe/thirdparty/luasocket/src/unix.c
vendored
|
@ -1,3 +1,4 @@
|
|||
#ifndef _WIN32
|
||||
/*=========================================================================*\
|
||||
* Unix domain socket
|
||||
* LuaSocket toolkit
|
||||
|
@ -67,3 +68,4 @@ LUASOCKET_API int luaopen_socket_unix(lua_State *L)
|
|||
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
|
2
singe/thirdparty/luasocket/src/unixdgram.c
vendored
2
singe/thirdparty/luasocket/src/unixdgram.c
vendored
|
@ -1,3 +1,4 @@
|
|||
#ifndef _WIN32
|
||||
/*=========================================================================*\
|
||||
* Unix domain socket dgram submodule
|
||||
* LuaSocket toolkit
|
||||
|
@ -403,3 +404,4 @@ static int global_create(lua_State *L)
|
|||
return 2;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
2
singe/thirdparty/luasocket/src/unixstream.c
vendored
2
singe/thirdparty/luasocket/src/unixstream.c
vendored
|
@ -1,3 +1,4 @@
|
|||
#ifndef _WIN32
|
||||
/*=========================================================================*\
|
||||
* Unix domain socket stream sub module
|
||||
* LuaSocket toolkit
|
||||
|
@ -353,3 +354,4 @@ static int global_create(lua_State *L) {
|
|||
return 2;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue