| OLD | NEW |
| 1 # All toolchains use the same generated code. | 1 # All toolchains use the same generated code. |
| 2 gen_dir = "$root_build_dir/gen/mojo/nacl" | 2 gen_dir = "$root_build_dir/gen/mojo/nacl" |
| 3 | 3 |
| 4 # Only allow the generator to be run by one toolchain. | 4 # Only allow the generator to be run by one toolchain. |
| 5 if (current_toolchain == default_toolchain) { | 5 if (current_toolchain == default_toolchain) { |
| 6 # Generate the code to plumb the Mojo public API into the NaCl sandbox. | 6 # Generate the code to plumb the Mojo public API into the NaCl sandbox. |
| 7 action("mojo_nacl_codegen") { | 7 action("mojo_nacl_codegen") { |
| 8 script = "generator/generate_nacl_bindings.py" | 8 script = "generator/generate_nacl_bindings.py" |
| 9 args = [ | 9 args = [ |
| 10 "-d", | 10 "-d", |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 # Trusted code | 29 # Trusted code |
| 30 if (!is_nacl) { | 30 if (!is_nacl) { |
| 31 # A library for launching a NaCl sandbox connected to a Mojo embedder. | 31 # A library for launching a NaCl sandbox connected to a Mojo embedder. |
| 32 static_library("monacl_sel") { | 32 static_library("monacl_sel") { |
| 33 sources = [ | 33 sources = [ |
| 34 "mojo_syscall_internal.h", | 34 "mojo_syscall_internal.h", |
| 35 "$gen_dir/mojo_syscall.cc", | 35 "$gen_dir/mojo_syscall.cc", |
| 36 "monacl_sel_main.cc", | 36 "monacl_sel_main.cc", |
| 37 ] | 37 ] |
| 38 |
| 38 deps = [ | 39 deps = [ |
| 39 # This target makes sure we have all the pre-processor defines needed to | 40 # This target makes sure we have all the pre-processor defines needed to |
| 40 # use NaCl's headers. | 41 # use NaCl's headers. |
| 41 "//native_client/build/config/nacl:nacl_base", | 42 "//native_client/build/config/nacl:nacl_base", |
| 42 "//native_client/src/trusted/desc:nrd_xfer", | 43 "//native_client/src/trusted/desc:nrd_xfer", |
| 43 "//native_client/src/trusted/service_runtime:sel_main_chrome", | 44 "//native_client/src/trusted/service_runtime:sel_main_chrome", |
| 44 ":mojo_nacl_codegen($default_toolchain)", | 45 ":mojo_nacl_codegen($default_toolchain)", |
| 45 ] | 46 ] |
| 46 } | 47 public_configs = |
| 47 | 48 [ "//third_party/mojo/src/mojo/public/build/config:mojo_sdk" ] |
| 48 # A simple shell for running untrusted binaries that talk to the Mojo | |
| 49 # embedder. (No services.) | |
| 50 executable("monacl_shell") { | |
| 51 testonly = true | |
| 52 sources = [ | |
| 53 "monacl_shell.cc", | |
| 54 ] | |
| 55 deps = [ | |
| 56 "//base:base", | |
| 57 "//third_party/mojo/src/mojo/edk/system:system", | |
| 58 ":monacl_sel", | |
| 59 ] | |
| 60 } | 49 } |
| 61 } | 50 } |
| 62 | 51 |
| 63 # Untrusted code | 52 # Untrusted code |
| 64 if (is_nacl) { | 53 if (is_nacl) { |
| 65 # Thunk mapping the Mojo public API onto NaCl syscalls. | 54 # Thunk mapping the Mojo public API onto NaCl syscalls. |
| 66 static_library("mojo") { | 55 static_library("mojo") { |
| 67 sources = [ | 56 sources = [ |
| 68 "$gen_dir/libmojo.cc", | 57 "$gen_dir/libmojo.cc", |
| 69 "$gen_dir/mojo_irt.h", | 58 "$gen_dir/mojo_irt.h", |
| 70 ] | 59 ] |
| 71 include_dirs = [ "$root_build_dir/gen" ] | 60 |
| 72 deps = [ | 61 public_configs = |
| 62 [ "//third_party/mojo/src/mojo/public/build/config:mojo_sdk" ] |
| 63 |
| 64 public_deps = [ |
| 73 ":mojo_nacl_codegen($default_toolchain)", | 65 ":mojo_nacl_codegen($default_toolchain)", |
| 74 ] | 66 ] |
| 75 } | 67 } |
| 76 | 68 |
| 77 # Unit test for the Mojo public API. | 69 source_set("irt_mojo_sources") { |
| 78 executable("monacl_test") { | |
| 79 testonly = true | |
| 80 sources = [ | |
| 81 "//third_party/mojo/src/mojo/public/cpp/system/tests/core_unittest.cc", | |
| 82 "//third_party/mojo/src/mojo/public/cpp/system/tests/macros_unittest.cc", | |
| 83 ] | |
| 84 deps = [ | |
| 85 "//testing/gtest:gtest", | |
| 86 "//testing/gtest:gtest_main", | |
| 87 "//third_party/mojo/src/mojo/public/c/system/tests:tests", | |
| 88 "//third_party/mojo/src/mojo/public/cpp/system:system", | |
| 89 ":mojo", | |
| 90 ] | |
| 91 } | |
| 92 | |
| 93 executable("irt_mojo") { | |
| 94 cflags_c = [ "-std=c99" ] | 70 cflags_c = [ "-std=c99" ] |
| 95 sources = [ | 71 sources = [ |
| 96 "irt_entry_mojo.c", | |
| 97 "$gen_dir/mojo_irt.c", | 72 "$gen_dir/mojo_irt.c", |
| 98 "$gen_dir/mojo_irt.h", | 73 "$gen_dir/mojo_irt.h", |
| 99 ] | 74 ] |
| 100 include_dirs = [ "$root_build_dir/gen" ] | 75 public_deps = [ |
| 101 deps = [ | |
| 102 "//native_client/build/config/nacl:nacl_base", | 76 "//native_client/build/config/nacl:nacl_base", |
| 103 "//native_client/src/untrusted/irt:irt_core_lib", | 77 "//native_client/src/untrusted/irt:irt_core_lib", |
| 104 "//native_client/src/untrusted/nacl:imc_syscalls", | 78 "//native_client/src/untrusted/nacl:imc_syscalls", |
| 105 ":mojo_nacl_codegen($default_toolchain)", | 79 ":mojo_nacl_codegen($default_toolchain)", |
| 106 ] | 80 ] |
| 107 } | 81 } |
| 108 } | 82 } |
| 109 | |
| 110 group("mojo_nacl") { | |
| 111 deps = [ | |
| 112 ":irt_mojo(//native_client/build/toolchain/nacl:irt_${current_cpu})", | |
| 113 ] | |
| 114 } | |
| 115 | |
| 116 group("mojo_nacl_tests") { | |
| 117 testonly = true | |
| 118 deps = [ | |
| 119 ":monacl_shell", | |
| 120 ":monacl_test(//native_client/build/toolchain/nacl:clang_newlib_${current_cp
u})", | |
| 121 ] | |
| 122 } | |
| OLD | NEW |