From 65c25065ee99494ebc8d775c2c270bb123cce3da Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Mon, 18 May 2015 17:17:19 +0300 Subject: [PATCH 1/2] angelscript: don't use deprecated GetParamTypeId Signed-off-by: Igor Gnatenko --- src/scriptengine/scriptarray.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/scriptengine/scriptarray.cpp b/src/scriptengine/scriptarray.cpp index edb2bcd1c..c04b3f98c 100644 --- a/src/scriptengine/scriptarray.cpp +++ b/src/scriptengine/scriptarray.cpp @@ -1496,7 +1496,8 @@ void CScriptArray::Precache() continue; // The parameter must either be a reference to the subtype or a handle to the subtype - int paramTypeId = func->GetParamTypeId(0, &flags); + int paramTypeId; + func->GetParam(0, ¶mTypeId, &flags, NULL, NULL); if( (paramTypeId & ~(asTYPEID_OBJHANDLE|asTYPEID_HANDLETOCONST)) != (subTypeId & ~(asTYPEID_OBJHANDLE|asTYPEID_HANDLETOCONST)) ) continue; From 7005f3b069ead45bf7e5f6eb99c2a4c6a6197508 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Mon, 18 May 2015 17:23:28 +0300 Subject: [PATCH 2/2] build: allow to use system angelscript Signed-off-by: Igor Gnatenko --- CMakeLists.txt | 14 ++++++++++---- cmake/FindAngelscript.cmake | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 cmake/FindAngelscript.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 2c2f3f5c7..52a06913f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,9 +121,15 @@ elseif(MSVC) endif() -# Build the angelscript library -add_subdirectory("${PROJECT_SOURCE_DIR}/lib/angelscript/projects/cmake") -include_directories("${PROJECT_SOURCE_DIR}/lib/angelscript/include") +# Build the angelscript library if not in system +find_package(Angelscript) +if(ANGELSCRIPT_FOUND) + include_directories(${Angelscript_INCLUDE_DIRS}) +else() + add_subdirectory("${PROJECT_SOURCE_DIR}/lib/angelscript/projects/cmake") + include_directories("${PROJECT_SOURCE_DIR}/lib/angelscript/include") + set(Angelscript_LIBRARIES angelscript) +endif() # OpenAL if(APPLE) @@ -310,7 +316,7 @@ target_link_libraries(supertuxkart enet glew stkirrlicht - angelscript + ${Angelscript_LIBRARIES} ${CURL_LIBRARIES} ${OGGVORBIS_LIBRARIES} ${OPENAL_LIBRARY} diff --git a/cmake/FindAngelscript.cmake b/cmake/FindAngelscript.cmake new file mode 100644 index 000000000..09020c319 --- /dev/null +++ b/cmake/FindAngelscript.cmake @@ -0,0 +1,33 @@ +# - Try to find angelscript +# Once done this will define +# +# ANGELSCRIPT_FOUND - system has angelscript +# Angelscript_INCLUDE_DIRS - the angelscript include directory +# Angelscript_LIBRARIES - the libraries needed to use angelscript +# + +FIND_PATH(Angelscript_INCLUDE_DIRS angelscript.h + PATHS + /usr/local + /usr + PATH_SUFFIXES include + ) + +FIND_LIBRARY(Angelscript_LIBRARY + NAMES angelscript + PATHS + /usr/local + /usr + PATH_SUFFIXES lib + ) + +# handle the QUIETLY and REQUIRED arguments and set ANGELSCRIPT_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Angelscript DEFAULT_MSG Angelscript_LIBRARY Angelscript_INCLUDE_DIRS) + +IF (ANGELSCRIPT_FOUND) + SET(Angelscript_LIBRARIES ${Angelscript_LIBRARY}) +ENDIF (ANGELSCRIPT_FOUND) + +MARK_AS_ADVANCED(Angelscript_LIBRARY Angelscript_LIBRARIES Angelscript_INCLUDE_DIRS)