Skip to content

TTarget

Build target representation in the fpmake system

Declaration

Source position: fpmkunit.pp line 730

type

  TTarget = class(TNamedItem)
  public
    constructor Create;
    destructor Destroy;
    procedure AssignTo;
    function GetOutputFileName : string;
    function HaveOptions : Boolean;
    procedure AddOption;
    function SubTargetAllowed : Boolean;
    function SubTargetsAsString : string;
    procedure SetName;
    procedure SetExeName;
    procedure SetXML;
    procedure GetCleanFiles(List: TStrings; const APrefixU: string; 
                       const APrefixB: string; ACPU: TCpu; AOS: TOS; 
                       const aSubTarget: string);
    procedure GetCleanFiles(List: TStrings; const APrefixU: string; 
                       const APrefixB: string; 
                       const aTarget: TCompileTarget);
    procedure GetArchiveFiles(List: TStrings; ACPU: TCpu; AOS: TOS);
    procedure GetArchiveFiles(List: TStrings; const aTarget: TCompileTarget);
    procedure GetInstallFiles(List: TStrings; const APrefixU: string; 
                         const APrefixB: string; ACPU: TCpu; AOS: TOS; 
                         const aSubTarget: string);
    procedure GetInstallFiles(List: TStrings; const APrefixU: string; 
                         const APrefixB: string; 
                         const aTarget: TCompileTarget);
    property Dependencies: TDependencies; {r}
    property ResourceFiles: TResourceFiles; {r}
    property Commands: TCommands; {r}
    property State: TTargetState; {r}
    property TargetType: TTargetType; {rw}
    property OSes: TOSes; {rw}
    property CPUs: TCPUS; {rw}
    property SubTargets: TRTLStringDynArray; {rw}
    property Mode: TCompilerMode; {rw}
    property Options: TStrings; {rw}
    property SourceFileName: string; {r}
    property UnitFileName: string; {r}
    property ObjectFileName: string; {r}
    property LTOFileName: string; {r}
    property RSTFileName: string; {r}
    property RSJFileName: string; {r}
    property FPCTarget: string; {rw}
    property Extension: string; {rw}
    property FileType: TFileType; {rw}
    property Directory: string; {rw}
    property ResourceStrings: Boolean; {rw}
    property Install: Boolean; {rw}
    property TargetSourceFileName: string; {r}
    property ObjectPath: TConditionalStrings; {r}
    property UnitPath: TConditionalStrings; {r}
    property IncludePath: TConditionalStrings; {r}
    property XML: string; {rw}
    property IsFPMakePlugin: Boolean; {rw}
    property BeforeCompile: TNotifyEvent; {rw}
    property AfterCompile: TNotifyEvent; {rw}
    property BeforeClean: TNotifyEvent; {rw}
    property AfterClean: TNotifyEvent; {rw}
  end;

Description

TTarget represents a single build target within a package, such as a unit, program, or library. Each target defines what needs to be compiled, how it should be compiled, and where the resulting files should be installed.

Build targets can be units, programs, libraries, or documentation files. They contain information about source files, compilation options, dependencies, CPU and OS requirements, and installation settings.

Targets are managed through the TTargets collection and are owned by TPackage instances.

Properties

Member Visibility Description
AfterClean public Event handler executed after target cleanup
AfterCompile public Event handler executed after target compilation
BeforeClean public Event handler executed before target cleanup
BeforeCompile public Event handler executed before target compilation
Commands read only public Collection of custom commands for the target
CPUs public Set of CPU architectures this target supports
Dependencies read only public Collection of target dependencies
Directory public Directory where the target source files are located
Extension public File extension for the compiled target
FileType public Type of file this target generates
FPCTarget public FPC compiler target specification
IncludePath read only public Search path for include files during compilation
Install public Whether this target should be installed
IsFPMakePlugin public Whether this target is an FPMake plugin
LTOFileName read only public Link-time optimization file name for the target
Mode public Compiler mode for the target
ObjectFileName read only public Resolved object file name for the target
ObjectPath read only public Path for object files generated during compilation
Options public Compiler options for the target
OSes public Set of operating systems this target supports
ResourceFiles read only public Collection of resource files for the target
ResourceStrings public Whether to generate resource string support for the target
RSJFileName read only public Resource string JSON filename for the target
RSTFileName read only public Resource string table filename for the target
SourceFileName read only public Resolved source file name for the target
State read only public Current build state of the target
SubTargets public Array of subtarget names for this target
TargetSourceFileName read only public Source filename for the build target
TargetType public Type of the build target
UnitFileName read only public Resolved unit file name for the target
UnitPath read only public Search path for unit files during compilation
XML public Whether to generate XML documentation for the target
See all Properties

Methods

Member Visibility Description
AddOption public Adds a compilation option to the target
AssignTo public Assigns target properties to another object
Create public Creates a new build target instance
Destroy public Destroys the target instance and frees resources
GetArchiveFiles public Gets list of files to be archived for this target
GetCleanFiles public Gets list of files to be cleaned for this target
GetInstallFiles public Gets list of files to be installed for this target
GetOutputFileName public Returns the target's output filename for the specified OS
HaveOptions public Checks if target has compilation options
SetExeName public Sets the executable name for the target
SetName public Sets the name of the target
SetXML public Sets XML configuration data for the target
SubTargetAllowed public Checks if a subtarget is allowed for this target
SubTargetsAsString public Returns all subtargets as a comma-separated string
See all Methods

See also

Name Description
TPackage Central class for package management and building
TTargets Collection class for managing build targets
TTargetType Classification of build target types
TFileType File type classification for build targets
TDependency Represents a build dependency in the fpmake system