fpm_sources Module

Discovery of sources

This module implements subroutines for building a list of [[srcfile_t]] objects by looking for source files in the filesystem.



Functions

public function get_exe_name_with_suffix(source) result(suffixed)

Build an executable name with suffix. Safe routine that always returns an allocated string

Arguments

Type IntentOptional Attributes Name
type(srcfile_t), intent(in) :: source

Return Value character(len=:), allocatable


Subroutines

public subroutine add_executable_sources(sources, executables, scope, auto_discover, with_f_ext, error)

Add to sources using the executable and test entries in the manifest and applies any executable-specific overrides such as executable%name. Adds all sources (including modules) from each executable%source_dir Compare lowercase strings to allow auto-discovery of pre-processed extensions

Arguments

Type IntentOptional Attributes Name
type(srcfile_t), intent(inout), allocatable, target :: sources(:)

List of [[srcfile_t]] objects to append to. Allocated if not allocated

class(executable_config_t), intent(in) :: executables(:)

List of [[executable_config_t]] entries from manifest

integer, intent(in) :: scope

Scope to apply to the discovered sources: either FPM_SCOPE_APP or FPM_SCOPE_TEST, see fpm_model

logical, intent(in) :: auto_discover

If .false. only executables and tests specified in the manifest are added to sources

type(string_t), intent(in), optional :: with_f_ext(:)

Additional user-defined (preprocessor) extensions that should be treated as Fortran sources

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

Error handling

public subroutine add_sources_from_dir(sources, directory, scope, with_executables, with_f_ext, recurse, error)

Add to sources by looking for source files in directory

Arguments

Type IntentOptional Attributes Name
type(srcfile_t), intent(inout), allocatable, target :: sources(:)

List of [[srcfile_t]] objects to append to. Allocated if not allocated

character(len=*), intent(in) :: directory

Directory in which to search for source files

integer, intent(in) :: scope

Scope to apply to the discovered sources, see fpm_model for enumeration

logical, intent(in), optional :: with_executables

Executable sources (fortran programs) are ignored unless with_executables=.true.

type(string_t), intent(in), optional :: with_f_ext(:)

Additional user-defined (preprocessor) extensions that should be treated as Fortran sources

logical, intent(in), optional :: recurse

Whether to recursively search subdirectories, default is .true.

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

Error handling