brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 1 | # 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', |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 31 | '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 | ], |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 44 | '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)', |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 51 | '-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 | }, |
| 60 | { |
| 61 | 'variables': { |
| 62 | 'script': '<(AOS)/build/act_builder.rb', |
| 63 | }, |
| 64 | 'rule_name': 'genact', |
| 65 | 'extension': 'act', |
| 66 | 'outputs': [ |
| 67 | '<(output_h)', |
| 68 | '<(output_cc)', |
| 69 | '<(output_main)', |
| 70 | ], |
| 71 | 'inputs': [ |
| 72 | '<(script)', |
| 73 | ], |
| 74 | 'action': ['ruby', '<(script)', |
| 75 | '<(gen_namespace)', |
| 76 | '<(RULE_INPUT_PATH)', |
| 77 | '<(DEPTH)', |
| 78 | '<(out_dir)', 'header', 'cpp', 'main'], |
| 79 | #'message': 'Generating C++ code from <(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).act', |
| 80 | 'process_outputs_as_sources': 1, |
| 81 | }, |
| 82 | ], |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 83 | 'include_dirs': [ |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 84 | '<(prefix_dir)/<(_target_name)', |
| 85 | ], |
| 86 | 'direct_dependent_settings': { |
| 87 | 'include_dirs': [ |
| 88 | '<(prefix_dir)/<(_target_name)', |
| 89 | ], |
| 90 | 'variables': { |
| 91 | 'gen_srcdir_parents': ['<(out_dir)'], |
| 92 | }, |
| 93 | }, |
Brian Silverman | 8dc9fd4 | 2014-02-10 13:35:43 -0800 | [diff] [blame] | 94 | 'dependencies': [ |
| 95 | '<(AOS)/common/common.gyp:queues', |
Brian Silverman | 665e60c | 2014-02-12 13:57:10 -0800 | [diff] [blame] | 96 | '<(AOS)/common/common.gyp:once', |
Brian Silverman | 04fdc23 | 2014-02-12 14:51:11 -0800 | [diff] [blame^] | 97 | '<(AOS)/common/common.gyp:queue_types', |
Brian Silverman | 8dc9fd4 | 2014-02-10 13:35:43 -0800 | [diff] [blame] | 98 | ], |
| 99 | 'export_dependent_settings': [ |
| 100 | '<(AOS)/common/common.gyp:queues', |
| 101 | ], |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 102 | 'hard_dependency': 1, |
| 103 | } |