mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-24 01:48:44 +00:00
Fixed: #55 ryzom_client crashes on start with unprotected error in call to Lua API
This commit is contained in:
parent
acd4e32b1c
commit
1b5057f096
4 changed files with 128 additions and 6 deletions
|
@ -144,11 +144,6 @@ IF(WITH_NEL)
|
|||
|
||||
IF(WITH_GUI)
|
||||
FIND_PACKAGE(Libwww REQUIRED)
|
||||
IF(WITH_LUA51)
|
||||
FIND_PACKAGE(Lua51 REQUIRED)
|
||||
ELSE(WITH_LUA51)
|
||||
FIND_PACKAGE(Lua50 REQUIRED)
|
||||
ENDIF(WITH_LUA51)
|
||||
FIND_PACKAGE(Luabind REQUIRED)
|
||||
FIND_PACKAGE(CURL REQUIRED)
|
||||
|
||||
|
|
81
code/CMakeModules/FindLua52.cmake
Normal file
81
code/CMakeModules/FindLua52.cmake
Normal file
|
@ -0,0 +1,81 @@
|
|||
# Locate Lua library
|
||||
# This module defines
|
||||
# LUA52_FOUND, if false, do not try to link to Lua
|
||||
# LUA_LIBRARIES
|
||||
# LUA_INCLUDE_DIR, where to find lua.h
|
||||
# LUA_VERSION_STRING, the version of Lua found (since CMake 2.8.8)
|
||||
#
|
||||
# Note that the expected include convention is
|
||||
# #include "lua.h"
|
||||
# and not
|
||||
# #include <lua/lua.h>
|
||||
# This is because, the lua location is not standardized and may exist
|
||||
# in locations other than lua/
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2007-2009 Kitware, Inc.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
find_path(LUA_INCLUDE_DIR lua.h
|
||||
HINTS
|
||||
ENV LUA_DIR
|
||||
PATH_SUFFIXES include/lua52 include/lua5.2 include/lua-5.2 include/lua include
|
||||
PATHS
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/sw # Fink
|
||||
/opt/local # DarwinPorts
|
||||
/opt/csw # Blastwave
|
||||
/opt
|
||||
)
|
||||
|
||||
find_library(LUA_LIBRARY
|
||||
NAMES lua52 lua5.2 lua-5.2 lua
|
||||
HINTS
|
||||
ENV LUA_DIR
|
||||
PATH_SUFFIXES lib
|
||||
PATHS
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/sw
|
||||
/opt/local
|
||||
/opt/csw
|
||||
/opt
|
||||
)
|
||||
|
||||
if(LUA_LIBRARY)
|
||||
# include the math library for Unix
|
||||
if(UNIX AND NOT APPLE AND NOT BEOS)
|
||||
find_library(LUA_MATH_LIBRARY m)
|
||||
set( LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}" CACHE STRING "Lua Libraries")
|
||||
# For Windows and Mac, don't need to explicitly include the math library
|
||||
else()
|
||||
set( LUA_LIBRARIES "${LUA_LIBRARY}" CACHE STRING "Lua Libraries")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h")
|
||||
file(STRINGS "${LUA_INCLUDE_DIR}/lua.h" lua_version_str REGEX "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua .+\"")
|
||||
|
||||
string(REGEX REPLACE "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([^\"]+)\".*" "\\1" LUA_VERSION_STRING "${lua_version_str}")
|
||||
unset(lua_version_str)
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua52
|
||||
REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR
|
||||
VERSION_VAR LUA_VERSION_STRING)
|
||||
|
||||
mark_as_advanced(LUA_INCLUDE_DIR LUA_LIBRARIES LUA_LIBRARY LUA_MATH_LIBRARY)
|
||||
|
|
@ -4,6 +4,48 @@
|
|||
# LUABIND_FOUND, if false, do not try to link to LUABIND
|
||||
# LUABIND_INCLUDE_DIR, where to find headers.
|
||||
|
||||
MACRO(FIND_CORRECT_LUA_VERSION)
|
||||
# Check Lua version linked to Luabind under Linux
|
||||
IF(LUABIND_LIBRARY_RELEASE MATCHES "\\.so")
|
||||
INCLUDE(CheckDepends)
|
||||
|
||||
SET(LUA52_LIBRARY "liblua5.2")
|
||||
CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA52_LIBRARY LUALIB_FOUND)
|
||||
|
||||
IF(LUALIB_FOUND)
|
||||
MESSAGE(STATUS "Luabind is using Lua 5.2")
|
||||
FIND_PACKAGE(Lua52 REQUIRED)
|
||||
ELSE(LUALIB_FOUND)
|
||||
SET(LUA51_LIBRARY "liblua5.1")
|
||||
CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA51_LIBRARY LUALIB_FOUND)
|
||||
|
||||
IF(LUALIB_FOUND)
|
||||
MESSAGE(STATUS "Luabind is using Lua 5.1")
|
||||
FIND_PACKAGE(Lua51 REQUIRED)
|
||||
ELSE(LUALIB_FOUND)
|
||||
SET(LUA50_LIBRARY "liblua5.0")
|
||||
CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA50_LIBRARY LUALIB_FOUND)
|
||||
|
||||
IF(LUALIB_FOUND)
|
||||
MESSAGE(STATUS "Luabind is using Lua 5.0")
|
||||
FIND_PACKAGE(Lua50 REQUIRED)
|
||||
ELSE(LUALIB_FOUND)
|
||||
MESSAGE(FATAL_ERROR "Can't determine Lua version used by Luabind")
|
||||
ENDIF(LUALIB_FOUND)
|
||||
ENDIF(LUALIB_FOUND)
|
||||
ENDIF(LUALIB_FOUND)
|
||||
ELSE(LUABIND_LIBRARY_RELEASE MATCHES "\\.so")
|
||||
# TODO: find a way to detect Lua version
|
||||
IF(WITH_LUA52)
|
||||
FIND_PACKAGE(Lua52 REQUIRED)
|
||||
ELSEIF(WITH_LUA51)
|
||||
FIND_PACKAGE(Lua51 REQUIRED)
|
||||
ELSE(WITH_LUA52)
|
||||
FIND_PACKAGE(Lua50 REQUIRED)
|
||||
ENDIF(WITH_LUA52)
|
||||
ENDIF(LUABIND_LIBRARY_RELEASE MATCHES "\\.so")
|
||||
ENDMACRO(FIND_CORRECT_LUA_VERSION)
|
||||
|
||||
IF(LUABIND_LIBRARIES AND LUABIND_INCLUDE_DIR)
|
||||
# in cache already
|
||||
SET(Luabind_FIND_QUIETLY TRUE)
|
||||
|
@ -84,6 +126,9 @@ IF(LUABIND_FOUND)
|
|||
IF(LUABIND_VERSION_FILE)
|
||||
SET(LUABIND_DEFINITIONS "-DHAVE_LUABIND_VERSION")
|
||||
ENDIF(LUABIND_VERSION_FILE)
|
||||
|
||||
FIND_CORRECT_LUA_VERSION()
|
||||
|
||||
IF(NOT Luabind_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found Luabind: ${LUABIND_LIBRARIES}")
|
||||
ENDIF(NOT Luabind_FIND_QUIETLY)
|
||||
|
|
|
@ -345,7 +345,8 @@ MACRO(NL_SETUP_RYZOM_DEFAULT_OPTIONS)
|
|||
###
|
||||
# Optional support
|
||||
###
|
||||
OPTION(WITH_LUA51 "Build Ryzom Core using Lua51" ON )
|
||||
OPTION(WITH_LUA51 "Build Ryzom Core using Lua 5.1" ON )
|
||||
OPTION(WITH_LUA52 "Build Ryzom Core using Lua 5.2" OFF)
|
||||
ENDMACRO(NL_SETUP_RYZOM_DEFAULT_OPTIONS)
|
||||
|
||||
MACRO(NL_SETUP_SNOWBALLS_DEFAULT_OPTIONS)
|
||||
|
|
Loading…
Reference in a new issue