Lines Matching full:gn

4 Pigweed's GN Python Build
9 - :bdg-ref-primary-line:`module-pw_build` for other GN templates available
14 Pigweed uses a custom GN-based build system to manage its Python code. The
20 Pigweed's Python code is exclusively managed by GN, but the GN-based build may
22 setup uses GN to set up the initial Python environment, regardless of the final
23 build system. As needed, non-GN projects can declare just their Python packages
24 in GN.
28 In addition to compiler commands a Pigweed GN build will execute Python scripts
31 :ref:`module-pw_build-pw_python_action` GN template which will ultimately run
39 When a Pigweed GN build starts a single venv is created for use by all
56 out[GN Build Dir<br/>fa:fa-folder out]
85 … <https://cs.opensource.google/pigweed/pigweed/+/main:pw_env_setup/BUILD.gn?q=pigweed_build_venv>`_
87 :bdg-ref-primary-line:`docs-python-build-python-gn-venv` on how to define
96 provided. Having that Python dependency defined in GN allows the
103 .. admonition:: Benefits of Python ``venvs`` in GN
106 - Using venvs to execute Python in GN provides reproducible builds with fixed
115 .. _docs-python-build-python-gn-venv:
119 Pigweed's GN Python build infrastructure relies on `Python virtual environments
125 There must be at least one venv for Python defined in GN. There can be multiple
128 The default build venv is specified via a GN arg and is best set in the root
129 ``.gn`` or ``BUILD.gn`` file. For example:
142 .. _docs-python-build-python-gn-requirements-files:
147 the bootstrapped environment and in the GN build venv. There are two main ways
157 to the ``pw_build_PIP_REQUIREMENTS`` GN arg list.
165 The GN arg can be set in your project's root ``.gn`` or ``BUILD.gn`` file.
174 See the :ref:`docs-python-build-python-gn-structure` section below for a full
184 from the ``pw_env_setup`` module from in your top level ``.gn`` file. Additonal
197 via the ``pw_build_PIP_CONSTRAINTS`` and ``pw_build_PIP_REQUIREMENTS`` GN args
205 GN targets expected to be used within the venv. When the venv is created each
222 .. literalinclude:: pw_build/py/gn_tests/BUILD.gn
342 To build that one gn target with ninja, pass the output name from gn as a target
347 gn gen out
349 $(gn ls out --as=output \
400 platforms all at once by setting a GN arg:
440 GN Args
442 Setting these args in the ``//.gn`` file will add the relevant pip command line
499 .. _docs-python-build-python-gn-structure:
501 GN File Structure for Python Code
504 Pigweed's GN build system. A brief file hierarchy is shown here with file
509 :caption: :octicon:`file-directory;1em` Top level GN file hierarchy
510 :name: gn-python-file-tree
513 ├── .gn
514 ├── BUILDCONFIG.gn
517 ├── BUILD.gn
520 │ ├── BUILD.gn
542 - :octicon:`file;1em` .gn
546 buildconfig = "//BUILDCONFIG.gn"
563 # Default gn build virtualenv target.
569 There are some additional gn args to control how pip installations are
573 :start-after: [default-pip-gn-args]
574 :end-before: [default-pip-gn-args]
576 - :octicon:`file;1em` BUILDCONFIG.gn
598 - :octicon:`file;1em` BUILD.gn
641 # The default venv for Python actions in GN
642 # Set this gn arg in a declare_args block in this file 'BUILD.gn' or in '.gn' to
695 │ ├── BUILD.gn
709 The ``BUILD.gn`` declares this package in GN. For upstream Pigweed, a presubmit
710 check in ensures that all Python files are listed in a ``BUILD.gn``.
738 A ``pw_python_package`` represents a Python package as a GN target. It is
739 implemented with a GN template. The ``pw_python_package`` template is documented
749 A ``pw_python_package`` target is composed of several GN subtargets. Each
790 The default set of analysis tools to run can be set globally via a GN arg
816 generated wheel with `GN metadata
817 <https://gn.googlesource.com/gn/+/HEAD/docs/reference.md#var_metadata>`_.
824 The Pigweed GN build supports protocol buffers with the ``pw_proto_library``
833 The ``pw_python_package`` target in the ``BUILD.gn`` duplicates much of the
982 Pigweed uses GN as its primary build system for all languages. While GN does not
983 natively support Python, adding support is straightforward with GN templates.
985 GN has strong multi-toolchain and multi-language capabilities. In GN, it is
988 declaration. When using GN for multiple languages, Ninja schedules build steps
991 Not all Pigweed users build with GN. Of Pigweed's three supported build systems,
992 GN is the fastest, lightest weight, and easiest to run. It also has simple,
993 clean syntax. This makes it feasible to use GN only for Python while building
996 Given these considerations, GN is an ideal choice for Pigweed's Python build.