Unaltered Lua source code and documentation with CMake build infrastructure. This repository contains Lua Version 5.4.6 sources extracted from https://www.lua.org/ftp/lua-5.4.6.tar.gz. Tested generators and architectures are:
- Visual Studio 17 2022, Win32
- Visual Studio 17 2022, x64
Notice: Present Makefiles
originate from Lua source code archive and are not used within the context of CMake-based build.
A complete Microsoft Visual Studio Installation is optional but not strictly necessary. Simply install Buildtools for Visual Studio 2022 from https://visualstudio.microsoft.com/de/downloads/#build-tools-for-visual-studio-2022 and select the following minimum components for download and installation:
- MSVC v143 - VS 2022 C++-x64/x86-Buildtools
- C++-CMake-Tools for Windows
- Windows 11-SDK (10.0.22621.0)
Open Developer Command Prompt for VS 2022
and change drive and directory. Download and unpack sources or simply clone this repository:
c:
cd c:\Temp
git clone git@github.com:KritzelKratzel/lua.git
cd lua
CMake strongly encourages out-of-source builds.
mkdir build
cd build
cmake .. -G "Visual Studio 17 2022" -A <arch>
cmake --build . --config Release
cmake --install . --config Release
Replace <arch>
with your desired architecture. Available architectures with selected Visual Studio 17 2022
generator are Win32
, x64
, ARM
and ARM64
. Default installation directory is C:/Apps/lua-5.4.6
where a directory structure according to GNU Coding Standards is created:
bin
: Lua binarieslua.exe
andluac.exe
, both statically linked, no DLL dependency,include
: Public header files,lib
: Lua static libraryliblua.lib
,share
: documentation, man-pages, CMake configuration.
The default installation path can be overwritten by using CMAKE_INSTALL_PREFIX
at the command line during CMake configuration. Example:
cmake .. -G "Visual Studio 17 2022" -A x64 -DCMAKE_INSTALL_PREFIX="C:\Foo\Bar"
Finally add the path to Lua to Windows search path for executables.
setx PATH "%PATH%;C:\Apps\lua-5.4.6\bin"
Open an new command window and test lua. Use CTRL-C
to leave Lua in interactive mode.
C:\Users\John Doe>lua
Lua 5.4.6 Copyright (C) 1994-2023 Lua.org, PUC-Rio
> print(_VERSION)
Lua 5.4
>
C:\Users\John Doe>
Table of Lua modules which smoothly fit into Lua with CMake Support:
Extension Name | Purpose | Forked from |
---|---|---|
LuaSocket | Network support for the Lua language | https://github.com/lunarmodules/luasocket |
librs232 | Multiplatform library for serial communications over RS-232 (serial port) | https://github.com/srdgame/librs232 |
LuaFileSystem | Complements the set of functions related to file systems offered by the standard Lua distribution | https://github.com/lunarmodules/luafilesystem |
argparse | argparse is a feature-rich command line parser for Lua inspired by argparse for Python. | https://github.com/luarocks/argparse |
Luacheck | Luacheck is a static analyzer and a linter for Lua. It detects various issues such as usage of undefined global variables, unused variables and values, accessing uninitialized variables, unreachable code and more. | https://github.com/lunarmodules/luacheck |
More will follow soon.