Implementation of the meta data for compiler flag profiles.
A profiles table can currently have the following subtables: Profile names - any string, if omitted, flags are appended to all matching profiles Compiler - any from the following list, omitting it yields an error
OS - any from the following list, if omitted, the profile is used if and only if there is no profile perfectly matching the current configuration
Each of the subtables currently supports the following fields:
[profiles.debug.gfortran.linux]
flags="-Wall -g -Og"
c-flags="-g O1"
cxx-flags="-g O1"
link-time-flags="-xlinkopt"
files={"hello_world.f90"="-Wall -O3"}
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
character(len=*), | public, | parameter | :: | DEFAULT_COMPILER | = | 'gfortran' |
Name of the default compiler |
character(len=:), | public, | allocatable | :: | path |
Type storing file name - file scope compiler flags pairs
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
character(len=:), | public, | allocatable | :: | file_name |
Name of the file |
||
character(len=:), | public, | allocatable | :: | flags |
File scope flags |
generic, public :: dump => dump_to_toml, dump_to_file, dump_to_unit | |
procedure, public :: dump_to_toml => file_scope_dump | |
generic, public :: load => load_from_toml, load_from_file, load_from_unit | |
procedure, public :: load_from_toml => file_scope_load | |
generic, public :: operator(==) => serializable_is_same | |
procedure, public :: serializable_is_same => file_scope_same | Serialization interface |
procedure, public, non_overridable :: test_serialization | Test load/write roundtrip |
Configuration meta data for a profile (now based on features)
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
type(file_scope_flag), | public, | allocatable | :: | file_scope_flags(:) |
File scope flags (maintained for backwards compatibility) |
||
type(feature_config_t), | public | :: | profile_feature |
Profile feature - contains all profile configuration |
procedure, public :: c_flags => get_profile_c_flags | |
procedure, public :: compiler => get_profile_compiler | |
procedure, public :: cxx_flags => get_profile_cxx_flags | |
generic, public :: dump => dump_to_toml, dump_to_file, dump_to_unit | |
procedure, public :: dump_to_toml => profile_dump | |
procedure, public :: flags => get_profile_flags | |
procedure, public :: info | Print information on this instance |
procedure, public :: is_built_in => get_profile_is_built_in | |
procedure, public :: link_time_flags => get_profile_link_time_flags | |
generic, public :: load => load_from_toml, load_from_file, load_from_unit | |
procedure, public :: load_from_toml => profile_load | |
generic, public :: operator(==) => serializable_is_same | |
procedure, public :: os_type => get_profile_os_type | |
procedure, public :: profile_name => get_profile_name | Convenience accessors for backward compatibility |
procedure, public :: serializable_is_same => profile_same | Serialization interface |
procedure, public, non_overridable :: test_serialization | Test load/write roundtrip |
All checks passed!
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(file_scope_flag), | intent(in) | :: | this | |||
class(serializable_t), | intent(in) | :: | that |
Get C flags
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(profile_config_t), | intent(in) | :: | self |
Get compiler name
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(profile_config_t), | intent(in) | :: | self |
Get C++ flags
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(profile_config_t), | intent(in) | :: | self |
Get flags
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(profile_config_t), | intent(in) | :: | self |
Get is_built_in flag (maps to feature default flag)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(profile_config_t), | intent(in) | :: | self |
Get link time flags
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(profile_config_t), | intent(in) | :: | self |
Convenience accessor procedures for backward compatibility Get profile name
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(profile_config_t), | intent(in) | :: | self |
Get OS type
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(profile_config_t), | intent(in) | :: | self |
Construct a new profile configuration from a TOML data structure
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | profile_name |
Name of the profile |
||
character(len=*), | intent(in) | :: | compiler |
Name of the compiler |
||
integer, | intent(in) | :: | os_type |
Type of the OS |
||
character(len=*), | intent(in), | optional | :: | flags |
Fortran compiler flags |
|
character(len=*), | intent(in), | optional | :: | c_flags |
C compiler flags |
|
character(len=*), | intent(in), | optional | :: | cxx_flags |
C++ compiler flags |
|
character(len=*), | intent(in), | optional | :: | link_time_flags |
Link time compiler flags |
|
type(file_scope_flag), | intent(in), | optional | :: | file_scope_flags(:) |
File scope flags |
|
logical, | intent(in), | optional | :: | is_built_in |
Is this profile one of the built-in ones? |
Match lowercase string with name of OS to os_type enum
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | os_type |
Enum representing type of OS |
Name of operating system
All checks passed!
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(profile_config_t), | intent(in) | :: | this | |||
class(serializable_t), | intent(in) | :: | that |
Dump to toml table
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(file_scope_flag), | intent(inout) | :: | self |
Instance of the serializable object |
||
type(toml_table), | intent(inout) | :: | table |
Data structure |
||
type(error_t), | intent(out), | allocatable | :: | error |
Error handling |
Read from toml table (no checks made at this stage)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(file_scope_flag), | intent(inout) | :: | self |
Instance of the serializable object |
||
type(toml_table), | intent(inout) | :: | table |
Data structure |
||
type(error_t), | intent(out), | allocatable | :: | error |
Error handling |
Look for profile with given configuration in array profiles
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(profile_config_t), | intent(in), | allocatable | :: | profiles(:) |
Array of profiles |
|
character(len=:), | intent(in), | allocatable | :: | profile_name |
Name of profile |
|
type(platform_config_t), | intent(in) | :: | target | |||
logical, | intent(out) | :: | found_matching |
Boolean value containing true if matching profile was found |
||
type(profile_config_t), | intent(out) | :: | chosen_profile |
Last matching profile in the profiles array |
Look for flags, c-flags, link-time-flags key-val pairs and files table in a given table and create new profiles
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=:), | intent(in), | allocatable | :: | profile_name |
Name of profile |
|
character(len=:), | intent(in), | allocatable | :: | compiler_name |
Name of compiler |
|
integer, | intent(in) | :: | os_type |
OS type |
||
type(toml_key), | intent(in), | allocatable | :: | key_list(:) |
List of keys in the table |
|
type(toml_table), | intent(in), | pointer | :: | table |
Table containing OS tables |
|
type(profile_config_t), | intent(inout), | allocatable | :: | profiles(:) |
List of profiles |
|
integer, | intent(inout) | :: | profindex |
Index in the list of profiles |
||
logical, | intent(in) | :: | os_valid |
Was called with valid operating system |
Write information on instance
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(profile_config_t), | intent(in) | :: | self |
Instance of the profile configuration |
||
integer, | intent(in) | :: | unit |
Unit for IO |
||
integer, | intent(in), | optional | :: | verbosity |
Verbosity of the printout |
Construct new profiles array from a TOML data structure
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(profile_config_t), | intent(out), | allocatable | :: | profiles(:) |
Instance of the dependency configuration |
|
type(toml_table), | intent(inout), | target | :: | table |
Instance of the TOML data structure |
|
type(error_t), | intent(out), | allocatable | :: | error |
Error handling |
Dump to toml table
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(profile_config_t), | intent(inout) | :: | self |
Instance of the serializable object |
||
type(toml_table), | intent(inout) | :: | table |
Data structure |
||
type(error_t), | intent(out), | allocatable | :: | error |
Error handling |
Read from toml table (no checks made at this stage)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(profile_config_t), | intent(inout) | :: | self |
Instance of the serializable object |
||
type(toml_table), | intent(inout) | :: | table |
Data structure |
||
type(error_t), | intent(out), | allocatable | :: | error |
Error handling |
Traverse compiler tables
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=:), | intent(in), | allocatable | :: | profile_name |
Name of profile |
|
type(toml_key), | intent(in), | allocatable | :: | comp_list(:) |
List of OSs in table with profile name given |
|
type(toml_table), | intent(in), | pointer | :: | table |
Table containing compiler tables |
|
type(error_t), | intent(out), | allocatable | :: | error |
Error handling |
|
integer, | intent(inout), | optional | :: | profiles_size |
Number of profiles in list of profiles |
|
type(profile_config_t), | intent(inout), | optional, | allocatable | :: | profiles(:) |
List of profiles |
integer, | intent(inout), | optional | :: | profindex |
Index in the list of profiles |
Traverse operating system tables to obtain profiles
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=:), | intent(in), | allocatable | :: | profile_name |
Name of profile |
|
character(len=:), | intent(in), | allocatable | :: | compiler_name |
Name of compiler |
|
type(toml_key), | intent(in), | allocatable | :: | os_list(:) |
List of OSs in table with profile name and compiler name given |
|
type(toml_table), | intent(in), | pointer | :: | table |
Table containing OS tables |
|
type(profile_config_t), | intent(inout), | allocatable | :: | profiles(:) |
List of profiles |
|
integer, | intent(inout) | :: | profindex |
Index in the list of profiles |
||
type(error_t), | intent(out), | allocatable | :: | error |
Error handling |
Traverse operating system tables to obtain number of profiles
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=:), | intent(in), | allocatable | :: | profile_name |
Name of profile |
|
character(len=:), | intent(in), | allocatable | :: | compiler_name |
Name of compiler |
|
type(toml_key), | intent(in), | allocatable | :: | os_list(:) |
List of OSs in table with profile name and compiler name given |
|
type(toml_table), | intent(in), | pointer | :: | table |
Table containing OS tables |
|
integer, | intent(inout) | :: | profiles_size |
Number of profiles in list of profiles |
||
type(error_t), | intent(out), | allocatable | :: | error |
Error handling |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=:), | intent(in), | allocatable | :: | profile_name |
Name of profile |
|
character(len=:), | intent(in), | allocatable | :: | compiler_name |
Name of compiler |
|
type(toml_key), | intent(in), | allocatable | :: | key_list(:) |
List of keys in the table |
|
type(toml_table), | intent(in), | pointer | :: | table |
Table containing OS tables |
|
type(error_t), | intent(out), | allocatable | :: | error |
Error handling |
|
logical, | intent(in) | :: | os_valid |
Was called with valid operating system |