| # Copyright 2014 The Chromium Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("../mojo_sdk.gni") |
| import("//third_party/cython/rules.gni") |
| import("rules.gni") |
| |
| group("python") { |
| deps = [ |
| ":bindings", |
| ":mojo_system", |
| ":mojo_system_impl", |
| ] |
| } |
| |
| # GYP version: mojo.gyp:mojo_python_system |
| python_binary_module("mojo_system") { |
| configs = [ "../build/config:mojo_sdk" ] |
| deps = [ |
| ":system_embedded", |
| ] |
| } |
| |
| python_binary_source_set("system_embedded") { |
| cython_sources = [ |
| "c_async_waiter.pxd", |
| "c_core.pxd", |
| "c_export.pxd", |
| "c_thunks.pxd", |
| "mojo_system.pyx", |
| ] |
| configs = [ "../build/config:mojo_sdk" ] |
| deps = [ |
| "../c/system", |
| "../cpp/bindings:callback", |
| "../cpp/system", |
| "../cpp/utility", |
| "../platform/native:system", |
| ] |
| } |
| |
| python_binary_module("mojo_system_impl") { |
| cython_sources = [ |
| "c_environment.pxd", |
| "c_export.pxd", |
| "c_thunks.pxd", |
| "mojo_system_impl.pyx", |
| ] |
| sources = [ |
| "src/python_system_helper.cc", |
| "src/python_system_helper.h", |
| ] |
| configs = [ "../build/config:mojo_sdk" ] |
| deps = [ |
| ":python_common", |
| "../c/environment", |
| "../c/system", |
| "../cpp/bindings:callback", |
| "../cpp/environment:standalone", |
| "../cpp/system", |
| "../cpp/utility", |
| "../platform/native:system", |
| ] |
| } |
| |
| python_binary_source_set("python_common") { |
| sources = [ |
| "src/common.cc", |
| "src/common.h", |
| ] |
| configs = [ "../build/config:mojo_sdk" ] |
| deps = [ |
| "../c/environment:environment", |
| "../cpp/bindings:callback", |
| "../cpp/environment:environment", |
| "../cpp/system:system", |
| "../cpp/utility", |
| ] |
| } |
| |
| python_package("packaged_application") { |
| sources = [ |
| "mojo_application/__init__.py", |
| "mojo_application/application_delegate.py", |
| "mojo_application/application_impl.py", |
| "mojo_application/application_runner.py", |
| "mojo_application/service_provider_impl.py", |
| ] |
| } |
| |
| action("import_interface_bindings") { |
| visibility = [ ":bindings" ] |
| script = rebase_path("mojo/public/tools/gn/unzip.py", ".", mojo_root) |
| timestamp = "$target_gen_dir/${target_name}.outputstamp" |
| mojom_deps = [ "../interfaces/bindings:bindings_python" ] |
| inputs = [] |
| foreach(d, mojom_deps) { |
| dep_name = get_label_info(d, "name") |
| dep_target_out_dir = get_label_info(d, "target_out_dir") |
| inputs += [ "$dep_target_out_dir/$dep_name.pyzip" ] |
| } |
| outputs = [ |
| timestamp, |
| ] |
| rebase_inputs = rebase_path(inputs, root_build_dir) |
| rabase_output = rebase_path("$root_out_dir/python", root_build_dir) |
| rebase_timestamp = rebase_path(timestamp, root_build_dir) |
| args = [ |
| "--inputs=${rebase_inputs}", |
| "--output=${rabase_output}", |
| "--timestamp=${rebase_timestamp}", |
| ] |
| |
| deps = mojom_deps |
| } |
| |
| copy("bindings") { |
| sources = [ |
| "mojo_bindings/__init__.py", |
| "mojo_bindings/descriptor.py", |
| "mojo_bindings/interface_reflection.py", |
| "mojo_bindings/messaging.py", |
| "mojo_bindings/promise.py", |
| "mojo_bindings/reflection.py", |
| "mojo_bindings/serialization.py", |
| ] |
| outputs = [ |
| "$root_out_dir/python/mojo_bindings/{{source_file_part}}", |
| ] |
| deps = [ |
| ":import_interface_bindings", |
| ":mojo_system", |
| ] |
| } |
| |
| python_package("packaged_bindings") { |
| sources = [ |
| "mojo_bindings/__init__.py", |
| "mojo_bindings/descriptor.py", |
| "mojo_bindings/interface_reflection.py", |
| "mojo_bindings/messaging.py", |
| "mojo_bindings/promise.py", |
| "mojo_bindings/reflection.py", |
| "mojo_bindings/serialization.py", |
| ] |
| |
| deps = [ |
| "../interfaces/bindings:bindings_python", |
| ] |
| } |