OLD | NEW |
| (Empty) |
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 | |
3 # found in the LICENSE file. | |
4 | |
5 import("../mojo_sdk.gni") | |
6 import("//third_party/cython/rules.gni") | |
7 import("rules.gni") | |
8 | |
9 group("python") { | |
10 deps = [ | |
11 ":bindings", | |
12 ":mojo_system", | |
13 ":mojo_system_impl", | |
14 ] | |
15 } | |
16 | |
17 # GYP version: mojo.gyp:mojo_python_system | |
18 python_binary_module("mojo_system") { | |
19 configs = [ "../build/config:mojo_sdk" ] | |
20 deps = [ | |
21 ":system_embedded", | |
22 ] | |
23 } | |
24 | |
25 python_binary_source_set("system_embedded") { | |
26 cython_sources = [ | |
27 "c_async_waiter.pxd", | |
28 "c_core.pxd", | |
29 "c_export.pxd", | |
30 "c_thunks.pxd", | |
31 "mojo_system.pyx", | |
32 ] | |
33 configs = [ "../build/config:mojo_sdk" ] | |
34 deps = [ | |
35 "../cpp/bindings:callback", | |
36 "../cpp/system", | |
37 "../cpp/utility", | |
38 "../platform/native:system_thunks", | |
39 ] | |
40 public_deps = [ | |
41 "../c:system", | |
42 ] | |
43 } | |
44 | |
45 python_binary_module("mojo_system_impl") { | |
46 cython_sources = [ | |
47 "c_environment.pxd", | |
48 "c_export.pxd", | |
49 "c_thunks.pxd", | |
50 "mojo_system_impl.pyx", | |
51 ] | |
52 sources = [ | |
53 "src/python_system_helper.cc", | |
54 "src/python_system_helper.h", | |
55 ] | |
56 configs = [ "../build/config:mojo_sdk" ] | |
57 deps = [ | |
58 ":python_common", | |
59 "../c:environment", | |
60 "../c:system", | |
61 "../cpp/bindings:callback", | |
62 "../cpp/environment:standalone", | |
63 "../cpp/system", | |
64 "../cpp/utility", | |
65 "../platform/native:system_thunks", | |
66 ] | |
67 } | |
68 | |
69 python_binary_source_set("python_common") { | |
70 sources = [ | |
71 "src/common.cc", | |
72 "src/common.h", | |
73 ] | |
74 configs = [ "../build/config:mojo_sdk" ] | |
75 deps = [ | |
76 "../c:environment", | |
77 "../cpp/bindings:callback", | |
78 "../cpp/environment:environment", | |
79 "../cpp/system:system", | |
80 "../cpp/utility", | |
81 ] | |
82 } | |
83 | |
84 python_package("packaged_application") { | |
85 sources = [ | |
86 "mojo_application/__init__.py", | |
87 "mojo_application/application_delegate.py", | |
88 "mojo_application/application_impl.py", | |
89 "mojo_application/application_runner.py", | |
90 "mojo_application/service_provider_impl.py", | |
91 ] | |
92 } | |
93 | |
94 action("import_interface_bindings") { | |
95 visibility = [ ":bindings" ] | |
96 script = rebase_path("mojo/public/tools/gn/unzip.py", ".", mojo_root) | |
97 timestamp = "$target_gen_dir/${target_name}.outputstamp" | |
98 mojom_deps = [ "../interfaces/bindings:bindings_python" ] | |
99 inputs = [] | |
100 foreach(d, mojom_deps) { | |
101 dep_name = get_label_info(d, "name") | |
102 dep_target_out_dir = get_label_info(d, "target_out_dir") | |
103 inputs += [ "$dep_target_out_dir/$dep_name.pyzip" ] | |
104 } | |
105 outputs = [ | |
106 timestamp, | |
107 ] | |
108 rebase_inputs = rebase_path(inputs, root_build_dir) | |
109 rabase_output = rebase_path("$root_out_dir/python", root_build_dir) | |
110 rebase_timestamp = rebase_path(timestamp, root_build_dir) | |
111 args = [ | |
112 "--inputs=${rebase_inputs}", | |
113 "--output=${rabase_output}", | |
114 "--timestamp=${rebase_timestamp}", | |
115 ] | |
116 | |
117 deps = mojom_deps | |
118 } | |
119 | |
120 group("bindings") { | |
121 deps = [ | |
122 ":import_interface_bindings", | |
123 ":serialization_bindings", | |
124 ] | |
125 } | |
126 | |
127 # This target lists dependencies needed to use generated mojom files for | |
128 # serialization/deserialization only, but not the full mojo application stack. | |
129 copy("serialization_bindings") { | |
130 sources = [ | |
131 "mojo_bindings/__init__.py", | |
132 "mojo_bindings/descriptor.py", | |
133 "mojo_bindings/interface_reflection.py", | |
134 "mojo_bindings/messaging.py", | |
135 "mojo_bindings/promise.py", | |
136 "mojo_bindings/reflection.py", | |
137 "mojo_bindings/serialization.py", | |
138 ] | |
139 outputs = [ | |
140 "$root_out_dir/python/mojo_bindings/{{source_file_part}}", | |
141 ] | |
142 deps = [ | |
143 ":mojo_system", | |
144 ] | |
145 } | |
146 | |
147 python_package("packaged_bindings") { | |
148 sources = [ | |
149 "mojo_bindings/__init__.py", | |
150 "mojo_bindings/descriptor.py", | |
151 "mojo_bindings/interface_reflection.py", | |
152 "mojo_bindings/messaging.py", | |
153 "mojo_bindings/promise.py", | |
154 "mojo_bindings/reflection.py", | |
155 "mojo_bindings/serialization.py", | |
156 ] | |
157 | |
158 deps = [ | |
159 "../interfaces/bindings:bindings_python", | |
160 ] | |
161 } | |
OLD | NEW |