diff --git a/AUTHORS b/AUTHORS index 6cbf5a42..aa63909b 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,3 +1,3 @@ edubart - leader developer (project creator) -andrefaramir - scripting (implemented battle, hotkeys, chat, ..) -baxnie - inactive (implemented first game functionality) +andrefaramir - scripting (implemented a lot of modules like battle, hotkeys, npctrade, chat) +baxnie - implemented first game functionality diff --git a/src/framework/CMakeLists.txt b/src/framework/CMakeLists.txt index 4998cf8b..11290a55 100644 --- a/src/framework/CMakeLists.txt +++ b/src/framework/CMakeLists.txt @@ -10,6 +10,8 @@ OPTION(USE_OPENGL_ES2 "Use OpenGL ES 2.0 (for mobiles devices)" OFF) OPTION(CRASH_HANDLER "Generate crash reports" ON) SET(BUILD_REVISION "custom" CACHE "Git revision string (intended for releases)" STRING) +OPTION(LUAJIT "Use lua jit" OFF) + # set debug as default build type IF(NOT CMAKE_BUILD_TYPE) SET(CMAKE_BUILD_TYPE RelWithDebInfo) @@ -36,7 +38,12 @@ ELSE() SET(OPENGL_LIBRARIES ${GLEW_LIBRARY} ${OPENGL_LIBRARIES}) ENDIF() -FIND_PACKAGE(Lua REQUIRED) +IF(LUAJIT) + FIND_PACKAGE(LuaJIT REQUIRED) +ELSE() + FIND_PACKAGE(Lua REQUIRED) +ENDIF() + FIND_PACKAGE(PhysFS REQUIRED) FIND_PACKAGE(GMP REQUIRED) FIND_PACKAGE(ZLIB REQUIRED) diff --git a/src/framework/cmake/FindLuaJIT.cmake b/src/framework/cmake/FindLuaJIT.cmake new file mode 100644 index 00000000..f7263818 --- /dev/null +++ b/src/framework/cmake/FindLuaJIT.cmake @@ -0,0 +1,22 @@ +# Try to find the lua librairy +# LUA_FOUND - system has lua +# LUA_INCLUDE_DIR - the lua include directory +# LUA_LIBRARY - the lua library +# LUA_LIBRARIES - the lua library and it's dependencies + +FIND_PATH(LUA_INCLUDE_DIR NAMES lua.h PATH_SUFFIXES luajit-2.0) +FIND_LIBRARY(LUA_LIBRARY NAMES libluajit51.a libluajit5.1.a libluajit-5.1.a libluajit.a luajit51 luajit5.1 luajit-5.1 luajit) + +IF(LUA_LIBRARY) + IF(UNIX AND NOT APPLE) + FIND_LIBRARY(LUA_MATH_LIBRARY m) + SET(LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}") + ELSE(UNIX AND NOT APPLE) + SET(LUA_LIBRARIES "${LUA_LIBRARY}") + ENDIF(UNIX AND NOT APPLE) +ENDIF(LUA_LIBRARY) + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LuaJIT DEFAULT_MSG LUA_LIBRARIES LUA_INCLUDE_DIR) +MARK_AS_ADVANCED(LUA_INCLUDE_DIR LUA_LIBRARIES LUA_LIBRARY LUA_MATH_LIBRARY) + diff --git a/src/framework/thirdparty/lbitlib-5.2.0-backport4.cpp b/src/framework/thirdparty/lbitlib-5.2.0-backport4.cpp index 6ad823cf..1a4a2190 100644 --- a/src/framework/thirdparty/lbitlib-5.2.0-backport4.cpp +++ b/src/framework/thirdparty/lbitlib-5.2.0-backport4.cpp @@ -43,6 +43,9 @@ extern "C" { @@ LUA_UNSIGNED is the integral type used by lua_pushunsigned/lua_tounsigned. ** It must have at least 32 bits. */ +#ifndef LUAI_INT32 +#define LUAI_INT32 int +#endif #define LUA_UNSIGNED unsigned LUAI_INT32 #if defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI) /* { */ @@ -154,8 +157,8 @@ static lua_Unsigned luaL_checkunsigned (lua_State *L, int arg) { /* ----- Lua 5.2 luaL_newlib() compatibility: ----- */ #define LUAMOD_API LUALIB_API -#define LUA_BITLIBNAME "bit32" -#define luaL_newlib(x, y) luaL_register(x, LUA_BITLIBNAME, y) +#define LUA_BIT32LIBNAME "bit32" +#define luaL_newlib(x, y) luaL_register(x, LUA_BIT32LIBNAME, y) /* ----- avoid a 'symbol redefined' warning below ----- */