OLD | NEW |
1 .. _tutorial2: | 1 .. _tutorial2: |
2 | 2 |
3 ###################################### | 3 ###################################### |
4 C++ Tutorial: Getting Started (Part 2) | 4 C++ Tutorial: Getting Started (Part 2) |
5 ###################################### | 5 ###################################### |
6 | 6 |
7 .. contents:: | 7 .. contents:: |
8 :local: | 8 :local: |
9 :backlinks: none | 9 :backlinks: none |
10 :depth: 2 | 10 :depth: 2 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 simple, but if we want to add support for multiple toolchains, configurations, | 45 simple, but if we want to add support for multiple toolchains, configurations, |
46 source files, or build steps, it would grow increasingly complex. The SDK build | 46 source files, or build steps, it would grow increasingly complex. The SDK build |
47 system uses a set of variables and macros to make this possible, without | 47 system uses a set of variables and macros to make this possible, without |
48 significantly increasing the complexity of the makefile. | 48 significantly increasing the complexity of the makefile. |
49 | 49 |
50 Here is the new makefile, supporting three toolchains (PNaCl, Newlib NaCl, | 50 Here is the new makefile, supporting three toolchains (PNaCl, Newlib NaCl, |
51 Glibc NaCl) and two configurations (Debug, Release). | 51 Glibc NaCl) and two configurations (Debug, Release). |
52 | 52 |
53 .. naclcode:: | 53 .. naclcode:: |
54 | 54 |
55 VALID_TOOLCHAINS := pnacl newlib glibc | 55 VALID_TOOLCHAINS := pnacl clang-newlib glibc |
56 | 56 |
57 NACL_SDK_ROOT ?= $(abspath $(CURDIR)/../..) | 57 NACL_SDK_ROOT ?= $(abspath $(CURDIR)/../..) |
58 include $(NACL_SDK_ROOT)/tools/common.mk | 58 include $(NACL_SDK_ROOT)/tools/common.mk |
59 | 59 |
60 TARGET = part2 | 60 TARGET = part2 |
61 LIBS = ppapi_cpp ppapi | 61 LIBS = ppapi_cpp ppapi |
62 | 62 |
63 CFLAGS = -Wall | 63 CFLAGS = -Wall |
64 SOURCES = hello_tutorial.cc | 64 SOURCES = hello_tutorial.cc |
65 | 65 |
(...skipping 15 matching lines...) Expand all Loading... |
81 Choosing valid toolchains, and including common.mk | 81 Choosing valid toolchains, and including common.mk |
82 -------------------------------------------------- | 82 -------------------------------------------------- |
83 | 83 |
84 The makefile begins by specifying the toolchains that are valid for this | 84 The makefile begins by specifying the toolchains that are valid for this |
85 project. The Native Client SDK build system supports multi-toolchain projects | 85 project. The Native Client SDK build system supports multi-toolchain projects |
86 for its examples and libraries, but generally you will choose one toolchain | 86 for its examples and libraries, but generally you will choose one toolchain |
87 when you begin your project and never change it. Please see the | 87 when you begin your project and never change it. Please see the |
88 :ref:`Toolchains section of the Native Client overview <toolchains>` for more | 88 :ref:`Toolchains section of the Native Client overview <toolchains>` for more |
89 information. | 89 information. |
90 | 90 |
91 For this example, we support the ``pnacl``, ``newlib`` and ``glibc`` toolchains. | 91 For this example, we support the ``pnacl``, ``clang-newlib`` and ``glibc`` |
| 92 toolchains. |
92 | 93 |
93 .. naclcode:: | 94 .. naclcode:: |
94 | 95 |
95 VALID_TOOLCHAINS := pnacl newlib glibc | 96 VALID_TOOLCHAINS := pnacl clang-newlib glibc |
96 | 97 |
97 Next, as a convenience, we specify where to find ``NACL_SDK_ROOT``. Because | 98 Next, as a convenience, we specify where to find ``NACL_SDK_ROOT``. Because |
98 this example is located in ``pepper_$(VERSION)/getting_started/part2``, the | 99 this example is located in ``pepper_$(VERSION)/getting_started/part2``, the |
99 root of the SDK is two directories up. | 100 root of the SDK is two directories up. |
100 | 101 |
101 .. naclcode:: | 102 .. naclcode:: |
102 | 103 |
103 NACL_SDK_ROOT ?= $(abspath $(CURDIR)/../..) | 104 NACL_SDK_ROOT ?= $(abspath $(CURDIR)/../..) |
104 | 105 |
105 .. Note:: | 106 .. Note:: |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 CSP-compliance, but help make the SDK examples more generic. | 284 CSP-compliance, but help make the SDK examples more generic. |
284 | 285 |
285 First, we add some `data attributes | 286 First, we add some `data attributes |
286 <https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Using_data_attributes>`
_ | 287 <https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Using_data_attributes>`
_ |
287 to the body element to specify the name, supported toolchains, supported | 288 to the body element to specify the name, supported toolchains, supported |
288 configurations, and path to the ``.nmf`` file: | 289 configurations, and path to the ``.nmf`` file: |
289 | 290 |
290 .. naclcode:: | 291 .. naclcode:: |
291 | 292 |
292 <body data-name="part2" | 293 <body data-name="part2" |
293 data-tools="newlib glibc pnacl" | 294 data-tools="clang-newlib glibc pnacl" |
294 data-configs="Debug Release" | 295 data-configs="Debug Release" |
295 data-path="{tc}/{config}"> | 296 data-path="{tc}/{config}"> |
296 ... | 297 ... |
297 | 298 |
298 ``common.js`` will read these data attributes to allow you to load the same | 299 ``common.js`` will read these data attributes to allow you to load the same |
299 example with different toolchains by changing the URL's `query string | 300 example with different toolchains by changing the URL's `query string |
300 <http://en.wikipedia.org/wiki/Query_string>`_. For example, you can load the | 301 <http://en.wikipedia.org/wiki/Query_string>`_. For example, you can load the |
301 glibc Debug version of this example by navigating to | 302 glibc Debug version of this example by navigating to |
302 ``index.html?tc=glibc&config=Debug``. Path URI's such as ``../``, for example | 303 ``index.html?tc=glibc&config=Debug``. Path URI's such as ``../``, for example |
303 do not work for either the data-path parameter or its corresponding query | 304 do not work for either the data-path parameter or its corresponding query |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 Compile the Native Client module and run the application again | 501 Compile the Native Client module and run the application again |
501 ============================================================== | 502 ============================================================== |
502 | 503 |
503 #. Compile the Native Client module by running the ``make`` command again. | 504 #. Compile the Native Client module by running the ``make`` command again. |
504 #. Start the SDK web server by running ``make server``. | 505 #. Start the SDK web server by running ``make server``. |
505 #. Re-run the application by reloading ``http://localhost:5103/part2`` in | 506 #. Re-run the application by reloading ``http://localhost:5103/part2`` in |
506 Chrome. | 507 Chrome. |
507 | 508 |
508 After Chrome loads the Native Client module, you should see the message sent | 509 After Chrome loads the Native Client module, you should see the message sent |
509 from the module. | 510 from the module. |
OLD | NEW |