Recent

Author Topic: fpcres now supports compilation of RC files  (Read 16198 times)

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
fpcres now supports compilation of RC files
« on: August 12, 2020, 11:36:31 pm »
Hello together!

Thanks to the work of Martok the fpcres utility is now able to compile RC files into RES files.

To compile an RC file to a RES file you need to pass the -of res argument as otherwise the RC reader won't be used (it's a "catch all" TResourceReader descendant and thus not registered by default). You can specify include paths for the preprocessor using --include <path> and defines can be declared using -D sym (including defines with values using -D sym=val).

The Free Pascal compiler is capable of using fpcres for resource compilation as well, but due to bootstrapping issues that currently needs to be enabled using a new option -FF. Once a FPC release with a fpcres supporting RC files is released we'll make that option the default and deprecate windres/gorc (I currently plan to merge this into 3.2.1, thus 3.2.2 would support this and future 3.3.1 (and thus 3.4) would then use fpcres by default).

Please test this with your applications and report your problems as this is the biggest change regarding resource compilation since their introduction.

Compatibility note: due to build dependencies the FileInfo unit was moved from fcl-base to fcl-extra, so please keep a look out for stale PPU files.

Fred vS

  • Hero Member
  • *****
  • Posts: 3158
    • StrumPract is the musicians best friend
Re: fpcres now supports compilation of RC files
« Reply #1 on: August 13, 2020, 12:45:19 am »
Would it mean that fpc could produce now *.res resource files without the need of windres in Windows and Unix OS system too?

If yes, wow and  many thanks.

Fre;D
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

ASBzone

  • Hero Member
  • *****
  • Posts: 678
  • Automation leads to relaxation...
    • Free Console Utilities for Windows (and a few for Linux) from BrainWaveCC
Re: fpcres now supports compilation of RC files
« Reply #2 on: August 13, 2020, 01:30:14 am »
Hello together!

Thanks to the work of Martok the fpcres utility is now able to compile RC files into RES files.

To compile an RC file to a RES file you need to pass the -of res argument as otherwise the RC reader won't be used (it's a "catch all" TResourceReader descendant and thus not registered by default). You can specify include paths for the preprocessor using --include <path> and defines can be declared using -D sym (including defines with values using -D sym=val).

...

Awesome news!   Thanks to Martok and everyone else involved...
-ASB: https://www.BrainWaveCC.com/

Lazarus v2.2.7-ada7a90186 / FPC v3.2.3-706-gaadb53e72c
(Windows 64-bit install w/Win32 and Linux/Arm cross-compiles via FpcUpDeluxe on both instances)

My Systems: Windows 10/11 Pro x64 (Current)

olly

  • New Member
  • *
  • Posts: 42
Re: fpcres now supports compilation of RC files
« Reply #3 on: August 13, 2020, 03:10:59 am »
https://forum.lazarus.freepascal.org/index.php/topic,50796.msg371698.html#msg371698

You weren't kidding! Good job to all!

Off topic, but let's hope we don't have to wait a long time for this to make a official release.  :)

« Last Edit: August 13, 2020, 03:57:36 am by olly »

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
Re: fpcres now supports compilation of RC files
« Reply #4 on: August 13, 2020, 09:08:03 am »
Would it mean that fpc could produce now *.res resource files without the need of windres in Windows and Unix OS system too?

Yes, though for now you need to pass the parameter -FF to the compiler so that it uses fpcres instead of windres / gorc.

Off topic, but let's hope we don't have to wait a long time for this to make a official release.  :)

As said the plan is to merge this to 3.2.1, so that the next minor release will contain it, allowing us to switch 3.3.1 to use it by default.

However to make it default we need people to test it with their projects now. It doesn't help if we make it default and later on people complain that we broke everything just because we weren't able to test whatever corner cases they have.

Fred vS

  • Hero Member
  • *****
  • Posts: 3158
    • StrumPract is the musicians best friend
Re: fpcres now supports compilation of RC files
« Reply #5 on: August 13, 2020, 12:39:08 pm »
Would it mean that fpc could produce now *.res resource files without the need of windres in Windows and Unix OS system too?

Yes, though for now you need to pass the parameter -FF to the compiler so that it uses fpcres instead of windres / gorc


Excellent, one step forward for more autonomy, many thanks to Martok and Sven.

Fre;D
« Last Edit: August 13, 2020, 12:42:39 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

Polarx79

  • Newbie
  • Posts: 4
Re: fpcres now supports compilation of RC files
« Reply #6 on: August 13, 2020, 07:44:29 pm »
Thanks for all the hard work !! Blessings  :D

