Open GWRon opened 1 year ago
I appended some further debug prints: changes the output of:
Method DoBuild(makelib:Int, app_build:Int = False)
...
Select m.stage
...
Case STAGE_OBJECT
...
If processor.BCCVersion() <> "BlitzMax" Then
...
print "m.cc_opts = " + m.cc_opts
print " cc_opts = " + cc_opts
print " processor.Option(cc_opts) = " + processor.Option("cc_opts", "")
print " globals.Option(cc_opts) = " + globals.Get("cc_opts")
Changing the line from
' @bmk addccopt -DSPECIAL_OPTION
to
' @bmk addccopt mykey -DSPECIAL_OPTION
leads to "-DSPECIAL_OPTION" being listed for the "globals" (but not in "[m.]cc_opts")
old:
[ 85%] Compiling:untitled1.bmx.gui.debug.linux.x64.c
m.cc_opts =
cc_opts =
processor.Option(cc_opts) = -fno-strict-aliasing -fpie -fno-exceptions -c -O3 -msse3
globals.Option(cc_opts) = -fno-strict-aliasing -fpie -fno-exceptions -c -O3 -msse3
new:
[ 85%] Compiling:untitled1.bmx.gui.debug.linux.x64.c
m.cc_opts =
cc_opts =
processor.Option(cc_opts) = -fno-strict-aliasing -fpie -fno-exceptions -c -O3 -msse3 -DSPECIAL_OPTION
globals.Option(cc_opts) = -fno-strict-aliasing -fpie -fno-exceptions -c -O3 -msse3 -DSPECIAL_OPTION
Placing a "pre.bmk" next to my untitled1.bmx (aka unsaved file in maxide):
addccopt mykey -DSPECIAL_OPTION23
results in
Building untitled1
Loading /BlitzMaxNG/bin/custom.bmk
TBMKGlobals.AddOption: variable=ld_opts key=static-stdc value=-static-libstdc++
Loading /BlitzMaxNG/tmp/pre.bmk
arg1: mykey
TBMKGlobals.AddOption: variable=cc_opts key=mykey value=-DSPECIAL_OPTION23
globals.Get(cc_opts) = -fno-strict-aliasing -fpie -fno-exceptions -c -O3 -msse3 -DSPECIAL_OPTION23
processor.Option(cc_opts) = -fno-strict-aliasing -fpie -fno-exceptions -c -O3 -msse3 -DSPECIAL_OPTION23
source.cc_opts =
[ 85%] Compiling:untitled1.bmx.gui.debug.linux.x64.c
m.cc_opts =
cc_opts =
processor.Option(cc_opts) = -fno-strict-aliasing -fpie -fno-exceptions -c -O3 -msse3 -DSPECIAL_OPTION23
globals.Option(cc_opts) = -fno-strict-aliasing -fpie -fno-exceptions -c -O3 -msse3 -DSPECIAL_OPTION23
gcc -IBlitzMaxNG/mod
-IBlitzMaxNG/mod/brl.mod/blitz.mod
-IBlitzMaxNG/mod/brl.mod/appstub.mod
...
-w -DBMX_NG -fno-strict-aliasing -fpie -fno-exceptions -c -O3 -msse3 -DSPECIAL_OPTION23
-g -o BlitzMaxNG/tmp/.bmx/untitled1.bmx.gui.debug.linux.x64.o BlitzMaxNG/tmp/.bmx/untitled1.bmx.gui.debug.linux.x64.c
Executing:untitled1.debug
/BlitzMaxNG/tmp/untitled1.debug
hello
Process complete
So this step works (but also requires a "key"). The "key" information is missing in the docs: https://blitzmax.org/docs/en/language/pre_post_compilation_scripts/
Compiling this code leads to about the following (added some "prints:
this looks like the cc_opt of the main file is not used for compiling the mainfile.