cmake option to use luajit

This commit is contained in:
Eduardo Bart 2012-04-16 10:57:24 -03:00
parent 1d558bc412
commit a4a00a49fe
4 changed files with 37 additions and 5 deletions

View File

@ -1,3 +1,3 @@
edubart - leader developer (project creator) <edub4rt@gmail.com> edubart - leader developer (project creator) <edub4rt@gmail.com>
andrefaramir - scripting (implemented battle, hotkeys, chat, ..) <andre_faramir@hotmail.com> andrefaramir - scripting (implemented a lot of modules like battle, hotkeys, npctrade, chat) <andre_faramir@hotmail.com>
baxnie - inactive (implemented first game functionality) <henrique_santiago93@hotmail.com> baxnie - implemented first game functionality <henrique_santiago93@hotmail.com>

View File

@ -10,6 +10,8 @@ OPTION(USE_OPENGL_ES2 "Use OpenGL ES 2.0 (for mobiles devices)" OFF)
OPTION(CRASH_HANDLER "Generate crash reports" ON) OPTION(CRASH_HANDLER "Generate crash reports" ON)
SET(BUILD_REVISION "custom" CACHE "Git revision string (intended for releases)" STRING) SET(BUILD_REVISION "custom" CACHE "Git revision string (intended for releases)" STRING)
OPTION(LUAJIT "Use lua jit" OFF)
# set debug as default build type # set debug as default build type
IF(NOT CMAKE_BUILD_TYPE) IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE RelWithDebInfo) SET(CMAKE_BUILD_TYPE RelWithDebInfo)
@ -36,7 +38,12 @@ ELSE()
SET(OPENGL_LIBRARIES ${GLEW_LIBRARY} ${OPENGL_LIBRARIES}) SET(OPENGL_LIBRARIES ${GLEW_LIBRARY} ${OPENGL_LIBRARIES})
ENDIF() ENDIF()
FIND_PACKAGE(Lua REQUIRED) IF(LUAJIT)
FIND_PACKAGE(LuaJIT REQUIRED)
ELSE()
FIND_PACKAGE(Lua REQUIRED)
ENDIF()
FIND_PACKAGE(PhysFS REQUIRED) FIND_PACKAGE(PhysFS REQUIRED)
FIND_PACKAGE(GMP REQUIRED) FIND_PACKAGE(GMP REQUIRED)
FIND_PACKAGE(ZLIB REQUIRED) FIND_PACKAGE(ZLIB REQUIRED)

View File

@ -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)

View File

@ -43,6 +43,9 @@ extern "C" {
@@ LUA_UNSIGNED is the integral type used by lua_pushunsigned/lua_tounsigned. @@ LUA_UNSIGNED is the integral type used by lua_pushunsigned/lua_tounsigned.
** It must have at least 32 bits. ** It must have at least 32 bits.
*/ */
#ifndef LUAI_INT32
#define LUAI_INT32 int
#endif
#define LUA_UNSIGNED unsigned LUAI_INT32 #define LUA_UNSIGNED unsigned LUAI_INT32
#if defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI) /* { */ #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: ----- */ /* ----- Lua 5.2 luaL_newlib() compatibility: ----- */
#define LUAMOD_API LUALIB_API #define LUAMOD_API LUALIB_API
#define LUA_BITLIBNAME "bit32" #define LUA_BIT32LIBNAME "bit32"
#define luaL_newlib(x, y) luaL_register(x, LUA_BITLIBNAME, y) #define luaL_newlib(x, y) luaL_register(x, LUA_BIT32LIBNAME, y)
/* ----- avoid a 'symbol redefined' warning below ----- */ /* ----- avoid a 'symbol redefined' warning below ----- */