Skip to content

Commit 82942f1

Browse files
authored
Add information about conda-packages (#38)
1 parent 186c915 commit 82942f1

File tree

1 file changed

+101
-80
lines changed

1 file changed

+101
-80
lines changed

README.rst

Lines changed: 101 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ Fortuno – flextensible unit testing framework for Fortran
55
**Fortuno** (Fortran Unit Testing Objects) is a flexible & extensible,
66
object-oriented unit testing framework designed for the Fortran programming
77
language. It emphasizes ease of use by minimizing boiler plate code when writing
8-
tests, while also prioratizing modularity and extensibility. Fortuno provides
9-
the essential building blocks to help developers create customized unit testing
8+
tests while prioratizing modularity and extensibility. Fortuno provides the
9+
essential building blocks to help developers create customized unit testing
1010
solutions.
1111

1212
Fortuno provides:
@@ -29,36 +29,56 @@ Fortuno provides:
2929

3030
**Documentation** can be found on the `Fortuno documentation site
3131
<https://fortuno.readthedocs.io>`_. Additionally, you may want to explore the
32-
examples provided in the `example folder <example/>`_.
32+
examples provided in the `example <example/>`_ folder.
3333

3434

35-
Quickstart
36-
==========
35+
Obtaining Fortuno
36+
=================
3737

38-
The easiest way to begin a new project with the Fortuno unit testing framework
39-
is by using the `Cookiecutter-Fortran-project
40-
<https://github.com/fortuno-repos/cookiecutter-fortran-project>`_ template
41-
generator. This tool creates a minimal project setup that’s ready for building,
42-
testing, and installation, with options to select your preferred build system
43-
(CMake, Fpm, or Meson), parallelization method (serial, MPI-parallel, or
44-
coarray-parallel), and built-in Fortuno integration.
38+
You can obtain Fortuno by installing it as a Conda package, downloading it and
39+
building it during your build process, or manually building and installing it
40+
from source.
4541

46-
If you'd like to add Fortuno unit tests to an existing project, follow the
47-
instructions below. In the examples, it’s assumed your library includes a module
48-
called ``mylib`` that provides a ``factorial()`` function for calculating the
49-
factorial of integers. You can adjust these names to match your actual library
50-
and function names.
5142

43+
Install Fortuno as a Conda package
44+
----------------------------------
45+
46+
The easiest way to obtain Fortuno is by installing a precompiled version via the
47+
Conda package management framework from the `conda-forge
48+
<https://conda-forge.org/>`_ channel. Ensure you are using either a Conda client
49+
with this channel as default (e.g. `miniforge
50+
<https://github.com/conda-forge/miniforge>`_) or manually add the channel. If
51+
you're not familiar with Conda, consult the `miniforge
52+
<https://github.com/conda-forge/miniforge>`_ project for setup instructions.
53+
54+
After switching to the desired Conda environment, run ::
55+
56+
conda install 'fortuno=*=nompi_*'
57+
58+
to obtain Fortuno with serial interface only. If you wish to use Fortuno for
59+
testing both serial and MPI-parallel routines, run ::
60+
61+
conda install 'fortuno=*=openmpi_*'
62+
63+
or ::
64+
65+
conda install 'fortuno=*=mpich_*'
66+
67+
depending on the preferred MPI-framework.
68+
69+
*Note:* The coarray interface is not available through Conda yet. To use the
70+
coarray interface, build Fortuno during your build process or manually, as
71+
described below.
5272

53-
Obtaining Fortuno during your build process
54-
-------------------------------------------
5573

56-
If you project is built with Fpm, CMake or Meson, the simplest way to integrate
57-
Fortuno is by downloading and building it as part of your project's build
58-
process. The steps vary depending on the build system you're using:
74+
Building Fortuno as part of your build process
75+
----------------------------------------------
5976

60-
* **Fpm**: Add Fortuno as a development dependency by including the following
61-
lines in your ``fpm.toml`` file:
77+
If your project is built with Fpm, CMake or Meson, you can seamlessly download
78+
and build Fortuno as part of your project's build process. The setup steps differ
79+
depending on the build system you are using:
80+
81+
* **Fpm**: Add Fortuno as a development dependency in your ``fpm.toml`` file:
6282

6383
* **Serial interface**::
6484

@@ -76,8 +96,7 @@ process. The steps vary depending on the build system you're using:
7696
fortuno = { git = "https://github.com/fortuno-repos/fortuno-fpm-coarray.git" }
7797

7898

79-
* **CMake**: Add the relevant snippet to your project's ``CMakeLists.txt``
80-
file:
99+
* **CMake**: Add the relevant snippet to your ``CMakeLists.txt`` file:
81100

82101
* **Serial interface**::
83102

@@ -115,20 +134,19 @@ process. The steps vary depending on the build system you're using:
115134
``FORTUNO_FFLAGS_COARRAY`` and ``FORTUNO_LDFLAGS_COARRAY`` with the
116135
appropriate compiler and linker flags for coarray parallelism.
117136

118-
*Note*: If Fortuno is already installed on your system, the settings
119-
described above will automatically use the installed version rather than
120-
downloading and building it during your project's build process.
137+
*Note*: If Fortuno is already installed on your system, these settings will
138+
automatically use the installed version instead of downloading and building
139+
it during your build process.
121140

122-
* **Meson**: Create a ``fortuno.wrap`` file in the subprojects/ directory
123-
(create it if it doesn’t already exist) with the following content::
141+
* **Meson**: Create a ``fortuno.wrap`` file in the ``subprojects/`` directory
142+
with the following content::
124143

125144
[wrap-git]
126145
directory=fortuno
127146
url=https://github.com/fortuno-repos/fortuno
128147
revision=main
129148

130-
Register Fortuno as a subproject by adding the following to your main
131-
``meson.build`` file:
149+
Then register Fortuno as a subproject in ``meson.build``:
132150

133151
* **Serial interface**::
134152

@@ -157,32 +175,21 @@ process. The steps vary depending on the build system you're using:
157175
},
158176
)
159177

