mirror of
https://github.com/walterschell/Lua.git
synced 2024-11-10 01:01:46 +00:00
Updated CMakeListss.txt and README.md to reflect 5.4.3
This commit is contained in:
parent
eaf5abbb8e
commit
572fb4bb47
@ -1,5 +1,5 @@
|
|||||||
cmake_minimum_required(VERSION 3.1)
|
cmake_minimum_required(VERSION 3.1)
|
||||||
project(lua LANGUAGES C VERSION 5.4.2)
|
project(lua LANGUAGES C VERSION 5.4.3)
|
||||||
|
|
||||||
option(LUA_SUPPORT_DL "Support dynamic loading of compiled modules" OFF)
|
option(LUA_SUPPORT_DL "Support dynamic loading of compiled modules" OFF)
|
||||||
option(LUA_BUILD_AS_CXX "Build lua as C++" OFF)
|
option(LUA_BUILD_AS_CXX "Build lua as C++" OFF)
|
||||||
@ -20,4 +20,4 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
add_subdirectory(lua-5.4.2)
|
add_subdirectory(lua-5.4.3)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Lua
|
# Lua
|
||||||
CMake based build of Lua 5.4.2
|
CMake based build of Lua 5.4.3
|
||||||
| Build as C | Build as C++ |
|
| Build as C | Build as C++ |
|
||||||
| --: | --: |
|
| --: | --: |
|
||||||
| ![Build Linux](https://github.com/walterschell/Lua/actions/workflows/build-linux.yml/badge.svg?branch=master) | ![Build Linux as C++](https://github.com/walterschell/Lua/actions/workflows/build-emscripten-cxx.yml/badge.svg?branch=master) |
|
| ![Build Linux](https://github.com/walterschell/Lua/actions/workflows/build-linux.yml/badge.svg?branch=master) | ![Build Linux as C++](https://github.com/walterschell/Lua/actions/workflows/build-emscripten-cxx.yml/badge.svg?branch=master) |
|
||||||
|
90
lua-5.4.3/CMakeLists.txt
Normal file
90
lua-5.4.3/CMakeLists.txt
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
set(LUA_LIB_SRCS
|
||||||
|
"src/lapi.c"
|
||||||
|
"src/lcode.c"
|
||||||
|
"src/lctype.c"
|
||||||
|
"src/ldebug.c"
|
||||||
|
"src/ldo.c"
|
||||||
|
"src/ldump.c"
|
||||||
|
"src/lfunc.c"
|
||||||
|
"src/lgc.c"
|
||||||
|
"src/llex.c"
|
||||||
|
"src/lmem.c"
|
||||||
|
"src/lobject.c"
|
||||||
|
"src/lopcodes.c"
|
||||||
|
"src/lparser.c"
|
||||||
|
"src/lstate.c"
|
||||||
|
"src/lstring.c"
|
||||||
|
"src/ltable.c"
|
||||||
|
"src/ltm.c"
|
||||||
|
"src/lundump.c"
|
||||||
|
"src/lvm.c"
|
||||||
|
"src/lzio.c"
|
||||||
|
"src/lauxlib.c"
|
||||||
|
"src/lbaselib.c"
|
||||||
|
"src/lcorolib.c"
|
||||||
|
"src/ldblib.c"
|
||||||
|
"src/liolib.c"
|
||||||
|
"src/lmathlib.c"
|
||||||
|
"src/loadlib.c"
|
||||||
|
"src/loslib.c"
|
||||||
|
"src/lstrlib.c"
|
||||||
|
"src/ltablib.c"
|
||||||
|
"src/lutf8lib.c"
|
||||||
|
"src/linit.c"
|
||||||
|
)
|
||||||
|
|
||||||
|
if(LUA_BUILD_AS_CXX)
|
||||||
|
set_source_files_properties(${LUA_LIB_SRCS} "src/lua.c" "src/luac.c" PROPERTIES LANGUAGE CXX )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_library(lua_static STATIC ${LUA_LIB_SRCS})
|
||||||
|
set_target_properties(lua_static PROPERTIES OUTPUT_NAME "lua")
|
||||||
|
target_include_directories(lua_static PUBLIC "include")
|
||||||
|
if(UNIX)
|
||||||
|
set(LUA_DEFINITIONS)
|
||||||
|
|
||||||
|
if(NOT EMSCRIPTEN)
|
||||||
|
find_library(LIBM m)
|
||||||
|
#TODO: Redo this with find_package
|
||||||
|
if(NOT LIBM)
|
||||||
|
message(FATAL_ERROR "libm not found and is required by lua")
|
||||||
|
endif()
|
||||||
|
target_link_libraries(lua_static INTERFACE ${LIBM})
|
||||||
|
|
||||||
|
list(APPEND LUA_DEFINITIONS LUA_USE_POSIX)
|
||||||
|
if(LUA_SUPPORT_DL)
|
||||||
|
target_compile_definitions(lua_static PRIVATE "LUA_USE_DLOPEN")
|
||||||
|
target_link_libraries(lua_static INTERFACE dl)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_compile_definitions(lua_static
|
||||||
|
PUBLIC ${LUA_DEFINITIONS}
|
||||||
|
)
|
||||||
|
target_compile_options(lua_static
|
||||||
|
PRIVATE "-Wall" "-Wextra"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(LUA_BUILD_BINARY)
|
||||||
|
include(CheckIncludeFile)
|
||||||
|
CHECK_INCLUDE_FILE("readline/readline.h" HAVE_READLINE_READLINE_H)
|
||||||
|
|
||||||
|
|
||||||
|
add_executable(lua "src/lua.c")
|
||||||
|
target_link_libraries(lua PUBLIC lua_static)
|
||||||
|
set_target_properties(lua PROPERTIES
|
||||||
|
RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}
|
||||||
|
)
|
||||||
|
if (HAVE_READLINE_READLINE_H)
|
||||||
|
target_compile_definitions(lua PUBLIC "LUA_USE_READLINE")
|
||||||
|
target_link_libraries(lua PUBLIC readline)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
if(LUA_BUILD_COMPILER)
|
||||||
|
add_executable(luac "src/luac.c")
|
||||||
|
target_link_libraries(luac PUBLIC lua_static)
|
||||||
|
set_target_properties(luac PROPERTIES
|
||||||
|
RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}
|
||||||
|
)
|
||||||
|
endif()
|
Loading…
Reference in New Issue
Block a user