Skip to content

Commit

Permalink
fix documentation issues with path names
Browse files Browse the repository at this point in the history
add curl to .readthedocs.yaml to install curl package in image
  • Loading branch information
shahzebsiddiqui committed Jan 24, 2024
1 parent ef7e6b8 commit c99e5a8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
1 change: 1 addition & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ build:
apt_packages:
- iputils-ping
- build-essential
- curl
- gfortran
- csh
- zsh
Expand Down
22 changes: 14 additions & 8 deletions docs/writing_buildspecs/compilation.rst
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
Compilation Example
==================
====================

Hello World Example
-------------------
--------------------

In this section, we will show to compile source code with compiler and compiler flags. To get started,
let's start with a simple hello world example we have available in C and C++ as shown below

.. literalinclude:: ../tutorials/compilation/hello_world.c
.. literalinclude:: ../tutorials/compilation/hello.c
:language: c

.. literalinclude:: ../tutorials/compilation/hello_world.cpp
.. literalinclude:: ../tutorials/compilation/hello.cpp
:language: c++

Shown below is an example buildspec file that will compile the above source code with the gcc compiler.
The ``compilers`` section is used to specify the compiler to use that is selected via the ``name`` property which applies
a regular expression to search for compiler. The compilers are defined in buildtest configuration file see :ref:`compilers`
for more details.

.. literalinclude:: ../../tutorials/compilation/hello_world_buildspec.yml
.. literalinclude:: ../tutorials/compilation/hello_world_compilation.yml
:language: yaml
:emphasize-lines: 6-7, 9-10

Buildtest will define environment variables like ``BUILDTEST_CC`` and ``BUILDTEST_CXX`` that point to compiler wrapper
for the selected compiler.
Buildtest will define environment variables like ``BUILDTEST_CC`` and ``BUILDTEST_CXX`` that point to the C and C++
compiler wrapper for the selected compiler.

Let's try to run the code and inspect the test output and test file.

Expand All @@ -33,6 +33,12 @@ Let's try to run the code and inspect the test output and test file.

.. command-output:: buildtest inspect query -o -t hello_world_c_cpp

Please note that the compiler definition for ``builtin_gcc`` is a canonical name to reference to system GNU
compiler that is set to `/usr/bin/gcc`, `/usr/bin/g++`. The compiler details can be extracted from the configuration
file via ``buildtest config compilers list`` command. Shown below is the YAML output of the compiler details.

.. command-output:: buildtest config compilers list --yaml

STREAM Benchmark Example
------------------------

Expand All @@ -42,7 +48,7 @@ we will need to download the source code and compile the source code. We will us
The `cflags` option is responsible for setting C compiler flags which is set to environment variable ``BUILDTEST_CFLAGS`` that we can access in
the ``run`` section. The ``env`` section is used to set environment variables that are used in the ``run`` section.

.. literalinclude:: ../../tutorials/compilation/stream.yml
.. literalinclude:: ../tutorials/compilation/stream.yml
:language: yaml
:emphasize-lines: 9-13,16

Expand Down

0 comments on commit c99e5a8

Please sign in to comment.