News:

Simutrans.com Portal
Our Simutrans site. You can find everything about Simutrans from here.

Windows flags: -mwindows and -mconsole

Started by ArthurDenture, September 01, 2013, 05:39:19 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ArthurDenture

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.

Ters

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.

prissi

As Ters wrote, there are probably even more such oddities in the Makefile.

ArthurDenture

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.

prissi

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.

ArthurDenture

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.

TurfIt

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...

ArthurDenture

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.

prissi

Applied this (accidently together with some changes I made of scr_coord, so don't wonder ...)

kierongreen

Quoteaccidently together with
Glad I'm not the only one to do this! :)