brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 1 | # Include this file in any target that needs to use swig wrappers. |
| 2 | # |
| 3 | # To use, create a target of the following form: |
| 4 | # { |
| 5 | # 'target_name': 'my_target_javawrap', |
| 6 | # 'type': 'static_library', # or any other type that can handle .cc files |
| 7 | # 'sources': [ |
| 8 | # 'aos/example/target.swig', |
| 9 | # ], |
| 10 | # 'variables': { |
| 11 | # 'package': 'aos.test', |
| 12 | # }, |
| 13 | # 'includes': ['path/to/swig.gypi'], |
| 14 | # }, |
| 15 | # Code that depends on this target will be able to use the swig wrapped |
| 16 | # java classes. |
| 17 | # |
| 18 | # using <http://src.chromium.org/svn/trunk/src/build/protoc.gypi> as an |
| 19 | # example of how this should work |
| 20 | { |
| 21 | 'variables': { |
| 22 | 'prefix_dir': '<(SHARED_INTERMEDIATE_DIR)/', |
| 23 | 'out_dir': '<(prefix_dir)/<(_target_name)/', |
| 24 | 'output_java_wrap': '<(out_dir)/<(RULE_INPUT_ROOT)_wrap.cc', |
| 25 | 'java_dir': '<(out_dir)/<(RULE_INPUT_ROOT)_java', |
| 26 | 'no_rsync': 1, |
| 27 | }, |
| 28 | 'rules': [ |
| 29 | { |
| 30 | 'rule_name': 'genswig', |
| 31 | 'extension': 'swig', |
| 32 | 'outputs': [ |
| 33 | '<(output_java_wrap)', |
| 34 | '<(java_dir)', |
| 35 | ], |
| 36 | 'action': [ |
| 37 | '<(DEPTH)/aos/build/mkdirswig', |
| 38 | '<(java_dir)', |
| 39 | '-I<(DEPTH)', |
| 40 | '-outdir', ' <(java_dir)', |
| 41 | '-package', '<(package)', |
| 42 | '-o', '<(output_java_wrap)', |
| 43 | '-c++', |
| 44 | '-Wall', |
| 45 | '-Wextra', |
| 46 | '-java', |
| 47 | '<(RULE_INPUT_PATH)'], |
| 48 | 'message': 'Generating C++ code from <(RULE_INPUT_DIRNAME)/<(RULE_INPUT_ROOT).swig', |
| 49 | 'process_outputs_as_sources': 1, |
| 50 | }, |
| 51 | ], |
| 52 | 'cflags': [ |
| 53 | # For the swig-generated C++ code. |
| 54 | '-fno-strict-aliasing', |
| 55 | '-Wno-cast-qual', |
| 56 | ], |
| 57 | 'include_dirs': [ |
| 58 | '<(prefix_dir)/<(_target_name)', |
| 59 | '/usr/lib/jvm/default-java/include', |
| 60 | '/usr/lib/jvm/default-java/include/linux', |
| 61 | ], |
| 62 | 'direct_dependent_settings': { |
| 63 | 'include_dirs': [ |
| 64 | '<(prefix_dir)/<(_target_name)', |
| 65 | '/usr/lib/jvm/default-java/include', |
| 66 | '/usr/lib/jvm/default-java/include/linux', |
| 67 | ], |
| 68 | 'variables': { |
| 69 | 'gen_srcdir_parents': ['<(out_dir)'], |
| 70 | }, |
| 71 | }, |
| 72 | 'hard_dependency': 1, |
| 73 | } |