This project provides a simple and out-of-the-box gn toolchain configuration, to make cross-platform compile easier under the gn+ninja build system.
-
Put all files of this project into 'build' directory in the root of your project. You could import this project in the form of ordinary folder, submuodule, subtree, or though some dependency manager system, as you wish.
-
Create a '.gn' file in the root directory, with content as following:
buildconfig = "//build/BUILDCONFIG.gn"
-
Write your 'BUILD.gn' files for your project, following the rules of gn.
-
Run
gn gen out
andninja -C out
, to build your project.
Please refer to project gn_toolchain_sample.
- Build from source code
- https://gn.googlesource.com/gn
- git://github.com/ninja-build/ninja.git
- Download binaries from official website
- Get from package manager. Try package names as following:
- Mac
- Homebrew: (no gn), ninja
- MacPorts: gn-devel, ninja
- Linux
- apt-get & apt: generate-ninja, ninja-build
- yum & dnf: gn, ninja-build
- pacman: gn, ninja
- Mac