-
-
Notifications
You must be signed in to change notification settings - Fork 148
Description
Hi,
We are developing a tool for compiling packages in Delphi. It was done for our own cases, but some time ago we decided to open source it so if people want to use it for their own projects/components, they can.
I've been exploring many open source projects, we have a list of products already adapted here: https://github.com/tmssoftware/smartsetup-registry
And while I am not sure Castle Engine is really a match for this (As it really needs a more complex install that installs the castleEngine IDE), well, I wanted to try it. I had to make the following modifications to make it work:
- In Delphi11 or older, I get:
R:\castle\Products\castle-engine\src\services\steam\castlesteam.pas(224): error E2056: String literals may have at most 255 elements
Delphi12 compiled fine, but all other delphis are not compiling.
So, to fix it, I just broke the string in 2: instead of 'abcd', use 'ab'+'cd'
- There is no libsuffix in the dpks. This is one that I am not sure if might break other stuff (is the CastleEngine IDE expecting castle_engine.bpl instead of castle_engine290.bpl? But we need to have a libsuffix so we can install in more than one IDE at the same time. So I modified all Dpks to add a line with libsuffix:
{$DESCRIPTION 'Castle Game Engine - Delphi IDE design-time-only package'}
{$LIBSUFFIX AUTO}
{$DESIGNONLY}
{$IMPLICITBUILD ON}
Note that Libsuffix auto is only correctly supported in D11+ (which I am not sure matters, since as the code was now, it only compiled in D12) If you want to add support for older versions,create extra packages for each version supported. By now, I am just happy supporting D11 and newer 😄
The good news is that with the fix it looks like it is working (I am no expert in castle engine, but I couldn't see anything wrong). I could get CastleEngine installed in D11 and D12 in 1 minute:
And it looks ok:
By the way, there is a point 3: As you can see in my previous screenshot, I compiled the packages for both 32 and 64 bit. But I had to skip the design package in 64 bits because it doesn't compile, so I couldn't install it in the Delphi 12.3 64 bit IDE.
I got the error:
R:\castle\Products\castle-engine\src\base_rendering\castleinternalcontextwgl.pas(35): error F2613: Unit 'Windows' not found. [R:\castle\Temp\p\castle.engine_d12_win64intel_Release\castle_engine_design.dproj]
That's because it only targets 32 bit (which is expected, as it was the only possibility until very little ago):
The package compiles the same in 64bit without a 64 bit target, but unit Aliases aren't defined in 64bit. So it should be uses WinApi.Windows instead of uses Windows
But that's just because the package doesn't have a 64 bit target. if you add the 64 bit target and don't change anything else (except of course our config to tell it to compile that package in 64 bit), you get:
(it did take 10 seconds more to compile the design package...) And now, it is registered in the 64-bit IDE:
I don't know. As said, this tool is mostly designed to compile libraries, so I am not sure it is the best fit here. But well, I had some fun, I got to fix a bug in our tool too, and you got those 3 things to fix 🙂 It took me about 1/2 an hour to get it to compile (including fixing the bug on our side...).
If you prefer, I can make a pull request for the changes, or you can change them yourselves, as you wish. The one that might be more problematic is adding the LIBSUFFIX AUTO line, because:
- It limits to only D11 and D12
- It might add some incompatibility if any of your code expects the library name without the suffix.
But it is really not possible to install in more than one delphi version wihtout different bpl names for each version.
Also, if you want to try it, I can give instructions to compile castle engine with the tool we are doing. You need the latest version of the dev branch since this is not officially supported yet, and you also need a small yaml file that I can post here. But that's only if you are interested. If not, I am just reporting the bugs.
Ps: The tool also installs in lazarus, but that part is less tested, and I haven't tried it here.