diff --git a/src/compiler/fb.bas b/src/compiler/fb.bas index fc23276d57..6f527b013f 100644 --- a/src/compiler/fb.bas +++ b/src/compiler/fb.bas @@ -480,6 +480,7 @@ sub fbGlobalInit() env.clopt.stacksize = FB_DEFSTACKSIZE env.clopt.objinfo = TRUE env.clopt.showincludes = FALSE + env.clopt.modeview = FB_DEFAULT_MODEVIEW hUpdateLangOptions( ) hUpdateTargetOptions( ) @@ -571,6 +572,8 @@ sub fbSetOption( byval opt as integer, byval value as integer ) env.clopt.objinfo = value case FB_COMPOPT_SHOWINCLUDES env.clopt.showincludes = value + case FB_COMPOPT_MODEVIEW + env.clopt.modeview = value end select end sub @@ -643,6 +646,8 @@ function fbGetOption( byval opt as integer ) as integer function = env.clopt.objinfo case FB_COMPOPT_SHOWINCLUDES function = env.clopt.showincludes + case FB_COMPOPT_MODEVIEW + function = env.clopt.modeview case else function = 0 diff --git a/src/compiler/fb.bi b/src/compiler/fb.bi index 37706cac45..b3181462d0 100644 --- a/src/compiler/fb.bi +++ b/src/compiler/fb.bi @@ -92,10 +92,18 @@ enum FB_COMPOPT FB_COMPOPT_STACKSIZE '' integer FB_COMPOPT_OBJINFO '' boolean: write/read .fbctinf sections etc.? FB_COMPOPT_SHOWINCLUDES '' boolean: -showincludes + FB_COMPOPT_MODEVIEW ''__FB_GUI__ FB_COMPOPTIONS end enum +enum FB_MODEVIEW + FB_MODEVIEW_CONSOLE = 0 + FB_MODEVIEW_GUI +end enum + +const FB_DEFAULT_MODEVIEW = FB_MODEVIEW_CONSOLE + '' pedantic checks enum FB_PDCHECK FB_PDCHECK_NONE = &h00000000 @@ -265,6 +273,7 @@ type FBCMMLINEOPT stacksize as integer objinfo as integer showincludes as integer + modeview as FB_MODEVIEW end type '' features allowed in the selected language diff --git a/src/compiler/fbc.bas b/src/compiler/fbc.bas index 5fe5717aec..87657a7d5e 100644 --- a/src/compiler/fbc.bas +++ b/src/compiler/fbc.bas @@ -924,7 +924,7 @@ private function hLinkFiles( ) as integer ldcline += hFindLib( "crtend.o" ) end select - + if( fbGetOption( FB_COMPOPT_TARGET ) = FB_COMPTARGET_DARWIN ) then ldcline += " -macosx_version_min 10.6" end if @@ -1755,6 +1755,9 @@ private sub handleOpt(byval optid as integer, byref arg as string) case OPT_S fbc.subsystem = arg + select case( arg ) + case "gui" : fbSetOption( FB_COMPOPT_MODEVIEW, FB_MODEVIEW_GUI ) + end select case OPT_SHOWINCLUDES fbSetOption( FB_COMPOPT_SHOWINCLUDES, TRUE ) @@ -3203,7 +3206,7 @@ private sub hAddDefaultLibs( ) defined(__FB_NETBSD__) fbcAddDefLibPath( "/usr/X11R6/lib" ) #endif - + #if defined(__FB_DARWIN__) and defined(ENABLE_XQUARTZ) fbcAddDefLibPAth( "/opt/X11/lib" ) #endif diff --git a/src/compiler/symb-define.bas b/src/compiler/symb-define.bas index 48119b5697..e63286fec6 100644 --- a/src/compiler/symb-define.bas +++ b/src/compiler/symb-define.bas @@ -86,6 +86,10 @@ private function hDefOptGosub_cb ( ) as string function = str( env.opt.gosub = TRUE ) end function +private function hDefGui_cb ( ) as string + function = str( env.clopt.modeview = FB_MODEVIEW_GUI ) +end function + private function hDefOutExe_cb ( ) as string function = str( env.clopt.outtype = FB_OUTTYPE_EXECUTABLE ) end function @@ -208,7 +212,8 @@ dim shared defTb(0 to ...) as SYMBDEF => _ (@"__FB_BACKEND__" , NULL , FB_DEFINE_FLAGS_STR, @hDefBackend_cb ), _ (@"__FB_FPU__" , NULL , FB_DEFINE_FLAGS_STR, @hDefFpu_cb ), _ (@"__FB_FPMODE__" , NULL , FB_DEFINE_FLAGS_STR, @hDefFpmode_cb ), _ - (@"__FB_GCC__" , NULL , 0 , @hDefGcc_cb ) _ + (@"__FB_GCC__" , NULL , 0 , @hDefGcc_cb ), _ + (@"__FB_GUI__" , NULL , 0 , @hDefGui_cb ) _ } sub symbDefineInit _