hi, i like to know how you guys shrink the size of Irrlicht-Programs.
Mine are always 4 MiByte and above. In comparison GLUT programs are like 40KiBytes and such. I know there are many features in the Engine, but i thought the linker only links actually needed features to the programs. Is this already the minimum?
Can i Compile Irrlicht to separate Libs like one for Images, one for Objects and so on. Does this help?, and if yes how do i do it?
I think i dont need any D3D features. I always link Irrlicht statically with __IRR_STATIC_LIB__. Because i dont want any dependencies needed for my programs.
How can i compress the exe or the contents, if any uncompressed data.
thx in advance for any suggestions.
Shrinking Irrlicht Exe Size
-
- Posts: 1010
- Joined: Mon Oct 24, 2011 10:03 pm
- Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d
Re: Shrinking Irrlicht Exe Size
I'm not sure what you are trying to acomplish with this?
Is the compiled library debug or release?
as a default I am pretty sure there are no d3d features in it. (at least not gcc version, which on that matter is 5.6mb, you are talking about the irrlicht library, right?)
Is the compiled library debug or release?
as a default I am pretty sure there are no d3d features in it. (at least not gcc version, which on that matter is 5.6mb, you are talking about the irrlicht library, right?)
"this is not the bottleneck you are looking for"
Re: Shrinking Irrlicht Exe Size
You can add the optimization -Os flag to your compiler to reduce size.
Re: Shrinking Irrlicht Exe Size
1) Open IrrCompileConfig.h and comment out everything you don't need; software renderers, directx drivers, file loaders and so on.
2) Compile Irrlicht as a static library (as you already are doing)
3) If you're using Visual Studio, make sure you're using the shared version of the c runtime libraries, this will use Msvcr??.dll instead of embedding that junk in your app. Note that depending on OS, your users might not have this installed!
3) When you build your executable, do so in release mode with size and whole program optimization enabled. This may take a while!
4) If you're using gcc, use the "strip" command to remove any leftover symbols (not sure if this is absolutely required)
5) Finally, use UPX to compress your binary before release. (make a copy first, last time I used it on an x64 system it was flaky)
Depending on what features you've used, you should be able to get a trivial Irrlicht binary down to between 300 and 500k, your mileage may vary. Note that GCC binaries are bigger as they don't have external dependencies, 800-900k is as good as you'll get. Also, viruses often use UPX to keep their sizes down, so antivirus may report false positives.
2) Compile Irrlicht as a static library (as you already are doing)
3) If you're using Visual Studio, make sure you're using the shared version of the c runtime libraries, this will use Msvcr??.dll instead of embedding that junk in your app. Note that depending on OS, your users might not have this installed!
3) When you build your executable, do so in release mode with size and whole program optimization enabled. This may take a while!
4) If you're using gcc, use the "strip" command to remove any leftover symbols (not sure if this is absolutely required)
5) Finally, use UPX to compress your binary before release. (make a copy first, last time I used it on an x64 system it was flaky)
Depending on what features you've used, you should be able to get a trivial Irrlicht binary down to between 300 and 500k, your mileage may vary. Note that GCC binaries are bigger as they don't have external dependencies, 800-900k is as good as you'll get. Also, viruses often use UPX to keep their sizes down, so antivirus may report false positives.
-
- Posts: 5
- Joined: Thu Dec 29, 2011 9:54 pm
Re: Shrinking Irrlicht Exe Size
Yeah thx,
the UPX sound nice, it will rearrange the exe and integrate a decompressor automaticly.
i looked at the irrCompileConfig.h and only found a few switches that should be commented out im testing what that brings, but
I believe the model-loaders make up the most space?
Do i have to have a copy of irrlicht for each of my projects, that are manually configurated by the irrCompileConfig?
I really thought the linker would strip all never used functions/classes by default.
And yes i already link and compile in RELEASE mode.
EDIT: i also found there are no loaders for DDS (a very very common file-format), XPM (often used in wxWidgets), GIF and SVG
EDIT: why are there no separeted switches for ICursorControl, IFont and IGUIEnvironment. As i saw in API doc a font has its own draw-call with no need for GUIEnv?
but irrCompileConfig sais i cant have the one (fonts) without the GUIEnv.
the UPX sound nice, it will rearrange the exe and integrate a decompressor automaticly.
i looked at the irrCompileConfig.h and only found a few switches that should be commented out im testing what that brings, but
I believe the model-loaders make up the most space?
Do i have to have a copy of irrlicht for each of my projects, that are manually configurated by the irrCompileConfig?
I really thought the linker would strip all never used functions/classes by default.
And yes i already link and compile in RELEASE mode.
EDIT: i also found there are no loaders for DDS (a very very common file-format), XPM (often used in wxWidgets), GIF and SVG
EDIT: why are there no separeted switches for ICursorControl, IFont and IGUIEnvironment. As i saw in API doc a font has its own draw-call with no need for GUIEnv?
but irrCompileConfig sais i cant have the one (fonts) without the GUIEnv.
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Re: Shrinking Irrlicht Exe Size
There's only one gui environment, so you might save maybe 10kB or so. Same holds for the other things, with even less savings. DDS is available, you just have to enable it in the compile config file. XPM is a pretty useless format, bmp should be as efficient and more widely used. GIF has no real use over PNG, and SVG is simply to complex to easily include it. But you can find an integration method here on the forum.
And no, I don't think that the model loaders have the most impact. If you disable opengl or d3d it would save much more, also the sw drivers.
And no, I don't think that the model loaders have the most impact. If you disable opengl or d3d it would save much more, also the sw drivers.
Re: Shrinking Irrlicht Exe Size
Why do you need to load XPM? Use them as intended and build them in, they are already headers. Though building a texture instead of using as an image would need more code.