1 | """
|
2 | yaks/NINJA_subgraph.py
|
3 | """
|
4 | from __future__ import print_function
|
5 |
|
6 | from build import ninja_lib
|
7 | from build.ninja_lib import log, mycpp_library, mycpp_binary, main_cc
|
8 |
|
9 | _ = log
|
10 |
|
11 | # TODO: should have dependencies with sh_binary
|
12 | RULES_PY = 'build/ninja-rules-py.sh'
|
13 |
|
14 |
|
15 | def 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_library(
|
27 | ru,
|
28 | 'yaks/yaks_main.py',
|
29 | py_inputs=ninja_lib.TryDynamicDeps('yaks/yaks_main.py'),
|
30 | deps=[
|
31 | '//core/optview', # TODO: remove this dep
|
32 | '//core/runtime.asdl',
|
33 | '//core/value.asdl',
|
34 | '//cpp/data_lang',
|
35 | '//cpp/frontend_match',
|
36 | '//data_lang/nil8.asdl',
|
37 | '//frontend/consts',
|
38 | '//frontend/syntax.asdl', # TODO: remove this, value.asdl dep
|
39 | '//mycpp/runtime',
|
40 | '//yaks/yaks.asdl',
|
41 | ])
|
42 |
|
43 | mycpp_binary(ru,
|
44 | '//yaks/yaks_main.mycpp',
|
45 | matrix=ninja_lib.COMPILERS_VARIANTS +
|
46 | ninja_lib.GC_PERF_VARIANTS)
|
47 |
|
48 | n.newline()
|
49 |
|
50 | ### CUSTOM translation with the COMPILED yaks binary.
|
51 | n.rule('yaks',
|
52 | command='_bin/cxx-opt/yaks/yaks_main.mycpp cpp $in > $out',
|
53 | description='yaks cpp $in > $out')
|
54 | n.newline()
|
55 |
|
56 | # Similar to mycpp_library()
|
57 | bundle_cc = '_gen/yaks/examples/hello.yaks.cc'
|
58 | n.build(
|
59 | [bundle_cc],
|
60 | 'yaks',
|
61 | ['yaks/examples/hello.yaks'],
|
62 | implicit=['_bin/cxx-opt/yaks/yaks_main.mycpp'],
|
63 | )
|
64 | n.newline()
|
65 |
|
66 | ru.cc_library(
|
67 | '//yaks/examples/hello.yaks',
|
68 | srcs=[bundle_cc],
|
69 | deps=['//mycpp/runtime'],
|
70 | )
|
71 |
|
72 | # Similar to mycpp_binaryary()
|
73 | main_cc(ru, '_gen/yaks/examples/hello.yaks-main.cc')
|
74 |
|
75 | ru.cc_binary(
|
76 | '_gen/yaks/examples/hello.yaks-main.cc',
|
77 | matrix=ninja_lib.COMPILERS_VARIANTS + ninja_lib.GC_PERF_VARIANTS,
|
78 | deps=['//yaks/examples/hello.yaks'],
|
79 | )
|
80 |
|
81 |
|
82 | # vim: sw=4
|