timniederhausen / gn-build

Basic //build directory for use with Chromium's GN
126 stars 71 forks source link
chromium gn

//build directory for GN-based projects

This project provides a work-in-progress standalone version of the toolchains and configs used by the Chromium project.

Supported platforms

The toolchains have been tested on the following platforms:

The testsrc branch contains the test/example project used by the CI tests.

Reference

Basic variables

All variables described here are build args and can be overridden in the user's args.gn file.

//build/config/BUILDCONFIG.gn

(these variables are available everywhere)

//build/toolchain/clang.gni

//build/toolchain/compiler_version.gni

Windows toolchain

//build/toolchain/win/settings.gni

POSIX toolchain

This is the default toolchain for POSIX operating systems, which is used for all POSIX systems that don't have special toolchains.

//build/toolchain/posix/settings.gni

Mac/iOS toolchain

//build/toolchain/mac/settings.gni

//build/toolchain/mac/mac_sdk.gni

//build/toolchain/mac/ios_sdk.gni

Android toolchain

//build/toolchain/android/settings.gni

Recommended workflow

Fork this repo and add it as a submodule/subtree/DEPS-entry to your project. This way you can modify every part of the //build directory while still being able to easily merge upstream changes (e.g. support for new GN features that you don't want to implement yourself.)

To ease sharing/composition of projects using this //build repo, it is recommended that you refrain from modifying large parts of the toolchains/configs. If changes are necessary, consider contributing them back ;)

For more complex projects, it might be feasible to use a custom build-config file that just import()s //build/config/BUILDCONFIG.gn and then overrides the defaults set inside BUILDCONFIG.gn. There's also GN's default_args scope, which can be used to provide project-specific argument overrides.