OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 template("python_binary_module_sources") { | 5 template("python_binary_module_sources") { |
6 # Only available on linux for now. | 6 # Only available on linux for now. |
7 assert(is_linux) | 7 assert(is_linux) |
8 assert(defined(invoker.sources)) | 8 assert(defined(invoker.sources)) |
9 | 9 |
10 cython_root = "//third_party/cython" | 10 cython_root = "//third_party/cython" |
11 cython_script = "$cython_root/src/cython.py" | 11 cython_script = "$cython_root/src/cython.py" |
12 cython_output = "${target_out_dir}/${target_name}.cc" | 12 cython_output = "${target_out_dir}/${target_name}.cc" |
13 | 13 |
14 generator_target_name = target_name + "_cython_compiler" | 14 generator_target_name = target_name + "_cython_compiler" |
15 config_name = target_name + "_python_config" | 15 config_name = target_name + "_python_config" |
16 | 16 |
17 target_visibility = [ ":$target_name" ] | 17 target_visibility = [ ":$target_name" ] |
18 | 18 |
19 action(generator_target_name) { | 19 action(generator_target_name) { |
20 visibility = target_visibility | 20 visibility = target_visibility |
21 script = cython_script | 21 script = cython_script |
22 sources = invoker.sources | 22 sources = invoker.sources |
23 outputs = [ cython_output ] | 23 outputs = [ |
| 24 cython_output, |
| 25 ] |
24 args = [ | 26 args = [ |
25 "--cplus", | 27 "--cplus", |
26 "-I", | 28 "-I", |
27 rebase_path("//", root_build_dir), | 29 rebase_path("//", root_build_dir), |
28 "-o", | 30 "-o", |
29 rebase_path(cython_output, root_build_dir), | 31 rebase_path(cython_output, root_build_dir), |
30 ] + rebase_path(sources, root_build_dir) | 32 ] + rebase_path(sources, root_build_dir) |
31 } | 33 } |
32 | 34 |
33 config(config_name) { | 35 config(config_name) { |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 if (defined(invoker.configs)) { | 110 if (defined(invoker.configs)) { |
109 configs += invoker.configs | 111 configs += invoker.configs |
110 } | 112 } |
111 } | 113 } |
112 | 114 |
113 copy(target_name) { | 115 copy(target_name) { |
114 python_base_module = invoker.python_base_module | 116 python_base_module = invoker.python_base_module |
115 sources = [ | 117 sources = [ |
116 "$root_out_dir/${shared_library_prefix}${shared_library_name}${shared_libr
ary_suffix}", | 118 "$root_out_dir/${shared_library_prefix}${shared_library_name}${shared_libr
ary_suffix}", |
117 ] | 119 ] |
118 outputs = | 120 outputs = [ |
119 [ "$root_out_dir/python/$python_base_module/${target_name}${python_modul
e_suffix}" ] | 121 "$root_out_dir/python/$python_base_module/${target_name}${python_module_su
ffix}", |
| 122 ] |
120 deps = [ | 123 deps = [ |
121 ":$shared_library_name", | 124 ":$shared_library_name", |
122 ] | 125 ] |
123 } | 126 } |
124 } | 127 } |
OLD | NEW |