fix(LuaLib): Fix compilation with lua5.1 (#291)

This commit is contained in:
iThorgrim
2025-08-28 19:26:56 +02:00
committed by GitHub
parent 581ab3a346
commit 4bb12494f5
2 changed files with 4 additions and 4 deletions

View File

@@ -16,10 +16,6 @@ endif()
if (LUA_VERSION MATCHES "luajit") if (LUA_VERSION MATCHES "luajit")
add_subdirectory(src/lualib/luajit) add_subdirectory(src/lualib/luajit)
set(LUAJIT_VERSION true)
else() else()
add_subdirectory(src/lualib/lua) add_subdirectory(src/lualib/lua)
set(LUAJIT_VERSION false)
endif() endif()
set_target_properties(lualib PROPERTIES INTERFACE_COMPILE_DEFINITIONS LUAJIT_VERSION)

View File

@@ -60,6 +60,7 @@ if (WIN32)
PROPERTIES PROPERTIES
IMPORTED_LOCATION ${LUA_BIN_FOLDER}/src/lua51.lib IMPORTED_LOCATION ${LUA_BIN_FOLDER}/src/lua51.lib
INTERFACE_INCLUDE_DIRECTORIES "${LUA_SRC_FOLDER}/src" INTERFACE_INCLUDE_DIRECTORIES "${LUA_SRC_FOLDER}/src"
INTERFACE_COMPILE_DEFINITIONS "LUAJIT_VERSION=1"
) )
# install generated files # install generated files
@@ -92,6 +93,7 @@ if (WIN32)
IMPORTED_LOCATION ${LUA_BIN_FOLDER}/src/lua51.dll IMPORTED_LOCATION ${LUA_BIN_FOLDER}/src/lua51.dll
IMPORTED_IMPLIB ${LUA_BIN_FOLDER}/src/lua51.lib IMPORTED_IMPLIB ${LUA_BIN_FOLDER}/src/lua51.lib
INTERFACE_INCLUDE_DIRECTORIES "${LUA_SRC_FOLDER}/src" INTERFACE_INCLUDE_DIRECTORIES "${LUA_SRC_FOLDER}/src"
INTERFACE_COMPILE_DEFINITIONS "LUAJIT_VERSION=1"
) )
# install generated files # install generated files
@@ -147,6 +149,7 @@ if (UNIX OR APPLE)
PROPERTIES PROPERTIES
# IMPORTED_LOCATION ${LUAJIT_LIB_PATH} # cmake bullshit. spent days figuring this and turns out set_target_properties does squat shit while set_property works fine. # IMPORTED_LOCATION ${LUAJIT_LIB_PATH} # cmake bullshit. spent days figuring this and turns out set_target_properties does squat shit while set_property works fine.
INTERFACE_INCLUDE_DIRECTORIES "${LUA_SRC_FOLDER}/src" INTERFACE_INCLUDE_DIRECTORIES "${LUA_SRC_FOLDER}/src"
INTERFACE_COMPILE_DEFINITIONS "LUAJIT_VERSION=1"
) )
set_property(TARGET lualib PROPERTY IMPORTED_LOCATION ${LUAJIT_LIB_PATH}) set_property(TARGET lualib PROPERTY IMPORTED_LOCATION ${LUAJIT_LIB_PATH})
@@ -154,3 +157,4 @@ if (UNIX OR APPLE)
install(DIRECTORY ${LUA_INSTALL_PATH}/ DESTINATION ${CMAKE_INSTALL_PREFIX}) install(DIRECTORY ${LUA_INSTALL_PATH}/ DESTINATION ${CMAKE_INSTALL_PREFIX})
endif() endif()