build options

BlitzMax Forums/BlitzMax Programming/build options

rdodson41(Posted 2006) [#1]
Would it be possible to make the build options something that is written in the top of the code, such as
DebugMode
GuiApp

SuperStrict

'rest of code here

The problem is that I am switching back and forth between something that is a GUI app and one that isn't, and each time I have to recompile I have to set the flag in the IDE, compile one, change the flag, compile the other and it is a pain in the neck. So is it possible that something like this could be done?


ozak(Posted 2006) [#2]
Now that's a great idea!


FlameDuck(Posted 2006) [#3]
Possible yes. Good idea, probably not.

It would be better if bmk was more Ant like, or failing that, you could just make your own build scripts.


ozak(Posted 2006) [#4]
You can do it in BMK.


Yan(Posted 2006) [#5]
Perhaps it's time for Skidracer to put that project properties button to good use. ;o)


rdodson41(Posted 2006) [#6]
Why wouldn't it be a good idea? It would make some things much easier, becaues I have a command line app that connects to a server which is a gui app, and when i make a change to both its a real hassle to compile them both again. Also, if you want to debug, you just type the line in the top, or even type it there and keep it commented, so if you want to toggle debug mode, you just comment or uncomment the line.


FlameDuck(Posted 2006) [#7]
Why wouldn't it be a good idea?
1. Not everyone enjoys having their source code in one 600KB file.
2. What about legacy source code that doesn't have these settings, how should they be compiled?
3. How would the linker identify the correct binary to link against?
4. Some settings (BuildGuiApp) are project wide, while others (Debug) only apply to the source file in question. How would bmk resolve conflicts?


rdodson41(Posted 2006) [#8]
1. I never mentioned anything about putting all your source code in one file.
2. If they need to be compiled again then put in the code.
3. BMK decides what to link based on what options are in the source file.
5. If BuildGuiApp is project wide then put it in each of your project files. Put Debug in the ones you want to debug.


Dreamora(Posted 2006) [#9]
4. Both is project wide. You can't set single files on debug as the BMK calls those things for the whole makeapp process not for a single source file. (debug -> -d flag on bmk call. release -> -r flag on bmk call, gui -> -t gui on bmk call, console -> -t console on bmk call and others that you can find in the bmk_modutil.bmx in the src/bmk folder)


FlameDuck(Posted 2006) [#10]
1. I never mentioned anything about putting all your source code in one file.
Then what should happen if different files have different settings? Surely you aren't suggesting I go though 400+ files and change the first line to "DebugMode" whenever I wanted to make a Debug build?

And what if I wanted to use the same network library for a commandline program and a GUI app? What if I only want the GUI app to have debug munging?

You can't set single files on debug as the BMK calls those things for the whole makeapp process not for a single source file.
But you would have to be able to if the build options where in-line code.


Dreamora(Posted 2006) [#11]
And what would be the use of it?
The debugger still works basing on the process name and not a single source file and its only started basing on the debug on/off setting.
And in the running exe, there is no possibility anymoe to say from which bmx this part comes.

so -> pointless and undoable

Framework, AppType and Debug on/off are and will ever be on project wide scope.


rdodson41(Posted 2006) [#12]

Surely you aren't suggesting I go though 400+ files and change the first line to "DebugMode" whenever I wanted to make a Debug build?


The DebugMode and GuiMode codes would be project wide through imports. What I was saying was that I had two different projects that interracted and one was a console tool and one was a gui tool. The point is that these codes should be project wide so that each project can individually be a console or gui app but can be worked on at the same time.