premake.lua for Lua 5.1

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

premake.lua for Lua 5.1

Nick-50

The following is a premake script to make Lua 5.1 (also attached). I've
only tried it on VS2003. Let me know if you have any issues.

        http://premake.berlios.de/

This works fine with 5.1 rc3. Warnings from rc2 are gone under VC2003.

Nick


--->8--- snip --->8------>8------>8------>8------>8------>8---

--
-- Premake generates make files for several systems.
-- Details: http://premake.berlios.de/
-- Author : Nick Trout ([hidden email])
--
-- To generate makefiles and build Lua 5.1:
-- * Unzip Lua (into default lua-5.1 directory)
-- * Build a working version of premake for your OS and put it
--   in your path.
-- * Put this premake.lua file in "lua-5.1/premake" (or
--   modify path below).
-- * Run premake with the appropriate arguments (see
--   premake --help).

-- This is the path from the premake.lua file to the Lua
-- source files.
source_relative_path = '../src/'

-----------------------------------------------------------

function make_relative(files)
        local relative = {}
        for i,f in files do
            table.insert(relative, source_relative_path .. f)
        end
        return relative
end

-- Lua project --

project.name = 'Lua51'
project.path = '.'        -- where to put build files
project.bindir = 'bin'
project.libdir = 'lib'

-- Lua library --

package = newpackage()
package.name = 'lualib51'
package.kind = 'lib'
package.language = 'c'
package.files = make_relative{
        -- Lua
        'lapi.c', 'lcode.c', 'ldebug.c', 'ldo.c', 'ldump.c', 'lfunc.c',
        'lgc.c', 'llex.c', 'lmem.c', 'lobject.c', 'lopcodes.c', 'lparser.c',
        'lstate.c', 'lstring.c', 'ltable.c', 'ltm.c', 'lundump.c', 'lvm.c',
        'lzio.c',
        -- standard libs
        'lauxlib.c', 'lbaselib.c', 'ldblib.c', 'liolib.c', 'lmathlib.c',
'loslib.c',
        'ltablib.c', 'lstrlib.c', 'loadlib.c', 'linit.c'
}

-- Lua command line executable --

package = newpackage()
package.name = 'lua'
package.kind = 'exe'
package.language = 'c'
package.files = make_relative{ 'lua.c' }
package.links = { 'lualib51' }

-- Luac command line executable --

package = newpackage()
package.name = 'luac'
package.kind = 'exe'
package.language = 'c'
package.files = make_relative{ 'luac.c', 'print.c' }
package.links = { 'lualib51' }

--->8--- snip --->8------>8------>8------>8------>8------>8---

Apologies if you get this twice!






--
-- Premake generates make files for several systems.
-- Details: http://premake.berlios.de/
-- Author : Nick Trout ([hidden email])
--
-- To generate makefiles and build Lua 5.1:
-- * Unzip Lua (into default lua-5.1 directory)
-- * Build a working version of premake for your OS and put it
--   in your path.
-- * Put this premake.lua file in "lua-5.1/premake" (or
--   modify path below).
-- * Run premake with the appropriate arguments (see
--   premake --help).

-- This is the path from the premake.lua file to the Lua
-- source files.
source_relative_path = '../src/'

-----------------------------------------------------------

function make_relative(files)
    local relative = {}
    for i,f in files do
        table.insert(relative, source_relative_path .. f)
    end
    return relative
end

-- Lua project --

project.name = 'Lua51'
project.path = '.'        -- where to put build files
project.bindir = 'bin'
project.libdir = 'lib'

-- Lua library --

package = newpackage()
package.name = 'lualib51'
package.kind = 'lib'
package.language = 'c'
package.files = make_relative{
        -- Lua
        'lapi.c', 'lcode.c', 'ldebug.c', 'ldo.c', 'ldump.c', 'lfunc.c',
        'lgc.c', 'llex.c', 'lmem.c', 'lobject.c', 'lopcodes.c', 'lparser.c',
        'lstate.c', 'lstring.c', 'ltable.c', 'ltm.c', 'lundump.c', 'lvm.c',
        'lzio.c',
        -- standard libs
        'lauxlib.c', 'lbaselib.c', 'ldblib.c', 'liolib.c', 'lmathlib.c', 'loslib.c',
        'ltablib.c', 'lstrlib.c', 'loadlib.c', 'linit.c'
}

-- Lua command line executable --

package = newpackage()
package.name = 'lua'
package.kind = 'exe'
package.language = 'c'
package.files = make_relative{ 'lua.c' }
package.links = { 'lualib51' }

-- Luac command line executable --

package = newpackage()
package.name = 'luac'
package.kind = 'exe'
package.language = 'c'
package.files = make_relative{ 'luac.c', 'print.c' }
package.links = { 'lualib51' }