Lunatic: make it possible to build with LuaJIT 2.1, add -Lopts=profile there.

git-svn-id: https://svn.eduke32.com/eduke32@4107 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-10-16 19:43:06 +00:00
parent 1b29ac6db7
commit 7791f94073
7 changed files with 42 additions and 8 deletions

View file

@ -144,7 +144,9 @@ BUILD32_ON_64 ?= 0
USE_LIBPNG ?= 1
USE_LIBVPX ?= 1
NETCODE ?= 1
LUNATIC ?= 0
USE_LUAJIT_2_1 ?= 0
# EXPERIMENTAL, unfinished x86_64 assembly routines. DO NOT ENABLE.
USE_ASM64 ?= 0
@ -469,6 +471,9 @@ ifneq ($(LUNATIC),0)
override DISABLEINLINING=1
BASECOMMONFLAGS+= -I$(MAKEFILE_COMMON_DIR)/source/lunatic -DLUNATIC
ifneq ($(USE_LUAJIT_2_1),0)
BASECOMMONFLAGS+= -DUSE_LUAJIT_2_1
endif
# Determine size of defs.ilua bytecode once.
ifndef DEFS_BC_SIZE

View file

@ -3,7 +3,11 @@
#ifndef ENGINE_LUNATIC_H_
#define ENGINE_LUNATIC_H_
#include <luajit-2.0/lua.h>
#ifdef USE_LUAJIT_2_1
# include <luajit-2.1/lua.h>
#else
# include <luajit-2.0/lua.h>
#endif
typedef struct

View file

@ -1,8 +1,14 @@
/* The Lunatic Interpreter, part of EDuke32. Common, engine-side stuff. */
#include <luajit-2.0/lua.h>
#include <luajit-2.0/lualib.h>
#include <luajit-2.0/lauxlib.h>
#ifdef USE_LUAJIT_2_1
# include <luajit-2.1/lua.h>
# include <luajit-2.1/lualib.h>
# include <luajit-2.1/lauxlib.h>
#else
# include <luajit-2.0/lua.h>
# include <luajit-2.0/lualib.h>
# include <luajit-2.0/lauxlib.h>
#endif
#include "cache1d.h"
#include "osd.h"

View file

@ -2873,6 +2873,7 @@ void G_GameExit(const char *msg)
{
#ifdef LUNATIC
El_PrintTimes();
El_DestroyState(&g_ElState);
#endif
if (*msg != 0) g_player[myconnectindex].ps->palette = BASEPAL;

View file

@ -12,6 +12,7 @@ local ffiC = ffi.C
local bit = require("bit")
local bor = bit.bor
local pcall = pcall
ffi.cdef "const char **g_argv;"
@ -22,12 +23,14 @@ ffi.cdef "const char **g_argv;"
-- (env var: LUAJIT_VERBOSEFILE)
-- dump: load LuaJIT's 'dump' module, printing generated IR/machine code
-- (env var: LUAJIT_DUMPFILE)
-- profile: load LuaJIT's 'jit.p' module for profiling (LuaJIT 2.1 only)
-- (env var: LUAJIT_PROFILEFILE)
-- strict: catch various conditions that may indicate an logical error
-- TODO for strict: actor[], spriteext[], per-actor gamevars
local debug_flags = {}
local IS_DEBUG_FLAG = {
diag=true, nojit=true, traces=true, dump=true,
strict=true,
strict=true, profile=true,
}
-- Handle command-line argument. (Look for -Lopts=...)
@ -64,6 +67,12 @@ if (not _LUNATIC_AUX) then
elseif (debug_flags.traces) then
require("v").on()
end
if (debug_flags.profile) then
if (pcall(function() require("jit.p").start() end) == false) then
print("Warning: failed enabing profiler. Running LuaJIT 2.0 build?")
end
end
end
local math = require("math")

View file

@ -5,8 +5,13 @@
#include <errno.h>
#include <string.h> // strerror
#include <luajit-2.0/lualib.h>
#include <luajit-2.0/lauxlib.h>
#ifdef USE_LUAJIT_2_1
# include <luajit-2.1/lualib.h>
# include <luajit-2.1/lauxlib.h>
#else
# include <luajit-2.0/lualib.h>
# include <luajit-2.0/lauxlib.h>
#endif
#include "build.h" // printext256

View file

@ -1,6 +1,10 @@
/* The Lunatic Interpreter, part of EDuke32. Editor stuff. */
#include <luajit-2.0/lualib.h>
#ifdef USE_LUAJIT_2_1
# include <luajit-2.1/lualib.h>
#else
# include <luajit-2.0/lualib.h>
#endif
#include "lunatic_m32.h"