QB64.org Forum

Active Forums => QB64 Discussion => Topic started by: FilipeEstima on April 25, 2019, 01:14:56 pm

Title: How to automatically UPX an EXE created by QB64?
Post by: FilipeEstima on April 25, 2019, 01:14:56 pm
Where should I add an instruction that will, upon finishing the executable compilation, automatically UPX it?
Title: Re: How to automatically UPX an EXE created by QB64?
Post by: Pete on April 25, 2019, 02:51:03 pm
It sounds like you will need to make a shell or powershell script for that: https://www.rootusers.com/how-to-zipunzip-files-in-windows-with-powershell/

You can use SHELL to compile a QB64 file and then work with powershell to archive it, or whatever.

Is this what you are trying to do?

Pete
Title: Re: How to automatically UPX an EXE created by QB64?
Post by: FilipeEstima on April 25, 2019, 03:19:55 pm
I read somewhere in this forum that adding -o2 to internal\c\makeline.win.txt would make the compiled executables to run faster, due to better code optimization.

So this got me thinking. Maybe there is a place where I can add upx %.exe (or whatever) to automatically compress the compiled executable, every time. It is most likely doable, I just don't know exactly how or where to add code to do it.
Title: Re: How to automatically UPX an EXE created by QB64?
Post by: Raven_Singularity on April 25, 2019, 04:46:47 pm
UPX is an in-place executable compressor.  It makes the EXE much smaller without significant overhead to load it.  It would be nice if QB64 used -O2 and UPX by default.

It sounds like you will need to make a shell or powershell script for that: https://www.rootusers.com/how-to-zipunzip-files-in-windows-with-powershell/

You can use SHELL to compile a QB64 file and then work with powershell to archive it, or whatever.

Is this what you are trying to do?

Pete

The optimisation parameter -O2 is just for the compiler.  You'll need to do the UPX compression after QB64 compiles the executable.  I'm not sure if there's a data/config file you can edit for adding this post compile command.  If not, you'd need to manually edit the QB64.bas file to do the UPX command, then recompile QB64.EXE.

I read somewhere in this forum that adding -o2 to internal\c\makeline.win.txt would make the compiled executables to run faster, due to better code optimization.

So this got me thinking. Maybe there is a place where I can add upx %.exe (or whatever) to automatically compress the compiled executable, every time. It is most likely doable, I just don't know exactly how or where to add code to do it.