compiler_t Derived Type

type, public :: compiler_t

Definition of compiler object


Contents

Source Code


Components

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


Type-Bound Procedures

procedure, public :: compile_c

Compile a C object

  • public subroutine compile_c(self, input, output, args, log_file, stat)

    Compile a C object

    Arguments

    Type IntentOptional 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

procedure, public :: compile_cpp

Compile a CPP object

  • public subroutine compile_cpp(self, input, output, args, log_file, stat)

    Compile a CPP object

    Arguments

    Type IntentOptional 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

procedure, public :: compile_fortran

Compile a Fortran object

  • public subroutine compile_fortran(self, input, output, args, log_file, stat)

    Compile a Fortran object

    Arguments

    Type IntentOptional 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

procedure, public :: enumerate_libraries

Enumerate libraries, based on compiler and platform

  • public function enumerate_libraries(self, prefix, libs) result(r)

    Enumerate libraries, based on compiler and platform

    Arguments

    Type IntentOptional Attributes Name
    class(compiler_t), intent(in) :: self
    character(len=*), intent(in) :: prefix
    type(string_t), intent(in) :: libs(:)

    Return Value character(len=:), allocatable

procedure, public :: get_default_flags

Get default compiler flags

  • public function get_default_flags(self, release) result(flags)

    Arguments

    Type IntentOptional Attributes Name
    class(compiler_t), intent(in) :: self
    logical, intent(in) :: release

    Return Value character(len=:), allocatable

procedure, public :: get_include_flag

Get flag for include directories

  • public function get_include_flag(self, path) result(flags)

    Arguments

    Type IntentOptional Attributes Name
    class(compiler_t), intent(in) :: self
    character(len=*), intent(in) :: path

    Return Value character(len=:), allocatable

procedure, public :: get_module_flag

Get flag for module output directories

  • public function get_module_flag(self, path) result(flags)

    Arguments

    Type IntentOptional Attributes Name
    class(compiler_t), intent(in) :: self
    character(len=*), intent(in) :: path

    Return Value character(len=:), allocatable

procedure, public :: is_unknown

Check whether compiler is recognized

  • public pure function is_unknown(self)

    Arguments

    Type IntentOptional Attributes Name
    class(compiler_t), intent(in) :: self

    Return Value logical

procedure, public :: link

Link executable

  • public subroutine link(self, output, args, log_file, stat)

    Link an executable

    Arguments

    Type IntentOptional 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

Source Code

type :: 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
    !> Compile a Fortran object
    procedure :: compile_fortran
    !> Compile a C object
    procedure :: compile_c
    !> Compile a CPP object
    procedure :: compile_cpp
    !> Link executable
    procedure :: link
    !> Check whether compiler is recognized
    procedure :: is_unknown
    !> Enumerate libraries, based on compiler and platform
    procedure :: enumerate_libraries
end type compiler_t