Fred vS

  • Hero Member
  • *****
  • Posts: 3158
    • StrumPract is the musicians best friend
Re: fpcres now supports compilation of RC files
« Reply #7 on: December 16, 2020, 03:05:14 am »
Hello.

Quote
However to make it default we need people to test it with their projects now

Sorry, I few late...
 :-[

Is it possible to try it with fpc 3.2.0 ?

Adding that parameter:  -FF

Gives that error at compilation:

Code: Pascal  [Select][+][-]
  1. Error: (11006) Illegal parameter: -FF


I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11382
  • FPC developer.
Re: fpcres now supports compilation of RC files
« Reply #8 on: December 16, 2020, 08:11:11 am »
It is 3.2.1 plus.  Some fixes haven't been merged for non mainstream targets.

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
Re: fpcres now supports compilation of RC files
« Reply #9 on: December 16, 2020, 09:13:36 am »
Is it possible to try it with fpc 3.2.0 ?

No, as marcov said it's only part of 3.2.1.

Adding that parameter:  -FF

Gives that error at compilation:

Code: Pascal  [Select][+][-]
  1. Error: (11006) Illegal parameter: -FF

Only the changes for the fpcres utility have been merged to 3.2.1, the support for the compiler to use fpcres for RC files has not been merged. This was done so that trunk can drop this parameter again once 3.2.2 (or 3.2.4) is released and instead make fpcres the default for RC files.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11382
  • FPC developer.
Re: fpcres now supports compilation of RC files
« Reply #10 on: December 16, 2020, 10:19:23 am »
I just checked what fcl-res unmerged revs there are, and one is the riscv merge (not important for fixes), the other is

r40751 | florian | 2019-01-03 21:55:25 +0100 (Thu, 03 Jan 2019) | 1 line
Changed paths:
   M /trunk/packages/fcl-res/src/elfconsts.pp
   M /trunk/packages/fcl-res/src/elfsubwriter.inc

* set default abi to eabi5 on arm

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
Re: fpcres now supports compilation of RC files
« Reply #11 on: December 16, 2020, 01:53:51 pm »
That one could maybe be merged as well, but what is missing (by intention) are the changes for the compiler itself as the -FF option mentioned above is only intended to be temporary until we have a release with an updated fpcres out.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11382
  • FPC developer.
Re: fpcres now supports compilation of RC files
« Reply #12 on: December 16, 2020, 02:41:42 pm »
Probably that rev wouldn't merge earlier because riscv was merged inbetween, it needs manual merging

Fred vS

  • Hero Member
  • *****
  • Posts: 3158
    • StrumPract is the musicians best friend
Re: fpcres now supports compilation of RC files
« Reply #13 on: December 16, 2020, 03:21:12 pm »
@PascalDragon and Marcov: thanks for your light.

OK, I understand that fpcres will be implement by default later.

But is it possible to use fpcres as stand-alone, something like:

Code: Pascal  [Select][+][-]
  1. fpcres myresource.rc

That will produce a myresource.res.

And so first produce the .res , and in code, just use:

Code: Pascal  [Select][+][-]
  1. {$R *.res}

instead of

Code: Pascal  [Select][+][-]
  1. {$R *.rc}

?

Thanks.

[EDIT]

I did try this without luck:

Code: Pascal  [Select][+][-]
  1. fpcres /lazpaint-master/lazpaint/lazpaint.rc
  2. Error: No known file format detected for file /lazpaint-master/lazpaint/lazpaint.rc'
  3.  

Note that lazpaint.rc is perfectly recognized with windres and the lazpaint.res is produced.

Code: [Select]
windres /lazpaint-master/lazpaint/lazpaint.rc lazpaint.res


« Last Edit: December 16, 2020, 04:00:34 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

Fred vS

  • Hero Member
  • *****
  • Posts: 3158
    • StrumPract is the musicians best friend
Re: fpcres now supports compilation of RC files
« Reply #14 on: December 16, 2020, 04:07:44 pm »
Hello.

OK, I get it, this works perfectly on Linux (note the last parameters):

Code: Pascal  [Select][+][-]
  1. fred@fiens ~/l/lazpaint> fpcres /home/fred/lazpaint-master/lazpaint/lazpaint.rc -o lazpaint.res -of res

And the lazpaint.res produced seems perfectly the same as the one produced by windres.

So, for me, ok, let's make it as default for the compiler.

(And big WoW).

Thanks.

Fre;D
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

 

TinyPortal © 2005-2018