Lazarus

1. Introduction

You can use Castle Game Engine with Free Pascal Compiler (FPC) and Lazarus IDE.

2. We don’t strictly depend on Lazarus

Free Pascal Compiler (FPC) is a separate thing from Lazarus IDE. To understand the difference:

  • FPC is a (command-line) Pascal compiler. You need to use either FPC or Delphi to compile your CGE programs. We only support these 2 modern Pascal compilers.

  • Lazarus IDE is an IDE (editor, project manager) using FPC.

    Lazarus also provides LCL, a visual component library, along with ability to visually design LCL applications. But we do not use LCL in most CGE applications (the ones based on TCastleWindow). In effect, while Castle Game Engine integrates well with Lazarus, we don’t strictly depend on Lazarus — not like we depend on FPC.

3. Installing both FPC and Lazarus

Windows

Download and run a simple installer from the Lazarus website that will install both Lazarus (IDE) and FPC (compiler).

Linux

You should

  • install FPC first. It is easiest to install a package called fpc using your package manager.

  • Then download and install Lazarus package for Linux.

  • To compile the applications, install also GTK and OpenGL development libraries, from packages like libgtk2.0-dev, libgl-dev on Debian-based distros.

macOS

You can download packages for both FPC (download file like fpc-3.2.2.intelarm64-macosx.dmg) and Lazarus (file like Lazarus-2.2.0-0-x86_64-macosx.pkg) from the downloads on Lazarus website.

Lazarus website
Tip
You can install FPC and Lazarus in other ways, for example using FpcUpDeluxe.
Tip
If you prefer other IDE than Lazarus, you can install only FPC and use any Pascal code editor you like, like Visual Studio Code.

4. Configure FPC and Lazarus locations in Castle Game Engine editor

Configure FPC and Lazarus locations in Castle Game Engine editor Preferences, if they have not been auto-detected correctly.

Castle Game Engine Editor Preferences

5. Register Lazarus Packages

In Castle Game Engine editor Preferences, go to tab FPC and Lazarus and click on the button "Register Lazarus Packages". This will allow to compile and debug CGE applications inside Lazarus.

Lazarus packages registration confirmation

To improve this documentation just edit this page and create a pull request to cge-www repository.