Clone this repo:

Branches

  1. 289842f [protobuf] Support link_public_deps in GN by Clayton Wilkinson · 3 weeks ago main master
  2. bb28110 [protobuf] Suppress -Wcall-graph-section-no-prototype by prabhukr · 5 weeks ago
  3. 0180f64 [build] Allow //src/diagnostics/* in protoc visibility by Kiet Tran · 6 weeks ago
  4. 6486fcc [build] Make license rules conditional on is_fuchsia_tree by Anivia Li · 4 months ago
  5. 6cb190d [docs] Remove step 2 from README uprev instructions by Anivia Li · 4 months ago

Protocol Buffers GN Build Support

This repository contains GN build system support for Protocol Buffers. It's in its own repository because it needs to be shared by Fuchsia and Cobalt.

This repo should be checked out such that:

  • It is in //build/secondary/third_party/protobuf.
  • Protobuf is in //third_party/protobuf/src.
  • //.gn contains secondary_source = "//build/secondary/"

See the GN documentation on secondary_source.

Updating Build Files

WARNING: DO NOT MODIFY THE BUILD.gn FILE DIRECTLY!

The BUILD.gn file in this directory is generated automatically. Any manual changes will be overwritten.

To make changes to the build configuration:

  1. Edit the BUILD.input.gn file to suit your needs, for example managing visibility, suppressing warnings, etc.
  2. Run the gen.py script located in this directory to regenerate the BUILD.gn file:
    ./gen.py [commit_hash]
    
    If no commit hash is specified, it defaults to HEAD of //third_party/protobuf/src.
  3. Commit both the updated BUILD.input.gn and the newly generated BUILD.gn file.

Failing to modify BUILD.input.gn will result in your changes being lost the next time the build file is regenerated.