README.OpenSource
1[
2 {
3 "Name": "gn",
4 "License": "BSD-style License",
5 "License File": "LICENSE",
6 "Version Number": "5e43d016589db2c613c98f9916afd729a36e781a",
7 "Owner": "wangweichao2@huawei.com",
8 "Upstream URL": "https://gn.googlesource.com/gn",
9 "Description": "GN is a meta-build system that generates build files for Ninja."
10 }
11]
12
README.md
1# GN
2
3GN is a meta-build system that generates build files for
4[Ninja](https://ninja-build.org).
5
6Related resources:
7
8 * Documentation in [docs/](https://gn.googlesource.com/gn/+/master/docs/).
9 * An introductory [presentation](https://docs.google.com/presentation/d/15Zwb53JcncHfEwHpnG_PoIbbzQ3GQi_cpujYwbpcbZo/edit?usp=sharing).
10 * The [mailing list](https://groups.google.com/a/chromium.org/forum/#!forum/gn-dev).
11
12## Getting a binary
13
14You can download the latest version of GN binary for
15[Linux](https://chrome-infra-packages.appspot.com/dl/gn/gn/linux-amd64/+/latest),
16[macOS](https://chrome-infra-packages.appspot.com/dl/gn/gn/mac-amd64/+/latest) and
17[Windows](https://chrome-infra-packages.appspot.com/dl/gn/gn/windows-amd64/+/latest).
18
19Alternatively, you can build GN from source:
20
21 git clone https://gn.googlesource.com/gn
22 cd gn
23 python build/gen.py
24 ninja -C out
25 # To run tests:
26 out/gn_unittests
27
28On Windows, it is expected that `cl.exe`, `link.exe`, and `lib.exe` can be found
29in `PATH`, so you'll want to run from a Visual Studio command prompt, or
30similar.
31
32On Linux and Mac, the default compiler is `clang++`, a recent version is
33expected to be found in `PATH`. This can be overridden by setting `CC`, `CXX`,
34and `AR`.
35
36## Examples
37
38There is a simple example in [examples/simple_build](examples/simple_build)
39directory that is a good place to get started with the minimal configuration.
40
41To build and run the simple example with the default gcc compiler:
42
43 cd examples/simple_build
44 ../../out/gn gen -C out
45 ninja -C out
46 ./out/hello
47
48For a maximal configuration see the Chromium setup:
49 * [.gn](https://cs.chromium.org/chromium/src/.gn)
50 * [BUILDCONFIG.gn](https://cs.chromium.org/chromium/src/build/config/BUILDCONFIG.gn)
51 * [Toolchain setup](https://cs.chromium.org/chromium/src/build/toolchain/)
52 * [Compiler setup](https://cs.chromium.org/chromium/src/build/config/compiler/BUILD.gn)
53
54and the Fuchsia setup:
55 * [.gn](https://fuchsia.googlesource.com/fuchsia/+/refs/heads/master/.gn)
56 * [BUILDCONFIG.gn](https://fuchsia.googlesource.com/fuchsia/+/refs/heads/master/build/config/BUILDCONFIG.gn)
57 * [Toolchain setup](https://fuchsia.googlesource.com/fuchsia/+/refs/heads/master/build/toolchain/)
58 * [Compiler setup](https://fuchsia.googlesource.com/fuchsia/+/refs/heads/master/build/config/BUILD.gn)
59
60## Reporting bugs
61
62If you find a bug, you can see if it is known or report it in the [bug
63database](https://bugs.chromium.org/p/gn/issues/list).
64
65## Sending patches
66
67GN uses [Gerrit](https://www.gerritcodereview.com/) for code review. The short
68version of how to patch is:
69
70 Register at https://gn-review.googlesource.com.
71
72 ... edit code ...
73 ninja -C out && out/gn_unittests
74
75Then, to upload a change for review:
76
77 git commit
78 git push origin HEAD:refs/for/master
79
80The first time you do this you'll get an error from the server about a missing
81change-ID. Follow the directions in the error message to install the change-ID
82hook and run `git commit --amend` to apply the hook to the current commit.
83
84When revising a change, use:
85
86 git commit --amend
87 git push origin HEAD:refs/for/master
88
89which will add the new changes to the existing code review, rather than creating
90a new one.
91
92We ask that all contributors
93[sign Google's Contributor License Agreement](https://cla.developers.google.com/)
94(either individual or corporate as appropriate, select 'any other Google
95project').
96
97## Community
98
99You may ask questions and follow along with GN's development on Chromium's
100[gn-dev@](https://groups.google.com/a/chromium.org/forum/#!forum/gn-dev)
101Google Group.
102