blob: 7ae0d890637856e48f19c3783229f081ba3cb544 [file] [log] [blame]
brians343bc112013-02-10 01:53:46 +00001# Include this file in any target that needs to use files generated from queue
2# etc. definitions.
3#
4# To use, create a target of the following form:
5# {
6# 'target_name': 'my_queues',
7# 'type': 'static_library', # or any other type that can handle .cc files
8# 'sources': [
9# 'aos/example/Queue.q',
10# 'aos/example/ControlLoop.q',
11# ],
12# 'variables': {
13# 'header_path': 'aos/example',
14# },
15# 'includes': ['path/to/queues.gypi'],
16# },
17# Code that depends on this target will be able to #include
18# "aos/example/Queue.q.h" and "aos/example/ControlLoop.q.h".
19#
20# using <http://src.chromium.org/svn/trunk/src/build/protoc.gypi> as an
21# example of how this should work
22{
23 'variables': {
24 #'header_path': '>!(python -c "import os.path; print os.path.relpath(\'<(RULE_INPUT_PATH)\', \'<(DEPTH)\')")',
25 'prefix_dir': '<(SHARED_INTERMEDIATE_DIR)/<!(echo <(header_path) | sed "s/[^A-Za-z0-9]/_/g")',
26 'out_dir': '<(prefix_dir)/<(_target_name)/<(header_path)',
27 'gen_namespace%': '>!(echo >(header_path) | sed "s:\([^/]*\).*:\\1:g")',
28 'output_h': '<(out_dir)/<(RULE_INPUT_ROOT).q.h',
29 'output_cc': '<(out_dir)/<(RULE_INPUT_ROOT).q.cc',
30 'output_main': '<(out_dir)/<(RULE_INPUT_ROOT)_main.cc',
31 'output_swg': '<(out_dir)/<(RULE_INPUT_ROOT).q.swig',
32 'output_java_wrap': '<(out_dir)/<(RULE_INPUT_ROOT)_java_wrap.cc',
33 'java_dir': '<(out_dir)/<(RULE_INPUT_ROOT).q_java',
34 'no_rsync': 1,
35 },
36 'rules': [
37 {
38 'variables': {
39 'script': '<(AOS)/build/queues/compiler.rb',
40 },
41 'rule_name': 'genqueue',
42 'extension': 'q',
43 'outputs': [
44 '<(output_h)',
45 '<(output_cc)',
46 ],
47 'conditions': [
48 ['OS=="crio"', {
49 'outputs': [
50 # cRIO doesn't do swig for a good reason.
51 ]
52 },{
53 'outputs': [
54 '<(output_swg)',
55 '<(output_java_wrap)',
56 '<(java_dir)',
57 ]
58 }]
59 ],
60 'inputs': [
61 '<(script)',
62 '<!@(find <(AOS)/build/queues/ -name *.rb)',
63 '<(AOS)/common/queue.h',
64 '<(AOS)/common/time.h',
65 ],
66 'action': ['ruby', '<(script)',
67 '--swig',
68 '--swigccout', '<(output_java_wrap)',
69 '-I', '<(DEPTH)',
70 '<(RULE_INPUT_PATH)',
71 '-cpp_out',
72 '<(header_path)',
73 '-cpp_base',
74 '<(prefix_dir)/<(_target_name)'],
75 'message': 'Generating C++ code from <(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).q',
76 'process_outputs_as_sources': 1,
77 },
78 {
79 'variables': {
80 'script': '<(AOS)/build/act_builder.rb',
81 },
82 'rule_name': 'genact',
83 'extension': 'act',
84 'outputs': [
85 '<(output_h)',
86 '<(output_cc)',
87 '<(output_main)',
88 ],
89 'inputs': [
90 '<(script)',
91 ],
92 'action': ['ruby', '<(script)',
93 '<(gen_namespace)',
94 '<(RULE_INPUT_PATH)',
95 '<(DEPTH)',
96 '<(out_dir)', 'header', 'cpp', 'main'],
97 #'message': 'Generating C++ code from <(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).act',
98 'process_outputs_as_sources': 1,
99 },
100 ],
101 'cflags': [
102# For the swig-generated C++ code.
103 '-fno-strict-aliasing',
104 '-Wno-cast-qual',
105 ],
106 'include_dirs': [
107 '/usr/lib/jvm/default-java/include',
108 '/usr/lib/jvm/default-java/include/linux',
109 '<(prefix_dir)/<(_target_name)',
110 ],
111 'direct_dependent_settings': {
112 'include_dirs': [
113 '<(prefix_dir)/<(_target_name)',
114 ],
115 'variables': {
116 'gen_srcdir_parents': ['<(out_dir)'],
117 },
118 },
Brian Silverman8dc9fd42014-02-10 13:35:43 -0800119 'dependencies': [
120 '<(AOS)/common/common.gyp:queues',
121 ],
122 'export_dependent_settings': [
123 '<(AOS)/common/common.gyp:queues',
124 ],
brians343bc112013-02-10 01:53:46 +0000125 'hard_dependency': 1,
126}