mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 15:29:55 +00:00
Check LuaJit version
This commit is contained in:
parent
ff142b6009
commit
b6dd84c8ef
4 changed files with 49 additions and 7 deletions
|
@ -21,6 +21,6 @@ ccache --version
|
||||||
cmake --version
|
cmake --version
|
||||||
qmake --version
|
qmake --version
|
||||||
|
|
||||||
curl -fSL -R -J https://gitlab.com/OpenMW/openmw-deps/-/raw/main/macos/openmw-deps-20221010.zip -o ~/openmw-deps.zip
|
curl -fSL -R -J https://gitlab.com/OpenMW/openmw-deps/-/raw/main/macos/openmw-deps-20221113.zip -o ~/openmw-deps.zip
|
||||||
unzip -o ~/openmw-deps.zip -d /private/tmp/openmw-deps > /dev/null
|
unzip -o ~/openmw-deps.zip -d /private/tmp/openmw-deps > /dev/null
|
||||||
|
|
||||||
|
|
|
@ -556,7 +556,7 @@ fi
|
||||||
BULLET_VER="2.89"
|
BULLET_VER="2.89"
|
||||||
FFMPEG_VER="4.2.2"
|
FFMPEG_VER="4.2.2"
|
||||||
ICU_VER="70_1"
|
ICU_VER="70_1"
|
||||||
LUAJIT_VER="2.1.0-beta3"
|
LUAJIT_VER="v2.1.0-beta3-452-g7a0cf5fd"
|
||||||
LZ4_VER="1.9.2"
|
LZ4_VER="1.9.2"
|
||||||
OPENAL_VER="1.20.1"
|
OPENAL_VER="1.20.1"
|
||||||
QT_VER="5.15.2"
|
QT_VER="5.15.2"
|
||||||
|
|
|
@ -471,6 +471,9 @@ else(USE_LUAJIT)
|
||||||
find_package(Lua REQUIRED)
|
find_package(Lua REQUIRED)
|
||||||
add_compile_definitions(NO_LUAJIT)
|
add_compile_definitions(NO_LUAJIT)
|
||||||
endif(USE_LUAJIT)
|
endif(USE_LUAJIT)
|
||||||
|
if (NOT WIN32)
|
||||||
|
include(cmake/CheckLuaCustomAllocator.cmake)
|
||||||
|
endif()
|
||||||
|
|
||||||
# C++ library binding to Lua
|
# C++ library binding to Lua
|
||||||
set(SOL_INCLUDE_DIR ${OpenMW_SOURCE_DIR}/extern/sol3)
|
set(SOL_INCLUDE_DIR ${OpenMW_SOURCE_DIR}/extern/sol3)
|
||||||
|
|
39
cmake/CheckLuaCustomAllocator.cmake
Normal file
39
cmake/CheckLuaCustomAllocator.cmake
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
set(TMP_ROOT ${CMAKE_BINARY_DIR}/try-compile)
|
||||||
|
file(MAKE_DIRECTORY ${TMP_ROOT})
|
||||||
|
|
||||||
|
file(WRITE ${TMP_ROOT}/checkluacustomallocator.c
|
||||||
|
"
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <lua.h>
|
||||||
|
|
||||||
|
void* custom_alloc(void* ud, void* ptr, size_t osize, size_t nsize) {
|
||||||
|
if (nsize == 0) {
|
||||||
|
free(ptr);
|
||||||
|
return NULL;
|
||||||
|
} else {
|
||||||
|
return realloc(ptr, nsize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
return lua_newstate(custom_alloc, NULL) ? 0 : 1;
|
||||||
|
}
|
||||||
|
")
|
||||||
|
|
||||||
|
message(STATUS "Checking if Lua allows to provide a custom allocator")
|
||||||
|
|
||||||
|
try_run(RUN_RESULT_VAR COMPILE_RESULT_VAR
|
||||||
|
${TMP_ROOT}/temp
|
||||||
|
${TMP_ROOT}/checkluacustomallocator.c
|
||||||
|
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${LUA_INCLUDE_DIR}"
|
||||||
|
LINK_LIBRARIES "${LUA_LIBRARIES}"
|
||||||
|
)
|
||||||
|
|
||||||
|
if (NOT ${COMPILE_RESULT_VAR})
|
||||||
|
message(FATAL_ERROR "Incorrect Lua library: can't compile checkluacustomallocator.c" )
|
||||||
|
elseif(NOT ${RUN_RESULT_VAR} EQUAL 0)
|
||||||
|
message(FATAL_ERROR "Incorrect Lua library: custom allocator not supported (likely LuaJit compiled with LJ_64 but without LJ_GC64)" )
|
||||||
|
else()
|
||||||
|
message(STATUS "Lua supports custom allocator")
|
||||||
|
endif()
|
||||||
|
|
Loading…
Reference in a new issue