160-
The variables ``fflags_coarray`` and ``ldflags_coarray`` should be defined
161-
in your project to contain the flags required to compile and link
162-
coarray-parallel code.
163-
164-
*Note*: If Fortuno is already installed on your system, the settings
165-
described above will automatically use the installed version rather than
166-
downloading and building it during your project's build process.
167-
178+
Define ``fflags_coarray`` and ``ldflags_coarray`` in your project to contain
179+
the flags needed to compile and link coarray-parallel code.
168180

169-
Installing Fortuno on your system
170-
---------------------------------
181+
*Note*: If Fortuno is already installed on your system, these settings will
182+
automatically use the installed version instead of downloading and building
183+
it during your build process.
171184

172-
As an alternative to downloading and building Fortuno on-the-fly during your
173-
project's build process, it is also possible to install the library directly on
174-
your system and use the installed version during the build. This can be useful
175-
for avoiding repeated downloads as well as for using Fortuno with other build
176-
systems (e.g. Make).
177185

186+
Building and installing Fortuno from source
187+
-------------------------------------------
178188

179-
Installing from source
180-
.......................
181-
182-
To install Fortuno from the downloaded source, you must follow the standard CMake workflow:
189+
You can also build and install Fortuno from source using a typical CMake
190+
workflow.
183191

184-
* Review the ``config.cmake`` file for variables that allow you to customize the
185-
build.
192+
* Review the ``config.cmake`` file for customizable build variables.
186193

187194
* Configure Fortuno::
188195

@@ -191,7 +198,7 @@ To install Fortuno from the downloaded source, you must follow the standard CMak
191198

192199
Ensure CMake selects the correct Fortran compiler by explicitly setting the
193200
``FC`` environment variable. You should also customize the installation
194-
directory by setting the ``CMAKE_INSTALL_PREFIX`` variable accordingly.
201+
directory by setting ``CMAKE_INSTALL_PREFIX``.
195202

196203
* Build the library::
197204

@@ -205,51 +212,65 @@ To install Fortuno from the downloaded source, you must follow the standard CMak
205212
Using the installed library
206213
...........................
207214

208-
How you integrate the installed Fortuno library into your project depends on the
209-
build system you are using for your project:
215+
To integrate the manually installed Fortuno library into your project, follow
216+
these instructions based on your build system:
210217

211218
* **CMake**: Follow the CMake instructions outlined earlier. Ensure the
212219
``CMAKE_PREFIX_PATH`` environment variable includes Fortuno's installation
213-
location so that CMake can find the library. For example::
220+
location::
214221

215222
export CMAKE_PREFIX_PATH="${HOME}/opt/fortuno:${CMAKE_PREFIX_PATH}"
216223

