Move examples to toplevel, document better. Add links to Chromium and Fuchsia files. Change-Id: I1a2526e9793989647b1b239f40807e869e59c5c2 Reviewed-on: https://gn-review.googlesource.com/c/gn/+/5520 Reviewed-by: Scott Graham <scottmg@chromium.org> Commit-Queue: Brett Wilson <brettw@chromium.org>
diff --git a/README.md b/README.md index a370e00..8ac7837 100644 --- a/README.md +++ b/README.md
@@ -5,7 +5,7 @@ [docs/](https://gn.googlesource.com/gn/+/master/docs/) and [a presentation on it](https://docs.google.com/presentation/d/15Zwb53JcncHfEwHpnG_PoIbbzQ3GQi_cpujYwbpcbZo/edit?usp=sharing). -## Getting started +## Getting a binary You can download the latest version of GN binary for [Linux](https://chrome-infra-packages.appspot.com/dl/gn/gn/linux-amd64/+/latest), @@ -29,6 +29,23 @@ expected to be found in `PATH`. This can be overridden by setting `CC`, `CXX`, and `AR`. +## Examples + +There is a simple example in [examples/simple_build](examples/simple_build) +directory that is a good place to get started with the minimal configuration. + +For a maximal configuration see the Chromium setup: + * [.gn](https://cs.chromium.org/chromium/src/.gn) + * [BUILDCONFIG.gn](https://cs.chromium.org/chromium/src/build/config/BUILDCONFIG.gn) + * [Toolchain setup](https://cs.chromium.org/chromium/src/build/toolchain/) + * [Compiler setup](https://cs.chromium.org/chromium/src/build/config/compiler/BUILD.gn) + +and the Fuchsia setup: + * [.gn](https://fuchsia.googlesource.com/fuchsia/+/refs/heads/master/.gn) + * [BUILDCONFIG.gn](https://fuchsia.googlesource.com/fuchsia/+/refs/heads/master/build/config/BUILDCONFIG.gn) + * [Toolchain setup](https://fuchsia.googlesource.com/fuchsia/+/refs/heads/master/build/toolchain/) + * [Compiler setup](https://fuchsia.googlesource.com/fuchsia/+/refs/heads/master/build/config/BUILD.gn) + ## Reporting bugs If you find a bug, you can see if it is known or report it in the [bug @@ -64,6 +81,6 @@ ## Community -You may ask questions and follow along w/ GN's development on Chromium's +You may ask questions and follow along with GN's development on Chromium's [gn-dev@](https://groups.google.com/a/chromium.org/forum/#!forum/gn-dev) Google Group.
diff --git a/tools/gn/example/.gn b/examples/simple_build/.gn similarity index 100% rename from tools/gn/example/.gn rename to examples/simple_build/.gn
diff --git a/tools/gn/example/BUILD.gn b/examples/simple_build/BUILD.gn similarity index 100% rename from tools/gn/example/BUILD.gn rename to examples/simple_build/BUILD.gn
diff --git a/examples/simple_build/README.md b/examples/simple_build/README.md new file mode 100644 index 0000000..78b3917 --- /dev/null +++ b/examples/simple_build/README.md
@@ -0,0 +1,12 @@ +# GN Simple Build Example + +This is an example directory structure that compiles some simple targets using +gcc. It is intended to show how to set up a simple GN build. It is deliberately +simplistic so the structure is more clear, and doesn't support everything on +every platform. + +It is recommended that you take this and add on as your requirements indicate. +You may also want to see the Chromium and Fuchsia build configurations for the +maximal functionality (the [root README](../../README.md) has links to these). + +Don't miss the ".gn" file in this directory which may be hidden on your system!
diff --git a/tools/gn/example/build/BUILD.gn b/examples/simple_build/build/BUILD.gn similarity index 100% rename from tools/gn/example/build/BUILD.gn rename to examples/simple_build/build/BUILD.gn
diff --git a/tools/gn/example/build/BUILDCONFIG.gn b/examples/simple_build/build/BUILDCONFIG.gn similarity index 100% rename from tools/gn/example/build/BUILDCONFIG.gn rename to examples/simple_build/build/BUILDCONFIG.gn
diff --git a/tools/gn/example/build/toolchain/BUILD.gn b/examples/simple_build/build/toolchain/BUILD.gn similarity index 100% rename from tools/gn/example/build/toolchain/BUILD.gn rename to examples/simple_build/build/toolchain/BUILD.gn
diff --git a/tools/gn/example/hello.cc b/examples/simple_build/hello.cc similarity index 100% rename from tools/gn/example/hello.cc rename to examples/simple_build/hello.cc
diff --git a/tools/gn/example/hello_shared.cc b/examples/simple_build/hello_shared.cc similarity index 100% rename from tools/gn/example/hello_shared.cc rename to examples/simple_build/hello_shared.cc
diff --git a/tools/gn/example/hello_shared.h b/examples/simple_build/hello_shared.h similarity index 100% rename from tools/gn/example/hello_shared.h rename to examples/simple_build/hello_shared.h
diff --git a/tools/gn/example/hello_static.cc b/examples/simple_build/hello_static.cc similarity index 100% rename from tools/gn/example/hello_static.cc rename to examples/simple_build/hello_static.cc
diff --git a/tools/gn/example/hello_static.h b/examples/simple_build/hello_static.h similarity index 100% rename from tools/gn/example/hello_static.h rename to examples/simple_build/hello_static.h
diff --git a/tools/gn/example/README.txt b/tools/gn/example/README.txt deleted file mode 100644 index d0ddeed..0000000 --- a/tools/gn/example/README.txt +++ /dev/null
@@ -1,4 +0,0 @@ -This is an example directory structure that compiles some simple targets using -gcc. It is intended to show how to set up a simple GN build. - -Don't miss the ".gn" file in this directory!