lua 源码编译 MSVC
> git clone -b 'v5.4.0' https://github.com/lua/lua.git
> cd lua
> vim CMakeLists.txt
> cmake -DCMAKE_BUILD_TYPE=Release -S . -B build
> cmake --build build --config Release
> ls build/Release/
lua.dll lua.exe lua.lib
CMakeLists.txt:
cmake_minimum_required(VERSION 3.0.0)
project(lua VERSION 0.1.0)
file(GLOB LUA_SRC ${CMAKE_SOURCE_DIR}/*.c)
list(FILTER LUA_SRC EXCLUDE REGEX "onelua.c$" )
add_executable(lua ${LUA_SRC})
file(GLOB LUA_LIB_SRC ${CMAKE_SOURCE_DIR}/*.c)
list(FILTER LUA_LIB_SRC EXCLUDE REGEX "lua.c$" )
add_library(lua_static STATIC ${LUA_LIB_SRC})
set_target_properties(lua_static PROPERTIES OUTPUT_NAME "lua")
set_target_properties(lua_static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
add_library(lua_shared SHARED ${LUA_LIB_SRC})
set_target_properties(lua_shared PROPERTIES OUTPUT_NAME "lua")
set_target_properties(lua_shared PROPERTIES CLEAN_DIRECT_OUTPUT 1)