You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
2.0 KiB
Python
60 lines
2.0 KiB
Python
# -*- python -*-
|
|
|
|
SRC_DIR = 'lua-5.3.6/src'
|
|
|
|
def configure(ctx):
|
|
ctx.check_cc(lib='m', mandatory=False)
|
|
if ctx.check_cc(lib='dl', mandatory=False):
|
|
ctx.env.append_value('DEFINES_LUA', 'LUA_USE_DLOPEN')
|
|
if ctx.env.DEST_OS != 'win32':
|
|
ctx.env.append_value('DEFINES_LUA', 'LUA_USE_POSIX')
|
|
|
|
if not ctx.env.LUAC_MODE:
|
|
ctx.env.LUAC_MODE = ctx.env.CROSS and 'copy' or 'luac'
|
|
ctx.env.append_value('DEFINES_LUA', ['LUA_COMPAT_5_2', 'LUA_COMPAT_5_1'])
|
|
|
|
def build(ctx):
|
|
ctx(idx = 51200,
|
|
source = 'lua_one.cpp',
|
|
features = ctx.env.LUA_DLL and 'cxx cxxshlib' or 'cxx cxxstlib',
|
|
includes = SRC_DIR,
|
|
export_includes = SRC_DIR,
|
|
uselib = 'EXT',
|
|
use = 'LUA DL M',
|
|
# '#lua53' puts the dll into the root build dir, but names the implib
|
|
# '#lua53.lib', which works actually, because it links with '-l#lua53',
|
|
# but on linux it creates a 'liblua53.a' while still trying to link with
|
|
# '-l#lua53'. '#./lua53' is an ugly workaround, but it works.
|
|
target = '#./lua53',
|
|
name = 'lua')
|
|
|
|
# maybe optional
|
|
ctx(idx = 51201,
|
|
features = 'cxx cxxprogram',
|
|
source = '%s/lua.c' % SRC_DIR,
|
|
use = 'lua',
|
|
uselib = 'EXT',
|
|
target = 'libshit-lua')
|
|
ctx(idx = 51202,
|
|
features = 'cxx cxxprogram',
|
|
source = 'lua_one.cpp',
|
|
defines = 'MAKE_LUAC',
|
|
use = 'lua',
|
|
uselib = 'EXT',
|
|
target = 'luac')
|
|
|
|
from waflib import Task
|
|
# task .lua->.h
|
|
class luac(Task.Task):
|
|
run_str = '${tsk.executable} ${LUACFLAGS} -o ${TGT} ${SRC}'
|
|
color = 'BLUE'
|
|
|
|
from waflib.TaskGen import taskgen_method
|
|
@taskgen_method
|
|
def luac_task(self, inp, out, executable):
|
|
tmp = inp.change_ext('.luac')
|
|
tsk = self.create_task('luac', inp, tmp)
|
|
tsk.executable = executable
|
|
self.create_task('bin2c', tmp, out)
|
|
return tsk
|