fpm_manifest_package Module

Define the package data containing the meta data from the configuration file.

The package data defines a Fortran type corresponding to the respective TOML document, after creating it from a package file no more interaction with the TOML document is required.

Every configuration type provides it custom constructor (prefixed with new_) and knows how to deserialize itself from a TOML document. To ensure we find no untracked content in the package file all keywords are checked and possible entries have to be explicitly allowed in the check function. If entries are mutally exclusive or interdependent inside the current table the check function is required to enforce this schema on the data structure.

The package file root allows the following keywords

name = "string"
version = "string"
license = "string"
author = "string"
maintainer = "string"
copyright = "string"
[library]
[dependencies]
[dev-dependencies]
[profiles]
[build]
[install]
[fortran]
[[ executable ]]
[[ example ]]
[[ test ]]
[extra]


Derived Types

type, public, extends(feature_config_t) ::  package_config_t

Package meta data Package configuration data - extends a feature_config_t to represent the “default” package feature. The following are now inherited from feature_config_t: name (but for package it’s the package name), description, compiler, os_type (defaults to id_all, OS_ALL for packages) library, executable(:), dependency(:), dev_dependency(:), example(:), test(:), preprocess(:) flags, c_flags, cxx_flags, link_time_flags, requires_features(:)

Components

Type Visibility Attributes Name Initial
character(len=:), public, allocatable :: author
type(build_config_t), public, allocatable :: build

Build configuration

character(len=:), public, allocatable :: c_flags
character(len=:), public, allocatable :: copyright
character(len=:), public, allocatable :: cxx_flags
logical, public :: default = .false.

Is this feature enabled by default

type(dependency_config_t), public, allocatable :: dependency(:)

Dependencies

character(len=:), public, allocatable :: description
type(dependency_config_t), public, allocatable :: dev_dependency(:)

Development dependencies

type(example_config_t), public, allocatable :: example(:)

Examples

type(executable_config_t), public, allocatable :: executable(:)

Executable configurations

type(feature_collection_t), public, allocatable :: features(:)

Additional feature collections beyond the default package feature

character(len=:), public, allocatable :: flags

Compiler flags

type(fortran_config_t), public, allocatable :: fortran

Fortran configuration

type(install_config_t), public, allocatable :: install

Installation configuration

type(library_config_t), public, allocatable :: library

Library configuration

character(len=:), public, allocatable :: license

Package metadata (package-specific)

character(len=:), public, allocatable :: link_time_flags
character(len=:), public, allocatable :: maintainer
type(metapackage_config_t), public :: meta

Metapackage data

character(len=:), public, allocatable :: name

Feature identity

type(platform_config_t), public :: platform

Compiler/OS targeting (consistent with profile_config_t pattern)

type(preprocess_config_t), public, allocatable :: preprocess(:)

Preprocessor configuration

type(profile_config_t), public, allocatable :: profiles(:)

Profiles (collections of features)

type(string_t), public, allocatable :: requires_features(:)

Feature dependencies

type(test_config_t), public, allocatable :: test(:)

Tests

type(version_t), public :: version

Package version (name is inherited from feature_config_t%name)

Type-Bound Procedures

procedure, public, nopass :: check

Check validity of the TOML table

generic, public :: dump => dump_to_toml, dump_to_file, dump_to_unit
procedure, public :: dump_to_toml
procedure, public :: export_config

Export package configuration with features applied

procedure, public :: info

Print information on this instance

generic, public :: load => load_from_toml, load_from_file, load_from_unit
procedure, public :: load_from_toml
procedure, public :: manifest_name

Get manifest name

generic, public :: operator(==) => serializable_is_same
procedure, public :: serializable_is_same => manifest_is_same

Serialization interface

procedure, public, non_overridable :: test_serialization

Test load/write roundtrip


Subroutines

public subroutine new_package(self, table, root, error)

Construct a new package configuration from a TOML data structure

Arguments

Type IntentOptional Attributes Name
type(package_config_t), intent(out) :: self

Instance of the package configuration

type(toml_table), intent(inout) :: table

Instance of the TOML data structure

character(len=*), intent(in), optional :: root

Root directory of the manifest

type(error_t), intent(out), allocatable :: error

Error handling