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 |
integer, | public, | parameter | :: | OS_ALL | = | -1 | |
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
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
character(len=:), | public, | allocatable | :: | c_flags |
C compiler flags |
||
character(len=:), | public, | allocatable | :: | compiler |
Name of the compiler |
||
character(len=:), | public, | allocatable | :: | cxx_flags |
C++ compiler flags |
||
type(file_scope_flag), | public, | allocatable | :: | file_scope_flags(:) |
File scope flags |
||
character(len=:), | public, | allocatable | :: | flags |
Fortran compiler flags |
||
logical, | public | :: | is_built_in | = | .false. |
Is this profile one of the built-in ones? |
|
character(len=:), | public, | allocatable | :: | link_time_flags |
Link time compiler flags |
||
integer, | public | :: | os_type | = | OS_ALL |
Value repesenting OS |
|
character(len=:), | public, | allocatable | :: | profile_name |
Name of the profile |
generic, public :: dump => dump_to_toml, dump_to_file, dump_to_unit | |
procedure, public :: dump_to_toml => profile_dump | |
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 => profile_load | |
generic, public :: operator(==) => serializable_is_same | |
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 |
Construct an array of built-in profiles
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(error_t), | intent(out), | allocatable | :: | error |
Error handling |
Print a representation of profile_config_t
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(profile_config_t), | intent(in) | :: | profile |
Profile to be represented |
String representation of given profile
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 |
|
character(len=:), | intent(in), | allocatable | :: | compiler |
Name of compiler |
|
integer, | intent(in) | :: | os_type |
Type of operating system (enum) |
||
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 |
Match os_type enum to a lowercase string with name of OS
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=:), | intent(in), | allocatable | :: | os_name |
Name of operating system |
|
integer, | intent(out) | :: | os_type |
Enum representing type of OS |
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 |
Check if compiler name is a valid compiler name
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=:), | intent(in), | allocatable | :: | compiler_name |
Name of a compiler |
|
logical, | intent(out) | :: | is_valid |
Boolean value of whether compiler_name is valid or not |
Check if os_name is a valid name of a supported OS
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=:), | intent(in), | allocatable | :: | os_name |
Name of an operating system |
|
logical, | intent(out) | :: | is_valid |
Boolean value of whether os_name is valid or not |
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 |