dcourtois / premake-qt

Premake module adding support for Qt to actions (Visual Studio, makefiles, etc.)
Do What The F*ck You Want To Public License
45 stars 11 forks source link

Add option to link qtmain.lib #16

Closed chrisaverage closed 4 years ago

chrisaverage commented 4 years ago

When building with MSVC you can specify the subsystem to be either /CONSOLE or /WINDOWS. The first one configures your app to use main() as entry point and shows a console window. The other configures your app to use WinMain() and doesn't show console window.

When developing with Qt I'd like to use the /WINDOWS subsystem but still use main(). To allow that Qt has a convenient little lib qtmain.lib (or qtmaind.lib) that adds a WinMain() implementation and calls your main() after dealing with all the nasty param conversions.

It would be nice to be able to specify in premake-qt that it should link that little helper so that I don't need to specify the lib path manually. Something along the lines of qt.linkqtmain().

dcourtois commented 4 years ago

I'll see what I can do (I don't have as much time as I once had to work on these project :p) In the meantime the workaround should be fairly simple since the Qt lib directory is already automatically added to your current config:

configuration "windows"
    links { "qtmain" }
chrisaverage commented 4 years ago

That's what I'm doing now but it gets hairy with the suffix in debug etc. Anyway, not a big deal. Just a suggestion to make the config shorter. Thanks for the library. It helps a lot.

dcourtois commented 4 years ago

You should be able to now use

qtmain ( true )

on the project/config you want. Let me know if it works (I'll let you close the issue if it does)

chrisaverage commented 4 years ago

Works great. Thanks!