<commit_before>---
layout: default
title: Development
permalink: /native-code/development/
---


{% include toc-hide.html %}


The currently supported platforms are Windows, Mac OS X, Linux, Android and
iOS. See the [Android][1] and [iOS][2] pages for build instructions and
example applications specific to these mobile platforms.


### Before You Start

First, be sure to install the [prerequisite software][3].


### Getting the Code

For desktop development:

  1. Create a working directory, enter it, and run `fetch webrtc`:

     ~~~~~ bash
     mkdir webrtc-checkout
     cd webrtc-checkout
     fetch --nohooks webrtc
     gclient sync
     ~~~~~

     NOTICE: Due to [bug 5578][12] you may have to press 'y' to accept a license
     dialog for downloading Google Play Services SDK.

     The dowload will **take a long time** because it downloads the whole
     Chromium repository and dependencies, which are several gigabytes.
     **Do not** interrupt this step or you may need to start all over agan (a
     new `gclient sync` may be enough, but you might also need to start over
     cleanly).

  2. Optionally you can specify how new branches should be tracked:

     ~~~~~ bash
     git config branch.autosetupmerge always
     git config branch.autosetuprebase always
     ~~~~~

  3. Alternatively, you can create new local branches like this (recommended):

     ~~~~~ bash
     cd src
     git checkout master
     git new-branch your-branch-name
     ~~~~~

See [Android][1] and [iOS][2] pages for separate instructions.



### Updating the Code

Update your current branch with:

~~~~~ bash
git pull
~~~~~

**Notice:** if you're not on a branch, `git pull` won't work, and you'll need
to use `git fetch` instead.

Periodically, the build toolchain and dependencies of WebRTC are updated. To
get such updates you must run:

~~~~~ bash
gclient sync
~~~~~


### Building

[Ninja][6] is the default build system for all platforms.

See [Android][1] and [iOS][2] for build instructions specific to those
platforms.


#### Generating Ninja project files

**NOTICE:** We're in the middle of migrating from [GYP][4] to [GN][13] for
generating project files. Currently Linux, Android and Mac are switched to GN on
our bots. For Android, check
[this page]({{ site.baseurl }}/native-code/android/) for details on how to
build for that platform. For Mac, see the GN section below.

##### Using GYP

With [GYP][4], [Ninja][6] project files are generated by [GYP][4] in `out/Debug`
and `out/Release` by default. To (re-)generate the ninja files, run:

~~~~~ bash
python webrtc/build/gyp_webrtc.py
~~~~~

##### Using GN

With [GN][13], [Ninja][6] project files are generated by in a directory of your
choice. It can be `out/Debug` or `out/Release` but you can pick any directory
you like.

To generate project files using the defaults (Debug build), run:

~~~~~ bash
gn gen out/Default
~~~~~

To generate ninja project files for a Release build instead:

~~~~~ bash
gn gen out/Default --args='is_debug=false'
~~~~~

See the [GN][13] documentation for all available options.


#### Compiling

When you have Ninja project files generated (see previous section), compile
(standing in `src/`) using:

For default GYP ninja generated files (Debug/Release):

~~~~~ bash
ninja -C out/Debug
~~~~~
<commit_msg>Update build instructions after Windows GN switch<commit_after>---
layout: default
title: Development
permalink: /native-code/development/
---


{% include toc-hide.html %}


The currently supported platforms are Windows, Mac OS X, Linux, Android and
iOS. See the [Android][1] and [iOS][2] pages for build instructions and
example applications specific to these mobile platforms.


### Before You Start

First, be sure to install the [prerequisite software][3].


### Getting the Code

For desktop development:

  1. Create a working directory, enter it, and run `fetch webrtc`:

     ~~~~~ bash
     mkdir webrtc-checkout
     cd webrtc-checkout
     fetch --nohooks webrtc
     gclient sync
     ~~~~~

     NOTICE: Due to [bug 5578][12] you may have to press 'y' to accept a license
     dialog for downloading Google Play Services SDK.

     The dowload will **take a long time** because it downloads the whole
     Chromium repository and dependencies, which are several gigabytes.
     **Do not** interrupt this step or you may need to start all over agan (a
     new `gclient sync` may be enough, but you might also need to start over
     cleanly).

  2. Optionally you can specify how new branches should be tracked:

     ~~~~~ bash
     git config branch.autosetupmerge always
     git config branch.autosetuprebase always
     ~~~~~

  3. Alternatively, you can create new local branches like this (recommended):

     ~~~~~ bash
     cd src
     git checkout master
     git new-branch your-branch-name
     ~~~~~

See [Android][1] and [iOS][2] pages for separate instructions.



### Updating the Code

Update your current branch with:

~~~~~ bash
git pull
~~~~~

**Notice:** if you're not on a branch, `git pull` won't work, and you'll need
to use `git fetch` instead.

Periodically, the build toolchain and dependencies of WebRTC are updated. To
get such updates you must run:

~~~~~ bash
gclient sync
~~~~~


### Building

[Ninja][6] is the default build system for all platforms.

See [Android][1] and [iOS][2] for build instructions specific to those
platforms.


#### Generating Ninja project files

**NOTICE:** We're currently migrating from [GYP][4] to [GN][13] for
generating project files. Currently all platforms except iOS are switched to GN
on our bots. With this, only the production code is maintained for a short
period pf time (set `include_tests=0 include_examples=0` in `GYP_DEFINES`).
For Android GN instructions, check
[the Android page]({{ site.baseurl }}/native-code/android/).

##### Using GN

With [GN][13], [Ninja][6] project files are generated by in a directory of your
choice. It can be `out/Debug` or `out/Release` but you can pick any directory
you like.

To generate project files using the defaults (Debug build), run:

~~~~~ bash
gn gen out/Default
~~~~~

To generate ninja project files for a Release build instead:

~~~~~ bash
gn gen out/Default --args='is_debug=false'
~~~~~

See the [GN][13] documentation for all available options.


##### Using GYP (deprecated)

With [GYP][4], [Ninja][6] project files are generated by [GYP][4] in `out/Debug`
and `out/Release` by default. To (re-)generate the ninja files, run:

~~~~~ bash
python webrtc/build/gyp_webrtc.py
~~~~~


#### Compiling

When you have Ninja project files generated (see previous section), compile
(standing in `src/`) using:

For default GYP ninja generated files (Debug/Release):

~~~~~ bash
ninja -C out/Debug
~~~~~

{'fraction_non_alphanumeric': 0.10870532403974492, 'fraction_numerical': 0.008601512679816105, 'mean_word_length': 3.776203966005666, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3200662', 'n_tokens_mistral': 2057, 'n_tokens_neox': 1921, 'n_words': 894}