| OLD | NEW |
| (Empty) |
| 1 # Copyright (c) 2015 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 # TODO(dpranke) - it's very dangerous to have files being built with one | |
| 6 # toolchain having as part of the include_dirs a path to another toolchain's | |
| 7 # gen/ directory; it would be easy to end up including files meant for a | |
| 8 # different toolchain. We should either change this code to generate the | |
| 9 # files in every toolchain, or check in the generated code. Currently | |
| 10 # the plan is to do the latter. | |
| 11 | |
| 12 # All toolchains use the same generated code. | |
| 13 gen_dir = "$root_build_dir/gen/mojo/nacl" | |
| 14 | |
| 15 config("mojo_nacl") { | |
| 16 include_dirs = [ "$root_build_dir/gen" ] | |
| 17 } | |
| 18 | |
| 19 # Only allow the generator to be run by one toolchain. | |
| 20 if (current_toolchain == default_toolchain) { | |
| 21 # Generate the code to plumb the Mojo public API into the NaCl sandbox. | |
| 22 action("mojo_nacl_codegen") { | |
| 23 script = "generator/generate_nacl_bindings.py" | |
| 24 args = [ | |
| 25 "-d", | |
| 26 rebase_path(gen_dir, root_build_dir), | |
| 27 ] | |
| 28 inputs = [ | |
| 29 script, | |
| 30 "generator/interface.py", | |
| 31 "generator/interface_dsl.py", | |
| 32 "generator/mojo_syscall.cc.tmpl", | |
| 33 "generator/libmojo.cc.tmpl", | |
| 34 ] | |
| 35 outputs = [ | |
| 36 "$gen_dir/mojo_irt.c", | |
| 37 "$gen_dir/mojo_irt.h", | |
| 38 "$gen_dir/mojo_syscall.cc", | |
| 39 "$gen_dir/libmojo.cc", | |
| 40 ] | |
| 41 } | |
| 42 } | |
| 43 | |
| 44 # Trusted code | |
| 45 if (!is_nacl) { | |
| 46 # A library for launching a NaCl sandbox connected to a Mojo embedder. | |
| 47 static_library("monacl_sel") { | |
| 48 sources = [ | |
| 49 "$gen_dir/mojo_syscall.cc", | |
| 50 "mojo_syscall_internal.h", | |
| 51 "monacl_sel_main.cc", | |
| 52 ] | |
| 53 | |
| 54 deps = [ | |
| 55 # This target makes sure we have all the pre-processor defines needed to | |
| 56 # use NaCl's headers. | |
| 57 "//native_client/build/config/nacl:nacl_base", | |
| 58 "//native_client/src/trusted/desc:nrd_xfer", | |
| 59 "//native_client/src/trusted/service_runtime:sel_main_chrome", | |
| 60 ":mojo_nacl_codegen($default_toolchain)", | |
| 61 ] | |
| 62 public_configs = | |
| 63 [ "//third_party/mojo/src/mojo/public/build/config:mojo_sdk" ] | |
| 64 } | |
| 65 } | |
| 66 | |
| 67 # Untrusted code | |
| 68 if (is_nacl) { | |
| 69 # Thunk mapping the Mojo public API onto NaCl syscalls. | |
| 70 static_library("mojo") { | |
| 71 sources = [ | |
| 72 "$gen_dir/libmojo.cc", | |
| 73 "$gen_dir/mojo_irt.h", | |
| 74 ] | |
| 75 | |
| 76 public_configs = [ | |
| 77 ":mojo_nacl", | |
| 78 "//third_party/mojo/src/mojo/public/build/config:mojo_sdk", | |
| 79 ] | |
| 80 | |
| 81 public_deps = [ | |
| 82 ":mojo_nacl_codegen($default_toolchain)", | |
| 83 ] | |
| 84 } | |
| 85 | |
| 86 source_set("irt_mojo_sources") { | |
| 87 cflags_c = [ "-std=c99" ] | |
| 88 sources = [ | |
| 89 "$gen_dir/mojo_irt.c", | |
| 90 "$gen_dir/mojo_irt.h", | |
| 91 ] | |
| 92 | |
| 93 public_configs = [ | |
| 94 ":mojo_nacl", | |
| 95 "//third_party/mojo/src/mojo/public/build/config:mojo_sdk", | |
| 96 ] | |
| 97 | |
| 98 public_deps = [ | |
| 99 "//native_client/build/config/nacl:nacl_base", | |
| 100 "//native_client/src/untrusted/irt:irt_core_lib", | |
| 101 "//native_client/src/untrusted/nacl:imc_syscalls", | |
| 102 ":mojo_nacl_codegen($default_toolchain)", | |
| 103 ] | |
| 104 } | |
| 105 } | |
| OLD | NEW |