Developing macOS, Android, iOS applications using Delphi

1. Introduction

Warning
This feature is not ready yet, we are working on it. See the news post for details. Right now, if you use Delphi, you can use the engine but without rendering on Android, iOS, macOS. If you need support for these platforms right now, follow the existing documentation and use our engine with FPC.

You can create applications using Delphi and Castle Game Engine for a number of platforms. We already support Windows and Linux. We work on support for more platforms with the Delphi compiler.

2. Overview

Delphi IDE and compilers run always on Windows. From Windows they access other systems, like a remote macOS machine, or a connected Android device, and run there applications.

Below we give a quick overview how to build for macOS, Android and iOS from Delphi.

If you have already used Delphi (e.g. through FireMonkey) with these platforms, then this page will likely not teach you anything new. There’s nothing really specific to Castle Game Engine below. Just setup connection to PAServer (on macOS), setup SDKs, and you’re good to go.

3. macOS

Connecting to your macOS machine and building for it:

  1. Similar to using Delphi to build Linux applications, you need to install PAServer on macOS.

  2. Then in Delphi (from Windows), go to "Options → Deployment → Connection Profile Manager" and add a new connection. Make sure everything works by "Test Connection" button.

  3. Then in Delphi initialize SDK for macOS, in the "Options → Deployment → SDK Manager". This should import all libraries from macOS to your Windows.

    Note
    If the process asks for confirmation when overwriting, you want to say "Yes" to have latest state from macOS copied into your Windows.
    Note
    You will have to rerun the import process each time the libraries on macOS possibly changed, like after a system upgrade.

That’s it. Now switch the project’s platform to "macOS 64-bit" or "macOS ARM 64-bit" and it should just build and run. We tested both Intel-based and Arm-based (Aarch64 actually) versions of the macOS platform, and they only need one connection, to any macOS machine, it seems.

Before we get rendering working (TODO), you can test it with a command-line scene_information_cli_tool from our examples. It can be built by Delphi, and works as a command-line tool on macOS.

Note
When in doubt, we recommend first to test deploying a trivial "Blank" new application using FMX from Delphi to macOS. This should be a test independent of "Castle Game Engine".

4. iOS

Connecting to iOS:

  1. You need a working connection to a macOS machine to build for iOS. We recommend to first go through the macOS deployment, documented above, before doing iOS.

  2. Setup iOS SDK in the "Options → Deployment → SDK Manager". It will also happen automatically if you just try to build for "iOS Device 64-bit.

    Note
    You don’t install anything like a PAServer on iOS device. The Delphi (from Windows) will talk to your macOS to do building and deployment on iOS.

5. Android

Connecting to Android:

  1. Setup Android SDK in the "Options → Deployment → SDK Manager". You actually need 2 Android SDKs there: one for 32-bit (Arm 32-bit) and one for 64-bit (that’s Aarch 64-bit).

    Note
    Make sure that paths configured there to Java JDK are valid. If needed, install Java JDK and point the Delphi’s configuration (inside Android SDKs in "Options → Deployment → SDK Manager") to the proper Java JDK paths.
  2. To deploy your application to a real Android device, it’s simplest to just have it connected through USB to your machine.


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