OLD | NEW |
1 {{+bindTo:partials.standard_nacl_article}} | 1 {{+bindTo:partials.standard_nacl_article}} |
2 | 2 |
3 <section id="c-tutorial-getting-started-part-2"> | 3 <section id="c-tutorial-getting-started-part-2"> |
4 <span id="tutorial2"></span><h1 id="c-tutorial-getting-started-part-2"><span id=
"tutorial2"></span>C++ Tutorial: Getting Started (Part 2)</h1> | 4 <span id="tutorial2"></span><h1 id="c-tutorial-getting-started-part-2"><span id=
"tutorial2"></span>C++ Tutorial: Getting Started (Part 2)</h1> |
5 <div class="contents local" id="contents" style="display: none"> | 5 <div class="contents local" id="contents" style="display: none"> |
6 <ul class="small-gap"> | 6 <ul class="small-gap"> |
7 <li><a class="reference internal" href="#overview" id="id1">Overview</a></li> | 7 <li><a class="reference internal" href="#overview" id="id1">Overview</a></li> |
8 <li><p class="first"><a class="reference internal" href="#using-the-native-clien
t-sdk-build-system" id="id2">Using the Native Client SDK build system</a></p> | 8 <li><p class="first"><a class="reference internal" href="#using-the-native-clien
t-sdk-build-system" id="id2">Using the Native Client SDK build system</a></p> |
9 <ul class="small-gap"> | 9 <ul class="small-gap"> |
10 <li><a class="reference internal" href="#simplifying-the-makefile" id="id3">Simp
lifying the Makefile</a></li> | 10 <li><a class="reference internal" href="#simplifying-the-makefile" id="id3">Simp
lifying the Makefile</a></li> |
(...skipping 15 matching lines...) Expand all Loading... |
26 </ul> | 26 </ul> |
27 </li> | 27 </li> |
28 <li><a class="reference internal" href="#example-specific-behavior-with-example-
js" id="id13">Example-specific behavior with example.js</a></li> | 28 <li><a class="reference internal" href="#example-specific-behavior-with-example-
js" id="id13">Example-specific behavior with example.js</a></li> |
29 <li><a class="reference internal" href="#compile-the-native-client-module-and-ru
n-the-application-again" id="id14">Compile the Native Client module and run the
application again</a></li> | 29 <li><a class="reference internal" href="#compile-the-native-client-module-and-ru
n-the-application-again" id="id14">Compile the Native Client module and run the
application again</a></li> |
30 </ul> | 30 </ul> |
31 | 31 |
32 </div><h2 id="overview">Overview</h2> | 32 </div><h2 id="overview">Overview</h2> |
33 <p>This tutorial shows how to convert the finished PNaCl web application from | 33 <p>This tutorial shows how to convert the finished PNaCl web application from |
34 <a class="reference internal" href="/native-client/devguide/tutorial/tutorial-pa
rt1.html"><em>Part 1</em></a> to use the Native Client SDK build system and | 34 <a class="reference internal" href="/native-client/devguide/tutorial/tutorial-pa
rt1.html"><em>Part 1</em></a> to use the Native Client SDK build system and |
35 common JavaScript files. It also demonstrates some techniques to make your web | 35 common JavaScript files. It also demonstrates some techniques to make your web |
36 application <a class="reference external" href="/apps/contentSecurityPolicy">Con
tent Security Policy (CSP)-compliant</a>, which is necessary for <a class="refer
ence external" href="/apps/about_apps">Chrome Apps</a>.</p> | 36 application <a class="reference external" href="/apps/contentSecurityPolicy">Con
tent Security Policy (CSP)-compliant</a>, which is necessary for <a class="refer
ence external" href="/apps">Chrome Apps</a>.</p> |
37 <p>Using the Native Client SDK build system makes it easy to build with all of t
he | 37 <p>Using the Native Client SDK build system makes it easy to build with all of t
he |
38 SDK toolchains, and switch between the Debug and Release configurations. It | 38 SDK toolchains, and switch between the Debug and Release configurations. It |
39 also simplifies the makefiles for your project, as we’ll see in the next | 39 also simplifies the makefiles for your project, as we’ll see in the next |
40 section. Finally, it adds some useful commands for <a class="reference internal"
href="/native-client/sdk/examples.html#running-the-sdk-examples"><em>running</e
m></a> and <a class="reference internal" href="/native-client/sdk/examples.html#
debugging-the-sdk-examples"><em>debugging</em></a> | 40 section. Finally, it adds some useful commands for <a class="reference internal"
href="/native-client/sdk/examples.html#running-the-sdk-examples"><em>running</e
m></a> and <a class="reference internal" href="/native-client/sdk/examples.html#
debugging-the-sdk-examples"><em>debugging</em></a> |
41 your application.</p> | 41 your application.</p> |
42 <p>The finished code for this example can be found in the | 42 <p>The finished code for this example can be found in the |
43 <code>pepper_$(VERSION)/getting_started/part2</code> directory in the Native Cli
ent SDK | 43 <code>pepper_$(VERSION)/getting_started/part2</code> directory in the Native Cli
ent SDK |
44 download.</p> | 44 download.</p> |
45 <h2 id="using-the-native-client-sdk-build-system">Using the Native Client SDK bu
ild system</h2> | 45 <h2 id="using-the-native-client-sdk-build-system">Using the Native Client SDK bu
ild system</h2> |
46 <p>This section describes how to use the SDK build system. To do so, we’ll
make | 46 <p>This section describes how to use the SDK build system. To do so, we’ll
make |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 $(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$(LIBS),$(DEPS))) | 195 $(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$(LIBS),$(DEPS))) |
196 endif | 196 endif |
197 </pre> | 197 </pre> |
198 <p>Finally, the NMF rule generates a NaCl manifest file (<code>.nmf</code>) that
references | 198 <p>Finally, the NMF rule generates a NaCl manifest file (<code>.nmf</code>) that
references |
199 each executable generated in the previous step:</p> | 199 each executable generated in the previous step:</p> |
200 <pre class="prettyprint"> | 200 <pre class="prettyprint"> |
201 $(eval $(call NMF_RULE,$(TARGET),)) | 201 $(eval $(call NMF_RULE,$(TARGET),)) |
202 </pre> | 202 </pre> |
203 <h2 id="making-index-html-work-for-chrome-apps">Making index.html work for Chrom
e Apps</h2> | 203 <h2 id="making-index-html-work-for-chrome-apps">Making index.html work for Chrom
e Apps</h2> |
204 <p>This section describes the changes necessary to make the HTML and JavaScript
in | 204 <p>This section describes the changes necessary to make the HTML and JavaScript
in |
205 part1 CSP-compliant. This is required if you want to build a <a class="reference
external" href="/apps/about_apps">Chrome App</a>, but is not necessary if you w
ant to use PNaCl on the open | 205 part1 CSP-compliant. This is required if you want to build a <a class="reference
external" href="/apps">Chrome App</a>, but is not necessary if you want to use
PNaCl on the open web.</p> |
206 web.</p> | |
207 <h3 id="csp-rules">CSP rules</h3> | 206 <h3 id="csp-rules">CSP rules</h3> |
208 <p><a class="reference external" href="/apps/contentSecurityPolicy#what">Chrome
Apps CSP</a> restricts you from doing | 207 <p><a class="reference external" href="/apps/contentSecurityPolicy#what">Chrome
Apps CSP</a> restricts you from doing |
209 the following:</p> | 208 the following:</p> |
210 <ul class="small-gap"> | 209 <ul class="small-gap"> |
211 <li>You can’t use inline scripting in your Chrome App pages. The restriction | 210 <li>You can’t use inline scripting in your Chrome App pages. The restriction |
212 bans both <code><script></code> blocks and event handlers (<code><butto
n onclick="..."></code>).</li> | 211 bans both <code><script></code> blocks and event handlers (<code><butto
n onclick="..."></code>).</li> |
213 <li>You can’t reference any external resources in any of your app files (except | 212 <li>You can’t reference any external resources in any of your app files (except |
214 for video and audio resources). You can’t embed external resources in an | 213 for video and audio resources). You can’t embed external resources in an |
215 iframe.</li> | 214 iframe.</li> |
216 <li>You can’t use string-to-JavaScript methods like <code>eval()</code> and <cod
e>new | 215 <li>You can’t use string-to-JavaScript methods like <code>eval()</code> and <cod
e>new |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 </li> | 433 </li> |
435 <li><p class="first">Re-run the application by reloading <code>http://localhost:
5103/part2</code> in | 434 <li><p class="first">Re-run the application by reloading <code>http://localhost:
5103/part2</code> in |
436 Chrome.</p> | 435 Chrome.</p> |
437 <p>After Chrome loads the Native Client module, you should see the message sent | 436 <p>After Chrome loads the Native Client module, you should see the message sent |
438 from the module.</p> | 437 from the module.</p> |
439 </li> | 438 </li> |
440 </ol> | 439 </ol> |
441 </section> | 440 </section> |
442 | 441 |
443 {{/partials.standard_nacl_article}} | 442 {{/partials.standard_nacl_article}} |
OLD | NEW |