blob: 7c0343acbe8089809e1b5e16ec37c321b2e29243 [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,
Brian Silverman65f80962014-02-22 12:34:18 -080032 'aos_q_dependent_paths%': [],
brians343bc112013-02-10 01:53:46 +000033 },
34 'rules': [
35 {
36 'variables': {
37 'script': '<(AOS)/build/queues/compiler.rb',
38 },
39 'rule_name': 'genqueue',
40 'extension': 'q',
41 'outputs': [
42 '<(output_h)',
43 '<(output_cc)',
44 ],
brians343bc112013-02-10 01:53:46 +000045 'inputs': [
46 '<(script)',
47 '<!@(find <(AOS)/build/queues/ -name *.rb)',
48 '<(AOS)/common/queue.h',
49 '<(AOS)/common/time.h',
Brian Silverman65f80962014-02-22 12:34:18 -080050 '>@(aos_q_dependent_paths)',
brians343bc112013-02-10 01:53:46 +000051 ],
52 'action': ['ruby', '<(script)',
brians343bc112013-02-10 01:53:46 +000053 '-I', '<(DEPTH)',
54 '<(RULE_INPUT_PATH)',
55 '-cpp_out',
56 '<(header_path)',
57 '-cpp_base',
58 '<(prefix_dir)/<(_target_name)'],
Brian Silvermancbbc3c42014-02-22 18:33:17 -080059 'message': 'Generating C++ code for <(header_path)/<(RULE_INPUT_PATH)',
brians343bc112013-02-10 01:53:46 +000060 'process_outputs_as_sources': 1,
61 },
brians343bc112013-02-10 01:53:46 +000062 ],
brians343bc112013-02-10 01:53:46 +000063 'include_dirs': [
brians343bc112013-02-10 01:53:46 +000064 '<(prefix_dir)/<(_target_name)',
65 ],
66 'direct_dependent_settings': {
67 'include_dirs': [
68 '<(prefix_dir)/<(_target_name)',
69 ],
70 'variables': {
Brian Silverman65f80962014-02-22 12:34:18 -080071 'aos_q_dependent_paths': ['<@(_sources)'],
brians343bc112013-02-10 01:53:46 +000072 },
73 },
Brian Silverman8dc9fd42014-02-10 13:35:43 -080074 'dependencies': [
75 '<(AOS)/common/common.gyp:queues',
Brian Silverman665e60c2014-02-12 13:57:10 -080076 '<(AOS)/common/common.gyp:once',
Brian Silverman04fdc232014-02-12 14:51:11 -080077 '<(AOS)/common/common.gyp:queue_types',
Brian Silverman8dc9fd42014-02-10 13:35:43 -080078 ],
79 'export_dependent_settings': [
80 '<(AOS)/common/common.gyp:queues',
81 ],
brians343bc112013-02-10 01:53:46 +000082 'hard_dependency': 1,
83}