Include dependencies

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
mingorau
Posts: 1
Joined: Sat Jun 15, 2013 9:20 pm

Include dependencies

Post by mingorau »

This isn't exactly a bug but i didn't find a better place to post. There are a few inter-module dependencies can be reduced.

The first case CImage.cpp includes CBlit.h which in turn includes most header files in both software driver modules. I have created two files: image_utils.h and image_blitter.h which contain only the functions used by CImage.cpp . Thus if we aren't interested in the software renders we can just ignore this part of the source completely.

Case 2, the file CFileSystem.cpp includes headers for achives without checking if the user has disabled their use. I modified it to this and it appears to be working fine:

Code: Select all

 
#ifdef __IRR_COMPILE_WITH_PAK_ARCHIVE_LOADER_
#include "CPakReader.h"
#endif
 
#ifdef __IRR_COMPILE_WITH_NPK_ARCHIVE_LOADER_
#include "CNPKReader.h"
#endif
 
#ifdef __IRR_COMPILE_WITH_TAR_ARCHIVE_LOADER_
#include "CTarReader.h"
#endif
 
#ifdef __IRR_COMPILE_WITH_WAD_ARCHIVE_LOADER_
#include "CWADReader.h"
#endif
 
#ifdef __IRR_COMPILE_WITH_MOUNT_ARCHIVE_LOADER_
#include "CMountPointReader.h"
#endif
 
#ifdef __IRR_COMPILE_WITH_ZIP_ARCHIVE_LOADER_
#include "CZipReader.h"
#endif
 


Case 3, it's a similar case with CSceneManager.cpp . Even we disable most functionality with defines the scene manager still includes most headers. I'm still working on this.

Case 4, using the GUI with a builtin font requires the BMP image loader to be compiled (didn't test it but that's what the source comments say).

There reasons why i'm trying to remove include dependencies is: i'm working on a new build system based on Lua scripts called Robocop (for the moment); i wish to put parts of the code into dynamic libs (drivers, loaders, extra secene nodes, etc) that can be queried at runtime and loaded loaded dynamically as needed; combine all the useful utility code and os access functions found in Irrlicht into a compatibility layer api (called PCLib) that can be developed and improved separately.

I will open a few github projects soon for this (Robocop, PCLib, and PCIrrlicht) so if you are interested in these modifications you can find them there.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Include dependencies

Post by CuteAlien »

Case 1 makes probably sense.

About 2 and 3: The checks are inside the headers. So yes, it includes the headers - but there is no code added to the obj files. Makes compiling a little bit slower in those cases, but nicer code to read on the other hand.

Case 4 - yeah that's the case. I think it's about the font being used also for icons (Irrlicht had no spritebanks at the start so it used fonts instead).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply