Lazarus project files

From Free Pascal wiki

Project directory structure

Typical directory structure for Lazarus project:

  • created - auto-created by IDE or created manually
  • VCS - need to be included in Version Control System
directory name created VCS description
backup auto no Contains backup copies of project source files
lib auto no Contains compiled binary files for different CPU-OS
<Project name>.app auto no MacOS (Darwin) Bundle files
frames manual yes TFrame descendant files (*.lfm, *.pas), recommended for large projects with many frames
include manual yes Platform-dependent includes. Contains sub-directories for different OS (darwin, linux, win32, win64, etc..) Recommended for multiplatform projects with platform-specific units.
languages manual yes Contains *.po files with resource strings for different languages. Recommended for multi-language projects.
images manual yes Picture files (*.png, *.jpg, *.ico, *.xpm, etc..), that can be compiled into resource by lazres utility. Recommended for projects and packages with many image files.
logs manual no Debug output files (*.txt, *.log).

Project files extensions

The Lazarus Tutorial#The Lazarus files explains some extensions by an example.

  • VCS - need to be included in Version Control System
extension VCS filetype description
.lpi yes Lazarus Project Information contains project-specific settings like compiler settings and needed packages. stored in XML
.lps no Lazarus Program Session Personal data like cursor positions, source editor files, personal build modes. stored in XML
.lpr yes Lazarus Program Pascal source of main program.
.lfm yes Lazarus Form Form configuration information for all objects on a form (stored in a Lazarus-specific textual format, similar to Delphi dfm; the actions are described by Pascal source code in a corresponding *.pas file)
.pas yes Pascal code Pascal code typically for a form stored in a corresponding *.lfm file
yes Pascal code Useful if you want to avoid confusion with Delphi source code files.
.inc yes Pascal code include Included as part of Pascal code file. Typically contain platform-dependent definitions and routines.
.lrs no Lazarus Resource Generated Lazarus Resource file; not to be confused with a Windows resource file.

This file can be created with lazres tool (in directory Lazarus/Tools) using commandline: lazres myfile.lrs myfile.lfm

.compiled no FPC compilation state Created by the Free Pascal compiler. XML with compilator parameters.
.ppu no Compiled unit Compiled source code created by the Free Pascal compiler for each unit and program.
no Object file Created by the compiler, every ppu file has a corresponding o file, needed by the linker.
.lpk yes Lazarus package information package-specific settings, like compiler settings and needed packages; stored in XML
.lrt no Lazarus Resourcestring table Lazarus Resourcestring table created when saving a lfm file and i18n is enabled. It contains the TTranslateString properties of the lfm. Do not edit them, they are overwritten.
.rst no Resourcestring table Resourcestring table created by the compiler for every unit with a resourcestring section. Do not edit them, they are overwritten.
.rc yes Resource definition file Delphi-compatible resource-definition script (.rc file) that describes the resources used by your application.
.po yes GNU gettext messages When i18n is enabled the IDE creates/updated the .po files with the resourcestrings from the rst and lrt files.
.ico yes Icon file Icon for application file

An example .gitignore file for Lazarus/Free Pascal