Lua 5.4 changes... oh boy!

This commit is contained in:
ThePhD 2019-08-12 14:07:25 -04:00
parent 5799084572
commit 09f5e862b8
No known key found for this signature in database
GPG Key ID: 1509DB1C0F702BFA
5 changed files with 106 additions and 46 deletions

View File

@ -185,7 +185,9 @@ if (LUA_VANILLA_VERSION MATCHES "^5\\.1")
lbaselib.c ldblib.c liolib.c lmathlib.c loslib.c ltablib.c lbaselib.c ldblib.c liolib.c lmathlib.c loslib.c ltablib.c
lstrlib.c loadlib.c linit.c) lstrlib.c loadlib.c linit.c)
set(LUA_VANILLA_LUA_SOURCES lua.c ) set(LUA_VANILLA_LUA_SOURCES lua.c )
if (LUA_BUILD_LUA_COMPILER)
set(LUA_VANILLA_LUAC_SOURCES luac.c print.c ) set(LUA_VANILLA_LUAC_SOURCES luac.c print.c )
endif()
set(LUA_VANILLA_GENERATE_LUA_HPP true) set(LUA_VANILLA_GENERATE_LUA_HPP true)
elseif (LUA_VANILLA_VERSION MATCHES "^5\\.2") elseif (LUA_VANILLA_VERSION MATCHES "^5\\.2")
set(LUA_VANILLA_LIB_SOURCES lapi.c lcode.c lctype.c ldebug.c ldo.c ldump.c set(LUA_VANILLA_LIB_SOURCES lapi.c lcode.c lctype.c ldebug.c ldo.c ldump.c
@ -194,7 +196,9 @@ elseif (LUA_VANILLA_VERSION MATCHES "^5\\.2")
lauxlib.c lbaselib.c lbitlib.c lcorolib.c ldblib.c liolib.c lauxlib.c lbaselib.c lbitlib.c lcorolib.c ldblib.c liolib.c
lmathlib.c loslib.c lstrlib.c ltablib.c loadlib.c linit.c) lmathlib.c loslib.c lstrlib.c ltablib.c loadlib.c linit.c)
set(LUA_VANILLA_LUA_SOURCES lua.c ) set(LUA_VANILLA_LUA_SOURCES lua.c )
if (LUA_BUILD_LUA_COMPILER)
set(LUA_VANILLA_LUAC_SOURCES luac.c ) set(LUA_VANILLA_LUAC_SOURCES luac.c )
endif()
set(LUA_VANILLA_GENERATE_LUA_HPP false) set(LUA_VANILLA_GENERATE_LUA_HPP false)
elseif (LUA_VANILLA_VERSION MATCHES "^5\\.3") elseif (LUA_VANILLA_VERSION MATCHES "^5\\.3")
set(LUA_VANILLA_LIB_SOURCES lapi.c lcode.c lctype.c ldebug.c ldo.c ldump.c set(LUA_VANILLA_LIB_SOURCES lapi.c lcode.c lctype.c ldebug.c ldo.c ldump.c
@ -203,7 +207,9 @@ elseif (LUA_VANILLA_VERSION MATCHES "^5\\.3")
lbaselib.c lbitlib.c lcorolib.c ldblib.c liolib.c lmathlib.c lbaselib.c lbitlib.c lcorolib.c ldblib.c liolib.c lmathlib.c
loslib.c lstrlib.c ltablib.c lutf8lib.c loadlib.c linit.c) loslib.c lstrlib.c ltablib.c lutf8lib.c loadlib.c linit.c)
set(LUA_VANILLA_LUA_SOURCES lua.c ) set(LUA_VANILLA_LUA_SOURCES lua.c )
if (LUA_BUILD_LUA_COMPILER)
set(LUA_VANILLA_LUAC_SOURCES luac.c ) set(LUA_VANILLA_LUAC_SOURCES luac.c )
endif()
set(LUA_VANILLA_GENERATE_LUA_HPP false) set(LUA_VANILLA_GENERATE_LUA_HPP false)
elseif (LUA_VANILLA_VERSION MATCHES "^5\\.4") elseif (LUA_VANILLA_VERSION MATCHES "^5\\.4")
if (LUA_VANILLA_VERSION MATCHES "work") if (LUA_VANILLA_VERSION MATCHES "work")
@ -215,7 +221,9 @@ elseif (LUA_VANILLA_VERSION MATCHES "^5\\.4")
lparser.c lstate.c lstring.c lstrlib.c ltable.c ltablib.c ltm.c lundump.c lparser.c lstate.c lstring.c lstrlib.c ltable.c ltablib.c ltm.c lundump.c
lutf8lib.c lvm.c lzio.c) lutf8lib.c lvm.c lzio.c)
set(LUA_VANILLA_LUA_SOURCES lua.c ) set(LUA_VANILLA_LUA_SOURCES lua.c )
if (LUA_BUILD_LUA_COMPILER)
set(LUA_VANILLA_LUAC_SOURCES luac.c ) set(LUA_VANILLA_LUAC_SOURCES luac.c )
endif()
set(LUA_VANILLA_GENERATE_LUA_HPP false) set(LUA_VANILLA_GENERATE_LUA_HPP false)
else() else()
MESSAGE(WARNING "Using Lua 5.4.0-work1 file list for ${LUA_VERSION} version") MESSAGE(WARNING "Using Lua 5.4.0-work1 file list for ${LUA_VERSION} version")
@ -225,14 +233,15 @@ else()
lparser.c lstate.c lstring.c lstrlib.c ltable.c ltablib.c ltm.c lundump.c lparser.c lstate.c lstring.c lstrlib.c ltable.c ltablib.c ltm.c lundump.c
lutf8lib.c lvm.c lzio.c) lutf8lib.c lvm.c lzio.c)
set(LUA_VANILLA_LUA_SOURCES lua.c ) set(LUA_VANILLA_LUA_SOURCES lua.c )
if (LUA_BUILD_LUA_COMPILER)
set(LUA_VANILLA_LUAC_SOURCES luac.c ) set(LUA_VANILLA_LUAC_SOURCES luac.c )
endif()
set(LUA_VANILLA_GENERATE_LUA_HPP false) set(LUA_VANILLA_GENERATE_LUA_HPP false)
endif() endif()
set(LUA_VANILLA_SOURCE_DIR "${LUA_BUILD_TOPLEVEL}/src") set(LUA_VANILLA_SOURCE_DIR "${LUA_BUILD_TOPLEVEL}/src")
prepend(LUA_VANILLA_LIB_SOURCES "${LUA_VANILLA_SOURCE_DIR}/" ${LUA_VANILLA_LIB_SOURCES}) prepend(LUA_VANILLA_LIB_SOURCES "${LUA_VANILLA_SOURCE_DIR}/" ${LUA_VANILLA_LIB_SOURCES})
prepend(LUA_VANILLA_LUA_SOURCES "${LUA_VANILLA_SOURCE_DIR}/" ${LUA_VANILLA_LUA_SOURCES}) prepend(LUA_VANILLA_LUA_SOURCES "${LUA_VANILLA_SOURCE_DIR}/" ${LUA_VANILLA_LUA_SOURCES})
prepend(LUA_VANILLA_LUAC_SOURCES "${LUA_VANILLA_SOURCE_DIR}/" ${LUA_VANILLA_LUAC_SOURCES})
# download, just for the sake of download + extract # download, just for the sake of download + extract
# or pull from local folder # or pull from local folder
@ -242,7 +251,7 @@ if (LUA_LOCAL_DIR)
file(COPY "${LUA_LOCAL_DIR}/include" file(COPY "${LUA_LOCAL_DIR}/include"
DESTINATION "${LUA_BUILD_TOPLEVEL}") DESTINATION "${LUA_BUILD_TOPLEVEL}")
add_custom_target(LUA_VANILLA add_custom_target(LUA_VANILLA
DEPENDS "${LUA_VANILLA_LIB_SOURCES}" "${LUA_VANILLA_LUA_SOURCES}" "${LUA_VANILLA_LUAC_SOURCES}") DEPENDS "${LUA_VANILLA_LIB_SOURCES}" "${LUA_VANILLA_LUA_SOURCES}")
set(LUA_VANILLA_INCLUDE_DIRS ${LUA_VANILLA_INCLUDE_DIRS} "${LUA_VANILLA_SOURCE_DIR}" "${LUA_BUILD_TOPLEVEL}/include") set(LUA_VANILLA_INCLUDE_DIRS ${LUA_VANILLA_INCLUDE_DIRS} "${LUA_VANILLA_SOURCE_DIR}" "${LUA_BUILD_TOPLEVEL}/include")
else() else()
ExternalProject_Add(LUA_VANILLA ExternalProject_Add(LUA_VANILLA
@ -262,7 +271,7 @@ else()
BUILD_COMMAND "" BUILD_COMMAND ""
INSTALL_COMMAND "" INSTALL_COMMAND ""
TEST_COMMAND "" TEST_COMMAND ""
BUILD_BYPRODUCTS "${LUA_VANILLA_LIB_SOURCES}" "${LUA_VANILLA_LUA_SOURCES}" "${LUA_VANILLA_LUAC_SOURCES}") BUILD_BYPRODUCTS "${LUA_VANILLA_LIB_SOURCES}" "${LUA_VANILLA_LUA_SOURCES}")
# make a quick lua.hpp for 5.1 targets that don't have it # make a quick lua.hpp for 5.1 targets that don't have it
if (LUA_VANILLA_GENERATE_LUA_HPP) if (LUA_VANILLA_GENERATE_LUA_HPP)
@ -386,48 +395,47 @@ if (UNIX)
endif() endif()
# LuaC Compiler # LuaC Compiler
add_executable(${luacompiler} ${LUA_VANILLA_LUAC_SOURCES}) if (LUA_BUILD_LUA_COMPILER)
if (BUILD_LUA_AS_DLL) set_target_properties(${luacompiler}
# TODO: figure out how to make DLL internal symbols for lua public so we don't have to do this PROPERTIES
target_sources(${luacompiler} PRIVATE ${LUA_VANILLA_LIB_SOURCES}) LANGUAGE C
endif() LINKER_LANGUAGE C
set_target_properties(${luacompiler} C_STANDARD 99
PROPERTIES C_EXTENSIONS TRUE
LANGUAGE C OUTPUT_NAME luac-${LUA_VANILLA_VERSION})
LINKER_LANGUAGE C target_include_directories(${luacompiler}
C_STANDARD 99 PRIVATE "${LUA_VANILLA_INCLUDE_DIRS}")
C_EXTENSIONS TRUE target_compile_definitions(${luacompiler}
OUTPUT_NAME luac-${LUA_VANILLA_VERSION}) PUBLIC LUA_COMPAT_ALL ${LUA_VANILLA_DLL_DEFINE}
target_include_directories(${luacompiler} PRIVATE LUA_COMPAT_ALL ${LUA_VANILLA_DLL_DEFINE})
PRIVATE "${LUA_VANILLA_INCLUDE_DIRS}") if (MSVC)
target_compile_definitions(${luacompiler} target_compile_options(${luacompiler}
PUBLIC LUA_COMPAT_ALL ${LUA_VANILLA_DLL_DEFINE} PRIVATE /W1)
PRIVATE LUA_COMPAT_ALL ${LUA_VANILLA_DLL_DEFINE}) else()
if (MSVC) target_compile_options(${luacompiler}
target_compile_options(${luacompiler} PRIVATE -w)
PRIVATE /W1) endif()
else() if (WIN32)
target_compile_options(${luacompiler} #target_compile_definitions(${luacompiler}
PRIVATE -w) # PRIVATE LUA_USE_WINDOWS)
endif() else()
if (WIN32) target_compile_definitions(${luacompiler}
#target_compile_definitions(${luacompiler} PRIVATE LUA_USE_LINUX)
# PRIVATE LUA_USE_WINDOWS) endif()
else() target_link_libraries(${luacompiler} PRIVATE ${liblua})
target_compile_definitions(${luacompiler} if (CMAKE_DL_LIBS)
PRIVATE LUA_USE_LINUX) target_link_libraries(${luacompiler} PRIVATE ${CMAKE_DL_LIBS})
endif() endif()
target_link_libraries(${luacompiler} PRIVATE ${liblua}) if (UNIX)
if (CMAKE_DL_LIBS) # TODO: make readline optional?
target_link_libraries(${luacompiler} PRIVATE ${CMAKE_DL_LIBS}) target_link_libraries(${luacompiler} PRIVATE m readline)
endif() endif()
if (UNIX)
# TODO: make readline optional?
target_link_libraries(${luacompiler} PRIVATE m readline)
endif() endif()
# set externally-visible target indicator # set externally-visible target indicator
set(LUA_LIBRARIES ${liblua}) set(LUA_LIBRARIES ${liblua})
set(LUA_INTERPRETER ${luainterpreter}) set(LUA_INTERPRETER ${luainterpreter})
set(LUA_COMPILER ${luacompiler}) if (LUA_BUILD_LUA_COMPILER)
set(LUA_COMPILER ${luacompiler})
endif()
set(LUA_INCLUDE_DIRS "${LUA_VANILLA_SOURCE_DIR}") set(LUA_INCLUDE_DIRS "${LUA_VANILLA_SOURCE_DIR}")

View File

@ -42,7 +42,9 @@
#ifndef COMPAT53_INCLUDE_SOURCE #ifndef COMPAT53_INCLUDE_SOURCE
#define COMPAT53_INCLUDE_SOURCE 1 #define COMPAT53_INCLUDE_SOURCE 1
#endif // Build Compat Layer Inline #endif // Build Compat Layer Inline
#include "compatibility/compat-5.3.h" #include "compatibility/compat-5.3.h"
#include "compatibility/compat-5.4.h"
#endif // SOL_NO_COMPAT #endif // SOL_NO_COMPAT

View File

@ -0,0 +1,25 @@
#ifndef NOT_KEPLER_PROJECT_COMPAT54_H_
#define NOT_KEPLER_PROJECT_COMPAT54_H_
#if defined(__cplusplus) && !defined(COMPAT53_LUA_CPP)
extern "C" {
#endif
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
#if defined(__cplusplus) && !defined(COMPAT53_LUA_CPP)
}
#endif
#if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM == 504
#if !defined(LUA_ERRGCMM)
/* So Lua 5.4 actually removes this, which breaks sol2...
man, this API is quite unstable...!
*/
# define LUA_ERRGCMM (LUA_ERRERR + 2)
#endif /* LUA_ERRGCMM define */
#endif // Lua 5.4 only
#endif // NOT_KEPLER_PROJECT_COMPAT54_H_

View File

@ -20,8 +20,8 @@
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// This file was generated with a script. // This file was generated with a script.
// Generated 2019-07-26 02:13:25.323566 UTC // Generated 2019-08-12 18:06:54.421648 UTC
// This header was generated with sol v3.0.3 (revision eb5c442) // This header was generated with sol v3.0.3 (revision 5799084)
// https://github.com/ThePhD/sol2 // https://github.com/ThePhD/sol2
#ifndef SOL_SINGLE_INCLUDE_FORWARD_HPP #ifndef SOL_SINGLE_INCLUDE_FORWARD_HPP

View File

@ -20,8 +20,8 @@
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// This file was generated with a script. // This file was generated with a script.
// Generated 2019-07-26 02:13:25.052030 UTC // Generated 2019-08-12 18:06:53.939935 UTC
// This header was generated with sol v3.0.3 (revision eb5c442) // This header was generated with sol v3.0.3 (revision 5799084)
// https://github.com/ThePhD/sol2 // https://github.com/ThePhD/sol2
#ifndef SOL_SINGLE_INCLUDE_HPP #ifndef SOL_SINGLE_INCLUDE_HPP
@ -2185,6 +2185,7 @@ namespace sol {
#ifndef COMPAT53_INCLUDE_SOURCE #ifndef COMPAT53_INCLUDE_SOURCE
#define COMPAT53_INCLUDE_SOURCE 1 #define COMPAT53_INCLUDE_SOURCE 1
#endif // Build Compat Layer Inline #endif // Build Compat Layer Inline
// beginning of sol/compatibility/compat-5.3.h // beginning of sol/compatibility/compat-5.3.h
#ifndef KEPLER_PROJECT_COMPAT53_H_ #ifndef KEPLER_PROJECT_COMPAT53_H_
@ -3431,6 +3432,30 @@ COMPAT53_API void luaL_requiref(lua_State *L, const char *modname,
// end of sol/compatibility/compat-5.3.h // end of sol/compatibility/compat-5.3.h
// beginning of sol/compatibility/compat-5.4.h
#ifndef NOT_KEPLER_PROJECT_COMPAT54_H_
#define NOT_KEPLER_PROJECT_COMPAT54_H_
#if defined(__cplusplus) && !defined(COMPAT53_LUA_CPP)
extern "C" {
#endif
#if defined(__cplusplus) && !defined(COMPAT53_LUA_CPP)
}
#endif
#if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM == 504
#if !defined(LUA_ERRGCMM)
/* So Lua 5.4 actually removes this, which breaks sol2...
man, this API is quite unstable...!
*/
# define LUA_ERRGCMM (LUA_ERRERR + 2)
#endif /* LUA_ERRGCMM define */
#endif // Lua 5.4 only
#endif // NOT_KEPLER_PROJECT_COMPAT54_H_// end of sol/compatibility/compat-5.4.h
#endif // SOL_NO_COMPAT #endif // SOL_NO_COMPAT