Skip to content

Commit

Permalink
Add more detailed build instructions to the Contribution Guide
Browse files Browse the repository at this point in the history
Resolve #582 by adding more detailed instructions on using the `generate` target.
  • Loading branch information
callumfare committed Sep 13, 2023
1 parent 764ecf2 commit 67c2b80
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 7 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,19 @@ Tools can be acquired via instructions in [third_party](/third_party/README.md).

## Building

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

### Requirements

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

For development and contributions:
- clang-format-15.0 (can be installed with `python -m pip install clang-format==15.0.7`)

### Windows

Generating Visual Studio Project. EXE and binaries will be in **build/bin/{build_config}**
Expand Down
50 changes: 46 additions & 4 deletions scripts/core/CONTRIB.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,59 @@ accepted into the project.
Runtime team via the `GitHub issue tracker
<https://github.com/oneapi-src/unified-runtime/issues/new>`_.

Build Environment
=================

To be able to generate the source from the YAML files, the build environment
must be configured correctly and all dependencies must be installed. The
instructions for a basic setup are available in the `README
<https://github.com/oneapi-src/unified-runtime/blob/main/README.md#building>`_.

The following additional dependencies are required to support the ``generate``
target:
* Doxygen (>= 1.8)
* The Python script requirements listed in `third_party/requirements.txt_`

Doxygen can be installed via your system's package manager, e.g. on Ubuntu
``sudo apt install doxygen``, or by downloading it from the Doxygen website. It
must be available on the current ``PATH`` when the script is run.

The simplest way to install the requirements for the script is using a Python
virtual environment. This can be set up by running the following commands from
the project root:
.. code-block:: console
python3 -m venv .local
source .local/bin/activate
pip install -r third_party/requirements.txt
The virtual environment can be subsequently reactivated before any builds
without needing to reinstall the requirements:
.. code-block:: console
source .local/bin/activate
You *must* also enable the ``UR_FORMAT_CPP_STYLE`` CMake option to allow
formatting of the generated code, or the ``generate`` target will not be
available.
.. code-block:: console
cmake build/ -DUR_FORMAT_CPP_STYLE=ON
..
You can then follow the instructions below to use the ``generate`` target to
regenerate the source.

.. _third_party/requirements.txt:
https://github.com/oneapi-src/unified-runtime/blob/main/third_party/requirements.txt

Generating Source
=================

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

.. code-block:: console
Expand Down

0 comments on commit 67c2b80

Please sign in to comment.