The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: ArthurDenture on September 01, 2013, 05:39:19 PM

Title: Windows flags: -mwindows and -mconsole
Post by: ArthurDenture on September 01, 2013, 05:39:19 PM
I ran into this while hacking at the Makefile. It seems that -mwindows and -mconsole are added to the flags in different ways at various backend-specific places in the makefile. This is a bit surprising, as I would expect the logic not to have to be more complicated than:

# Choose between a windows console or windows GUI app type
ifeq ($(OSTYPE),mingw)
  ifneq ($(WIN32_CONSOLE),)
    CFLAGS += -mconsole
  else
    CFLAGS += -mwindows
  endif
endif

But instead that logic shows up within the various backends. I'm probably missing something here: is there a subtlety to those flags that I'm not aware of?

http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86_002d64-Windows-Options.html has the docs for those flags, btw.
Title: Re: Windows flags: -mwindows and -mconsole
Post by: Ters on September 01, 2013, 06:40:18 PM
It may have evolved from a patching of the flags from SDL_CONFIG, because the assumed defaults are different. The structuring of the ifs seems to suggest an poorly controlled growth with a new branch here and a new branch there, solving a particular problem when it arrises without looking at the big picture.
Title: Re: Windows flags: -mwindows and -mconsole
Post by: prissi on September 01, 2013, 08:50:48 PM
As Ters wrote, there are probably even more such oddities in the Makefile.
Title: Re: Windows flags: -mwindows and -mconsole
Post by: ArthurDenture on September 01, 2013, 09:31:15 PM
Yeah, that all seems right, just wanted to make sure I wasn't missing something. I think the only time you want the console to be enabled (unless you explicitly enable it with WIN32_CONSOLE) is when you're running with the posix backend. If that's the only special case, then the attached patch should clean up that setting correctly.
Title: Re: Windows flags: -mwindows and -mconsole
Post by: prissi on September 02, 2013, 09:26:15 PM
Many people in the german forum requested the release with the console explicitely ... So it is not only for posix, but also for GDI an option.
Title: Re: Windows flags: -mwindows and -mconsole
Post by: ArthurDenture on September 02, 2013, 11:43:48 PM
Right: for posix it should be enabled by default, and with GDI it should be enabled if you set WIN32_CONSOLE.

My patch leaves the console behavior for GDI unchanged: it's still enabled if you set WIN32_CONSOLE and disabled otherwise.
Title: Re: Windows flags: -mwindows and -mconsole
Post by: TurfIt on September 03, 2013, 12:44:13 AM
The patch above seems fine to me. I'd probably not force it for posix though, if one wants a silent server, so be it...
Title: Re: Windows flags: -mwindows and -mconsole
Post by: ArthurDenture on September 07, 2013, 01:48:46 AM
Could someone kindly apply this? :-). I think I have responded to all suggestions.

I have no opinion on whether posix mode should default to -mconsole or -mwindow. If you think it should be -mconsole, then just remove the ifeq ($(BACKEND),posix) branch.
Title: Re: Windows flags: -mwindows and -mconsole
Post by: prissi on September 07, 2013, 09:42:04 PM
Applied this (accidently together with some changes I made of scr_coord, so don't wonder ...)
Title: Re: Windows flags: -mwindows and -mconsole
Post by: kierongreen on September 08, 2013, 08:56:47 AM
Quoteaccidently together with
Glad I'm not the only one to do this! :)