Compile QML files for syntax checking during build.

main
Ben Niemann 1 year ago
parent 08c31ed695
commit afd10b2247

@ -25,8 +25,24 @@ import os.path
from waflib.Configure import conf
def configure(ctx):
ctx.find_program('qmlcachegen')
@conf
def qml_module(ctx, source):
assert source.endswith('.qml')
ctx.static_file(source)
# Compiling QML files currently only provides syntax checking during the build phase. The files
# are not actually used, unless packaged into and loaded from a Qt resource file
# (https://doc.qt.io/qt-5/qtquick-deployment.html#ahead-of-time-compilation)
source_node = ctx.path.find_resource(source)
target_node = ctx.path.find_or_declare(source + 'c')
ctx(
rule=' '.join(['${QMLCACHEGEN}', '-o', '${TGT}', '${SRC[0]}']),
source=[source_node],
target=[target_node],
)
#ctx.install_files(os.path.join(ctx.env.LIBDIR, target_node.parent.path_from(ctx.bldnode)), target_node)

Loading…
Cancel
Save