217-
* **Meson**: Follow the Meson instructions from the previous section. Make sure
218-
to set the ``PKG_CONFIG_PATH`` environment variable to include Fortuno’s
219-
installation location so that Meson can locate the library. For example::
224+
* **Meson**: Follow the Meson instructions from the previous section. Set the
225+
``PKG_CONFIG_PATH`` environment variable to include Fortuno’s installation
226+
location::
220227

221228
export PKG_CONFIG_PATH="${HOME}/opt/fortuno/lib/pkgconfig:${PKG_CONFIG_PATH}"
222229

223230
(Depending on your Linux distribution, you might need to use ``lib64`` instead
224-
of ``lib`` in the path.)
231+
of ``lib``.)
225232

226-
* **Other build systems (e.g., Make)**: Add the directory containing the
227-
installed ``.mod`` files to the compiler's search path during compilation
228-
using the appropriate flag for your compiler, for example::
233+
* **Other build systems (e.g., Make)**: Follow your usual workflow. Add the
234+
directory containing the installed ``.mod`` files to the compiler's search
235+
path using the appropriate compiler flag::
229236

230237
-I${HOME}/opt/fortuno/lib/modules
231238

232-
When linking the test application, ensure you link the appropriate
233-
interface-specific library and the general library using the correct compiler
234-
flags. For example::
239+
Link the appropriate interface-specific library and the general library with
240+
the appropriate compiler/linker flags::
235241

236242
-L${HOME}/opt/fortuno/lib -lfortuno_serial -lfortuno
237243

238-
(You may need to use ``lib64`` instead of ``lib`` in the paths, depending on
239-
your system's configuration.)
244+
(You may need to use ``lib64`` instead of ``lib`` depending on your system's
245+
configuration.)
246+
247+
248+
Quickstart
249+
==========
250+
251+
The easiest way to start a new project utilizing the Fortuno unit testing
252+
framework is by using the `Cookiecutter-Fortran-project
253+
<https://github.com/fortuno-repos/cookiecutter-fortran-project>`_ template. This
254+
tool creates a minimal project ready for building, testing, and installation,
255+
with options to select your preferred build system (CMake, Fpm, or Meson),
256+
parallelization method (serial, MPI-parallel, or coarray-parallel), and Fortuno
257+
integration.
258+
259+
To add Fortuno unit tests to an existing project, follow the instructions below.
260+
The examples assume your library includes a module called ``mylib`` with a
261+
``factorial()`` function for calculating the factorial of integers. Adjust the
262+
names to match your actual library and function names.
240263

241264

242265
Writing unit tests
243266
------------------
244267

245-
In Fortuno, writing unit tests is straightforward. For basic cases, tests are
246-
written as simple subroutines without arguments. Aside from the test routines
247-
themselves, only a minimal amount of additional code is required to register the
248-
tests in the framework and provide a command-line test driver to execute them.
268+
Writing unit tests in Fortuno is straightforward. For basic cases, tests are
269+
written as simple subroutines without arguments. Minimal additional code is
270+
required to register the tests and provide a command-line test driver.
249271

250-
For example, given a hypothetical library ``mylib`` that provides a
251-
``factorial()`` function, a minimal test program checking the results for two
252-
different input values might look like this::
272+
For example, the following minimal working example tests a ``factorial()``
273+
function in a hypothetical library ``mylib``::
253274

254275
! file: testapp.f90
255276

@@ -337,7 +358,7 @@ your chosen build system:
337358

338359
* **Meson**: In the ``meson.build`` file, declare an executable ``testapp``
339360
using ``testapp.f90`` as the source and ``fortuno_serial_dep`` as a
340-
dependency. Also include your library (e.g., ``mylib_dep``) as a dependency::
361+
dependency. Also, include your library (e.g., ``mylib_dep``) as a dependency::
341362

342363
testapp_exe = executable(
343364
'testapp',
@@ -395,13 +416,13 @@ Further information
395416

396417
For more detailed explanations, additional features, and various use cases,
397418
refer to the `Fortuno documentation <https://fortuno.readthedocs.io>`_ and
398-
explore the examples in the `example folder <example/>`_.
419+
explore the examples in the `example <example/>`_ folder.
399420

400421

401422
Compiler compatibility
402423
======================
403424

404-
To provide a simple interface along with maximum flexibility and extensibility,
425+
To provide a simple interface with maximum flexibility and extensibility,
405426
Fortuno leverages modern Fortran constructs extensively. Therefore, building
406427
Fortuno requires a compiler that supports Fortran 2018. Below is a table of
407428
compilers that have been successfully tested for building Fortuno. We recommend

0 commit comments

Comments
 (0)