fpm icon indicating copy to clipboard operation
fpm copied to clipboard

Fortran feature table

Open awvwgk opened this issue 3 years ago • 3 comments

In light of supporting #577 and other related features which require to toggle “features” we should have a better mechanism than lumping things together in the build table.

An easy option would be to have a features table, with booleans

[features]
implicit-typing = true

However, we might need more than a binary system, so a feature which is either on, off or on some automatic value

[features]
implicit-typing = "enabled"  # options are "enabled", "disabled", "default" (compiler specific)

A more complex setup could be a fortran table, which also allows to select the standard (with default being what the compiler uses without options, fpm being our community standard and f2018 the strict standard). Features could be instead of a subtable also an array of strings (easier to realize in a subtable than in the root table).

[fortran]
standard = "default"  # "fpm", "f2018", "f2008", ...
features = [
  "+implicit-typing",  # or "-implict-typing"
]

awvwgk avatar Jul 15 '22 22:07 awvwgk

In cargo it is done using a features table: https://doc.rust-lang.org/cargo/reference/features.html, but they have also an array of strings to enable unstable features: https://doc.rust-lang.org/cargo/reference/unstable.html.

awvwgk avatar Jul 18 '22 12:07 awvwgk

Would this down the line mean also a [c-lang] table, e.g. to select C dialects? (https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html#C-Dialect-Options)

ivan-pi avatar Jul 21 '22 14:07 ivan-pi

In this case it would make sense to stay with a features table where one can select the Fortran and C standard using a keyword argument.

awvwgk avatar Jul 21 '22 14:07 awvwgk