Definition of compiler object
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| character(len=:), | public, | allocatable | :: | cc |
Path to the C compiler |
||
| character(len=:), | public, | allocatable | :: | cxx |
Path to the C++ compiler |
||
| logical, | public | :: | echo | = | .true. |
Print all commands |
|
| character(len=:), | public, | allocatable | :: | fc |
Path to the Fortran compiler |
||
| integer(kind=compiler_enum), | public | :: | id | = | id_unknown |
Identifier of the compiler |
|
| logical, | public | :: | verbose | = | .true. |
Verbose output of command |
Check if the given C compile and/or link flags are accepted by the C compiler
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(compiler_t), | intent(in) | :: | self | |||
| character(len=*), | intent(in), | optional | :: | compile_flags | ||
| character(len=*), | intent(in), | optional | :: | link_flags |
C feature support
Check if the given C source code compiles, links, and runs successfully Create temporary source file Write contents Get flags Compile Link using C compiler for pure C programs Run Delete temporary files
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(compiler_t), | intent(in) | :: | self |
Instance of the compiler object |
||
| character(len=*), | intent(in) | :: | input |
C program source |
||
| character(len=*), | intent(in), | optional | :: | compile_flags |
Optional build and link flags |
|
| character(len=*), | intent(in), | optional | :: | link_flags |
Optional build and link flags |
Check if the given C++ compile and/or link flags are accepted by the C++ compiler
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(compiler_t), | intent(in) | :: | self | |||
| character(len=*), | intent(in), | optional | :: | compile_flags | ||
| character(len=*), | intent(in), | optional | :: | link_flags |
C++ feature support
Check if the given C++ source code compiles, links, and runs successfully Create temporary source file Write contents Get flags Compile Link using C++ compiler for pure C++ programs Run Delete temporary files
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(compiler_t), | intent(in) | :: | self |
Instance of the compiler object |
||
| character(len=*), | intent(in) | :: | input |
C++ program source |
||
| character(len=*), | intent(in), | optional | :: | compile_flags |
Optional build and link flags |
|
| character(len=*), | intent(in), | optional | :: | link_flags |
Optional build and link flags |
Check if the given compile and/or link flags are accepted by the compiler
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(compiler_t), | intent(in) | :: | self | |||
| character(len=*), | intent(in), | optional | :: | compile_flags | ||
| character(len=*), | intent(in), | optional | :: | link_flags |
Fortran feature support
Run a single-source Fortran program using the current compiler Compile a Fortran object Create temporary source file Write contents Get flags Intel: Needs -warn last for error on unknown command line arguments to work Compile and link program Run and retrieve exit code
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(compiler_t), | intent(in) | :: | self |
Instance of the compiler object |
||
| character(len=*), | intent(in) | :: | input |
Program Source |
||
| character(len=*), | intent(in), | optional | :: | compile_flags |
Optional build and link flags |
|
| character(len=*), | intent(in), | optional | :: | link_flags |
Optional build and link flags |
Compile a C object
Compile a C object
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(compiler_t), | intent(in) | :: | self |
Instance of the compiler object |
||
| character(len=*), | intent(in) | :: | input |
Source file input |
||
| character(len=*), | intent(in) | :: | output |
Output file of object |
||
| character(len=*), | intent(in) | :: | args |
Arguments for compiler |
||
| character(len=*), | intent(in) | :: | log_file |
Compiler output log file |
||
| integer, | intent(out) | :: | stat |
Status flag |
||
| type(compile_command_table_t), | intent(inout), | optional | :: | table |
Optional compile_commands table |
|
| logical, | intent(in), | optional | :: | dry_run |
Optional mocking |
Compile a CPP object
Compile a CPP object
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(compiler_t), | intent(in) | :: | self |
Instance of the compiler object |
||
| character(len=*), | intent(in) | :: | input |
Source file input |
||
| character(len=*), | intent(in) | :: | output |
Output file of object |
||
| character(len=*), | intent(in) | :: | args |
Arguments for compiler |
||
| character(len=*), | intent(in) | :: | log_file |
Compiler output log file |
||
| integer, | intent(out) | :: | stat |
Status flag |
||
| type(compile_command_table_t), | intent(inout), | optional | :: | table |
Optional compile_commands table |
|
| logical, | intent(in), | optional | :: | dry_run |
Optional mocking |
Compile a Fortran object
Compile a Fortran object
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(compiler_t), | intent(in) | :: | self |
Instance of the compiler object |
||
| character(len=*), | intent(in) | :: | input |
Source file input |
||
| character(len=*), | intent(in) | :: | output |
Output file of object |
||
| character(len=*), | intent(in) | :: | args |
Arguments for compiler |
||
| character(len=*), | intent(in) | :: | log_file |
Compiler output log file |
||
| integer, | intent(out) | :: | stat |
Status flag |
||
| type(compile_command_table_t), | intent(inout), | optional | :: | table |
Optional compile_commands table |
|
| logical, | intent(in), | optional | :: | dry_run |
Optional mocking |
Dump dependency to toml table
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(srcfile_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 |
Write serializable object to file
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(serializable_t), | intent(inout) | :: | self |
Instance of the dependency tree |
||
| character(len=*), | intent(in) | :: | file |
File name |
||
| type(error_t), | intent(out), | allocatable | :: | error |
Error handling |
|
| logical, | intent(in), | optional | :: | json |
Optional JSON format |
Write serializable object to a formatted Fortran unit
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(serializable_t), | intent(inout) | :: | self |
Instance of the dependency tree |
||
| integer, | intent(in) | :: | unit |
Formatted unit |
||
| type(error_t), | intent(out), | allocatable | :: | error |
Error handling |
|
| logical, | intent(in), | optional | :: | json |
Optional JSON format requested? |
Dump dependency to toml table
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(compiler_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 |
Enumerate libraries, based on compiler and platform
Enumerate libraries, based on compiler and platform
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(compiler_t), | intent(in) | :: | self | |||
| character(len=*), | intent(in) | :: | prefix | |||
| type(string_t), | intent(in) | :: | libs(:) |
Get default compiler flags
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(compiler_t), | intent(in) | :: | self | |||
| logical, | intent(in) | :: | release |
Get library export flags
Generate library export flags for a shared library build
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(compiler_t), | intent(in) | :: | self |
Instance of the compiler |
||
| character(len=*), | intent(in) | :: | target_dir |
Path and package name |
||
| character(len=*), | intent(in) | :: | target_name |
Path and package name |
Get feature flag
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(compiler_t), | intent(in) | :: | self | |||
| character(len=*), | intent(in) | :: | feature |
Generate header padding flags for macOS executables
Generate header padding flags for install_name_tool compatibility on macOS
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(compiler_t), | intent(in) | :: | self |
Get flag for include directories
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(compiler_t), | intent(in) | :: | self | |||
| character(len=*), | intent(in) | :: | path |
Get library install name flags
Generate install_name flag for a shared library build on macOS
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(compiler_t), | intent(in) | :: | self | |||
| character(len=*), | intent(in) | :: | target_dir | |||
| character(len=*), | intent(in) | :: | target_name |
Get flags for the main linking command
Get special flags for the main linker
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(compiler_t), | intent(in) | :: | self | |||
| character(len=*), | intent(in) | :: | language | |||
| character(len=:), | intent(out), | allocatable | :: | flags |
Get flag for module output directories
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(compiler_t), | intent(in) | :: | self | |||
| character(len=*), | intent(in) | :: | path |
Check whether this is a GNU compiler
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(compiler_t), | intent(in) | :: | self |
Check whether this is an Intel compiler
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(compiler_t), | intent(in) | :: | self |
Check whether compiler is recognized
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(compiler_t), | intent(in) | :: | self |
Link executable
Link an executable
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(compiler_t), | intent(in) | :: | self |
Instance of the compiler object |
||
| character(len=*), | intent(in) | :: | output |
Output file of object |
||
| character(len=*), | intent(in) | :: | args |
Arguments for compiler |
||
| character(len=*), | intent(in) | :: | log_file |
Compiler output log file |
||
| integer, | intent(out) | :: | stat |
Status flag |
||
| logical, | intent(in), | optional | :: | dry_run |
Optional mocking |
Link a shared library
Link a shared library
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(compiler_t), | intent(in) | :: | self |
Instance of the compiler object |
||
| character(len=*), | intent(in) | :: | output |
Output file of shared library object |
||
| character(len=*), | intent(in) | :: | args |
Arguments for the compiler |
||
| character(len=*), | intent(in) | :: | log_file |
Compiler output log file |
||
| integer, | intent(out) | :: | stat |
Status flag |
||
| logical, | intent(in), | optional | :: | dry_run |
Optional mocking |
Read dependency from toml table (no checks made at this stage)
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(srcfile_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 dependency tree from file
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(serializable_t), | intent(inout) | :: | self |
Instance of the dependency tree |
||
| character(len=*), | intent(in) | :: | file |
File name |
||
| type(error_t), | intent(out), | allocatable | :: | error |
Error handling |
|
| logical, | intent(in), | optional | :: | json |
Optional JSON format |
Read dependency tree from file init JSON interpreter Read object from TOML table
use default TOML parser
Read object from TOML table
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(serializable_t), | intent(inout) | :: | self |
Instance of the dependency tree |
||
| integer, | intent(in) | :: | unit |
File name |
||
| type(error_t), | intent(out), | allocatable | :: | error |
Error handling |
|
| logical, | intent(in), | optional | :: | json |
Optional JSON format |
Read dependency from toml table (no checks made at this stage)
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(compiler_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 |
Return compiler name
Return a compiler name string
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(compiler_t), | intent(in) | :: | self |
Instance of the compiler object |
Representation as string
Check that two source files are equal All checks passed!
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(srcfile_t), | intent(in) | :: | this | |||
| class(serializable_t), | intent(in) | :: | that |
Serialization interface
Check that two compiler_t objects are equal All checks passed!
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(compiler_t), | intent(in) | :: | this | |||
| class(serializable_t), | intent(in) | :: | that |
Test load/write roundtrip
Test serialization of a serializable object Dump to scratch file Load from scratch file Check same
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(serializable_t), | intent(inout) | :: | self | |||
| character(len=*), | intent(in) | :: | message | |||
| type(error_t), | intent(out), | allocatable | :: | error |
Check if the current compiler supports 128-bit real precision
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(compiler_t), | intent(in) | :: | self |
Instance of the compiler object |
Check if the current compiler supports 80-bit “extended” real precision
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(compiler_t), | intent(in) | :: | self |
Instance of the compiler object |
type, extends(serializable_t) :: compiler_t !> Identifier of the compiler integer(compiler_enum) :: id = id_unknown !> Path to the Fortran compiler character(len=:), allocatable :: fc !> Path to the C compiler character(len=:), allocatable :: cc !> Path to the C++ compiler character(len=:), allocatable :: cxx !> Print all commands logical :: echo = .true. !> Verbose output of command logical :: verbose = .true. contains !> Get default compiler flags procedure :: get_default_flags !> Get flag for module output directories procedure :: get_module_flag !> Get flag for include directories procedure :: get_include_flag !> Get feature flag procedure :: get_feature_flag !> Get flags for the main linking command procedure :: get_main_flags !> Get library export flags procedure :: get_export_flags !> Get library install name flags procedure :: get_install_name_flags !> Generate header padding flags for macOS executables procedure :: get_headerpad_flags !> Compile a Fortran object procedure :: compile_fortran !> Compile a C object procedure :: compile_c !> Compile a CPP object procedure :: compile_cpp !> Link a shared library procedure :: link_shared !> Link executable procedure :: link => link_executable !> Check whether compiler is recognized procedure :: is_unknown !> Check whether this is an Intel compiler procedure :: is_intel !> Check whether this is a GNU compiler procedure :: is_gnu !> Enumerate libraries, based on compiler and platform procedure :: enumerate_libraries !> Serialization interface procedure :: serializable_is_same => compiler_is_same procedure :: dump_to_toml => compiler_dump procedure :: load_from_toml => compiler_load !> Fortran feature support procedure :: check_fortran_source_runs procedure :: check_flags_supported procedure :: with_xdp procedure :: with_qp !> C feature support procedure :: check_c_source_runs procedure :: check_c_flags_supported !> C++ feature support procedure :: check_cxx_source_runs procedure :: check_cxx_flags_supported !> Return compiler name procedure :: name => compiler_name end type compiler_t