blob: ab049e3a41ddd830730b3f9a2544aadbd9093afa [file] [log] [blame]
Anthony DiGirolamo701489b2023-08-24 01:01:42 +00001.. _docs-root:
2
Armando Montanezae93bc42023-09-07 17:13:57 +00003======================
4Pigweed Sample Project
5======================
6
Anthony DiGirolamo701489b2023-08-24 01:01:42 +00007.. toctree::
Anthony DiGirolamo1682d532024-05-14 17:45:29 +00008 :maxdepth: 1
9 :hidden:
Anthony DiGirolamo701489b2023-08-24 01:01:42 +000010
Anthony DiGirolamo1682d532024-05-14 17:45:29 +000011 Home <self>
12 Examples <examples/docs>
13 Customization <customization>
14 Pigweed Docs <https://pigweed.dev>
15 Mailing List <https://groups.google.com/forum/#!forum/pigweed>
16 Chat Room <https://discord.gg/M9NSeTA>
17 Source Code <https://cs.pigweed.dev/pigweed>
18 Code Reviews <https://pigweed-review.googlesource.com>
19 Issue Tracker <https://issues.pigweed.dev/issues?q=status:open>
Anthony DiGirolamo701489b2023-08-24 01:01:42 +000020
Armando Montanezae93bc42023-09-07 17:13:57 +000021This repository outlines the recommended way of using Pigweed in a new or
22existing project. Feel free to fork this repository, or read it as a reference.
Anthony DiGirolamo701489b2023-08-24 01:01:42 +000023
24For more information see the `Pigweed Getting started
25guide <https://pigweed.dev/docs/getting_started.html>`__.
26
27Check back for more complex examples and features coming soon!
28
Armando Montanezae93bc42023-09-07 17:13:57 +000029---------------
30Getting started
31---------------
32Make sure you've set up `Pigweed's
33prerequisites <https://pigweed.dev/docs/getting_started.html#prerequisites>`__.
Armando Montanez6011ab42023-09-22 00:08:02 +000034
35**If you're on Windows**, you can automate the initial setup by downloading the
36first-time setup script **from cmd.exe**:
37
38.. code-block:: batch
39
Armando Montanez35322972023-09-22 21:45:55 +000040 curl https://pigweed.googlesource.com/pigweed/sample_project/+/main/tools/setup_windows_prerequisites.bat?format=TEXT > setup_pigweed_prerequisites.b64 && certutil -decode -f setup_pigweed_prerequisites.b64 setup_pigweed_prerequisites.bat && del setup_pigweed_prerequisites.b64
Armando Montanez6011ab42023-09-22 00:08:02 +000041
42Then you can run the script with the following command **in cmd.exe**:
43
44.. code-block:: batch
45
46 setup_pigweed_prerequisites.bat
47
48.. note::
49
50 You may see a few UAC prompts as the script installs Git, Python, and
51 enables developer mode.
52
Armando Montaneze969e172023-09-20 22:55:01 +000053Once that is done, you can clone this project with the following command:
Anthony DiGirolamo701489b2023-08-24 01:01:42 +000054
Armando Montanezae93bc42023-09-07 17:13:57 +000055.. code-block:: bash
Anthony DiGirolamo701489b2023-08-24 01:01:42 +000056
Armando Montaneze969e172023-09-20 22:55:01 +000057 git clone https://pigweed.googlesource.com/pigweed/sample_project
Anthony DiGirolamo701489b2023-08-24 01:01:42 +000058
Armando Montanezae93bc42023-09-07 17:13:57 +000059Environment setup
60=================
61Pigweed uses a local development environment for most of its tools. This
62means tools are not installed to your machine, and are instead stored in a
63directory inside your project (Note: git ignores this directory). The tools
64are temporarily added to the PATH of the current shell session.
Anthony DiGirolamo701489b2023-08-24 01:01:42 +000065
Armando Montanezae93bc42023-09-07 17:13:57 +000066To make sure the latest tooling has been fetched and set up, run the bootstrap
67command for your operating system:
Anthony DiGirolamo701489b2023-08-24 01:01:42 +000068
Armando Montanezb34ab3c2024-01-02 21:03:13 +000069.. tab-set::
Anthony DiGirolamo701489b2023-08-24 01:01:42 +000070
Armando Montanezb34ab3c2024-01-02 21:03:13 +000071 .. tab-item:: Linux
72 :sync: linux
Anthony DiGirolamo701489b2023-08-24 01:01:42 +000073
Armando Montanezb34ab3c2024-01-02 21:03:13 +000074 .. code-block:: bash
Anthony DiGirolamo701489b2023-08-24 01:01:42 +000075
Armando Montanezb34ab3c2024-01-02 21:03:13 +000076 source ./bootstrap.sh
Anthony DiGirolamo701489b2023-08-24 01:01:42 +000077
Armando Montanezb34ab3c2024-01-02 21:03:13 +000078 .. tab-item:: macOS
79 :sync: macos
Anthony DiGirolamo701489b2023-08-24 01:01:42 +000080
Armando Montanezb34ab3c2024-01-02 21:03:13 +000081 .. code-block:: bash
82
83 source ./bootstrap.sh
84
85 .. tab-item:: Windows
86 :sync: windows
87
88 .. code-block:: batch
89
90 bootstrap.bat
Anthony DiGirolamo701489b2023-08-24 01:01:42 +000091
Armando Montanezae93bc42023-09-07 17:13:57 +000092After tooling updates, you might need to run bootstrap again to ensure the
93latest tools.
Anthony DiGirolamo701489b2023-08-24 01:01:42 +000094
Armando Montanezae93bc42023-09-07 17:13:57 +000095After the initial bootstrap, you can use use the ``activate`` scripts to
96configure the current shell for development without doing a full update.
Anthony DiGirolamo701489b2023-08-24 01:01:42 +000097
Armando Montanezb34ab3c2024-01-02 21:03:13 +000098.. tab-set::
Anthony DiGirolamo701489b2023-08-24 01:01:42 +000099
Armando Montanezb34ab3c2024-01-02 21:03:13 +0000100 .. tab-item:: Linux
101 :sync: linux
Anthony DiGirolamo701489b2023-08-24 01:01:42 +0000102
Armando Montanezb34ab3c2024-01-02 21:03:13 +0000103 .. code-block:: bash
Anthony DiGirolamo701489b2023-08-24 01:01:42 +0000104
Armando Montanezb34ab3c2024-01-02 21:03:13 +0000105 source ./activate.sh
Anthony DiGirolamo701489b2023-08-24 01:01:42 +0000106
Armando Montanezb34ab3c2024-01-02 21:03:13 +0000107 .. tab-item:: macOS
108 :sync: macos
Anthony DiGirolamo701489b2023-08-24 01:01:42 +0000109
Armando Montanezb34ab3c2024-01-02 21:03:13 +0000110 .. code-block:: bash
111
112 source ./activate.sh
113
114 .. tab-item:: Windows
115 :sync: windows
116
117 .. code-block:: batch
118
119 activate.bat
Anthony DiGirolamo701489b2023-08-24 01:01:42 +0000120
Armando Montanezae93bc42023-09-07 17:13:57 +0000121.. _docs-building:
Anthony DiGirolamo701489b2023-08-24 01:01:42 +0000122
123Building
Armando Montanezae93bc42023-09-07 17:13:57 +0000124========
125All of these commands must be run from inside an activated developer
126environment. See `Environment setup <#environment-setup>`__
Anthony DiGirolamo701489b2023-08-24 01:01:42 +0000127
Armando Montanezae93bc42023-09-07 17:13:57 +0000128One-shot build
129--------------
130To build the project, documentation, and tests, run the following command in
131an activated environment:
Anthony DiGirolamo701489b2023-08-24 01:01:42 +0000132
Armando Montanezae93bc42023-09-07 17:13:57 +0000133.. code-block:: bash
Anthony DiGirolamo701489b2023-08-24 01:01:42 +0000134
Armando Montanez89344ce2023-09-07 21:33:21 +0000135 pw build
Anthony DiGirolamo701489b2023-08-24 01:01:42 +0000136
Armando Montanezae93bc42023-09-07 17:13:57 +0000137Automatically build on file save
138--------------------------------
139Alternatively, if you'd like an automatic rebuild to trigger whenever you save
140changes to files, use ``pw watch``:
Anthony DiGirolamo701489b2023-08-24 01:01:42 +0000141
Armando Montanezae93bc42023-09-07 17:13:57 +0000142.. code-block:: bash
Anthony DiGirolamo701489b2023-08-24 01:01:42 +0000143
Armando Montanezae93bc42023-09-07 17:13:57 +0000144 pw watch
Anthony DiGirolamo701489b2023-08-24 01:01:42 +0000145
Armando Montanezae93bc42023-09-07 17:13:57 +0000146----------------
147Typical workflow
148----------------
149When you pull latest repository changes, run bootstrap:
Anthony DiGirolamo701489b2023-08-24 01:01:42 +0000150
Armando Montanezb34ab3c2024-01-02 21:03:13 +0000151.. tab-set::
Anthony DiGirolamo701489b2023-08-24 01:01:42 +0000152
Armando Montanezb34ab3c2024-01-02 21:03:13 +0000153 .. tab-item:: Linux
154 :sync: linux
155
156 .. code-block:: bash
157
158 source ./bootstrap.sh
159
160 .. tab-item:: macOS
161 :sync: macos
162
163 .. code-block:: bash
164
165 source ./bootstrap.sh
166
167 .. tab-item:: Windows
168 :sync: windows
169
170 .. code-block:: batch
171
172 bootstrap.bat
Anthony DiGirolamo701489b2023-08-24 01:01:42 +0000173
Armando Montanezae93bc42023-09-07 17:13:57 +0000174If you're just launching a new shell session, you can activate instead:
Anthony DiGirolamo701489b2023-08-24 01:01:42 +0000175
Armando Montanezb34ab3c2024-01-02 21:03:13 +0000176.. tab-set::
Anthony DiGirolamo701489b2023-08-24 01:01:42 +0000177
Armando Montanezb34ab3c2024-01-02 21:03:13 +0000178 .. tab-item:: Linux
179 :sync: linux
180
181 .. code-block:: bash
182
183 source ./activate.sh
184
185 .. tab-item:: macOS
186 :sync: macos
187
188 .. code-block:: bash
189
190 source ./activate.sh
191
192 .. tab-item:: Windows
193 :sync: windows
194
195 .. code-block:: batch
196
197 activate.bat
Anthony DiGirolamo701489b2023-08-24 01:01:42 +0000198
Armando Montanezae93bc42023-09-07 17:13:57 +0000199and rebuild with:
Anthony DiGirolamo701489b2023-08-24 01:01:42 +0000200
Armando Montanezae93bc42023-09-07 17:13:57 +0000201.. code-block:: bash
Anthony DiGirolamo701489b2023-08-24 01:01:42 +0000202
Armando Montanez89344ce2023-09-07 21:33:21 +0000203 pw build
Anthony DiGirolamo701489b2023-08-24 01:01:42 +0000204
Armando Montanezae93bc42023-09-07 17:13:57 +0000205----------------------
206More info and Examples
207----------------------
208Check out some introductory examples :ref:`here <examples-root>`!