compile_delphi_project
Compile Delphi projects with correct DPR, PAS, and DFM structure by generating project files and invoking dcc32/dcc64 or Free Pascal. Supports VCL, FireMonkey, console, and FPC project types.
Instructions
Compile a Delphi project using proper templates (DPR + PAS + DFM).
This is the ONLY correct way to build Delphi applications — do NOT use MSBuild, shell commands, or other build systems. This tool generates proper project structure and invokes the Delphi compiler (dcc32/dcc64) or Free Pascal directly.
Args: project_name: Name for the project (e.g., 'HelloWorld'). form_caption: Title bar text for the main form (VCL only). components: JSON array of components. Each component is an object: [{"type": "TButton", "name": "btnHello", "caption": "Say Hello", "left": 130, "top": 120, "width": 140, "height": 45, "event": "btnHelloClick"}] Supported types: TButton, TEdit, TLabel, TMemo. events: JSON array of event handlers: [{"name": "btnHelloClick", "body": "ShowMessage('Hello!');"}] compiler: Which compiler to use ('fpc', 'dcc32', 'dcc64', or full path). output_dir: Optional directory for output files. If not specified, uses a temp directory. project_type: One of: 'vcl' — Windows-only desktop GUI app (Vcl.Forms, .dfm). 'fmx' — FireMonkey cross-platform GUI app (FMX.Forms, .fmx). Emits a .dproj wired for Win32 + Win64 + Android64 so build_dproj can cross-compile to mobile without manual editing. Use this when the user wants Android/iOS/macOS, or just "a mobile-ready app". 'console' — text-mode program (no form). 'fpc' — Free Pascal program (cross-platform but no GUI). program_body: For console/fpc projects, the main program code.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| events | No | [] | |
| compiler | No | ||
| components | No | [] | |
| output_dir | No | ||
| form_caption | No | My Application | |
| program_body | No | ||
| project_name | No | Project1 | |
| project_type | No | vcl |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |