blob: 4f238b91f9376f7b7b65ec4641803e4d065a2743 [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',
brians343bc112013-02-10 01:53:46 +000031 'no_rsync': 1,
32 },
33 'rules': [
34 {
35 'variables': {
36 'script': '<(AOS)/build/queues/compiler.rb',
37 },
38 'rule_name': 'genqueue',
39 'extension': 'q',
40 'outputs': [
41 '<(output_h)',
42 '<(output_cc)',
43 ],
brians343bc112013-02-10 01:53:46 +000044 'inputs': [
45 '<(script)',
46 '<!@(find <(AOS)/build/queues/ -name *.rb)',
47 '<(AOS)/common/queue.h',
48 '<(AOS)/common/time.h',
49 ],
50 'action': ['ruby', '<(script)',
brians343bc112013-02-10 01:53:46 +000051 '-I', '<(DEPTH)',
52 '<(RULE_INPUT_PATH)',
53 '-cpp_out',
54 '<(header_path)',
55 '-cpp_base',
56 '<(prefix_dir)/<(_target_name)'],
57 'message': 'Generating C++ code from <(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).q',
58 'process_outputs_as_sources': 1,
59 },
brians343bc112013-02-10 01:53:46 +000060 ],
brians343bc112013-02-10 01:53:46 +000061 'include_dirs': [
brians343bc112013-02-10 01:53:46 +000062 '<(prefix_dir)/<(_target_name)',
63 ],
64 'direct_dependent_settings': {
65 'include_dirs': [
66 '<(prefix_dir)/<(_target_name)',
67 ],
68 'variables': {
69 'gen_srcdir_parents': ['<(out_dir)'],
70 },
71 },
Brian Silverman8dc9fd42014-02-10 13:35:43 -080072 'dependencies': [
73 '<(AOS)/common/common.gyp:queues',
Brian Silverman665e60c2014-02-12 13:57:10 -080074 '<(AOS)/common/common.gyp:once',
Brian Silverman04fdc232014-02-12 14:51:11 -080075 '<(AOS)/common/common.gyp:queue_types',
Brian Silverman8dc9fd42014-02-10 13:35:43 -080076 ],
77 'export_dependent_settings': [
78 '<(AOS)/common/common.gyp:queues',
79 ],
brians343bc112013-02-10 01:53:46 +000080 'hard_dependency': 1,
81}