chromium/native_client_sdk/src/doc/io2014.rst

.. _io2014:

.. include:: /migration/deprecation.inc

###################
Building a NaCl App
###################

In the browser!
---------------

Follow along with Brad Nelson's Google I/O 2014 talk.
Explore our new in-browser development environment and debugger.

Learn how easy it is to edit, build, and debug NaCl application
all in your desktop web browser or on a Chromebook.
Work either on-line or off-line!

.. raw:: html

  <iframe class="video" width="500" height="281"
  src="//www.youtube.com/embed/OzNuzBDEWzk?rel=0" frameborder="0"></iframe>

.. raw:: html

  <div><b><font color="#880000" style="font-size: 120%">
  NOTE: The NaCl Development Environment has changed since this video was made.
  The instructions below no longer match the video.
  </font></b></div>
  
.. include:: nacldev/web_tools_note.inc

Installation
============

The setup process currently requires several steps.
We're working to reduce the number of steps in future releases.
As the process gets easier, we'll update this page.

To install the development environment:

  * Install the `NaCl Development Environment <https://chrome.google.com/webstore/detail/nacl-development-environm/aljpgkjeipgnmdpikaajmnepbcfkglfa>`_.

  * Navigate to: chrome://flags and:

    * Enable **Native Client**.
    * Restart your browser by clicking **Relaunch Now**.

  * First run is slow (as it downloads and installs packages). Launch and allow
    initial install to complete before first use.

.. include:: nacldev/editing.inc

.. include:: nacldev/git.inc


Tour (follow the video)
=======================

Create a working directory and go into it::

  $ mkdir work
  $ cd work

Download a zip file containing our sample::

  $ curl https://nacltools.storage.googleapis.com/io2014/voronoi.zip -O
  $ ls -l

Unzip the sample::

  $ unzip voronoi.zip

Go into the sample and take a look at the files inside::

  $ cd voronoi
  $ ls

Our project combines voronoi.cc with several C++ libraries to produce a NEXE
(or Native Client Executable).

.. image:: /images/voronoi1.png

Let's use git (a revision control program) to track our changes.

First, create a new repository::

  $ git init

Add everything here::

  $ git add .

Then commit our starting state::

  $ git commit -m "imported voronoi demo"

Now, run **make voronoi** to compile and run our program (NOTE: Changed since
video, we've got Makefiles!)::

  $ make voronoi


Thanks
======

Thanks for checking out our environment.
Things are rapidly changing and in the coming months you can expect to see
further improvements and filling out of our platform and library support.

Follow the status of the NaCl Dev Environment at :doc:`this page <nacldev>`.