fpm_targets Module

Build target handling

This module handles the construction of the build target list from the sources list (targets_from_sources), the resolution of module-dependencies between build targets (resolve_module_dependencies), and the enumeration of objects required for link targets (resolve_target_linking).

A build target (build_target_t) is a file to be generated by the backend (compilation and linking).

For more information, please read the documentation for the procedures:

Enumerations

Target type: FPM_TARGET_* Describes the type of build target — determines backend build rules



Contents


Variables

TypeVisibility AttributesNameInitial
integer, public, parameter:: FPM_TARGET_ARCHIVE =2

Target type is library archive

integer, public, parameter:: FPM_TARGET_C_OBJECT =4

Target type is c compiled object

integer, public, parameter:: FPM_TARGET_EXECUTABLE =1

Target type is executable

integer, public, parameter:: FPM_TARGET_OBJECT =3

Target type is compiled object

integer, public, parameter:: FPM_TARGET_UNKNOWN =-1

Target type is unknown (ignored)


Derived Types

type, public :: build_target_ptr

Wrapper type for constructing arrays of build_target_t pointers

type, public :: build_target_t

Type describing a generated build target


Subroutines

public subroutine add_dependency(target, dependency)

Add pointer to dependeny in target%dependencies

Arguments

Type IntentOptional AttributesName
type(build_target_t), intent(inout) :: target
type(build_target_t), intent(in), target:: dependency

public subroutine add_target(targets, type, output_file, source, link_libraries)

Allocate a new target and append to target list

Arguments

Type IntentOptional AttributesName
type(build_target_ptr), intent(inout), allocatable:: targets(:)
integer, intent(in) :: type
character, intent(in) :: output_file
type(srcfile_t), intent(in), optional :: source
type(string_t), intent(in), optional :: link_libraries(:)

public subroutine resolve_module_dependencies(targets, external_modules, error)

Add dependencies to source-based targets (FPM_TARGET_OBJECT) based on any modules used by the corresponding source file.

Read more…

Arguments

Type IntentOptional AttributesName
type(build_target_ptr), intent(inout), target:: targets(:)
type(string_t), intent(in) :: external_modules(:)
type(error_t), intent(out), allocatable:: error

public subroutine resolve_target_linking(targets, model)

Construct the linker flags string for each target target%link_flags includes non-library objects and library flags

Arguments

Type IntentOptional AttributesName
type(build_target_ptr), intent(inout), target:: targets(:)
type(fpm_model_t), intent(in) :: model

public subroutine targets_from_sources(targets, model, error)

High-level wrapper to generate build target information

Arguments

Type IntentOptional AttributesName
type(build_target_ptr), intent(out), allocatable:: targets(:)

The generated list of build targets

type(fpm_model_t), intent(inout), target:: model

The package model from which to construct the target list

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

Error structure