Improvements to cross-platform building: choose platform in editor, optionally allow case-insensitive URLs on case-sensitive filesystems, run Windows builds through WINE on Unix

Posted on

Choose platfom in CGE editor
Seamlessly running Windows application through WINE on Linux
  1. You can now choose the platform (Windows, Linux, Android, iOS…) to build and run from the editor. This platform is then used by compile, run, package, install build tool commands. This means that, if you have cross-compilers set up (hint: use fpcupdeluxe) then you can now easily build for various platforms, right from the GUI editor, without resorting to command-line and playing with environment variables.

  2. Another new feature, also related to the cross-platform development, is specifically for Linux/FreeBSD developers that want to target Windows too:

    You can now run Windows application on Unix seamlessly — if only you have WINE installed. The build tool, as well as GUI editor, will invoke wine / wine32 / wine64 under the hood, if you run Windows build on Unix. From the command-line, it means you use castle-engine run --os=win64 --cpu=x86_64 (or --os=win32 --cpu=i386 for 32-bit Windows) while your current (source, host) OS is Unix.

    Together, this means that if you have FPC cross-compiler from Linux to Windows installed (again, use fpcupdeluxe — it’s easy 🙂 ), and WINE installed (it should be included in the packages of all Linux distributions), then you can just switch in CGE editor platform to Windows, and press F9, and see the Windows application being compiled + run on your Linux without any fuss. The compilation / testing is then equally easy as for normal native Linux build.

  3. To make things balanced, we also have one new feature for Windows developers to make it easier for them to build apps for Unix (Linux, FreeBSD) desktops:

    You can set trivial global boolean CastleDataIgnoreCase, to easily run application with castle-data URLs that have wrong case on a case-sensitive filesystem. E.g. your file in the data directory may be called my_texture.png. Normally, accessing it by URL like castle-data:/My_Texture.png doesn’t work on Unix, as the file system honors the case (in contrast to Windows, where it works OK).

    Setting CastleDataIgnoreCase means that we search for the file name (and all directory components on the way) ignoring the upper/lower letters difference. It will raise an error only when it is impossible (no such file found, or ambiguous, e.g. you have both my_texture.png and My_Texture.png on disk — this is perfectly possible on case-sensitive filesystems).

    While this is slower (so we don’t really advise it as the “final solution”), but it is useful to quickly deploy applications tested mostly on Windows into Unix. In the long run, we still advise you to just honor the case, and thus make things work without CastleDataIgnoreCase, but using CastleDataIgnoreCase is now a possible and quick solution when you need it.

Start the discussion at Castle Game Engine Forum