From e0735baff26e7a518e7ac1ff038f1571cd1f2ca1 Mon Sep 17 00:00:00 2001 From: deepak1556 Date: Wed, 25 Jul 2018 20:15:52 +0530 Subject: [PATCH] docs: [gn] update build instructions --- docs/development/build-instructions-gn.md | 56 ++++++++++++++++++----- 1 file changed, 44 insertions(+), 12 deletions(-) diff --git a/docs/development/build-instructions-gn.md b/docs/development/build-instructions-gn.md index 7857e57dcc4..d27710e2f48 100644 --- a/docs/development/build-instructions-gn.md +++ b/docs/development/build-instructions-gn.md @@ -4,15 +4,28 @@ Follow the guidelines below for building Electron with the experimental GN build. > **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 -See the [macOS](build-instructions-osx.md#prerequisites) or -[Linux](build-instructions-linux.md#prerequisites) build instructions for the -requirements for your platform. In addition, you'll need to install -[`depot_tools`][depot-tools], the toolset used for fetching Chromium and its -dependencies. +Check the build prerequisites for your platform before proceeding + + * [macOS](build-instructions-osx.md#prerequisites) + * [Linux](build-instructions-linux.md#prerequisites) + * [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 @@ -41,11 +54,26 @@ $ export CHROMIUM_BUILDTOOLS_PATH=`pwd`/buildtools $ 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 -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. +This will generate a build directory `out/Default` under `src/` with +debug build configuration. You can replace `Default` with another name, +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 $ ninja -C out/Default electron:electron_app @@ -87,10 +115,14 @@ this document :) ## Tests 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 -$ (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: