mirror of
https://github.com/nishiowo/nishbox
synced 2025-04-21 20:24:39 +00:00
update lua and completely move to lua
This commit is contained in:
parent
73221cfd08
commit
a1aebffed1
2
.gitignore
vendored
2
.gitignore
vendored
@ -4,7 +4,7 @@
|
||||
*.core
|
||||
*.dll
|
||||
*.zip
|
||||
ext_*.h
|
||||
ext_*
|
||||
/deps
|
||||
/contrib
|
||||
/src/nishbox
|
||||
|
2
.gitmodules
vendored
2
.gitmodules
vendored
@ -1,4 +1,4 @@
|
||||
[submodule "external/lua"]
|
||||
path = external/lua
|
||||
url = https://github.com/lua/lua
|
||||
branch = v5.3
|
||||
branch = v5.4
|
||||
|
12
Makefile
12
Makefile
@ -3,13 +3,18 @@ WINDOWS = NO
|
||||
|
||||
include mk/p_*.mk
|
||||
|
||||
# Lua is statically linked anyways, so this is fine.
|
||||
LUA_CFLAGS = -DLUA_COMPAT_5_2 -DLUA_USE_C89 -I../external/lua
|
||||
LUA_LDFLAGS =
|
||||
LUA_LIBS =
|
||||
|
||||
AR = $(TARGET_PREFIX)ar
|
||||
CC = $(TARGET_PREFIX)gcc
|
||||
OBJDUMP = $(TARGET_PREFIX)objdump
|
||||
STRIP = $(TARGET_PREFIX)strip
|
||||
CFLAGS = -D_DEFAULT_SOURCE -DUSE_$(BACKEND) -I../engine $(ODE_CFLAGS) $(GL_CFLAGS)
|
||||
LDFLAGS =
|
||||
LIBS = $(ODE_LIBS) $(GL_LIBS) $(SOCKET_LIBS)
|
||||
CFLAGS = -D_DEFAULT_SOURCE -DUSE_$(BACKEND) -I../engine $(ODE_CFLAGS) $(GL_CFLAGS) $(LUA_CFLAGS)
|
||||
LDFLAGS = $(LUA_LDFLAGS)
|
||||
LIBS = $(ODE_LIBS) $(GL_LIBS) $(SOCKET_LIBS) $(LUA_LIBS)
|
||||
|
||||
.PHONY: all format clean ./engine ./src print-deps pack
|
||||
|
||||
@ -19,6 +24,7 @@ format:
|
||||
clang-format --verbose -i `find ./src ./engine "(" -name "*.c" -or -name "*.h" ")" -and -not -name "ext_*"`
|
||||
|
||||
./engine::
|
||||
cd $@ && env DISCARD="lua.c" ../tool/genmk LUA ../external/lua > ext_lua.mk
|
||||
$(MAKE) -C $@
|
||||
|
||||
./src:: ./engine
|
||||
|
@ -3,6 +3,8 @@ OBJS = version.o core.o draw.o log.o $(BACKEND)_draw.o font.o stb_image.o math.o
|
||||
|
||||
include ../common.mk
|
||||
|
||||
include ext_lua.mk
|
||||
|
||||
$(TARGET): $(OBJS)
|
||||
$(AR) rcs $@ $(OBJS)
|
||||
|
||||
|
@ -8,6 +8,8 @@
|
||||
#include <winsock.h>
|
||||
#endif
|
||||
|
||||
#include <lua.h>
|
||||
|
||||
/* Interface */
|
||||
#include "nb_core.h"
|
||||
|
||||
@ -28,6 +30,7 @@ void nb_engine_begin(void) {
|
||||
#endif
|
||||
nb_get_version(&ver);
|
||||
nb_function_log("NishBox engine %s", ver.full);
|
||||
nb_function_log("%s", LUA_RELEASE);
|
||||
nb_function_log("OpenGL backend: %s", ver.opengl);
|
||||
#ifdef _WIN32
|
||||
WSAStartup(MAKEWORD(1, 1), &wsa);
|
||||
|
2
external/lua
vendored
2
external/lua
vendored
@ -1 +1 @@
|
||||
Subproject commit 75ea9ccbea7c4886f30da147fb67b693b2624c26
|
||||
Subproject commit 3fe7be956f23385aa1950dc31e2f25127ccfc0ea
|
19
tool/genmk
Executable file
19
tool/genmk
Executable file
@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
OBJS=""
|
||||
for i in $2/*.c; do
|
||||
ADD=true
|
||||
SRC=`echo $i | rev | cut -d"/" -f1 | rev`
|
||||
OBJ=$1_`echo $i | rev | cut -d"/" -f1 | rev | cut -d"." -f1`.o
|
||||
for j in $DISCARD; do
|
||||
if [ "$j" = "$SRC" ]; then
|
||||
ADD=false
|
||||
break
|
||||
fi
|
||||
done
|
||||
if $ADD; then
|
||||
echo "$OBJ: $i"
|
||||
echo " \$(CC) \$(CFLAGS) -c -o \$@ $i"
|
||||
OBJS="$OBJS $OBJ"
|
||||
fi
|
||||
done
|
||||
echo "OBJS +=$OBJS"
|
Loading…
x
Reference in New Issue
Block a user