mirror of
https://github.com/elua/elua.git
synced 2025-01-25 01:02:54 +08:00
commit
ce71c23369
@ -11,6 +11,18 @@ page].
|
||||
If you've just downloaded *eLua* and are looking to get started check
|
||||
out link:http://www.eluaproject.net/en_using.html[using eLua].
|
||||
|
||||
Windows Cross Compiling Update
|
||||
----------------
|
||||
|
||||
To cross compile scripts on Windows (cross-lua), you'll need to install a few packages:
|
||||
|
||||
* A GCC compiler. link:http://tdm-gcc.tdragon.net/index.php[TDM-GCC] was tested,
|
||||
but other GCC for Windows distributions should work.
|
||||
* Python 2.7 (from link:http://www.python.org[python.org] or other distributions).
|
||||
* link:https://github.com/rjpcomputing/luaforwindows/releases/[Lua for Windows].
|
||||
|
||||
Run lua cross-lua.lua and then you're ready to cross compile Lua scripts!
|
||||
|
||||
|
||||
General Features
|
||||
----------------
|
||||
|
@ -96,6 +96,14 @@ local function _validate_ip( adesc, aname, aval, elname, sectname )
|
||||
return aval
|
||||
end
|
||||
|
||||
-- Validator for a boolean value
|
||||
local function _validate_bool( adesc, aname, aval, elname, sectname )
|
||||
if type( aval ) ~= "boolean" then
|
||||
return false, sf( "attribute '%s' of element '%s' in section '%s' must be a boolean", aname, elname, sectname)
|
||||
end
|
||||
return aval and 1 or 0
|
||||
end
|
||||
|
||||
-- Builds a validator with the given array element checker
|
||||
local function build_validator( realvname )
|
||||
return function( adesc, aname, aval, elname, sectname )
|
||||
@ -124,6 +132,7 @@ local validate_choice = build_validator( _validate_choice )
|
||||
local validate_log2 = build_validator( _validate_log2 )
|
||||
local validate_string = build_validator( _validate_string )
|
||||
local validate_ip = build_validator( _validate_ip )
|
||||
local validate_bool = build_validator( _validate_bool )
|
||||
|
||||
-- Composite validator: run each validator in turn
|
||||
local function composite_validator( adesc, aname, aval, elname, sectname )
|
||||
@ -219,3 +228,8 @@ function nostr( attr )
|
||||
return attr
|
||||
end
|
||||
|
||||
-- Returns a new boolean attr (can be either true or false)
|
||||
function bool_attr( macro, default )
|
||||
return { macro = macro, validator = validate_bool, default = default }
|
||||
end
|
||||
|
||||
|
@ -18,7 +18,7 @@ uart_flow =
|
||||
uart_values = {}
|
||||
|
||||
-- Add a sufficient number of virtual and real UARTs
|
||||
for i = 0, 127 do
|
||||
for i = 0, 255 do
|
||||
uart_values[ sf( 'vuart%d', i ) ] = sf( '( SERMUX_SERVICE_ID_FIRST + %d )', i )
|
||||
uart_values[ tostring( i ) ] = i
|
||||
end
|
||||
|
@ -6,7 +6,8 @@ local sf = string.format
|
||||
builder:init( args )
|
||||
builder:set_build_mode( builder.BUILD_DIR_LINEARIZED )
|
||||
|
||||
local output = 'luac.cross'
|
||||
local suffix = utils.is_windows() and '.exe' or ''
|
||||
local output = 'luac.cross' .. suffix
|
||||
local cdefs = '-DLUA_CROSS_COMPILER'
|
||||
|
||||
-- Lua source files and include path
|
||||
@ -21,6 +22,13 @@ local local_include = "-Isrc/lua -Iinc/desktop -Iinc"
|
||||
builder:set_compile_cmd( sf( "gcc -O2 %s -Wall %s -c $(FIRST) -o $(TARGET)", local_include, cdefs ) )
|
||||
builder:set_link_cmd( "gcc -o $(TARGET) $(DEPENDS) -lm" )
|
||||
|
||||
if not utils.is_dir( ".build" ) then
|
||||
if not utils.full_mkdir( ".build" ) then
|
||||
print( "[builder] Unable to create directory .build" )
|
||||
os.exit( 1 )
|
||||
end
|
||||
end
|
||||
|
||||
-- Build everything
|
||||
builder:make_exe_target( output, lua_full_files )
|
||||
builder:build()
|
||||
|
Loading…
x
Reference in New Issue
Block a user