- or the initial steps to get a Windows IDE to run cross-platform using CrossVCL.
Sorry about the pun, and I should also mention that this project is WIP, so no workable release/code yet.
Update: In the original image above the language selection was broken/disabled. Read the update in the end of the post on the changes I decided to do to makes this work better overall.
A few days back was a new update of CrossVCL announced in my email - for the lifetime license I had bought years earlier - which triggered an idea.
I hadn't really gotten around to use the product, but it could be nice to take it for a spin on some VCL project that would be great also to have running on Linux and macOS - since I do once again spend more time on a Linux desktop.
I do unfortunately not have the source code for my favorite IDE, and that would also be more than a one man job, and it would also result in a very amputated and lighter version - which would probably be great in many cases anyway.
But there are other open-sourced IDEs out there - PyScripter and Dev C++ could be great candidates for some CrossVCL adjustments.
CrossVCL is not an emulation, but a WinAPI implementation that is intended to cover the VCL/UI part, for the rest of the code the old Windows specific function should be replaced by their newer platform-agnostic variants. Like WinAPI.Windows.DeleteFile should now be System.SysUtils.DeleteFile.
My fork is still very much work in progress - and the Dev C++ source has some old code and some very Windows specific code, like the TClientSocket (unused) and TDDEServerConv - so these things needs to go - or be re-implemented in a different way.
I also temporarily removed some of the nicer new addition Embarcadero had made - like the extended styling and the use of SVG Icons - just to concentrate on the getting the basics up running in some form.
There are a few things to be aware of when updating Delphi to use CrossVCL - one is to remember to manually add the OpenGL framework on macOS - but read both the FAQ, Getting Started and the Dev Guide first.
Start with deploying and debugging a simple "Hello World" example, via the normal PAServer setup given by Embarcadero - to ensure everything is working, also be aware that when switching platforms - some value might have been added to your version resources like the CFBundle entries, but I guess that is nothing CrossVCL specific.
So in regards to the Dev-C++ code there are some parts that will need a dual-implementation like:
- Console window - PowerShell would be able work cross-platform probably - CMD and bash not.
- Interaction with debugger.
So there will be sections with code like:
// Windows-only code
// CrossVcl code
Current status is that the code is linking and deploying on both macOS 11.1 (Big Sur) and Ubuntu 20.04, but since my wife's mini Mac is painfully slow - I will concentrate on debugging and getting a working build up running on Ubuntu, and then most issues are probably fixed for macOS.
CrossVCL seems to me like a nice and a bit overlooked product - that for most Delphi VCL-based projects would be a fairly easy way to target two extra desktop platforms. Dev-C++ was not the easiest project to start with due to the legacy of some of the code, and all the integrations.
But let us see how far it brings me/us. I will write a follow-up post when my repo is pushed with a mostly working macOS and Ubuntu build.
Happy New Year - and stay healthy and save on the fireworks (think about all our fellow animals).
Update 4.january 2021
I have now spend a bit more time (too much time on a slow mac) on the Dev-C++ code, and there are some parts off the code I would characterise a defects and bit rot - remember most of this code is +10 year.
Among these are:
Non UTF-8 language and tip files: Extra code to handle that has been removed and the files have been converted - which also means that the language picker is shown correct - see top image in post.
Saving and loading of configuration files could seem to be implemented in a clever way, but in my opinion it ended up over-engineered. I have currently only patched that in an ugly way.
The components like the classbrowser, did have old Kylix ready code - that needed to go away - since its $LINUX directives would be picked up by CrossVCL, and they do point to the old Kylix Qt libraries.
The SVG images and extended styling makes less sense on macOS (and Linux) _ and since the used SVG components does currently use and windows xml.dll - some extra work would need to be put into making that feature cross-platform - which in my opinion is very low priority.
Even if I did include the icns and it starts up nicely and loads into the main form - there are still some windowism that stops me from compiling a console Hello World application - which would be my end goal - and when other more skilled people should take over :)
The next thing I want to look into is the editor - there is a SynEdit CrossVCL adjusted fork already - so I might look at these adjustments.
I should also say that I get a bit distracted by some of the bugs in the old original code - and fix these mostly UI glitches while "conversion".
I am working in a separate branch, but I do not think a merge will make any sense before the SVG/styling code is split - so that a Windows build in this branch will not be felt as a step back from the nice enhancement sponsored by EMBT.
But I am also sure that things like the language fix and the less use of WinAPI is beneficial in the main branch.