Skip to content

Commit 04b5da3

Browse files
committed
Add more detailed build instructions to the Contribution Guide
Resolve #582 by adding more detailed instructions on using the `generate` target.
1 parent 764ecf2 commit 04b5da3

File tree

2 files changed

+69
-7
lines changed

2 files changed

+69
-7
lines changed

README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,19 @@ Tools can be acquired via instructions in [third_party](/third_party/README.md).
7272

7373
## Building
7474

75+
The requirements and instructions below are for building the project from source
76+
without any modifications. To make modifications to the specification, please
77+
see the
78+
[Contribution Guide](https://oneapi-src.github.io/unified-runtime/core/CONTRIB.html)
79+
for more detailed instructions on the correct setup.
80+
7581
### Requirements
7682

7783
Required packages:
7884
- C++ compiler with C++17 support
7985
- [CMake](https://cmake.org/) >= 3.14.0
8086
- Python v3.6.6 or later
8187

82-
For development and contributions:
83-
- clang-format-15.0 (can be installed with `python -m pip install clang-format==15.0.7`)
84-
8588
### Windows
8689

8790
Generating Visual Studio Project. EXE and binaries will be in **build/bin/{build_config}**
@@ -137,6 +140,10 @@ It will generate the source code **and** run automated code formatting:
137140
$ make generate
138141
```
139142

143+
This target has additional dependencies which are described in the *Build
144+
Environment* section of the
145+
[Contribution Guide](https://oneapi-src.github.io/unified-runtime/core/CONTRIB.html).
146+
140147
## Contributions
141148

142149
For those who intend to make a contribution to the project please read our

scripts/core/CONTRIB.rst

Lines changed: 59 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,72 @@ accepted into the project.
3939
Runtime team via the `GitHub issue tracker
4040
<https://github.com/oneapi-src/unified-runtime/issues/new>`_.
4141

42+
Build Environment
43+
=================
44+
45+
To be able to generate the source from the YAML files, the build environment
46+
must be configured correctly and all dependencies must be installed. The
47+
instructions for a basic setup are available in the `README
48+
<https://github.com/oneapi-src/unified-runtime/blob/main/README.md#building>`_.
49+
50+
The following additional dependencies are required to support the ``generate``
51+
target:
52+
53+
* Doxygen (>= 1.8)
54+
55+
* The Python script requirements listed in `thirdparty/requirements.txt`_
56+
57+
Doxygen can be installed via your system's package manager, e.g. on Ubuntu
58+
``sudo apt install doxygen``, or by downloading it from the Doxygen website. It
59+
must be available on the current ``PATH`` when the script is run.
60+
61+
One way to install the requirements for the script is using a Python virtual
62+
environment. This can be set up by running the following commands from the
63+
project root:
64+
65+
.. code-block:: console
66+
67+
$ python3 -m venv .local
68+
$ source .local/bin/activate
69+
$ pip install -r third_party/requirements.txt
70+
71+
The virtual environment can be subsequently reactivated before any builds
72+
without needing to reinstall the requirements:
73+
74+
.. code-block:: console
75+
76+
$ source .local/bin/activate
77+
78+
Alternatively, a Docker container can be used instead of a virtual environment.
79+
Instructions on building and using a Docker image can be found in
80+
`.github/docker`_
81+
82+
You *must* also enable the ``UR_FORMAT_CPP_STYLE`` CMake option to allow
83+
formatting of the generated code, or the ``generate`` target will not be
84+
available.
85+
86+
.. code-block:: console
87+
88+
$ cmake build/ -DUR_FORMAT_CPP_STYLE=ON
89+
90+
You can then follow the instructions below to use the ``generate`` target to
91+
regenerate the source.
92+
93+
.. _thirdparty/requirements.txt:
94+
https://github.com/oneapi-src/unified-runtime/blob/main/third_party/requirements.txt
95+
.. _.github/docker:
96+
https://github.com/oneapi-src/unified-runtime/blob/main/.github/docker
97+
4298
Generating Source
4399
=================
44100

45101
The specification and many other components in the Unified Runtime repository
46102
are generated from a set of YAML_ files which are used as inputs to a Mako_
47103
based templating system. The YAML file syntax is defined in `YAML syntax`_. To
48104
generate the outputs of the Mako templates a build directory must be
49-
configured, instructions are available in the `README
50-
<https://github.com/oneapi-src/unified-runtime/blob/main/README.md>`_ file.
51-
Upon successfully configuring a build directory, generate the outputs with the
52-
following command (or suitable build system equivalent):
105+
configured as detailed above. Upon successfully configuring a build directory,
106+
generate the outputs with the following command (or suitable build system
107+
equivalent):
53108

54109
.. code-block:: console
55110

0 commit comments

Comments
 (0)