Revert "Merged all Chromoting Host code into remoting_core.dll (Windows)."
[chromium-blink-merge.git] / native_client_sdk / src / build_tools / generate_index.py
blob5bfe23a861e3ebf304783ca2536b9daea09b7c4c
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 HTML_TOP = '''
6 <!--
7 Copyright (c) 2012 The Chromium Authors. All rights reserved.
8 Use of this source code is governed by a BSD-style license that can be
9 found in the LICENSE file.
10 -->
12 <!DOCTYPE html>
13 <html>
14 <head>
15 <style type="text/css">
16 dt {
17 font-weight: bold;
19 dd {
20 margin-bottom: 12pt;
21 width: 800px;
23 </style>
24 <link href="http://code.google.com/css/codesite.css" rel="stylesheet"
25 type="text/css" />
26 <title>Native Client Examples</title>
27 </head>
28 <body>
29 <h1>Native Client Examples</h1>
30 <dd><p>This page lists all of the examples available in the most recent Native
31 Client SDK bundle. Each example is designed to teach a few specific Native
32 Client programming concepts. You will need to setup the build environment
33 including a path to 'make' which can be found in the 'tools' directory for
34 Windows, and the variable NACL_SDK_ROOT which points to one of the pepper
35 bundles found under the SDK install location. Calling make from the examples
36 directory will build all the projects, while calling make from an individual
37 example directory will build only that example.
38 </p></dd>
39 '''
41 HTML_END = '''
42 </body>
43 </html>
44 '''
46 SECTIONS = {
47 'API': """
48 <h3>Common APIs</h3>
49 <dd><p>The following set of examples illustrate various Pepper APIs including
50 audio, 2D, 3D, file I/O, input and urls.</p></dd>
51 """,
52 'Concepts': """
53 <h3>Common Concepts</h3>
54 <dd><p>The following set of examples illustrate various common concepts such as
55 showing load progress, using Shared Objects (dynamic libraries),
56 mulithreading...</p></dd>
57 """,
58 'Tools': """
59 <h3>Using the Tools</h3>
60 <dd><p>The following "hello_world" examples, show the basic outline of a
61 several types of Native Client applications. The simplest, "Hello World Stdio"
62 uses several provided libraries to simplify startup and provides a
63 simplified make showing a single build configuration. The other examples in
64 this SDK however, are designed to build and run with multiple toolsets, build
65 configurations, etc...
66 making the build much more complex. In all cases we are using <a
67 href="http://www.gnu.org/software/make/manual/make.html">GNU Make</a>.
68 See the link for further information.
69 </p></dd>
70 """,
74 class LandingPage(object):
75 def __init__(self):
76 self.section_list = ['Tools', 'API', 'Concepts']
77 self.section_map = {}
78 for section in self.section_list:
79 self.section_map[section] = []
81 def _ExampleDescription(self, index_path, title, details, focus):
82 return '''
83 <dt><a href="%s/index.html">%s</a></dt>
84 <dd>%s
85 <p>Teaching focus: %s</p>
86 </dd>
87 ''' % (index_path, title, details, focus)
89 def _GenerateSection(self, section):
90 out = SECTIONS[section]
91 for desc in self.section_map[section]:
92 index_path = desc['NAME']
93 title = desc['TITLE']
94 details = desc['DESC']
95 focus = desc['FOCUS']
96 out += self._ExampleDescription(index_path, title, details, focus)
97 return out
99 def GeneratePage(self):
100 out = HTML_TOP
101 for section in self.section_list:
102 out += self._GenerateSection(section)
103 out += HTML_END
104 return out
106 def AddDesc(self, desc):
107 group = desc['GROUP']
108 assert group in self.section_list
109 self.section_map[group].append(desc)