Automatically Append Project Files During Compilation

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Zach
Addict
Addict
Posts: 1675
Joined: Sun Dec 12, 2010 12:36 am
Location: Somewhere in the midwest
Contact:

Automatically Append Project Files During Compilation

Post by Zach »

(This suggestion refers strictly to Source files like *.pb, *.pbi NOT other general resource files like graphics and sound etc)
I guess I'm either really stupid and can't figure it out, or this functionality doesn't exist yet.. Hope its not the first one.


It would be nice, if your project files were all appended to the main file, when you compile your program.
I have to be honest in that I don't see the point of having Project Management that let's you add files to your project, etc if you don't compile them all in one shot.

I think this is the first IDE I've used where you have to explicitly declare all included files.. But then I don't have exposure to many different languages and IDE's.
Project Management is nice for opening all the files in your project, and managing your resources.. So why stop at compilation?

As an alternative, it would at least be nice if the IDE would automatically stick Xinclude statements for our project files, into the main compiler target. I imagine either version of this idea would be easy to implement, and could be turned on or off with a simple checkbox option..

Anyhow I just thought I would ask for this (or how to make sure it works if it is already possible), as I would like to see it.
Is there some specific reason why it hasn't been implemented, maybe ?
User avatar
spikey
Enthusiast
Enthusiast
Posts: 751
Joined: Wed Sep 22, 2010 1:17 pm
Location: United Kingdom

Re: Automatically Append Project Files During Compilation

Post by spikey »

1) Projects can have multiple build targets - ie one project can create more than one executable. You don't always want to recompile everything together. For example I have a set of CLI programs all in one project because they all share the same include files. However I don't always need to recompile all of them at the same time but having one project serves to remind me what else might be affected if I change an include file so I think about this earlier rather than later (saves on those 'Ah... that wasn't the best way to handle that' moments).

2) The bigger the project the longer compile takes so you don't want to compile stuff you don't need to. In really big projects compile time could be measured in hours... In fact I once worked on a project that took four (person) days to fully compile before we did a huge refactor of the software...

3) If the compiler automatically included all project files you might end up with a situation where executables are bigger than they needed to be because of redundant code or, worse, wouldn't compile because of unfulfilled dependencies.

4) Some of my includes are sequence specific - usually because of structures. The include file defines a generic structure that will work fine for its own procedures but other consumer files are free to define these structures a different way if they need to. However in this case the custom structure must be defined before the generic one to override it, to ensure the compiler logic works properly.


Incidentally I wrote a widget for the IDE that will allow you to browse for include files and writes the IncludePath and IncludeFile statements for you, to make it a bit easier. You can find it here:-
http://www.purebasic.fr/english/viewtop ... 12&t=43841

It would just be a case of changing one string to persuade it to use XIncludeFile instead if you prefer...
Zach
Addict
Addict
Posts: 1675
Joined: Sun Dec 12, 2010 12:36 am
Location: Somewhere in the midwest
Contact:

Re: Automatically Append Project Files During Compilation

Post by Zach »

Cool, thanks
Post Reply