OLD | NEW |
(Empty) | |
| 1 # All toolchains use the same generated code. |
| 2 gen_dir = "$root_build_dir/gen/mojo/nacl" |
| 3 |
| 4 # Only allow the generator to be run by one toolchain. |
| 5 if (current_toolchain == default_toolchain) { |
| 6 # Generate the code to plumb the Mojo public API into the NaCl sandbox. |
| 7 action("mojo_nacl_codegen") { |
| 8 script = "generator/generate_nacl_bindings.py" |
| 9 args = [ |
| 10 "-d", |
| 11 rebase_path(gen_dir, root_build_dir), |
| 12 ] |
| 13 inputs = [ |
| 14 script, |
| 15 "generator/interface.py", |
| 16 "generator/interface_dsl.py", |
| 17 "generator/mojo_syscall.cc.tmpl", |
| 18 "generator/libmojo.cc.tmpl", |
| 19 ] |
| 20 outputs = [ |
| 21 "$gen_dir/mojo_syscall.cc", |
| 22 "$gen_dir/libmojo.cc", |
| 23 ] |
| 24 } |
| 25 } |
| 26 |
| 27 # Trusted code |
| 28 if (!is_nacl) { |
| 29 # A library for launching a NaCl sandbox connected to a Mojo embedder. |
| 30 static_library("monacl_sel") { |
| 31 sources = [ |
| 32 "mojo_syscall_internal.h", |
| 33 "$gen_dir/mojo_syscall.cc", |
| 34 "monacl_sel_main.cc", |
| 35 ] |
| 36 deps = [ |
| 37 # This target makes sure we have all the pre-processor defines needed to |
| 38 # use NaCl's headers. |
| 39 "//native_client/build/config/nacl:nacl_base", |
| 40 "//native_client/src/trusted/desc:nrd_xfer", |
| 41 "//native_client/src/trusted/service_runtime:sel_main_chrome", |
| 42 ":mojo_nacl_codegen($default_toolchain)", |
| 43 ] |
| 44 } |
| 45 |
| 46 # A simple shell for running untrusted binaries that talk to the Mojo |
| 47 # embedder. (No services.) |
| 48 executable("monacl_shell") { |
| 49 testonly = true |
| 50 sources = [ |
| 51 "monacl_shell.cc", |
| 52 ] |
| 53 deps = [ |
| 54 "//base:base", |
| 55 "//mojo/edk/system:system", |
| 56 ":monacl_sel", |
| 57 ] |
| 58 } |
| 59 } |
| 60 |
| 61 # Untrusted code |
| 62 if (is_nacl) { |
| 63 # Thunk mapping the Mojo public API onto NaCl syscalls. |
| 64 static_library("mojo") { |
| 65 sources = [ |
| 66 "$gen_dir/libmojo.cc", |
| 67 ] |
| 68 deps = [ |
| 69 ":mojo_nacl_codegen($default_toolchain)", |
| 70 ] |
| 71 } |
| 72 |
| 73 # Unit test for the Mojo public API. |
| 74 executable("monacl_test") { |
| 75 testonly = true |
| 76 sources = [ |
| 77 "//mojo/public/cpp/system/tests/core_unittest.cc", |
| 78 "//mojo/public/cpp/system/tests/macros_unittest.cc", |
| 79 ] |
| 80 deps = [ |
| 81 "//native_client/src/untrusted/nacl:imc_syscalls", |
| 82 "//mojo/public/c/system/tests:tests", |
| 83 "//mojo/public/cpp/system:system", |
| 84 "//testing/gtest:gtest", |
| 85 "//testing/gtest:gtest_main", |
| 86 ":mojo", |
| 87 ] |
| 88 } |
| 89 } |
| 90 |
| 91 group("mojo_nacl") { |
| 92 deps = [ |
| 93 "//native_client/src/untrusted/irt:irt_core(//native_client/build/toolchain/
nacl:irt_${cpu_arch})", |
| 94 ] |
| 95 } |
| 96 |
| 97 group("mojo_nacl_tests") { |
| 98 testonly = true |
| 99 deps = [ |
| 100 ":monacl_shell", |
| 101 ":monacl_test(//native_client/build/toolchain/nacl:clang_newlib_${cpu_arch})
", |
| 102 ] |
| 103 } |
OLD | NEW |