Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read custom build commands from sourcefile? #31

Open
GWRon opened this issue Mar 8, 2019 · 1 comment
Open

Read custom build commands from sourcefile? #31

GWRon opened this issue Mar 8, 2019 · 1 comment

Comments

@GWRon
Copy link

GWRon commented Mar 8, 2019

For now you need to adjust build options "globally" if you have multiple files open - and some need a build as eg. "shared library" and the other one as "GUI" - maybe a third as console.

Maybe we should handle some '@MAXIDE syntax - similar to '@BMK. This could eg be something like '@MAXIDE appoptions=GUI which allows to get interpreted by MaxIDE. In that case it would build as GUI regardless of what is set in MaxIDE.

It would be a bit "dirty" as the user must be aware of WHERE they need to adjust the option to eg. build "release" instead of "debug" now (assuming one did manually define @MAXIDE buildoptions=debug).

Maybe it should update the MaxIDE menu-flags when activating a code panel window. This means the last "manual configuration" updates to the one set in the file. Still a bit dirty...hmm

Any ideas to achieve above with less "dirt" ?

@braxtonrivers
Copy link

I added something similar based on zethrax original idea to read options from the first line of bmx code,

that way if I forget to set maxide for example to build as gui, it can be overridden, and the same goes for bmk and bcc, as if they are set to gui by mistake then console boxes start flashing across the screen during a build.

I also added a simple clean option to delete the current '.bmx' folder forcing it to start afresh, crude but it seems to work as intended, and only a simple addition without requiring an ini for every file.

eg:
Superstrict 'GUI|THREADED|RELEASE|X64|UPX|MANIFEST|CLEAN

I added this include to bmk.bmx
Line 17:
args=ParseConfigArgs( AppArgs[2..], processor.BCCVersion() = "BlitzMax" )
Include "bmk_source_build_options.bmx"

bmk_source_build_options.bmx

'<-- Parse *only* the first line of the main source code file for config options.

'These option strings should go on the very first line of your main source code file. That line should be a comment line to stop it from being compiled.
'	eg. '[GUI] [THREADED] [DEBUG]
'	eg. '[GUI][THREADED][DEBUG]
'	eg. '(GUI|THREADED|DEBUG)
'	eg. 'GUI/THREADED/DEBUG
'	eg. 'GUI|THREADED|DEBUG

'The config option strings are:-
'	[console]		- console build.
'	[gui]			- gui build.
'	[threaded]	- (multi-threaded) build.
'	[unthreaded]	- (single-threaded) build.
'	[debug]		- debug build.
'	[release]		- release build.

If args.length
	Local configsourcepath:String=RealPath(args[0]).ToLower()
	If configsourcepath.EndsWith(".bmx")
		Local configstream:TStream=ReadStream:TStream(configsourcepath)
		If configstream
			Local configline:String=configstream.ReadLine().ToLower()
			CloseStream(configstream)
			If configline
				If configline.Contains("clean") Then opt_clean=True
				If configline.Contains("console") Then opt_apptype="console"
				If configline.Contains("debug") Then opt_debug=True
				If configline.Contains("gui") Then opt_apptype="gui"
				If configline.Contains("manifest") Then opt_manifest=True
				If configline.Contains("release") Then opt_debug=False
				If configline.Contains("threaded") Then opt_threaded=True
				If configline.Contains("unthreaded") Then opt_threaded=False
				If configline.Contains("upx") Then opt_upx=True
				If configline.Contains("x64") Then opt_arch="x64"
				If configline.Contains("x86") Then opt_arch="x86"
			EndIf
		EndIf
	EndIf
EndIf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants