2020-05-10 06:37:10 -03:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# encoding: utf-8
|
|
|
|
'''
|
|
|
|
build generated bindings from bindings.desc for AP_Scripting
|
|
|
|
'''
|
|
|
|
|
|
|
|
from waflib.TaskGen import after_method, before_method, feature
|
2020-05-12 04:31:27 -03:00
|
|
|
import os
|
2020-05-10 06:37:10 -03:00
|
|
|
|
|
|
|
CFLAGS="-std=c99 -Wno-error=missing-field-initializers -Wall -Werror -Wextra"
|
|
|
|
CC="gcc"
|
|
|
|
|
|
|
|
def configure(cfg):
|
|
|
|
cfg.env.AP_LIB_EXTRA_SOURCES['AP_Scripting'] = ['lua_generated_bindings.cpp']
|
|
|
|
|
2020-05-12 04:31:27 -03:00
|
|
|
def relpath(bld, node):
|
|
|
|
'''make a build relative path. This is needed for CI to pass on azure'''
|
|
|
|
blddir = bld.bldnode.make_node(".").abspath()
|
|
|
|
return os.path.relpath(node.abspath(), blddir)
|
|
|
|
|
2020-05-10 06:37:10 -03:00
|
|
|
def build(bld):
|
|
|
|
main_c = bld.srcnode.make_node('libraries/AP_Scripting/generator/src/main.c')
|
|
|
|
gen_bindings = bld.bldnode.find_or_declare('gen-bindings')
|
|
|
|
|
2020-05-12 04:31:27 -03:00
|
|
|
main_c_rel = relpath(bld, main_c)
|
|
|
|
gen_bindings_rel = relpath(bld, gen_bindings)
|
|
|
|
|
2020-05-10 06:37:10 -03:00
|
|
|
bld(
|
|
|
|
# build gen-bindings compiler
|
|
|
|
source=main_c,
|
|
|
|
target=[gen_bindings],
|
|
|
|
# we should have configure tests for finding the native compiler
|
2020-05-12 04:31:27 -03:00
|
|
|
rule="%s %s -o %s %s" % (CC, CFLAGS, gen_bindings_rel, main_c_rel),
|
2020-05-10 06:37:10 -03:00
|
|
|
group='dynamic_sources',
|
|
|
|
)
|
|
|
|
|
|
|
|
bindings = bld.srcnode.make_node('libraries/AP_Scripting/generator/description/bindings.desc')
|
2020-05-12 04:31:27 -03:00
|
|
|
bindings_rel = relpath(bld, bindings)
|
2020-05-10 06:37:10 -03:00
|
|
|
gen_bindings = bld.bldnode.find_or_declare('gen-bindings')
|
|
|
|
generated_cpp = bld.bldnode.find_or_declare('libraries/AP_Scripting/lua_generated_bindings.cpp')
|
|
|
|
generated_h = bld.bldnode.find_or_declare('libraries/AP_Scripting/lua_generated_bindings.h')
|
|
|
|
|
|
|
|
bld(
|
|
|
|
# build the bindings
|
|
|
|
source=[bindings, gen_bindings],
|
2020-05-12 04:31:27 -03:00
|
|
|
rule="./gen-bindings -o libraries/AP_Scripting/lua_generated_bindings -i %s" % bindings_rel,
|
2020-05-10 06:37:10 -03:00
|
|
|
target=[generated_cpp, generated_h],
|
|
|
|
group='dynamic_sources',
|
|
|
|
)
|