Last active
June 25, 2019 12:02
-
-
Save mukunda-/6e40bf97848493f7fc693564d1d4e927 to your computer and use it in GitHub Desktop.
Premake5 script for compiling lua.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
------------------------------------------------------------------------------- | |
-- WIN64 LUA buildscript. | |
-- Keep in mind that the working directory is /build/. | |
------------------------------------------------------------------------------- | |
-- Directory tree w/ outputs: | |
-- src Source files. | |
-- projects/library MSVC project files for building lua53.lib. | |
-- projects/interpreter MSVC project files for building lua.exe. | |
-- projects/compiler MSVC project files for building luac.exe. | |
-- bins Outputs | |
------------------------------------------------------------------------------- | |
-- Initial setup of solution etc. | |
-- | |
solution "lua" | |
-- We don't care about debug builds. | |
configurations { "Release" } | |
-- 64-bit targets. | |
platforms { "x64" } | |
architecture "x64" | |
-- `src` is the main source folder. | |
includedirs { "src" } | |
-- Windows misc defines, and define release build. | |
defines { "WIN32", "_WIN32", "_WINDOWS" } | |
defines { "WIN64", "_WIN64" } | |
defines { "NDEBUG" } | |
optimize "On" | |
language "C" | |
------------------------------------------------------------------------------- | |
-- This is the liblua project. | |
-- | |
project "lua53" | |
location "projects/library" | |
targetdir "bins" | |
targetname "lua53" | |
kind "StaticLib" | |
------------------------------------------------------------------------------- | |
-- Keep this up to date! | |
files { | |
"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/lbitlib.c", "src/lcorolib.c" ; | |
"src/ldblib.c", "src/liolib.c", "src/lmathlib.c", "src/loslib.c" ; | |
"src/lstrlib.c", "src/ltablib.c", "src/lutf8lib.c", "src/loadlib.c" ; | |
"src/linit.c" ; | |
"**.h" | |
} | |
------------------------------------------------------------------------------- | |
-- For compiling lua.exe and luac.exe: | |
-- | |
------------------------------------------------------------------------------- | |
-- Lua Interpreter | |
------------------------------------------------------------------------------- | |
project "lua" | |
kind "ConsoleApp" | |
location "projects/interpreter" | |
libdirs "bins" | |
targetdir "bins" | |
targetname "lua" | |
files { "src/lua.c" } | |
links { "lua53.lib" } | |
------------------------------------------------------------------------------- | |
-- Lua Compiler | |
------------------------------------------------------------------------------- | |
project "luac" | |
kind "ConsoleApp" | |
location "projects/compiler" | |
libdirs "bins" | |
targetdir "bins" | |
targetname "luac" | |
files { "luac/luac.c" } | |
links { "lua53.lib" } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rem --------------------------------------------------------------------------- | |
rem LUA building script! | |
rem --------------------------------------------------------------------------- | |
if not exist lua_build mkdir lua_build | |
cd lua_build | |
rem --------------------------------------------------------------------------- | |
rem Checkout sources. | |
rem | |
if not exist src ( | |
git clone --branch v5-3-4 --depth 1 https://github.com/lua/lua.git src | |
) | |
if not exist luac ( | |
git clone --depth 1 https://github.com/lua/luac.git luac | |
) | |
rem --------------------------------------------------------------------------- | |
rem Copy over the configuration and then run premake. %~dp0 is the path to this | |
rem bat file. | |
rem | |
copy %~dp0luaconf.h src\ /y | |
copy %~dp0premake5.lua . /y | |
premake5 vs2017 | |
rem --------------------------------------------------------------------------- | |
rem Build projects. | |
rem | |
devenv lua.sln /build Release /project "projects\library\lua53.vcxproj" | |
devenv lua.sln /build Release /project "projects\interpreter\lua.vcxproj" | |
devenv lua.sln /build Release /project "projects\compiler\luac.vcxproj" | |
rem --------------------------------------------------------------------------- | |
rem Install files to libs folder. | |
rem | |
rem xcopy bins\*.exe ..\..\libs\tools\ /y | |
rem xcopy bins\*.lib ..\..\libs\builds\lua\ /y | |
rem xcopy src\*.h ..\..\libs\headers\lua\ /y | |
rem xcopy ..\lua.hpp ..\..\libs\headers\lua\ /y | |
rem --------------------------------------------------------------------------- | |
rem All done! | |
rem | |
cd .. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment