Fpm: Link to precompiled system-wide archives

Created on 14 Jul 2020  路  2Comments  路  Source: fortran-lang/fpm

fpm is great for including external fortran projects as dependencies (typically downloaded at github).

However, it often arises that a fortran project needs to link to an already compiled system-wide archive, such as lapack or fftw. At present, to the best of my knowledge, there is no simple way to link to such files in fpm. It is possible that this might be possible using a Makefile, but that would be non-optimal.

Ideally, the libraries to link to would be placed in the fpm.toml file, something like this:

link = 'fftw, lapack'
specification

Most helpful comment

Since we flagged this for our first beta release, we should agree on a syntax for it.

I would suggest to include the external libraries in the build section:

[build]
link = ["fftw", "lapack"]

Which would translate to

gfortran ... -lfftw -llapack

in the link line.

To group libraries in the link line nested arrays could be used.

All 2 comments

This is certainly on our radar. We just haven't gotten to it yet.

Since we flagged this for our first beta release, we should agree on a syntax for it.

I would suggest to include the external libraries in the build section:

[build]
link = ["fftw", "lapack"]

Which would translate to

gfortran ... -lfftw -llapack

in the link line.

To group libraries in the link line nested arrays could be used.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

scivision picture scivision  路  10Comments

everythingfunctional picture everythingfunctional  路  8Comments

certik picture certik  路  8Comments

urbanjost picture urbanjost  路  5Comments

aslozada picture aslozada  路  5Comments