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_source_set") { | 5 template("python_binary_source_set") { |
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.cython_sources) || defined(invoker.sources)) | 8 assert(defined(invoker.cython_sources) || defined(invoker.sources)) |
9 | 9 |
10 config_name = target_name + "_python_config" | 10 config_name = target_name + "_python_config" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 } | 75 } |
76 } | 76 } |
77 | 77 |
78 template("python_binary_module") { | 78 template("python_binary_module") { |
79 # Only available on linux for now. | 79 # Only available on linux for now. |
80 assert(is_linux) | 80 assert(is_linux) |
81 | 81 |
82 has_sources = defined(invoker.cython_sources) || defined(invoker.sources) | 82 has_sources = defined(invoker.cython_sources) || defined(invoker.sources) |
83 | 83 |
84 assert(has_sources || defined(invoker.deps)) | 84 assert(has_sources || defined(invoker.deps)) |
85 assert(defined(invoker.python_base_module)) | 85 assert( |
| 86 !defined(invoker.python_base_module) || invoker.python_base_module != "") |
86 | 87 |
87 sources_target_name = target_name + "_cython_sources" | 88 sources_target_name = target_name + "_cython_sources" |
88 shared_library_name = target_name + "_shared_library" | 89 shared_library_name = target_name + "_shared_library" |
89 | 90 |
90 if (is_linux) { | 91 if (is_linux) { |
91 shared_library_prefix = "lib" | 92 shared_library_prefix = "lib" |
92 shared_library_suffix = ".so" | 93 shared_library_suffix = ".so" |
93 python_module_suffix = ".so" | 94 python_module_suffix = ".so" |
94 } | 95 } |
95 | 96 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 } | 132 } |
132 if (defined(invoker.deps)) { | 133 if (defined(invoker.deps)) { |
133 deps += invoker.deps | 134 deps += invoker.deps |
134 } | 135 } |
135 if (defined(invoker.datadeps)) { | 136 if (defined(invoker.datadeps)) { |
136 datadeps = invoker.datadeps | 137 datadeps = invoker.datadeps |
137 } | 138 } |
138 } | 139 } |
139 | 140 |
140 copy(target_name) { | 141 copy(target_name) { |
141 python_base_module = invoker.python_base_module | 142 if (defined(invoker.python_base_module)) { |
| 143 python_base_module = invoker.python_base_module |
| 144 output = "$root_out_dir/python/$python_base_module/${target_name}${python_
module_suffix}" |
| 145 } else { |
| 146 output = "$root_out_dir/python/${target_name}${python_module_suffix}" |
| 147 } |
| 148 |
142 sources = [ | 149 sources = [ |
143 "$root_out_dir/${shared_library_prefix}${shared_library_name}${shared_libr
ary_suffix}", | 150 "$root_out_dir/${shared_library_prefix}${shared_library_name}${shared_libr
ary_suffix}", |
144 ] | 151 ] |
145 outputs = [ | 152 outputs = [ |
146 "$root_out_dir/python/$python_base_module/${target_name}${python_module_su
ffix}", | 153 output, |
147 ] | 154 ] |
148 deps = [ | 155 deps = [ |
149 ":$shared_library_name", | 156 ":$shared_library_name", |
150 ] | 157 ] |
151 } | 158 } |
152 } | 159 } |
OLD | NEW |