Features(Lualib/Lua(Jit)): Lua Version and Static Linking Support (#209)

This commit is contained in:
iThorgrim
2025-01-12 01:35:05 +01:00
committed by GitHub
parent 41c940e680
commit f9fc165c7d
68 changed files with 468 additions and 20321 deletions

25
CMakeLists.txt Normal file
View File

@@ -0,0 +1,25 @@
set(LUA_VERSION "lua52" CACHE STRING "Lua version to use")
set_property(CACHE LUA_VERSION PROPERTY STRINGS luajit lua51 lua52 lua53 lua54)
MESSAGE(STATUS "Lua version: ${LUA_VERSION}")
# Avoid warning about DOWNLOAD_EXTRACT_TIMESTAMP in CMake 3.24:
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
cmake_policy(SET CMP0135 NEW)
endif()
option(LUA_STATIC "link lua statically" OFF)
if (LUA_STATIC)
MESSAGE(STATUS "Lua linking: static")
else()
MESSAGE(STATUS "Lua linking: dynamic")
endif()
if (LUA_VERSION MATCHES "luajit")
add_subdirectory(src/lualib/luajit)
set(LUAJIT_VERSION true)
else()
add_subdirectory(src/lualib/lua)
set(LUAJIT_VERSION false)
endif()
set_target_properties(lualib PROPERTIES INTERFACE_COMPILE_DEFINITIONS LUAJIT_VERSION)