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