OILS / yaks / NINJA_subgraph.py View on Github | oils.pub

77 lines, 54 significant
1"""
2yaks/NINJA_subgraph.py
3"""
4from __future__ import print_function
5
6from build import ninja_lib
7from build.ninja_lib import log, mycpp_binary
8
9_ = log
10
11# TODO: should have dependencies with sh_binary
12RULES_PY = 'build/ninja-rules-py.sh'
13
14
15def NinjaGraph(ru):
16 n = ru.n
17
18 ru.comment('Generated by %s' % __name__)
19
20 ru.asdl_library('yaks/yaks.asdl')
21
22 ru.cc_binary('yaks/yaks_runtime_test.cc',
23 deps=['//mycpp/runtime'],
24 matrix=ninja_lib.COMPILERS_VARIANTS)
25
26 mycpp_binary(
27 ru,
28 'yaks/yaks_main.py',
29 py_inputs=ninja_lib.TryDynamicDeps('yaks/yaks_main.py'),
30 matrix=ninja_lib.COMPILERS_VARIANTS + ninja_lib.GC_PERF_VARIANTS,
31 deps=[
32 '//core/optview', # TODO: remove this dep
33 '//core/runtime.asdl',
34 '//core/value.asdl',
35 '//cpp/data_lang',
36 '//cpp/frontend_match',
37 '//data_lang/nil8.asdl',
38 '//frontend/consts',
39 '//frontend/syntax.asdl', # TODO: remove this, value.asdl dep
40 '//mycpp/runtime',
41 '//yaks/yaks.asdl',
42 ])
43
44 n.newline()
45
46 ### CUSTOM translation with the COMPILED yaks binary.
47 n.rule('yaks',
48 command='_bin/cxx-opt/yaks/yaks_main.mycpp cpp $in > $out',
49 description='yaks cpp $in > $out')
50 n.newline()
51
52 raw_cc = '_gen/yaks/examples/hello_raw.yaks.cc'
53 example_cc = '_gen/yaks/examples/hello.yaks.cc'
54
55 n.build(
56 [raw_cc],
57 'yaks',
58 ['yaks/examples/hello.yaks'],
59 implicit=['_bin/cxx-opt/yaks/yaks_main.mycpp'],
60 )
61 n.newline()
62
63 n.build([example_cc],
64 'wrap-cc', [raw_cc],
65 implicit=[RULES_PY],
66 variables=[('main_namespace', 'hello'), ('preamble', '""'),
67 ('main_style', 'main-wrapper')])
68 n.newline()
69
70 ru.cc_binary(
71 example_cc,
72 matrix=ninja_lib.COMPILERS_VARIANTS + ninja_lib.GC_PERF_VARIANTS,
73 deps=['//mycpp/runtime'],
74 )
75
76
77# vim: sw=4