docs: [gn] update build instructions
This commit is contained in:
parent
96c39923b6
commit
e0735baff2
1 changed files with 44 additions and 12 deletions
|
@ -4,15 +4,28 @@ Follow the guidelines below for building Electron with the experimental GN
|
||||||
build.
|
build.
|
||||||
|
|
||||||
> **NOTE**: The GN build system is in _experimental_ status, and currently only
|
> **NOTE**: The GN build system is in _experimental_ status, and currently only
|
||||||
> works on macOS and Linux, in debug mode, as a component build.
|
> works on macOS, Linux and Windows.
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
See the [macOS](build-instructions-osx.md#prerequisites) or
|
Check the build prerequisites for your platform before proceeding
|
||||||
[Linux](build-instructions-linux.md#prerequisites) build instructions for the
|
|
||||||
requirements for your platform. In addition, you'll need to install
|
* [macOS](build-instructions-osx.md#prerequisites)
|
||||||
[`depot_tools`][depot-tools], the toolset used for fetching Chromium and its
|
* [Linux](build-instructions-linux.md#prerequisites)
|
||||||
dependencies.
|
* [Windows](build-instructions-windows.md#prerequisites)
|
||||||
|
|
||||||
|
## Install `depot_tools`
|
||||||
|
|
||||||
|
You'll need to install [`depot_tools`][depot-tools], the toolset
|
||||||
|
used for fetching Chromium and its dependencies.
|
||||||
|
|
||||||
|
Also, on windows open:
|
||||||
|
|
||||||
|
`Control Panel → System and Security → System → Advanced system settings`
|
||||||
|
|
||||||
|
and add a system variable `DEPOT_TOOLS_WIN_TOOLCHAIN` with value `0`.
|
||||||
|
This tells `depot_tools` to use your locally installed
|
||||||
|
version of Visual Studio (by default, `depot_tools` will try to use a google-internal version).
|
||||||
|
|
||||||
[depot-tools]: http://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up
|
[depot-tools]: http://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up
|
||||||
|
|
||||||
|
@ -41,11 +54,26 @@ $ export CHROMIUM_BUILDTOOLS_PATH=`pwd`/buildtools
|
||||||
$ gn gen out/Default --args='import("//electron/build/args/debug.gn")'
|
$ gn gen out/Default --args='import("//electron/build/args/debug.gn")'
|
||||||
```
|
```
|
||||||
|
|
||||||
This will generate all the ninja files needed for the build. You shouldn't have
|
This will generate a build directory `out/Default` under `src/` with
|
||||||
to run `gn gen` again—if you want to change the build arguments you can run `gn
|
debug build configuration. You can replace `Default` with another name,
|
||||||
args out/Default` to bring up an editor.
|
but it should be a subdirectory of `out`. Also, to know the list
|
||||||
|
of available configuration options, run `gn args out/Default --list`.
|
||||||
|
Also you shouldn't have to run `gn gen` again—if you want to change the
|
||||||
|
build arguments, you can run `gn args out/Default` to bring up an editor.
|
||||||
|
|
||||||
To build, run `ninja` with the `electron:electron_app` target:
|
**For generating Debug/Component build config of Electron:**
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ gn gen out/Default --args='import("//electron/build/args/debug.gn")'
|
||||||
|
```
|
||||||
|
|
||||||
|
**For generating Release/Non-Component build config of Electron:**
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ gn gen out/Default --args='import("//electron/build/args/release.gn")'
|
||||||
|
```
|
||||||
|
|
||||||
|
**To build, run `ninja` with the `electron:electron_app` target:**
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ ninja -C out/Default electron:electron_app
|
$ ninja -C out/Default electron:electron_app
|
||||||
|
@ -87,10 +115,14 @@ this document :)
|
||||||
## Tests
|
## Tests
|
||||||
|
|
||||||
To run the tests, you'll first need to build the test modules against the
|
To run the tests, you'll first need to build the test modules against the
|
||||||
same version of Node.js that was built as part of the build process.
|
same version of Node.js that was built as part of the build process. To
|
||||||
|
generate build headers for the modules to compile against, run the following
|
||||||
|
under `src/` directory.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ (cd electron/spec && npm i --nodedir=../../third_party/electron_node)
|
$ ninja -C out/Default electron/build/node:headers
|
||||||
|
# Install the test modules with the generated headers
|
||||||
|
$ (cd electron/spec && npm i --nodedir=../../out/Default/gen/node_headers)
|
||||||
```
|
```
|
||||||
|
|
||||||
Then, run Electron with `electron/spec` as the argument:
|
Then, run Electron with `electron/spec` as the argument:
|
||||||
|
|
Loading…
Reference in a new issue